Skip to content

Commit 80a448e

Browse files
authored
Merge pull request #54 from LabKey/fb_merge_discvr-20.7
Merge discvr-20.7 to develop
2 parents ff9629c + 5ac166b commit 80a448e

28 files changed

+437
-75
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/DefaultPipelineStepOutput.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,31 @@ public List<SequenceOutput> getSequenceOutputs()
101101
return Collections.unmodifiableList(_sequenceOutputs);
102102
}
103103

104+
@Override
104105
public void addSequenceOutput(File file, String label, String category, @Nullable Integer readsetId, @Nullable Integer analysisId, @Nullable Integer genomeId, @Nullable String description)
105106
{
106107
_sequenceOutputs.add(new SequenceOutput(file, label, category, readsetId, analysisId, genomeId, description));
107108
}
108109

110+
@Override
109111
public void addInput(File input, String role)
110112
{
111113
_inputs.add(Pair.of(input, role));
112114
}
113115

116+
@Override
114117
public void addOutput(File output, String role)
115118
{
116119
_outputs.add(Pair.of(output, role));
117120
}
118121

122+
@Override
119123
public void addIntermediateFile(File file)
120124
{
121125
addIntermediateFile(file, null);
122126
}
123127

128+
@Override
124129
public void addIntermediateFile(File file, String role)
125130
{
126131
if (role != null)
@@ -136,6 +141,11 @@ public void addPicardMetricsFile(Readset rs, File metricFile, File inputFile)
136141

137142
public void addPicardMetricsFile(Readset rs, File metricFile, PicardMetricsOutput.TYPE type)
138143
{
144+
if (!metricFile.exists())
145+
{
146+
throw new IllegalArgumentException("File does not exist: " + metricFile.getPath());
147+
}
148+
139149
_picardMetricsFiles.add(new PipelineStepOutput.PicardMetricsOutput(metricFile, type, rs.getRowId()));
140150
}
141151

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
UPDATE sequenceanalysis.quality_metrics SET metricname = 'Mean Read Length' WHERE metricname = 'Avg Read Length';
2+
3+
UPDATE sequenceanalysis.quality_metrics SET category = 'Readset' WHERE category IS NULL and metricname IN (
4+
'Total Reads',
5+
'Min Read Length',
6+
'Max Read Length',
7+
'Mean Read Length',
8+
'Total Bases',
9+
'Total MBases',
10+
'Total GBases',
11+
'Total Q10 Bases',
12+
'Total Q20 Bases',
13+
'Total Q30 Bases',
14+
'Total Q40 Bases',
15+
'Pct Q10',
16+
'Pct Q20',
17+
'Pct Q30',
18+
'Pct Q40'
19+
);
20+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
UPDATE sequenceanalysis.quality_metrics SET metricname = 'Mean Read Length' WHERE metricname = 'Avg Read Length';
2+
3+
UPDATE sequenceanalysis.quality_metrics SET category = 'Readset' WHERE category IS NULL and metricname IN (
4+
'Total Reads',
5+
'Min Read Length',
6+
'Max Read Length',
7+
'Mean Read Length',
8+
'Total Bases',
9+
'Total MBases',
10+
'Total GBases',
11+
'Total Q10 Bases',
12+
'Total Q20 Bases',
13+
'Total Q30 Bases',
14+
'Total Q40 Bases',
15+
'Pct Q10',
16+
'Pct Q20',
17+
'Pct Q30',
18+
'Pct Q40'
19+
);
20+

SequenceAnalysis/resources/schemas/sequenceanalysis.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@
11771177
<isHidden>true</isHidden>
11781178
</column>
11791179
<column columnName="instrument_run_id">
1180-
<columnTitle>Instrument Run</columnTitle>
1180+
<columnTitle>Batch/Run</columnTitle>
11811181
<fk>
11821182
<fkDbSchema>sequenceanalysis</fkDbSchema>
11831183
<fkTable>instrument_runs</fkTable>

SequenceAnalysis/resources/views/sequenceAnalysisDetails.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'<div style="margin-bottom: 10px;"></div>' +
1818
//'<div id="analysisNav_'+webpart.wrapperDivId+'"></div>' +
1919
//'<br>' +
20+
'<div id="outputs_'+webpart.wrapperDivId+'"></div>' +
2021
'<div id="qualityMetrics_'+webpart.wrapperDivId+'"></div>' +
2122
'<div style="margin-bottom: 10px;"></div>' +
2223
'<div id="readsetDiv_'+webpart.wrapperDivId+'"/>'
@@ -52,6 +53,15 @@
5253
successCallback: onSuccess
5354
});
5455

