Skip to content

Commit

Permalink
Bugfix to KING resume
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Feb 24, 2025
1 parent ee6a2e3 commit f83e55a
Showing 1 changed file with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,47 +172,48 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
plinkArgs2.add(plinkOutKing.getPath());

doneFile = new File (plinkOutKing.getPath() + ".done");
File plinkOutKingFile = new File(plinkOutKing.getPath() + ".kin0");
File plinkOutKingFileGz = new File(plinkOutKingFile.getPath() + ".txt.gz");
if (doneFile.exists())
{
getPipelineCtx().getLogger().debug("plink has completed, will not repeat");
}
else {
else
{
plink.execute(plinkArgs2);

if (!plinkOutKingFile.exists())
{
throw new PipelineJobException("Unable to find file: " + plinkOutKingFile.getPath());
}

if (plinkOutKingFileGz.exists())
{
plinkOutKingFileGz.delete();
}

try
{
Files.touch(doneFile);
Compress.compressGzip(plinkOutKingFile, plinkOutKingFileGz);
FileUtils.delete(plinkOutKingFile);
}
catch (IOException e)
{
throw new PipelineJobException(e);
}
}

File plinkOutKingFile = new File(plinkOutKing.getPath() + ".kin0");
if (!plinkOutKingFile.exists())
{
throw new PipelineJobException("Unable to find file: " + plinkOutKingFile.getPath());
}

File plinkOutKingFileTxt = new File(plinkOutKingFile.getPath() + ".txt.gz");
if (plinkOutKingFileTxt.exists())
{
plinkOutKingFileTxt.delete();
}

long lineCount = SequencePipelineService.get().getLineCount(plinkOutKingFile)-1;
try
{
Compress.compressGzip(plinkOutKingFile, plinkOutKingFileTxt);
FileUtils.delete(plinkOutKingFile);
}
catch (IOException e)
{
throw new PipelineJobException(e);
try
{
Files.touch(doneFile);
}
catch (IOException e)
{
throw new PipelineJobException(e);
}
}

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

return output;
}
Expand Down

0 comments on commit f83e55a

Please sign in to comment.