Skip to content

Commit f83e55a

Browse files
committed
Bugfix to KING resume
1 parent ee6a2e3 commit f83e55a

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/KingInferenceStep.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,47 +172,48 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
172172
plinkArgs2.add(plinkOutKing.getPath());
173173

174174
doneFile = new File (plinkOutKing.getPath() + ".done");
175+
File plinkOutKingFile = new File(plinkOutKing.getPath() + ".kin0");
176+
File plinkOutKingFileGz = new File(plinkOutKingFile.getPath() + ".txt.gz");
175177
if (doneFile.exists())
176178
{
177179
getPipelineCtx().getLogger().debug("plink has completed, will not repeat");
178180
}
179-
else {
181+
else
182+
{
180183
plink.execute(plinkArgs2);
181184

185+
if (!plinkOutKingFile.exists())
186+
{
187+
throw new PipelineJobException("Unable to find file: " + plinkOutKingFile.getPath());
188+
}
189+
190+
if (plinkOutKingFileGz.exists())
191+
{
192+
plinkOutKingFileGz.delete();
193+
}
194+
182195
try
183196
{
184-
Files.touch(doneFile);
197+
Compress.compressGzip(plinkOutKingFile, plinkOutKingFileGz);
198+
FileUtils.delete(plinkOutKingFile);
185199
}
186200
catch (IOException e)
187201
{
188202
throw new PipelineJobException(e);
189203
}
190-
}
191-
192-
File plinkOutKingFile = new File(plinkOutKing.getPath() + ".kin0");
193-
if (!plinkOutKingFile.exists())
194-
{
195-
throw new PipelineJobException("Unable to find file: " + plinkOutKingFile.getPath());
196-
}
197204

198-
File plinkOutKingFileTxt = new File(plinkOutKingFile.getPath() + ".txt.gz");
199-
if (plinkOutKingFileTxt.exists())
200-
{
201-
plinkOutKingFileTxt.delete();
202-
}
203-
204-
long lineCount = SequencePipelineService.get().getLineCount(plinkOutKingFile)-1;
205-
try
206-
{
207-
Compress.compressGzip(plinkOutKingFile, plinkOutKingFileTxt);
208-
FileUtils.delete(plinkOutKingFile);
209-
}
210-
catch (IOException e)
211-
{
212-
throw new PipelineJobException(e);
205+
try
206+
{
207+
Files.touch(doneFile);
208+
}
209+
catch (IOException e)
210+
{
211+
throw new PipelineJobException(e);
212+
}
213213
}
214214

215-
output.addSequenceOutput(plinkOutKingFileTxt, "PLINK2/KING Relatedness: " + inputVCF.getName(), "PLINK2/KING Kinship", null, null, genome.getGenomeId(), "Total lines: " + lineCount);
215+
long lineCount = SequencePipelineService.get().getLineCount(plinkOutKingFileGz)-1;
216+
output.addSequenceOutput(plinkOutKingFileGz, "PLINK2/KING Relatedness: " + inputVCF.getName(), "PLINK2/KING Kinship", null, null, genome.getGenomeId(), "Total lines: " + lineCount);
216217

217218
return output;
218219
}

0 commit comments

Comments
 (0)