Skip to content

Commit f79dfeb

Browse files
authored
Merge pull request #278 from LabKey/fb_merge_24.3_to_develop
Merge discvr-24.3 to develop
2 parents 4b7d600 + 30c2bc1 commit f79dfeb

File tree

27 files changed

+562
-121
lines changed

27 files changed

+562
-121
lines changed

SequenceAnalysis/resources/queries/sequenceanalysis/outputfiles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function beforeInsert(row, errors){
1919
beforeUpsert(row, errors);
2020
}
2121

22-
function beforeUpdate(row, errors){
22+
function beforeUpdate(row, oldRow, errors){
2323
beforeUpsert(row, errors);
2424
}
2525

SequenceAnalysis/resources/web/SequenceAnalysis/panel/AlignmentImportPanel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Ext4.define('SequenceAnalysis.panel.AlignmentImportPanel', {
8686
helpPopup: 'Description for this run, such as detail about the source of the alignments (optional)',
8787
itemId: 'jobDescription',
8888
name: 'jobDescription',
89-
allowBlank: true
89+
allowBlank: true,
90+
value: LABKEY.ActionURL.getParameter('jobDescription')
9091
},{
9192
fieldLabel: 'Delete Intermediate Files',
9293
helpPopup: 'Check to delete the intermediate files created by this pipeline. In general these are not needed and it will save disk space. These files might be useful for debugging though.',

SequenceAnalysis/resources/web/SequenceAnalysis/panel/AnalysisSectionPanel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ Ext4.define('SequenceAnalysis.panel.AnalysisSectionPanel', {
570570
return [];
571571
},
572572

573-
applySavedValues: function(values){
573+
applySavedValues: function(values, allowUrlOverride){
574574
if (this.stepType){
575575
var tools = values[this.stepType] ? values[this.stepType].split(';') : [];
576576
this.setActiveTools(tools);
@@ -585,6 +585,10 @@ Ext4.define('SequenceAnalysis.panel.AnalysisSectionPanel', {
585585
if (Ext4.isDefined(values[name])){
586586
p.setValue(values[name]);
587587
}
588+
589+
if (allowUrlOverride && LABKEY.ActionURL.getParameter(name)) {
590+
p.setValue(LABKEY.ActionURL.getParameter(name));
591+
}
588592
}, this);
589593
}
590594
},

SequenceAnalysis/resources/web/SequenceAnalysis/panel/BaseSequencePanel.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ Ext4.define('SequenceAnalysis.panel.BaseSequencePanel', {
269269
return;
270270
}
271271

272+
// If auto-loading, assume we want to read the URL
273+
thePanel.down('#readUrlParams').setValue(true);
274+
272275
var recIdx = store.find('name', LABKEY.ActionURL.getParameter('template'));
273276
if (recIdx > -1) {
274277
thePanel.down('labkey-combo').setValue(store.getAt(recIdx));
@@ -297,6 +300,12 @@ Ext4.define('SequenceAnalysis.panel.BaseSequencePanel', {
297300
helpPopup: 'By default, the pipelines jobs and their outputs will be created in the workbook you selected. However, in certain cases, such as bulk submission of many jobs, it might be preferable to submit each job to the source folder/workbook for each input. Checking this box will enable this.',
298301
fieldLabel: 'Submit Jobs to Same Folder/Workbook as Readset',
299302
labelWidth: 200
303+
},{
304+
xtype: 'checkbox',
305+
itemId: 'readUrlParams',
306+
helpPopup: 'If true, any parameters provided on the URL with the same name as a parameter in the JSON will be read and override the template.',
307+
fieldLabel: 'Read Parameters From URL',
308+
labelWidth: 200
300309
}]
301310
}],
302311
buttons: [{
@@ -353,7 +362,8 @@ Ext4.define('SequenceAnalysis.panel.BaseSequencePanel', {
353362
delete json.submitJobToReadsetContainer;
354363
}
355364

356-
win.sequencePanel.applySavedValues(json);
365+
var readUrlParams = win.down('#readUrlParams').getValue();
366+
win.sequencePanel.applySavedValues(json, readUrlParams);
357367

358368
var submitJobToReadsetContainer = win.sequencePanel.down('[name="submitJobToReadsetContainer"]');
359369
if (submitJobToReadsetContainer) {
@@ -386,7 +396,7 @@ Ext4.define('SequenceAnalysis.panel.BaseSequencePanel', {
386396
}
387397
},
388398

389-
applySavedValues: function(values){
399+
applySavedValues: function(values, allowUrlOverride){
390400
//allows for subclasses to exclude this panel
391401
var alignPanel = this.down('sequenceanalysis-alignmentpanel');
392402
if (alignPanel) {
@@ -395,7 +405,7 @@ Ext4.define('SequenceAnalysis.panel.BaseSequencePanel', {
395405

396406
var sections = this.query('sequenceanalysis-analysissectionpanel');
397407
Ext4.Array.forEach(sections, function(s){
398-
s.applySavedValues(values);
408+
s.applySavedValues(values, allowUrlOverride);
399409
}, this);
400410

401411
// For top-level properties:

SequenceAnalysis/resources/web/SequenceAnalysis/panel/SequenceAnalysisPanel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
300300
height: 100,
301301
helpPopup: 'Description for this analysis (optional)',
302302
name: 'jobDescription',
303-
allowBlank:true
303+
allowBlank: true,
304+
value: LABKEY.ActionURL.getParameter('jobDescription')
304305
},{
305306
fieldLabel: 'Delete Intermediate Files',
306307
helpPopup: 'Check to delete the intermediate files created by this pipeline. In general these are not needed and it will save disk space. These files might be useful for debugging though.',

SequenceAnalysis/resources/web/SequenceAnalysis/panel/VariantProcessingPanel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ Ext4.define('SequenceAnalysis.panel.VariantProcessingPanel', {
6161
height: 100,
6262
helpPopup: 'Description for this analysis (optional)',
6363
name: 'jobDescription',
64-
allowBlank:true
64+
allowBlank: true,
65+
value: LABKEY.ActionURL.getParameter('jobDescription')
6566
},{
6667
xtype: 'sequenceanalysis-variantscattergatherpanel',
6768
width: 620,

SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/DeepVariantHandler.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
9797
action.addInput(so.getFile(), "Input BAM File");
9898

9999
File outputFile = new File(ctx.getOutputDir(), FileUtil.getBaseName(so.getFile()) + ".g.vcf.gz");
100+
File outputFileVcf = new File(ctx.getOutputDir(), FileUtil.getBaseName(so.getFile()) + ".vcf.gz");
100101

101102
DeepVariantAnalysis.DeepVariantWrapper wrapper = new DeepVariantAnalysis.DeepVariantWrapper(job.getLogger());
102103
wrapper.setOutputDir(ctx.getOutputDir());
@@ -123,7 +124,8 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
123124
throw new PipelineJobException("Missing binVersion");
124125
}
125126

126-
wrapper.execute(so.getFile(), referenceGenome.getWorkingFastaFile(), outputFile, ctx.getFileManager(), binVersion, args);
127+
boolean retainVcf = ctx.getParams().optBoolean("retainVcf", false);
128+
wrapper.execute(so.getFile(), referenceGenome.getWorkingFastaFile(), outputFile, retainVcf, ctx.getFileManager(), binVersion, args);
127129

128130
action.addOutput(outputFile, "gVCF File", false);
129131

@@ -137,6 +139,19 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
137139

138140
ctx.addSequenceOutput(o);
139141

142+
if (retainVcf)
143+
{
144+
SequenceOutputFile vcf = new SequenceOutputFile();
145+
vcf.setName(outputFileVcf.getName());
146+
vcf.setFile(outputFileVcf);
147+
vcf.setLibrary_id(so.getLibrary_id());
148+
vcf.setCategory("DeepVariant VCF File");
149+
vcf.setReadset(so.getReadset());
150+
vcf.setDescription("DeepVariant Version: " + binVersion);
151+
152+
ctx.addSequenceOutput(vcf);
153+
}
154+
140155
ctx.addActions(action);
141156
}
142157

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/ProcessVariantsHandler.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,6 @@ public static List<Interval> getIntervals(JobContext ctx)
369369

370370
public static File processVCF(File input, Integer libraryId, JobContext ctx, Resumer resumer, boolean subsetToIntervals) throws PipelineJobException
371371
{
372-
try
373-
{
374-
SequenceAnalysisService.get().ensureVcfIndex(input, ctx.getLogger());
375-
}
376-
catch (IOException e)
377-
{
378-
throw new PipelineJobException(e);
379-
}
380-
381372
File currentVCF = input;
382373

383374
ctx.getJob().getLogger().info("***Starting processing of file: " + input.getName());
@@ -409,6 +400,15 @@ public static File processVCF(File input, Integer libraryId, JobContext ctx, Res
409400
}
410401
else
411402
{
403+
try
404+
{
405+
SequenceAnalysisService.get().ensureVcfIndex(input, ctx.getLogger());
406+
}
407+
catch (IOException e)
408+
{
409+
throw new PipelineJobException(e);
410+
}
411+
412412
OutputVariantsStartingInIntervalsStep.Wrapper wrapper = new OutputVariantsStartingInIntervalsStep.Wrapper(ctx.getLogger());
413413
wrapper.execute(input, outputFile, getIntervals(ctx));
414414
}
@@ -422,6 +422,7 @@ public static File processVCF(File input, Integer libraryId, JobContext ctx, Res
422422
for (PipelineStepCtx<VariantProcessingStep> stepCtx : providers)
423423
{
424424
ctx.getLogger().info("Starting to run: " + stepCtx.getProvider().getLabel());
425+
ctx.getLogger().debug("VCF: " + currentVCF);
425426
ctx.getJob().setStatus(PipelineJob.TaskStatus.running, "Running: " + stepCtx.getProvider().getLabel());
426427
stepIdx++;
427428

@@ -432,6 +433,15 @@ public static File processVCF(File input, Integer libraryId, JobContext ctx, Res
432433
continue;
433434
}
434435

436+
try
437+
{
438+
SequenceAnalysisService.get().ensureVcfIndex(currentVCF, ctx.getLogger());
439+
}
440+
catch (IOException e)
441+
{
442+
throw new PipelineJobException(e);
443+
}
444+
435445
RecordedAction action = new RecordedAction(stepCtx.getProvider().getLabel());
436446
Date start = new Date();
437447
action.setStartTime(start);
@@ -467,6 +477,7 @@ public static File processVCF(File input, Integer libraryId, JobContext ctx, Res
467477
{
468478
currentVCF = output.getVCF();
469479

480+
ctx.getJob().getLogger().info("output VCF: " + currentVCF.getPath());
470481
ctx.getJob().getLogger().info("total variants: " + getVCFLineCount(currentVCF, ctx.getJob().getLogger(), false, true));
471482
ctx.getJob().getLogger().info("passing variants: " + getVCFLineCount(currentVCF, ctx.getJob().getLogger(), true, false));
472483
ctx.getJob().getLogger().debug("index exists: " + (new File(currentVCF.getPath() + ".tbi")).exists());
@@ -767,6 +778,7 @@ protected String getJsonName()
767778

768779
public void setStepComplete(int stepIdx, String inputFilePath, RecordedAction action, File scatterOutput) throws PipelineJobException
769780
{
781+
getLogger().debug("Marking step complete with VCF: " + inputFilePath);
770782
_scatterOutputs.put(getKey(stepIdx, inputFilePath), scatterOutput);
771783
_recordedActions.add(action);
772784
saveState();

SequenceAnalysis/src/org/labkey/sequenceanalysis/query/DownloadSequenceDisplayColumnFactory.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@
66
import org.labkey.api.data.DisplayColumn;
77
import org.labkey.api.data.DisplayColumnFactory;
88
import org.labkey.api.data.RenderContext;
9-
import org.labkey.api.data.Sort;
10-
import org.labkey.api.data.UrlColumn;
119
import org.labkey.api.query.FieldKey;
1210
import org.labkey.api.util.PageFlowUtil;
13-
import org.labkey.api.util.StringExpression;
14-
import org.labkey.api.util.StringExpressionFactory;
15-
import org.labkey.api.util.URLHelper;
11+
import org.labkey.api.view.HttpView;
1612
import org.labkey.api.view.template.ClientDependency;
1713

1814
import java.io.IOException;
1915
import java.io.Writer;
20-
import java.util.Arrays;
2116
import java.util.Collections;
2217
import java.util.LinkedHashSet;
18+
import java.util.Map;
2319
import java.util.Set;
2420

2521
/**
@@ -39,11 +35,21 @@ public DisplayColumn createRenderer(ColumnInfo colInfo)
3935
{
4036
DataColumn ret = new DataColumn(colInfo)
4137
{
38+
private boolean _handlerRegistered = false;
39+
4240
@Override
4341
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
4442
{
4543
Object val = ctx.get(FieldKey.fromString(getBoundColumn().getFieldKey().getParent(), "rowId"));
46-
out.write(PageFlowUtil.link("Download Sequence").onClick("SequenceAnalysis.window.DownloadSequencesWindow.downloadSingle(" + val + ")").toString());
44+
out.write(PageFlowUtil.link("Download Sequence").attributes(Map.of(
45+
"data-rowid", val.toString()
46+
)).addClass("sdc-row").toString());
47+
48+
if (!_handlerRegistered)
49+
{
50+
HttpView.currentPageConfig().addHandlerForQuerySelector("a.sdc-row", "click", "SequenceAnalysis.window.DownloadSequencesWindow.downloadSingle(this.attributes.getNamedItem('data-rowid').value); return false;");
51+
_handlerRegistered = true;
52+
}
4753
}
4854

4955
@Override

SequenceAnalysis/src/org/labkey/sequenceanalysis/query/SequenceAnalysisCustomizer.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.labkey.api.security.User;
2929
import org.labkey.api.util.PageFlowUtil;
3030
import org.labkey.api.view.ActionURL;
31+
import org.labkey.api.view.HttpView;
3132
import org.labkey.api.view.template.ClientDependency;
3233
import org.labkey.sequenceanalysis.SequenceAnalysisSchema;
3334

@@ -232,6 +233,8 @@ public DisplayColumn createRenderer(ColumnInfo colInfo)
232233
{
233234
return new DataColumn(colInfo)
234235
{
236+
private boolean _handlerRegistered = false;
237+
235238
@Override
236239
public @NotNull Set<ClientDependency> getClientDependencies()
237240
{
@@ -275,8 +278,13 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
275278
}
276279
}
277280

278-
String onclick = "onclick=\"SequenceAnalysis.window.ManageFileSetsWindow.buttonHandlerForOutputFiles(" + PageFlowUtil.jsString(rowId.toString()) + ", " + PageFlowUtil.jsString(ctx.getCurrentRegion().getName()) + ");\"";
279-
out.write("<a class=\"fa fa-pencil lk-dr-action-icon\" data-tt=\"tooltip\" data-original-title=\"add/edit\" " + onclick + "></a>");
281+
out.write("<a class=\"fa fa-pencil lk-dr-action-icon sfs-row\" data-tt=\"tooltip\" data-rowid=\"" + rowId +"\" data-original-title=\"add/edit\"></a>");
282+
283+
if (!_handlerRegistered)
284+
{
285+
HttpView.currentPageConfig().addHandlerForQuerySelector("a.sfs-row", "click", "SequenceAnalysis.window.ManageFileSetsWindow.buttonHandlerForOutputFiles(this.attributes.getNamedItem('data-rowid').value, " + PageFlowUtil.jsString(ctx.getCurrentRegion().getName()) + "); return false;");
286+
_handlerRegistered = true;
287+
}
280288
}
281289
}
282290
};

0 commit comments

Comments
 (0)