Skip to content

Commit 2df816e

Browse files
committed
Paragraph: simplify output
1 parent 3962332 commit 2df816e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ else if (!svVcf.exists())
127127
// id path depth read length
128128
// TNPRC-IB18 ../IB18.cram 29.77 150
129129
File coverageFile = new File(ctx.getWorkingDirectory(), "coverage.txt");
130+
String rgId = null;
130131
try (PrintWriter writer = PrintWriters.getPrintWriter(coverageFile); SamReader reader = SamReaderFactory.makeDefault().open(so.getFile()))
131132
{
132133
SAMFileHeader header = reader.getFileHeader();
@@ -139,13 +140,13 @@ else if (header.getReadGroups().size() > 1)
139140
throw new PipelineJobException("More than one read group found in BAM");
140141
}
141142

142-
String rgId = header.getReadGroups().get(0).getSample();
143+
rgId = header.getReadGroups().get(0).getSample();
143144

144145
JSONObject json = new JSONObject(FileUtils.readFileToString(coverageJson, Charset.defaultCharset()));
145146
writer.println("id\tpath\tdepth\tread length");
146147
double depth = json.getJSONObject("autosome").getDouble("depth");
147148
double readLength = json.getInt("read_length");
148-
writer.println(rgId + "\t" + so.getFile().getPath() + "\t" + depth + "\t" + readLength);
149+
writer.println(rgId + "\t" + "/work/" + so.getFile().getName() + "\t" + depth + "\t" + readLength);
149150
}
150151
catch (IOException e)
151152
{
@@ -157,9 +158,12 @@ else if (header.getReadGroups().size() > 1)
157158
List<String> paragraphArgs = new ArrayList<>();
158159
paragraphArgs.add("/opt/paragraph/bin/multigrmpy.py");
159160

160-
File paragraphOut = new File(ctx.getWorkingDirectory(), FileUtil.getBaseName(so.getFile()) + ".paragraph.txt");
161+
dockerWrapper.ensureLocalCopy(so.getFile(), ctx.getWorkingDirectory(), ctx.getFileManager());
162+
dockerWrapper.ensureLocalCopy(SequenceAnalysisService.get().getExpectedBamOrCramIndex(so.getFile()), ctx.getWorkingDirectory(), ctx.getFileManager());
163+
164+
File paragraphOutDir = new File(ctx.getWorkingDirectory(), FileUtil.getBaseName(so.getFile()));
161165
paragraphArgs.add("-o");
162-
paragraphArgs.add("/work/" + paragraphOut.getName());
166+
paragraphArgs.add("/work/" + paragraphOutDir.getName());
163167

164168
paragraphArgs.add("-i");
165169
dockerWrapper.ensureLocalCopy(svVcf, ctx.getWorkingDirectory(), ctx.getFileManager());
@@ -187,7 +191,7 @@ else if (header.getReadGroups().size() > 1)
187191

188192
dockerWrapper.executeWithDocker(paragraphArgs, ctx.getWorkingDirectory(), ctx.getFileManager());
189193

190-
File genotypes = new File(ctx.getWorkingDirectory(), "genotypes.vcf.gz");
194+
File genotypes = new File(paragraphOutDir, "genotypes.vcf.gz");
191195
if (!genotypes.exists())
192196
{
193197
throw new PipelineJobException("Missing file: " + genotypes.getPath());

0 commit comments

Comments
 (0)