Skip to content

Commit 84a40d5

Browse files
committed
Aslo report pindel insertions
1 parent 0576278 commit 84a40d5

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/MergeLoFreqVcfHandler.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -340,23 +340,27 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
340340
continue;
341341
}
342342

343-
int length = Integer.parseInt(line[3]) - Integer.parseInt(line[2]) - 1; //NOTE: pindel reports one base upstream+downstream as part of the indel
344-
writer.writeNext(new String[]{ctx.getSequenceSupport().getCachedReadset(so.getReadset()).getName(), String.valueOf(so.getRowid()), String.valueOf(so.getReadset()), "Pindel", line[1], line[2], line[3], String.valueOf(length), "", line[0], line[4], "", line[5], line[6]});
345-
343+
int end1 = Integer.parseInt(line[3]) - 1; //pindel reports the end as one bp downstream of the event, so drop 1 bp even though we're keeping 1-based
344+
int length = end1 - Integer.parseInt(line[2]); //NOTE: pindel reports one base upstream+downstream as part of the indel
346345
if ("D".equalsIgnoreCase(line[0]))
347346
{
348-
ReferenceSequence rs = getReferenceSequence(ctx, genomeIds.iterator().next(), line[1]);
349-
int start0 = Integer.parseInt(line[2]) - 1;
350-
char alt = (char)rs.getBases()[start0];
347+
ReferenceSequence rs = getReferenceSequence(ctx, genomeIds.iterator().next(), line[1]);
348+
int start0 = Integer.parseInt(line[2]) - 1; //for consistency with VCFs, retain the first REF base, as pindel reports
349+
char alt = (char)rs.getBases()[start0];
351350

352-
int end1 = Integer.parseInt(line[3]) - 1; //pindel reports the end as one bp downstream of the event, so drop 1 bp even though we're keeping 1-based
353-
String ref = new String(Arrays.copyOfRange(rs.getBases(), start0, end1), StringUtilsLabKey.DEFAULT_CHARSET);
354-
if (ref.length() != length + 1)
355-
{
356-
throw new PipelineJobException("Improper pindel parsing: " + so.getRowid() + "/" + line[2] + "/" + line[3] + "/" + ref + "/" + alt);
357-
}
351+
String ref = new String(Arrays.copyOfRange(rs.getBases(), start0, end1), StringUtilsLabKey.DEFAULT_CHARSET);
352+
if (ref.length() != length + 1)
353+
{
354+
throw new PipelineJobException("Improper pindel parsing: " + so.getRowid() + "/" + line[2] + "/" + line[3] + "/" + ref + "/" + alt);
355+
}
358356

359-
uniqueIndels.add(line[1] + "<>" + line[2] + "<>" + ref + "<>" + alt);
357+
uniqueIndels.add(line[1] + "<>" + line[2] + "<>" + ref + "<>" + alt);
358+
359+
writer.writeNext(new String[]{ctx.getSequenceSupport().getCachedReadset(so.getReadset()).getName(), String.valueOf(so.getRowid()), String.valueOf(so.getReadset()), "Pindel", line[1], line[2], String.valueOf(end1), String.valueOf(length), ref, String.valueOf(alt), line[4], "", line[5], line[6]});
360+
}
361+
else
362+
{
363+
writer.writeNext(new String[]{ctx.getSequenceSupport().getCachedReadset(so.getReadset()).getName(), String.valueOf(so.getRowid()), String.valueOf(so.getReadset()), "Pindel", line[1], line[2], String.valueOf(end1), String.valueOf(length), "", line[0], line[4], "", line[5], line[6]});
360364
}
361365
}
362366
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/PindelAnalysis.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ public static File runPindel(AnalysisOutputImpl output, PipelineContext ctx, Rea
229229
{
230230
writer.writeNext(new String[]{"Type", "Contig", "Start", "End", "Depth", "ReadSupport", "Fraction"});
231231
parsePindelOutput(ctx, writer, new File(outPrefix.getPath() + "_D"), minFraction, minDepth, gatkDepth);
232+
parsePindelOutput(ctx, writer, new File(outPrefix.getPath() + "_SI"), minFraction, minDepth, gatkDepth);
233+
parsePindelOutput(ctx, writer, new File(outPrefix.getPath() + "_LI"), minFraction, minDepth, gatkDepth);
232234
parsePindelOutput(ctx, writer, new File(outPrefix.getPath() + "_INV"), minFraction, minDepth, gatkDepth);
233235
}
234236
catch (IOException e)
@@ -241,6 +243,11 @@ public static File runPindel(AnalysisOutputImpl output, PipelineContext ctx, Rea
241243

242244
private static void parsePindelOutput(PipelineContext ctx, CSVWriter writer, File pindelFile, double minFraction, int minDepth, File gatkDepthFile) throws IOException
243245
{
246+
if (!pindelFile.exists())
247+
{
248+
return;
249+
}
250+
244251
try (BufferedReader reader = Readers.getReader(pindelFile))
245252
{
246253
String line;

0 commit comments

Comments
 (0)