1515import org .labkey .api .sequenceanalysis .pipeline .VariantProcessingStep ;
1616import org .labkey .api .sequenceanalysis .pipeline .VariantProcessingStepOutputImpl ;
1717import org .labkey .api .sequenceanalysis .run .AbstractCommandPipelineStep ;
18+ import org .labkey .api .util .FileUtil ;
1819import org .labkey .api .util .PageFlowUtil ;
1920import org .labkey .api .writer .PrintWriters ;
2021import org .labkey .sequenceanalysis .pipeline .SequenceTaskHelper ;
@@ -75,18 +76,16 @@ public static File checkOrCreateIndex(SequenceAnalysisJobSupport support, Logger
7576
7677 SnpEffWrapper wrapper = new SnpEffWrapper (log );
7778 File snpEffIndexDir = wrapper .getExpectedIndexDir (snpEffBaseDir , genome .getGenomeId (), geneFileId );
78- if (snpEffIndexDir .exists ())
79- {
80- log .debug ("previously created index found, re-using: " + snpEffIndexDir .getPath ());
81- return snpEffBaseDir ;
82- }
83-
84- File binFile = new File (snpEffIndexDir , "snpEffectPredictor.bin" );
79+ File binFile = FileUtil .appendName (snpEffIndexDir , "snpEffectPredictor.bin" );
8580 if (!binFile .exists ())
8681 {
8782 log .debug ("existing index not found, expected: " + binFile .getPath ());
8883 wrapper .buildIndex (snpEffBaseDir , genome , geneFile , geneFileId );
8984 }
85+ else
86+ {
87+ log .debug ("previously created index found, re-using: " + snpEffIndexDir .getPath ());
88+ }
9089
9190 return snpEffBaseDir ;
9291 }
@@ -100,7 +99,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
10099 Integer geneFileId = getProvider ().getParameterByName (GENE_PARAM ).extractValue (getPipelineCtx ().getJob (), getProvider (), getStepIdx (), Integer .class );
101100 File snpEffBaseDir = checkOrCreateIndex (getPipelineCtx ().getSequenceSupport (), getPipelineCtx ().getLogger (), genome , geneFileId );
102101
103- File outputVcf = new File (outputDirectory , SequenceTaskHelper .getUnzippedBaseName (inputVCF ) + ".snpEff.vcf.gz" );
102+ File outputVcf = FileUtil . appendName (outputDirectory , SequenceTaskHelper .getUnzippedBaseName (inputVCF ) + ".snpEff.vcf.gz" );
104103 if (outputVcf .exists ())
105104 {
106105 getPipelineCtx ().getLogger ().debug ("deleting pre-existing output file: " + outputVcf .getPath ());
@@ -110,7 +109,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
110109 File intFile = null ;
111110 if (intervals != null )
112111 {
113- intFile = new File (outputVcf .getParentFile (), "snpEffintervals.bed" );
112+ intFile = FileUtil . appendName (outputVcf .getParentFile (), "snpEffintervals.bed" );
114113 try (PrintWriter writer = PrintWriters .getPrintWriter (intFile ))
115114 {
116115 getPipelineCtx ().getLogger ().debug ("Adding SnpEff intervals: " + intervals .size ());
0 commit comments