Skip to content

Commit ccc8554

Browse files
committed
Another bugfix to bwa/bwa2 index folders
1 parent db2b560 commit ccc8554

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public interface ReferenceGenome extends Serializable
7979

8080
/**
8181
* @param name The name used by the aligner to identify its cached directory
82-
* @return The folder expected containing the cached index, which is not guarenteed to exist. See AlignerIndexUtil for related methods.
82+
* @return The folder expected containing the cached index, which is not guaranteed to exist. See AlignerIndexUtil for related methods.
8383
*/
8484
File getAlignerIndexDir(String name);
8585

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAMem2Wrapper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public String getIndexCachedDirName(PipelineJob job)
5353
}
5454
}
5555

56+
@Override
57+
protected String getIndexDirName()
58+
{
59+
return("bwamem2");
60+
}
61+
5662
public static class Provider extends AbstractAlignmentStepProvider<AlignmentStep>
5763
{
5864
public Provider()

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAMemWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void performMemAlignment(PipelineJob job, AlignmentOutputImpl output, Fil
116116
}
117117
appendThreads(job, bwaArgs);
118118

119-
bwaArgs.add("'" + new File(referenceGenome.getAlignerIndexDir("bwa"), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath() + "'");
119+
bwaArgs.add("'" + new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath() + "'");
120120
bwaArgs.add("'" + inputFastq1.getPath() + "'");
121121

122122
if (inputFastq2 != null)

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAWrapper.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public final AlignmentOutput performAlignment(Readset rs, List<File> inputFastqs
151151
File inputFastq2 = assertSingleFile(inputFastqs2);
152152

153153
AlignmentOutputImpl output = new AlignmentOutputImpl();
154-
AlignerIndexUtil.copyIndexIfExists(this.getPipelineCtx(), output, "bwa", referenceGenome);
154+
AlignerIndexUtil.copyIndexIfExists(this.getPipelineCtx(), output, getIndexCachedDirName(getPipelineCtx().getJob()), referenceGenome);
155155

156156
doPerformAlignment(output, inputFastq1, inputFastq2, outputDirectory, referenceGenome, basename, rs, readGroupId, platformUnit);
157157
output.addCommandsExecuted(getWrapper().getCommandsExecuted());
@@ -197,7 +197,7 @@ private File runBWAAln(PipelineJob job, ReferenceGenome referenceGenome, File in
197197
args.add("aln");
198198
appendThreads(job, args);
199199
args.addAll(bwaAlnArgs);
200-
args.add(new File(referenceGenome.getAlignerIndexDir("bwa"), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
200+
args.add(new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
201201
args.add(inputFile.getPath());
202202

203203
File output = new File(getOutputDir(inputFile), inputFile.getName() + ".sai");
@@ -230,12 +230,12 @@ protected void performBwaAlignment(PipelineJob job, AlignmentOutputImpl output,
230230
throw new PipelineJobException("Reference FASTA does not exist: " + referenceGenome.getWorkingFastaFile().getPath());
231231
}
232232

233-
File expectedIndex = new File(referenceGenome.getAlignerIndexDir("bwa"), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile()) + ".bwa.index.sa");
233+
File expectedIndex = new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile()) + ".bwa.index.sa");
234234
if (!expectedIndex.exists())
235235
{
236236
throw new PipelineJobException("Expected index does not exist: " + expectedIndex);
237237
}
238-
args.add(new File(referenceGenome.getAlignerIndexDir("bwa"), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
238+
args.add(new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
239239

240240
//add SAI
241241
args.add(sai1.getPath());
@@ -283,4 +283,9 @@ public File getExe()
283283
{
284284
return SequencePipelineService.get().getExeForPackage("BWAPATH", "bwa");
285285
}
286+
287+
protected String getIndexDirName()
288+
{
289+
return("bwa");
290+
}
286291
}

0 commit comments

Comments
 (0)