comparison tools/effectiveT3/effectiveT3.py @ 24:a3d660e900b1 draft

planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/tools/effectiveT3 commit 7a746d55f0e8456992ee11c49a507285f9f39383-dirty
author peterjc
date Fri, 03 Feb 2017 12:49:54 -0500
parents 69ab4d862db2
children 69ba0f4e91af
comparison
equal deleted inserted replaced
23:69ab4d862db2 24:a3d660e900b1
30 model, threshold, fasta_file, tabular_file = sys.argv[1:] 30 model, threshold, fasta_file, tabular_file = sys.argv[1:]
31 31
32 if not os.path.isfile(fasta_file): 32 if not os.path.isfile(fasta_file):
33 sys.exit("Input FASTA file not found: %s" % fasta_file) 33 sys.exit("Input FASTA file not found: %s" % fasta_file)
34 34
35 if threshold not in ["selective", "sensitive"] \ 35 if threshold not in ["selective", "sensitive"] and not threshold.startswith("cutoff="):
36 and not threshold.startswith("cutoff="):
37 sys.exit("Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold) 36 sys.exit("Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold)
38 37
39 38
40 def clean_tabular(raw_handle, out_handle): 39 def clean_tabular(raw_handle, out_handle):
41 """Clean up Effective T3 output to make it tabular.""" 40 """Clean up Effective T3 output to make it tabular."""
42 count = 0 41 count = 0
43 positive = 0 42 positive = 0
44 errors = 0 43 errors = 0
45 for line in raw_handle: 44 for line in raw_handle:
46 if not line or line.startswith("#") \ 45 if not line or line.startswith("#") or line.startswith("Id; Description; Score;"):
47 or line.startswith("Id; Description; Score;"):
48 continue 46 continue
49 assert line.count(";") >= 3, repr(line) 47 assert line.count(";") >= 3, repr(line)
50 # Normally there will just be three semi-colons, however the 48 # Normally there will just be three semi-colons, however the
51 # original FASTA file's ID or description might have had 49 # original FASTA file's ID or description might have had
52 # semi-colons in it as well, hence the following hackery: 50 # semi-colons in it as well, hence the following hackery: