Skip to content

Commit 7fb981e

Browse files
authored
Merge pull request #299 from LabKey/fb_merge_24.3_to_develop
Merge 24.3 to develop
2 parents a7dad3f + dea2dbb commit 7fb981e

File tree

50 files changed

+1574
-353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1574
-353
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/AbstractCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ protected boolean isThrowNonZeroExits()
289289
return _throwNonZeroExits;
290290
}
291291

292-
protected static File resolveFileInPath(String exe, @Nullable String packageName, boolean throwIfNotFound)
292+
public static File resolveFileInPath(String exe, @Nullable String packageName, boolean throwIfNotFound)
293293
{
294294
File fn;
295295
String path;

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/AbstractGatk4Wrapper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public List<String> getBaseArgs(@Nullable String toolName)
9090
List<String> args = new ArrayList<>();
9191
args.add(SequencePipelineService.get().getJavaFilepath());
9292
args.addAll(SequencePipelineService.get().getJavaOpts(_maxRamOverride));
93+
args.add("-DGATK_STACKTRACE_ON_USER_EXCEPTION=true");
9394
args.add("-jar");
9495
args.add(getJAR().getPath());
9596

@@ -98,6 +99,8 @@ public List<String> getBaseArgs(@Nullable String toolName)
9899
args.add(toolName);
99100
}
100101

102+
103+
101104
return args;
102105
}
103106

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package org.labkey.api.sequenceanalysis.run;
2+
3+
import org.apache.commons.io.FileUtils;
4+
import org.apache.commons.lang3.StringUtils;
5+
import org.apache.logging.log4j.Logger;
6+
import org.labkey.api.pipeline.PipelineJobException;
7+
import org.labkey.api.sequenceanalysis.pipeline.PipelineOutputTracker;
8+
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
9+
import org.labkey.api.writer.PrintWriters;
10+
11+
import java.io.File;
12+
import java.io.IOException;
13+
import java.io.PrintWriter;
14+
import java.util.Arrays;
15+
import java.util.List;
16+
17+
public class DockerWrapper extends AbstractCommandWrapper
18+
{
19+
private final String _containerName;
20+
private File _tmpDir = null;
21+
22+
public DockerWrapper(String containerName, Logger log)
23+
{
24+
super(log);
25+
_containerName = containerName;
26+
}
27+
28+
public void setTmpDir(File tmpDir)
29+
{
30+
_tmpDir = tmpDir;
31+
}
32+
33+
public void executeWithDocker(List<String> containerArgs, File workDir, PipelineOutputTracker tracker) throws PipelineJobException
34+
{
35+
File localBashScript = new File(workDir, "docker.sh");
36+
File dockerBashScript = new File(workDir, "dockerRun.sh");
37+
tracker.addIntermediateFile(localBashScript);
38+
tracker.addIntermediateFile(dockerBashScript);
39+
40+
setWorkingDir(workDir);
41+
try (PrintWriter writer = PrintWriters.getPrintWriter(localBashScript); PrintWriter dockerWriter = PrintWriters.getPrintWriter(dockerBashScript))
42+
{
43+
writer.println("#!/bin/bash");
44+
writer.println("set -x");
45+
writer.println("WD=`pwd`");
46+
writer.println("HOME=`echo ~/`");
47+
writer.println("DOCKER='" + SequencePipelineService.get().getDockerCommand() + "'");
48+
writer.println("sudo $DOCKER pull " + _containerName);
49+
writer.println("sudo $DOCKER run --rm=true \\");
50+
writer.println("\t-v \"${WD}:/work\" \\");
51+
writer.println("\t-v \"${HOME}:/homeDir\" \\");
52+
if (_tmpDir != null)
53+
{
54+
writer.println("\t-v \"" + _tmpDir.getPath() + ":/tmp\" \\");
55+
}
56+
writer.println("\t--entrypoint /bin/bash \\");
57+
writer.println("\t-w /work \\");
58+
Integer maxRam = SequencePipelineService.get().getMaxRam();
59+
if (maxRam != null)
60+
{
61+
writer.println("\t-e SEQUENCEANALYSIS_MAX_RAM=" + maxRam + " \\");
62+
writer.println("\t--memory='" + maxRam + "g' \\");
63+
}
64+
writer.println("\t" + _containerName + " \\");
65+
writer.println("\t/work/" + dockerBashScript.getName());
66+
writer.println("EXIT_CODE=$?");
67+
writer.println("echo 'Docker run exit code: '$EXIT_CODE");
68+
writer.println("exit $EXIT_CODE");
69+
70+
dockerWriter.println("#!/bin/bash");
71+
dockerWriter.println("set -x");
72+
dockerWriter.println(StringUtils.join(containerArgs, " "));
73+
dockerWriter.println("EXIT_CODE=$?");
74+
dockerWriter.println("echo 'Exit code: '$?");
75+
dockerWriter.println("exit $EXIT_CODE");
76+
}
77+
catch (IOException e)
78+
{
79+
throw new PipelineJobException(e);
80+
}
81+
82+
execute(Arrays.asList("/bin/bash", localBashScript.getPath()));
83+
}
84+
85+
public File ensureLocalCopy(File input, File workingDirectory, PipelineOutputTracker output) throws PipelineJobException
86+
{
87+
try
88+
{
89+
if (workingDirectory.equals(input.getParentFile()))
90+
{
91+
return input;
92+
}
93+
94+
File local = new File(workingDirectory, input.getName());
95+
if (!local.exists())
96+
{
97+
getLogger().debug("Copying file locally: " + input.getPath());
98+
FileUtils.copyFile(input, local);
99+
}
100+
101+
output.addIntermediateFile(local);
102+
103+
return local;
104+
}
105+
catch (IOException e)
106+
{
107+
throw new PipelineJobException(e);
108+
}
109+
}
110+
}

