Skip to content

Commit 621ded4

Browse files
committed
Quote filenames and also ensure cached JB2 files lack spaces
1 parent 116d563 commit 621ded4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/util/GxfSorter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public File sortGff(File input, @Nullable File output) throws PipelineJobExcepti
5555
writer.println("OUT_GFF='" + outputFile.getPath() + "'");
5656

5757
String cat = inputIsGzip ? "zcat" : "cat";
58-
writer.println(cat + " $GFF | awk '{ if ($1 ~ \"^#\" ) print $0; else exit; }' > $OUT_GFF");
59-
writer.println("(" + cat + " $GFF | grep -v '#' | grep -v \"Parent=\" | sort -V -t$'\\t' -k1,1 -k4,4n -k5,5n; " + cat + " $GFF | grep -v '#' | grep -e \"Parent=\" | sort -V -t$'\\t' -k1,1 -k4,4n -k5,5n)| sort -V -t$'\\t' -k1,1 -k4,4n -s >> $OUT_GFF");
58+
writer.println(cat + " '$GFF' | awk '{ if ($1 ~ \"^#\" ) print $0; else exit; }' > '$OUT_GFF'");
59+
writer.println("(" + cat + " '$GFF' | grep -v '#' | grep -v \"Parent=\" | sort -V -t$'\\t' -k1,1 -k4,4n -k5,5n; " + cat + " '$GFF' | grep -v '#' | grep -e \"Parent=\" | sort -V -t$'\\t' -k1,1 -k4,4n -k5,5n)| sort -V -t$'\\t' -k1,1 -k4,4n -s >> '$OUT_GFF'");
6060

6161
if (outputIsGzip)
6262
{
63-
writer.println("bgzip -f $OUT_GFF");
63+
writer.println("bgzip -f '$OUT_GFF'");
6464
outputFile = new File(outputFile.getPath() + ".gz");
6565
}
6666
}
@@ -89,8 +89,8 @@ public File sortGtf(File input, @Nullable File output) throws PipelineJobExcepti
8989
writer.println("OUT_GTF='" + outputFile.getPath() + "'");
9090

9191
String cat = inputIsGzip ? "zcat" : "cat";
92-
writer.println(cat + " $GTF | awk '{ if ($1 ~ \"^#\" ) print $0; else exit; }' > $OUT_GTF");
93-
writer.println(cat + " $GTF | grep -v '#' | awk -v OFS='\\t' ' {");
92+
writer.println(cat + " '$GTF' | awk '{ if ($1 ~ \"^#\" ) print $0; else exit; }' > '$OUT_GTF'");
93+
writer.println(cat + " '$GTF' | grep -v '#' | awk -v OFS='\\t' ' {");
9494
writer.println("so = 3");
9595
writer.println("if (tolower($3) == \"gene\")");
9696
writer.println(" so = 1");
@@ -100,11 +100,11 @@ public File sortGtf(File input, @Nullable File output) throws PipelineJobExcepti
100100
writer.println(" so = 3");
101101
writer.println("else if (tolower($3) == \"cds\")");
102102
writer.println(" so = 4");
103-
writer.println("print so, $0 } ' | sort -V -t$'\\t' -k2,2 -k5,5n -k1,1n | cut -d$'\\t' -f2- >> $OUT_GTF");
103+
writer.println("print so, $0 } ' | sort -V -t$'\\t' -k2,2 -k5,5n -k1,1n | cut -d$'\\t' -f2- >> '$OUT_GTF'");
104104

105105
if (outputIsGzip)
106106
{
107-
writer.println("bgzip -f $OUT_GTF");
107+
writer.println("bgzip -f '$OUT_GTF'");
108108
outputFile = new File(outputFile.getPath() + ".gz");
109109
}
110110
}

jbrowse/src/org/labkey/jbrowse/model/JsonFile.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.labkey.api.sequenceanalysis.run.SimpleScriptWrapper;
4242
import org.labkey.api.settings.AppProps;
4343
import org.labkey.api.util.FileType;
44+
import org.labkey.api.util.FileUtil;
4445
import org.labkey.api.util.GUID;
4546
import org.labkey.api.util.PageFlowUtil;
4647
import org.labkey.api.util.Path;
@@ -860,7 +861,7 @@ public File getLocationOfProcessedTrack(boolean createDir)
860861
trackDir.mkdirs();
861862
}
862863

863-
return new File(trackDir, getSourceFileName() + (needsGzip() && !isGzipped() ? ".gz" : ""));
864+
return new File(trackDir, FileUtil.makeLegalName(getSourceFileName()).replaceAll(" ", "_") + (needsGzip() && !isGzipped() ? ".gz" : ""));
864865
}
865866

866867
protected String getSourceFileName()

0 commit comments

Comments
 (0)