@@ -24,6 +24,7 @@ def __init__(self,prog):
24
24
parser .add_argument ('-o' , '--out' , help = 'Basename of output files' )
25
25
parser .add_argument ('-e' , '--email' , required = True , help = 'Email address for IPRSCAN server' )
26
26
parser .add_argument ('--force' , action = 'store_true' , help = 'Over-write output folder' )
27
+ parser .add_argument ('-a' , '--antismash' , default = 'fungi' , choices = ['fungi' ,'plants' ], help = 'antiSMASH server' )
27
28
args = parser .parse_args ()
28
29
29
30
def runIPRpython (Input ):
@@ -237,10 +238,16 @@ def download(url, name):
237
238
shutil .rmtree (IPROUT )
238
239
239
240
if 'antismash' in args .methods or 'all' in args .methods :
240
- version = requests .get ("https://fungismash.secondarymetabolites.org/api/v1.0/version" )
241
+ if args .antismash == 'fungi' :
242
+ base_address = "https://fungismash.secondarymetabolites.org"
243
+ job_parameters = {'email' : args .email , 'smcogs' : 'on' , 'knownclusterblast' : 'on' , 'activesitefinder' : 'on' , 'subclusterblast' : 'on' }
244
+ elif args .antismash == 'plants' :
245
+ base_address = "https://plantismash.secondarymetabolites.org"
246
+ job_parameters = {'email' : args .email , 'knownclusterblast' : 'on' , 'subclusterblast' : 'on' }
247
+ version = requests .get (base_address + "/api/v1.0/version" )
241
248
as_vers = version .json ()['antismash_generation' ]
242
249
tax = version .json ()['taxon' ]
243
- as_status = requests .get ("https://fungismash.secondarymetabolites.org /api/v1.0/stats" )
250
+ as_status = requests .get (base_address + " /api/v1.0/stats" )
244
251
queue = as_status .json ()['queue_length' ]
245
252
running = as_status .json ()['running' ]
246
253
lib .log .info ("Connecting to antiSMASH %s v%s webserver" % (tax , as_vers ))
@@ -250,14 +257,14 @@ def download(url, name):
250
257
lib .log .error ("There are more than 10 antiSMASH jobs in queue, use --force to submit anyway" )
251
258
sys .exit (1 )
252
259
job_files = {'seq' : open (genbank , 'rb' )}
253
- job_parameters = { 'email' : args . email , 'smcogs' : 'on' , 'knownclusterblast' : 'on' , 'activesitefinder' : 'on' , 'subclusterblast' : 'on' }
260
+
254
261
lib .log .info ("Uploading %s to webserver" % genbank )
255
- postjob = requests .post ("https://fungismash.secondarymetabolites.org /api/v1.0/submit" , files = job_files , data = job_parameters )
262
+ postjob = requests .post (base_address + " /api/v1.0/submit" , files = job_files , data = job_parameters )
256
263
jobid = postjob .json ()['id' ]
257
264
#now we can query the job every so often, not sure what is reasonable here, start with 2 minutes?
258
265
lib .log .info ("Waiting for results from job: %s" % jobid )
259
266
while True :
260
- job_status = requests .get ("https://fungismash.secondarymetabolites.org /api/v1.0/status/"+ jobid )
267
+ job_status = requests .get (base_address + " /api/v1.0/status/"+ jobid )
261
268
if job_status .json ()['status' ] == 'done' :
262
269
break
263
270
time .sleep (120 ) #check every 2 minutes
@@ -267,15 +274,15 @@ def download(url, name):
267
274
lib .log .debug ("%s" % job_status .json ())
268
275
#need to retrieve results, have to find link, seems like this might be first scaffold name?
269
276
#after asking Kai Blin - there is no "easy" way to identify the output name, however, think I can grab the html file and parse it
270
- job_html = requests .get ("https://fungismash.secondarymetabolites.org" + result_url )
277
+ job_html = requests .get (base_address + result_url )
271
278
for line in job_html .iter_lines ():
272
279
if 'Download GenBank summary file' in line :
273
280
cols = line .split ('a href="' )
274
281
for x in cols :
275
282
if '.zip' in x :
276
283
link = x .split ('"' )[0 ]
277
284
baselink = link .replace ('.zip' , '' )
278
- download_url = "https://fungismash.secondarymetabolites.org" + base_url + link
285
+ download_url = base_address + base_url + link
279
286
download (download_url , 'antiSMASH.zip' )
280
287
#now unzip and move folder
281
288
zipref = zipfile .ZipFile ('antiSMASH.zip' , 'r' )
0 commit comments