SequenceAnalysis/pipeline_code/sequence_tools_install.sh

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -335,30 +335,6 @@ else
335335
fi
336336

337337

338-
#
339-
# BisSNP
340-
#
341-
echo ""
342-
echo ""
343-
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
344-
echo "Install BisSNP"
345-
echo ""
346-
cd $LKSRC_DIR
347-
348-
if [[ ! -e ${LKTOOLS_DIR}/BisSNP.jar || ! -z $FORCE_REINSTALL ]];
349-
then
350-
echo "Cleaning up previous installs"
351-
rm -Rf BisSNP*
352-
rm -Rf $LKTOOLS_DIR/BisSNP.jar
353-
354-
wget $WGET_OPTS https://downloads.sourceforge.net/project/bissnp/BisSNP-0.82.2/BisSNP-0.82.2.jar
355-
356-
install ./BisSNP-0.82.2.jar $LKTOOLS_DIR/BisSNP.jar
357-
else
358-
echo "Already installed"
359-
fi
360-
361-
362338
#
363339
#mosaik
364340
#
@@ -510,10 +486,10 @@ then
510486
rm -Rf bcftools*
511487
rm -Rf $LKTOOLS_DIR/bcftools
512488

513-
wget $WGET_OPTS https://github.com/samtools/bcftools/releases/download/1.18/bcftools-1.18.tar.bz2
514-
tar xjvf bcftools-1.18.tar.bz2
515-
chmod 755 bcftools-1.18
516-
cd bcftools-1.18
489+
wget $WGET_OPTS https://github.com/samtools/bcftools/releases/download/1.20/bcftools-1.20.tar.bz2
490+
tar xjvf bcftools-1.20.tar.bz2
491+
chmod 755 bcftools-1.20
492+
cd bcftools-1.20
517493
rm -f plugins/liftover.c
518494
wget $WGET_OPTS -P plugins https://raw.githubusercontent.com/freeseek/score/master/liftover.c
519495

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
2+
<columns>
3+
<!--<column name="rowid" />-->
4+
<column name="genomeId1" />
5+
<column name="genomeId2" />
6+
<column name="source" />
7+
<column name="version" />
8+
<column name="datedisabled" />
9+
<column name="chainFile" />
10+
</columns>
11+
<sorts>
12+
<sort column="genomeId1/name"/>
13+
<sort column="genomeId2/name"/>
14+
<sort column="version"/>
15+
</sorts>
16+
</customView>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
2+
<columns>
3+
<!--<column name="rowid" />-->
4+
<column name="genomeId1" />
5+
<column name="genomeId2" />
6+
<column name="source" />
7+
<column name="version" />
8+
<column name="dateDisabled" />
9+
<column name="chainFile" />
10+
<column name="chainFile/DataFileUrl" />
11+
</columns>
12+
<sorts>
13+
<sort column="genomeId1/name"/>
14+
<sort column="genomeId2/name"/>
15+
<sort column="version"/>
16+
</sorts>
17+
</customView>

