Skip to content

Commit 2c9d337

Browse files
committed
Fix merge conflicts
2 parents c9fbe4a + 301768b commit 2c9d337

File tree

52 files changed

+1888
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1888
-312
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/AbstractAlignmentStepProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ abstract public class AbstractAlignmentStepProvider<StepType extends AlignmentSt
3434
public static String SUPPORT_MERGED_UNALIGNED = "supportsMergeUnaligned";
3535
public static String COLLECT_WGS_METRICS = "collectWgsMetrics";
3636
public static String CONVERT_TO_CRAM = "convertToCram";
37+
public static String CRAM_ARCHIVAL_MODE = "doCramArchivalMode";
3738
public static String COLLECT_WGS_METRICS_NON_ZERO = "collectWgsMetricsNonZero";
3839
public static String DISCARD_BAM = "discardBam";
3940

@@ -116,6 +117,10 @@ private static List<ToolParameterDescriptor> getParamList(List<ToolParameterDesc
116117
put("checked", false);
117118
}}, false));
118119

120+
parameters.add(ToolParameterDescriptor.create("doCramArchivalMode", "CRAM Archival Mode", "If selected, the CRAM will undergo additional compression to save space. This is lossy and may not be compatible with all downstream tools. See samtools view --output-fmt-option archive", "checkbox", new JSONObject(){{
121+
put("checked", false);
122+
}}, false));
123+
119124
parameters.add(ToolParameterDescriptor.create(ALIGNMENT_MODE_PARAM, "Alignment Mode", "If your readset has more than one pair of FASTQs, there pipeline can either align each pair sequentially (and then merge these BAMs), or merge the pairs of FASTQs first and then perform alignment once. The default is to align each pair of FASTQs separately; however, some pipelines like STAR require the latter.", "ldk-simplecombo", new JSONObject(){{
120125
put("storeValues", ALIGNMENT_MODE.ALIGN_THEN_MERGE.name() + ";" + ALIGNMENT_MODE.MERGE_THEN_ALIGN.name());
121126
put("value", alignmentMode.name());

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/AlignmentStep.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,19 @@ default boolean supportsMetrics()
8080
boolean supportsGzipFastqs();
8181

8282
@Override
83-
AlignmentStepProvider getProvider();
83+
AlignmentStepProvider<?> getProvider();
8484

8585
default String getAlignmentDescription()
8686
{
87-
return "Aligner: " + getProvider().getName();
87+
ToolParameterDescriptor cramArchivalParam = getProvider().getParameterByName(AbstractAlignmentStepProvider.CRAM_ARCHIVAL_MODE);
88+
boolean doArchival = cramArchivalParam != null && cramArchivalParam.extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Boolean.class, false);
89+
String ret = "Aligner: " + getProvider().getName();
90+
if (doArchival)
91+
{
92+
ret = ret + "\nCRAM Archival Mode";
93+
}
94+
95+
return ret;
8896
}
8997

9098
interface AlignmentOutput extends PipelineStepOutput

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/SamtoolsCramConverter.java

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,44 @@ public SamtoolsCramConverter(Logger log)
1818
super(log);
1919
}
2020

21-
public File convert(File inputBam, File outputCram, File gzippedFasta, boolean doIndex, @Nullable Integer threads) throws PipelineJobException
21+
public File convert(File inputBam, File outputCram, File gzippedFasta, boolean doIndex, @Nullable Integer threads, boolean archivalMode) throws PipelineJobException
2222
{
2323
getLogger().info("Converting SAM/BAM to CRAM: " + inputBam.getPath());
24+
if (inputBam.equals(outputCram))
25+
{
26+
throw new PipelineJobException("Input/output files are the same");
27+
}
2428

2529
List<String> params = new ArrayList<>();
2630
params.add(getSamtoolsPath().getPath());
2731
params.add("view");
2832

29-
params.add("-C");
33+
params.add("--output-fmt");
34+
params.add("cram,version=3.0" + (archivalMode ? ",lossy_names=1" : ""));
3035

3136
params.add("-o");
3237
params.add(outputCram.getPath());
3338

39+
// CRAM does, however, have an optional archive settings mode (samtools view ...)
40+
// which is a lossy compression, doing things like removing read names, removing additional accessory fields, and additional compression of quality scores.
41+
// In all cases, the base sequence of the reads is preserved: https://www.htslib.org/doc/samtools.html
42+
if (archivalMode)
43+
{
44+
params.add("--output-fmt-option");
45+
params.add("archive");
46+
}
47+
3448
params.add("-T");
3549
params.add(gzippedFasta.getPath());
3650

51+
if (doIndex)
52+
{
53+
params.add("--write-index");
54+
}
55+
3756
if (threads != null)
3857
{
39-
params.add("--threads");
58+
params.add("-@");
4059
params.add(String.valueOf(threads));
4160
}
4261

@@ -49,11 +68,6 @@ public File convert(File inputBam, File outputCram, File gzippedFasta, boolean d
4968
throw new PipelineJobException("Missing output: " + outputCram.getPath());
5069
}
5170

52-
if (doIndex)
53-
{
54-
doIndex(outputCram, threads);
55-
}
56-
5771
return outputCram;
5872
}
5973

SequenceAnalysis/pipeline_code/extra_tools_install.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,17 @@ then
305305
else
306306
echo "Already installed"
307307
fi
308+
309+
if [[ ! -e ${LKTOOLS_DIR}/bbmap || ! -z $FORCE_REINSTALL ]];
310+
then
311+
echo "Cleaning up previous installs"
312+
rm -Rf $LKTOOLS_DIR/bbmap
313+
314+
wget https://sourceforge.net/projects/bbmap/files/BBMap_39.25.tar.gz
315+
tar -xf BBMap_39.25.tar.gz
316+
317+
mv bbmap $LKTOOLS_DIR/
318+
ln -s $LKTOOLS_DIR/bbmap/bbmap.sh $LKTOOLS_DIR/bbmap.sh
319+
else
320+
echo "Already installed"
321+
fi

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisController.java

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5183,4 +5183,62 @@ public void setDoNotRequireSra(boolean doNotRequireSra)
51835183
_doNotRequireSra = doNotRequireSra;
51845184
}
51855185
}
5186+
5187+
@RequiresSiteAdmin
5188+
public static class CreateExpDataForFileAction extends ConfirmAction<CreateExpDataForFileForm>
5189+
{
5190+
@Override
5191+
public void validateCommand(CreateExpDataForFileForm form, Errors errors)
5192+
{
5193+
5194+
}
5195+
5196+
@Override
5197+
public URLHelper getSuccessURL(CreateExpDataForFileForm form)
5198+
{
5199+
return getContainer().getStartURL(getUser());
5200+
}
5201+
5202+
@Override
5203+
public ModelAndView getConfirmView(CreateExpDataForFileForm form, BindException errors) throws Exception
5204+
{
5205+
return new HtmlView(HtmlString.unsafe("This will create a new ExpData with a DataFileUrl pointing to the provided URI. This should be a full URI, such as file:///my/path/myFile.txt." +
5206+
"<br><br>" +
5207+
"<label>DataFileUrl </label><input name=\"dataFileUrl\" value = \"" + HtmlString.of(form.getDataFileUrl()) + "\"><br>"));
5208+
}
5209+
5210+
@Override
5211+
public boolean handlePost(CreateExpDataForFileForm form, BindException errors) throws Exception
5212+
{
5213+
URI newUri = URI.create(form.getDataFileUrl());
5214+
File f = new File(newUri);
5215+
if (!f.exists())
5216+
{
5217+
throw new PipelineJobException("Missing file: " + form.getDataFileUrl());
5218+
}
5219+
5220+
DataType dataType = new DataType("File");
5221+
5222+
ExpData d = ExperimentService.get().createData(getContainer(), dataType, f.getName());
5223+
d.setDataFileURI(newUri);
5224+
d.save(getUser());
5225+
5226+
return true;
5227+
}
5228+
}
5229+
5230+
public static class CreateExpDataForFileForm
5231+
{
5232+
private String _dataFileUrl;
5233+
5234+
public String getDataFileUrl()
5235+
{
5236+
return _dataFileUrl;
5237+
}
5238+
5239+
public void setDataFileUrl(String dataFileUrl)
5240+
{
5241+
_dataFileUrl = dataFileUrl;
5242+
}
5243+
}
51865244
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
import org.labkey.sequenceanalysis.query.SequenceAnalysisUserSchema;
9292
import org.labkey.sequenceanalysis.query.SequenceTriggerHelper;
9393
import org.labkey.sequenceanalysis.run.RestoreSraDataHandler;
94+
import org.labkey.sequenceanalysis.run.alignment.BBMapWrapper;
9495
import org.labkey.sequenceanalysis.run.alignment.BWAMem2Wrapper;
9596
import org.labkey.sequenceanalysis.run.alignment.BWAMemWrapper;
9697
import org.labkey.sequenceanalysis.run.alignment.BWASWWrapper;
@@ -157,8 +158,6 @@
157158
import org.labkey.sequenceanalysis.run.reference.VirusReferenceLibraryStep;
158159
import org.labkey.sequenceanalysis.run.util.CombineGVCFsHandler;
159160
import org.labkey.sequenceanalysis.run.util.FastqcRunner;
160-
import org.labkey.sequenceanalysis.run.util.GenomicsDBAppendHandler;
161-
import org.labkey.sequenceanalysis.run.util.GenomicsDBImportHandler;
162161
import org.labkey.sequenceanalysis.run.util.SVAnnotateStep;
163162
import org.labkey.sequenceanalysis.run.variant.DepthOfCoverageHandler;
164163
import org.labkey.sequenceanalysis.run.variant.GenotypeConcordanceStep;
@@ -309,6 +308,7 @@ public static void registerPipelineSteps()
309308
SequencePipelineService.get().registerPipelineStep(new StarWrapper.Provider());
310309
SequencePipelineService.get().registerPipelineStep(new Pbmm2Wrapper.Provider());
311310
SequencePipelineService.get().registerPipelineStep(new VulcanWrapper.Provider());
311+
SequencePipelineService.get().registerPipelineStep(new BBMapWrapper.Provider());
312312

