Skip to content

Commit 2fd324b

Browse files
committed
Allow client-side to accept SRA archived data
1 parent d8e4752 commit 2fd324b

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
142142
containerPath: this.queryContainer,
143143
schemaName: 'sequenceanalysis',
144144
queryName: 'readdata',
145-
columns: 'rowid,readset,readset/name,container,container/displayName,container/path,fileid1,fileid1/name,fileid1/fileexists,fileid2,fileid2/name,fileid2/fileexists',
145+
columns: 'rowid,readset,readset/name,container,container/displayName,container/path,fileid1,fileid1/name,fileid1/fileexists,fileid2,fileid2/name,fileid2/fileexists,sra_accession',
146146
metadata: {
147147
queryContainerPath: {
148148
createIfDoesNotExist: true,
@@ -160,11 +160,17 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
160160
load: function (store) {
161161
var errors = [];
162162
var errorNames = [];
163+
var archived = [];
163164
store.each(function(rec){
164165
if (rec.get('fileid1')){
165166
if (!rec.get('fileid1/fileexists')){
166-
errors.push(rec);
167-
errorNames.push(rec.get('readset/name'));
167+
if (!rec.get('sra_accession')) {
168+
errors.push(rec);
169+
errorNames.push(rec.get('readset/name'));
170+
}
171+
else {
172+
archived.push(rec.get('readset/name'))
173+
}
168174
}
169175
else {
170176
this.fileIds.push(rec.get('fileid1'));
@@ -178,8 +184,13 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
178184

179185
if (rec.get('fileid2')){
180186
if (!rec.get('fileid2/fileexists')){
181-
errors.push(rec);
182-
errorNames.push(rec.get('name'))
187+
if (!rec.get('sra_accession')) {
188+
errors.push(rec);
189+
errorNames.push(rec.get('name'))
190+
}
191+
else {
192+
archived.push(rec.get('name'));
193+
}
183194
}
184195
else {
185196
this.fileIds.push(rec.get('fileid2'));
@@ -188,7 +199,7 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
188199
}
189200
}, this);
190201

191-
this.onStoreLoad(errorNames);
202+
this.onStoreLoad(errorNames, archived);
192203

193204
var target = this.down('#readsetCount');
194205
if (target) {
@@ -201,13 +212,18 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
201212

202213
storesLoaded: 0,
203214
errorNames: [],
215+
archivedNames: [],
204216

205-
onStoreLoad: function(errorNames){
217+
onStoreLoad: function(errorNames, archivedNames){
206218
this.storesLoaded++;
207219
if (errorNames){
208220
this.errorNames = this.errorNames.concat(errorNames);
209221
this.errorNames = Ext4.unique(this.errorNames);
210222
}
223+
224+
if (archivedNames) {
225+
this.archivedNames = Ext4.unique(this.archivedNames.concat(archivedNames));
226+
}
211227
if (this.storesLoaded === 2){
212228
this.afterStoreLoad();
213229
}
@@ -225,7 +241,10 @@ Ext4.define('SequenceAnalysis.panel.SequenceAnalysisPanel', {
225241
dv.refresh();
226242

227243
if (this.errorNames.length){
228-
alert('The follow readsets lack an input file and will be skipped: ' + this.errorNames.join(', '));
244+
alert('The following readsets lack an input file and will be skipped: ' + this.errorNames.join(', '));
245+
}
246+
else if (this.archivedNames.length) {
247+
Ext4.Msg.alert('Warning', 'One or more readsets contains SRA archived data. Please choose the option to auto-download these data');
229248
}
230249
},
231250

0 commit comments

Comments
 (0)