56+
LDK.Utils.getReadOnlyQWP({
57+
title: 'Outputs',
58+
schemaName: 'sequenceanalysis',
59+
queryName: 'outputfiles',
60+
maxRows: 20,
61+
containerPath: Laboratory.Utils.getQueryContainerPath(),
62+
filterArray: [LABKEY.Filter.create('analysis_id', analysisId, LABKEY.Filter.Types.EQUAL)]
63+
}).render('outputs_'+webpart.wrapperDivId);
64+
5565
LDK.Utils.getReadOnlyQWP({
5666
title: 'Quality Metrics',
5767
schemaName: 'sequenceanalysis',

SequenceAnalysis/resources/web/SequenceAnalysis/panel/IlluminaSampleExportPanel.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,30 @@ Ext4.define('SequenceAnalysis.panel.IlluminaSampleExportPanel', {
9999
allowBlank: false,
100100
displayField: 'name',
101101
valueField: 'name',
102+
value: 'FASTQ Only',
102103
store: Ext4.create('LABKEY.ext4.data.Store', {
103104
schemaName: 'sequenceanalysis',
104105
queryName: 'illumina_applications',
105106
columns: '*',
106107
autoLoad: true,
107108
listeners: {
109+
scope: this,
108110
load: function(store){
109111
var rec = LDK.StoreUtils.createModelInstance(store, {
110112
name: 'Custom'
111113
});
112114
store.add(rec);
115+
116+
var field = this.down('#application');
117+
field.fireEvent('change', field, field.getValue());
113118
}
114119
}
115120
}),
116121
listeners: {
117122
scope: this,
118123
change: function(field, val){
119124
var kitField = field.up('panel').down('#sampleKit');
120-
if (!val || val == 'Custom'){
125+
if (!val || val === 'Custom'){
121126
kitField.setDisabled(true);
122127
return;
123128
}
@@ -171,6 +176,12 @@ Ext4.define('SequenceAnalysis.panel.IlluminaSampleExportPanel', {
171176
helpPopup: 'Leave blank for single-end reads',
172177
itemId: 'cycles2',
173178
fieldLabel: 'Cycles Read 2'
179+
},{
180+
xtype: 'checkbox',
181+
itemId: 'nameUsingRowId',
182+
fieldLabel: 'Name FASTA Using Row Id',
183+
value: true,
184+
helpPopup: 'If checked, the FASTQs will be named using the numeric rowId, which can make import more automatic. If unchecked, they will be named using readset name.'
174185
},{
175186
xtype: 'combo',
176187
itemId: 'genomeFolder',
@@ -591,6 +602,7 @@ Ext4.define('SequenceAnalysis.panel.IlluminaSampleExportPanel', {
591602

592603
var genomeFolder = '';
593604
var genomeField = this.down('#genomeFolder');
605+
var nameUsingRowId = this.down('#nameUsingRowId').getValue();
594606
if (genomeField.getValue()){
595607
var recIdx = genomeField.store.find(genomeField.valueField, genomeField.getValue());
596608
var rec = genomeField.store.getAt(recIdx);
@@ -599,7 +611,7 @@ Ext4.define('SequenceAnalysis.panel.IlluminaSampleExportPanel', {
599611

600612
var sampleColumns = [
601613
['Sample_ID', 'rowid'],
602-
['Sample_Name', 'name'],
614+
['Sample_Name', 'name', function(row) { return nameUsingRowId ? 's_' + row.rowid : row.name; }],
603615
['Sample_Plate', ''],
604616
['Sample_Well', ''],
605617
['Sample_Project', ''],
@@ -621,7 +633,13 @@ Ext4.define('SequenceAnalysis.panel.IlluminaSampleExportPanel', {
621633
var toAdd = [];
622634
Ext4.each(sampleColumns, function(col){
623635
if (col.length > 2){
624-
toAdd.push(col[2]);
636+
if (Ext4.isFunction(col[2])) {
637+
toAdd.push(col[2](row));
638+
}
639+
else {
640+
toAdd.push(col[2]);
641+
}
642+
625643
}
626644
else {
627645
toAdd.push(row[col[1]]);

SequenceAnalysis/resources/web/SequenceAnalysis/panel/SequenceImportPanel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,8 +2335,8 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
23352335
}).show(btn);
23362336
}
23372337
}, {
2338-
text: 'Assign To Instrument Run',
2339-
tooltip: 'Click to assign the selected rows to an existing or new instrument run',
2338+
text: 'Assign To Instrument Run/Batch',
2339+
tooltip: 'Click to assign the selected rows to an existing or new instrument run or batch',
23402340
scope: this,
23412341
handler: function (btn) {
23422342
var grid = btn.up('grid');

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ private void processContainer(Container c, Logger log) throws IOException
342342
if (!d.getFile().exists())
343343
{
344344
log.error("expected output file does not exist: " + d.getFile().getPath());
345+
continue;
345346
}
346347

347348
//also verify indexes

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public String getName()
161161
@Override
162162
public Double getSchemaVersion()
163163
{
164-
return 12.322;
164+
return 12.323;
165165
}
166166

167167
@Override

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import org.apache.commons.io.FileUtils;
44
import org.apache.commons.lang3.StringUtils;
5-
import org.apache.logging.log4j.Logger;
65
import org.apache.logging.log4j.LogManager;
6+
import org.apache.logging.log4j.Logger;
7+
import org.biojava3.core.exceptions.CompoundNotFoundError;
78
import org.biojava3.core.sequence.DNASequence;
89
import org.labkey.api.collections.CaseInsensitiveHashMap;
910
import org.labkey.api.data.CompareType;
@@ -199,9 +200,28 @@ public void updateBarcodeRC(final ModuleContext moduleContext)
199200
ts.forEachResults(rs -> {
200201
Map<String, Object> r = new CaseInsensitiveHashMap<>();
201202
r.put("tag_name", rs.getString(FieldKey.fromString("tag_name")));
202-
DNASequence seq = new DNASequence(rs.getString(FieldKey.fromString("sequence")));
203-
r.put("reverse_complement", seq.getReverseComplement().getSequenceAsString());
204-
toUpdate.add(r);
203+
if (StringUtils.isEmpty(rs.getString(FieldKey.fromString("sequence"))))
204+
{
205+
return;
206+
}
207+
208+
try
209+
{
210+
String[] sequences = rs.getString(FieldKey.fromString("sequence")).split(",");
211+
List<String> rcs = new ArrayList<>();
212+
for (String s : sequences)
213+
{
214+
DNASequence seq = new DNASequence(s);
215+
rcs.add(seq.getReverseComplement().getSequenceAsString());
216+
}
217+
218+
r.put("reverse_complement", StringUtils.join(rcs, ","));
219+
toUpdate.add(r);
220+
}
221+
catch (CompoundNotFoundError e)
222+
{
223+
_log.error("Unable to reverse complement barcode: " + rs.getString(FieldKey.fromString("sequence")), e);
224+
}
205225
});
206226

207227
toUpdate.forEach(row -> {

0 commit comments

Comments
 (0)