SequenceAnalysis/resources/web/SequenceAnalysis/window/LiftoverWindow.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,24 @@ Ext4.define('SequenceAnalysis.window.LiftoverWindow', {
104104
maxValue: 1.0,
105105
value: 0.95,
106106
fieldLabel: 'Min Percent Match',
107-
helpPopup: 'In order to lift to the target genome, the feature must have at least this percent match. Lower this value to be more permissive; however, this risks incorrect liftovers',
107+
helpPopup: 'In order to lift to the target genome, the feature must have at least this percent match. Lower this value to be more permissive; however, this risks incorrect liftovers. This is ignored if using bcftools.',
108108
itemId: 'pctField'
109109
},{
110110
xtype: 'checkbox',
111111
itemId: 'dropGenotypes',
112112
checked: false,
113113
helpPopup: 'If checked, no genotypes will be written to the output file (applies to VCFs only). This can be useful (and necessary) when lifting VCFs with extremely high sample number.',
114114
fieldLabel: 'Drop Genotypes'
115+
},{
116+
xtype: 'checkbox',
117+
itemId: 'useBcfTools',
118+
checked: false,
119+
fieldLabel: 'Use bcftools'
120+
},{
121+
xtype: 'checkbox',
122+
itemId: 'doNotRetainUnmapped',
123+
checked: false,
124+
fieldLabel: 'Do Not Retain Unmapped'
115125
}].concat(SequenceAnalysis.window.OutputHandlerWindow.getCfgForToolParameters(this.toolParameters)),
116126
buttons: [{
117127
text: 'Submit',
@@ -152,6 +162,14 @@ Ext4.define('SequenceAnalysis.window.LiftoverWindow', {
152162
params.dropGenotypes = this.down('#dropGenotypes').getValue();
153163
}
154164

165+
if (this.down('#useBcfTools').getValue()){
166+
params.useBcfTools = this.down('#useBcfTools').getValue();
167+
}
168+
169+
if (this.down('#doNotRetainUnmapped').getValue()){
170+
params.doNotRetainUnmapped = this.down('#doNotRetainUnmapped').getValue();
171+
}
172+
155173
Ext4.Msg.wait('Saving...');
156174
LABKEY.Ajax.request({
157175
url: LABKEY.ActionURL.buildURL('sequenceanalysis', 'runSequenceHandler', this.containerPath),

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.labkey.sequenceanalysis.analysis.RnaSeqcHandler;
6060
import org.labkey.sequenceanalysis.analysis.SbtGeneCountHandler;
6161
import org.labkey.sequenceanalysis.analysis.UnmappedSequenceBasedGenotypeHandler;
62+
import org.labkey.sequenceanalysis.analysis.UpdateReadsetFilesHandler;
6263
import org.labkey.sequenceanalysis.button.AddSraRunButton;
6364
import org.labkey.sequenceanalysis.button.ArchiveReadsetsButton;
6465
import org.labkey.sequenceanalysis.button.ChangeReadsetStatusButton;
@@ -77,6 +78,7 @@
7778
import org.labkey.sequenceanalysis.run.alignment.BowtieWrapper;
7879
import org.labkey.sequenceanalysis.run.alignment.GSnapWrapper;
7980
import org.labkey.sequenceanalysis.run.alignment.MosaikWrapper;
81+
import org.labkey.sequenceanalysis.run.alignment.ParagraphStep;
8082
import org.labkey.sequenceanalysis.run.alignment.Pbmm2Wrapper;
8183
import org.labkey.sequenceanalysis.run.alignment.StarWrapper;
8284
import org.labkey.sequenceanalysis.run.alignment.VulcanWrapper;
@@ -113,6 +115,7 @@
113115
import org.labkey.sequenceanalysis.run.util.FastqcRunner;
114116
import org.labkey.sequenceanalysis.run.util.GenomicsDBAppendHandler;
115117
import org.labkey.sequenceanalysis.run.util.GenomicsDBImportHandler;
118+
import org.labkey.sequenceanalysis.run.util.SVAnnotateStep;
116119
import org.labkey.sequenceanalysis.run.variant.*;
117120
import org.labkey.sequenceanalysis.util.Barcoder;
118121
import org.labkey.sequenceanalysis.util.ChainFileValidator;
@@ -299,6 +302,7 @@ public static void registerPipelineSteps()
299302
SequencePipelineService.get().registerPipelineStep(new MendelianViolationReportStep.Provider());
300303
SequencePipelineService.get().registerPipelineStep(new SummarizeGenotypeQualityStep.Provider());
301304
SequencePipelineService.get().registerPipelineStep(new BcftoolsFillTagsStep.Provider());
305+
SequencePipelineService.get().registerPipelineStep(new SVAnnotateStep.Provider());
302306

303307
//handlers
304308
SequenceAnalysisService.get().registerFileHandler(new LiftoverHandler());
@@ -333,6 +337,8 @@ public static void registerPipelineSteps()
333337
SequenceAnalysisService.get().registerFileHandler(new PbsvJointCallingHandler());
334338
SequenceAnalysisService.get().registerFileHandler(new DeepVariantHandler());
335339
SequenceAnalysisService.get().registerFileHandler(new GLNexusHandler());
340+
SequenceAnalysisService.get().registerFileHandler(new ParagraphStep());
341+
SequenceAnalysisService.get().registerFileHandler(new UpdateReadsetFilesHandler());
336342

337343
SequenceAnalysisService.get().registerReadsetHandler(new MultiQCHandler());
338344
SequenceAnalysisService.get().registerReadsetHandler(new RestoreSraDataHandler());

0 commit comments

Comments
 (0)