313313
//de novo assembly
314314
SequencePipelineService.get().registerPipelineStep(new TrinityRunner.Provider());
@@ -395,8 +395,6 @@ public static void registerPipelineSteps()
395395
SequenceAnalysisService.get().registerFileHandler(new RecalculateSequenceMetricsHandler());
396396
SequenceAnalysisService.get().registerFileHandler(new ListVcfSamplesHandler());
397397
SequenceAnalysisService.get().registerFileHandler(new MultiQCBamHandler());
398-
SequenceAnalysisService.get().registerFileHandler(new GenomicsDBImportHandler());
399-
SequenceAnalysisService.get().registerFileHandler(new GenomicsDBAppendHandler());
400398
SequenceAnalysisService.get().registerFileHandler(new MergeLoFreqVcfHandler());
401399
SequenceAnalysisService.get().registerFileHandler(new PangolinHandler());
402400
SequenceAnalysisService.get().registerFileHandler(new NextCladeHandler());

SequenceAnalysis/src/org/labkey/sequenceanalysis/api/picard/CigarPositionIterable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void initializeCigar()
8181
int i = 0;
8282
for (char el : _explodedCigar)
8383
{
84-
CigarOperator op = CigarOperator.valueOf(Character.toString(el));
84+
CigarOperator op = CigarOperator.characterToEnum(el);
8585
if (op.consumesReadBases())
8686
{
8787
_readPositions[i] = readPos;
@@ -155,7 +155,7 @@ public PositionInfo(SAMRecord record, int pos, char[] ops, Integer[] readPos, In
155155
{
156156
_record = record;
157157
_pos = pos;
158-
_op = CigarOperator.valueOf(Character.toString(ops[pos]));
158+
_op = CigarOperator.characterToEnum(ops[pos]);
159159
_readPos = readPos[pos];
160160
_refPos = refPos[pos];
161161

0 commit comments

Comments
 (0)