@@ -64,7 +64,7 @@ def run(self, edit):
64
64
print ("Entrez count: {}" .format (ids ['Count' ]))
65
65
dialog_result = sublime .ok_cancel_dialog (
66
66
"Download {0} sequences? 'retmax': {1}" .format (ids ['Count' ],
67
- entrez_retmax ), 'Download' )
67
+ entrez_retmax ), 'Download' )
68
68
69
69
if dialog_result is True :
70
70
try :
@@ -216,24 +216,33 @@ def run(self, edit):
216
216
217
217
if len (links [0 ]["LinkSetDb" ]) == 0 :
218
218
sublime .error_message (
219
- "No sequences retrieved with id " + taxid )
219
+ "No sequences found with id " + taxid )
220
220
return
221
221
222
+ nt_ids = list ()
222
223
for link in links [0 ]["LinkSetDb" ][0 ]["Link" ]:
224
+ nt_ids .append (link ["Id" ])
225
+
226
+ print ("Entrez count: {}" .format (len (nt_ids )))
227
+ dialog_result = sublime .ok_cancel_dialog (
228
+ "Download {} sequences?" .format (len (nt_ids )), 'Download' )
229
+
230
+ if dialog_result is True :
223
231
try :
224
232
handle = Entrez .efetch (db = "nucleotide" ,
225
- id = link [ 'Id' ] ,
233
+ id = nt_ids ,
226
234
rettype = "gb" ,
227
235
retmode = "text" )
228
236
except (IOError ) as exception :
229
237
print (str (exception ))
230
- sublime .error_message ("Error retrieving sequence using id \
231
- '" + link [ 'Id' ] + "':" + str (exception ))
238
+ sublime .error_message ("Error retrieving sequences using id \
239
+ '" + taxid + "':" + str (exception ))
232
240
233
- seq_txt = seq_txt + handle .read ()
241
+ seq_txt = handle .read ()
234
242
235
- # Write the fasta string to a new window at position 0
236
- self .view .window ().new_file ().insert (edit , 0 , seq_txt )
243
+ # Write the fasta string to a new window at position 0
244
+ if seq_txt :
245
+ self .view .window ().new_file ().insert (edit , 0 , seq_txt )
237
246
238
247
239
248
# "Translate"
0 commit comments