Mercurial > repos > iuc > reprof
diff reprof.py @ 1:141da185be70 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/reprof commit 3aca39eed712c5b3ab8faac62accab588704ffd9
| author | iuc |
|---|---|
| date | Wed, 02 Dec 2015 15:01:36 -0500 |
| parents | 7c33ed152672 |
| children | fb0936cf5bef |
line wrap: on
line diff
--- a/reprof.py Mon Nov 30 20:10:58 2015 -0500 +++ b/reprof.py Wed Dec 02 15:01:36 2015 -0500 @@ -13,7 +13,7 @@ def run_reprof(query_path, modeldir): outtmp = tempfile.NamedTemporaryFile(delete=False) cmd = [ - './reprof/scripts/reprof', + 'reprof', '-i', query_path, '--modeldir=%s' % modeldir, '-o', outtmp.name @@ -75,6 +75,22 @@ with open(path, 'a') as handle: GFF.write([rec], handle) +def storeClassData(path, id, phel): + h = float(phel.count('H')) / float(len(phel)) + e = float(phel.count('E')) / float(len(phel)) + + if h > .45 and e < .05: + classification = 'all-alpha' + elif h < .05 and e > .45: + classification = 'all-beta' + elif h > .3 and e > .2: + classification = 'alpha-beta' + else: + classification = 'mixed' + + with open(path, 'a') as handle: + handle.write("{0}\t{1}\n".format(id, classification)) + def main(fasta, modeldir): for record in SeqIO.parse(fasta, 'fasta'): tmp = tempfile.NamedTemporaryFile(delete=False) @@ -86,23 +102,24 @@ for col in ('RI_S', 'P10', 'RI_A', 'PACC', 'PREL', 'pH', 'pE', 'pL'): storeWigData(data['idx'], data[col], record.id, col + '.wig') + eco = ['{ECO:0000255|reprof_1.0.1}'] storeGff3Data( 'secondary_structure.gff3', record.id, data['idx'], data['PHEL'], { 'H': { 'type': 'peptide_helix', - 'label': ['Helix'], - 'evidence': ['ECO:0000255'] + 'description': ['Helix'], + 'evidence': eco, }, 'E': { 'type': 'beta_strand', - 'label': ['Extended/Sheet'], - 'evidence': ['ECO:0000255'] + 'description': ['Extended/Sheet'], + 'evidence': eco, }, 'L': { 'type': 'loop', - 'label': ['Loop'], - 'evidence': ['ECO:0000255'] + 'description': ['Loop'], + 'evidence': eco, } } ) @@ -112,17 +129,19 @@ { 'B': { 'type': 'experimental_result_region', - 'label': ['Buried'], - 'evidence': ['ECO:0000255'] + 'description': ['Buried'], + 'evidence': eco, }, 'E': { 'type': 'experimental_result_region', - 'label': ['Exposed'], - 'evidence': ['ECO:0000255'] + 'description': ['Exposed'], + 'evidence': eco, }, } ) + storeClassData('report.tsv', record.id, data['PHEL']) + if __name__ == '__main__': # Grab all of the filters from our plugin loader
