Skip to content

Commit 117f09d

Browse files
committed
Avoid logging error for SequenceAnalysisMaintenanceTask when run on windows machines
1 parent a73f6fd commit 117f09d

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisMaintenanceTask.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,14 @@ private void processContainer(Container c, Logger log) throws IOException, Pipel
324324
File gzi = new File(fasta.getPath() + ".gz.gzi");
325325
if (!gzi.exists())
326326
{
327-
new FastaIndexer(log).execute(gz);
327+
if (SystemUtils.IS_OS_WINDOWS)
328+
{
329+
log.warn("Cannot index gzipped FASTA on windows: " + fasta.getPath());
330+
}
331+
else
332+
{
333+
new FastaIndexer(log).execute(gz);
334+
}
328335
}
329336

330337
expectedChildren.add(fasta.getName() + ".gz");

SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public String getPrimaryExtension()
119119
public static long getLineCount(File f) throws PipelineJobException
120120
{
121121
FileType gz = new FileType(".gz");
122-
try (InputStream is = gz.isType(f) ? new GZIPInputStream(new FileInputStream(f)) : new FileInputStream(f);BufferedReader reader = new BufferedReader(new InputStreamReader(is, StringUtilsLabKey.DEFAULT_CHARSET));)
122+
try (InputStream is = gz.isType(f) ? new GZIPInputStream(new FileInputStream(f)) : new FileInputStream(f); BufferedReader reader = new BufferedReader(new InputStreamReader(is, StringUtilsLabKey.DEFAULT_CHARSET));)
123123
{
124124
long i = 0;
125125
while (reader.readLine() != null)
@@ -228,7 +228,7 @@ public static void writeFastaRecord(Writer writer, String header, String sequenc
228228
if (sequence != null)
229229
{
230230
int len = sequence.length();
231-
for (int i=0; i<len; i+=lineLength)
231+
for (int i = 0; i < len; i += lineLength)
232232
{
233233
writer.write(sequence.substring(i, Math.min(len, i + lineLength)) + "\n");
234234
}
@@ -627,4 +627,19 @@ else if (FILETYPE.cram.getFileType().isType(bamOrCram))
627627

628628
throw new IllegalArgumentException("Must provide either a .bam or .cram file");
629629
}
630-
}
630+
631+
public static @Nullable File resolveUnderPath(String fn)
632+
{
633+
String path = System.getenv("PATH");
634+
for (String dir : path.split(File.pathSeparator))
635+
{
636+
File toTest = new File(dir, fn);
637+
if (toTest.exists())
638+
{
639+
return toTest;
640+
}
641+
}
642+
643+
return null;
644+
}
645+
}

0 commit comments

Comments
 (0)