comparison sirius_csifingerid.py @ 6:96b077221201 draft

"planemo upload for repository https://github.com/computational-metabolomics/sirius_csifingerid_galaxy commit a1dfcf9fe850298b80f3738611835a3ef53e820a"
author computational-metabolomics
date Fri, 04 Feb 2022 17:13:46 +0000
parents 8fb51147d15e
children e29e64ff50bb
comparison
equal deleted inserted replaced
5:57c4e7421085 6:96b077221201
40 if os.stat(args.input_pth).st_size == 0: 40 if os.stat(args.input_pth).st_size == 0:
41 print('Input file empty') 41 print('Input file empty')
42 exit() 42 exit()
43 43
44 if args.temp_dir: 44 if args.temp_dir:
45 wd = os.path.join(args.temp_dir, 'temp') 45 wd = os.path.join(args.temp_dir, 'temp_'+str(uuid.uuid4()))
46 os.mkdir(wd) 46 os.mkdir(wd)
47 47
48 if not os.path.exists(wd): 48 if not os.path.exists(wd):
49 os.mkdir(wd) 49 os.mkdir(wd)
50 else: 50 else:
394 and 0 < int(rank_filter) < int(line['rank']): 394 and 0 < int(rank_filter) < int(line['rank']):
395 # filter out those annotations greater than rank filter 395 # filter out those annotations greater than rank filter
396 # If rank_filter is zero then skip 396 # If rank_filter is zero then skip
397 continue 397 continue
398 398
399 if ('ConfidenceScore' in line 399 if 'ConfidenceScore' in line:
400 and 0 < float(confidence_filter) 400 if isinstance(line['ConfidenceScore'], str):
401 and float(line['ConfidenceScore']) < 401 # Value is NA or N/A
402 float(confidence_filter)): 402 continue
403 # filter out those annotations that are less than 403
404 # the confidence filter value 404 if (0 < float(confidence_filter)
405 continue 405 and float(line['ConfidenceScore'])
406 < float(confidence_filter)):
407 # filter out those annotations that are less than
408 # the confidence filter value
409 continue
406 line.update(ad) 410 line.update(ad)
407 411
408 dwriter.writerow(line) 412 dwriter.writerow(line)
409
410 if backwards_compatible:
411 # Headers required in this format for tools that used
412 # v4.9.3 of SIRIUS-CSI:FingerID
413 s1 = "sed 's/InChIkey2D/inchikey2d/g' {r} > {r}".format(r=result_pth)
414 os.system(s1)
415 s2 = "sed 's/CSI:FingerIDScore/Score/' {r} > {r}".format(r=result_pth)
416 os.system(s2)
417 413
418 414
419 concat_output('compound_identifications.tsv', 415 concat_output('compound_identifications.tsv',
420 args.annotations_result_pth, 416 args.annotations_result_pth,
421 args.rank_filter, 417 args.rank_filter,
422 args.confidence_filter, 418 args.confidence_filter)
423 args.backwards_compatible)
424 concat_output('canopus_summary.tsv', 419 concat_output('canopus_summary.tsv',
425 args.canopus_result_pth, 420 args.canopus_result_pth,
426 0, 421 0,
427 0, 422 0)
428 False)