From f83e55ab5dc704da586d56826424070f15bca493 Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 24 Feb 2025 06:47:31 -0800 Subject: [PATCH] Bugfix to KING resume --- .../run/variant/KingInferenceStep.java | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/KingInferenceStep.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/KingInferenceStep.java index a1b3b9af5..9a21691b5 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/KingInferenceStep.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/KingInferenceStep.java @@ -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; }