Mercurial > repos > galaxyp > hirieftools
changeset 3:78afc81ab244 draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/pi_db_tools commit decb06dc90d7069d317968b979f649a04720b264
author | galaxyp |
---|---|
date | Thu, 14 Sep 2017 11:55:02 -0400 |
parents | 77ddaee887a8 |
children | |
files | __pycache__/peptide_pi_annotator.cpython-36.pyc delta_pi_calc.xml peptide_pi_annotator.py pi_dbspec_align.xml test-data/peptable.txt test-data/peptable_deltapi.txt test-data/peptable_missed_ox.txt |
diffstat | 7 files changed, 28 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/delta_pi_calc.xml Fri Sep 01 03:14:54 2017 -0400 +++ b/delta_pi_calc.xml Thu Sep 14 11:55:02 2017 -0400 @@ -1,4 +1,4 @@ -<tool id="calc_delta_pi" name="Add delta pI" version="1.2"> +<tool id="calc_delta_pi" name="Add delta pI" version="1.3"> <description>to peptide table</description> <requirements> <requirement type="package" version="3.6">python</requirement>
--- a/peptide_pi_annotator.py Fri Sep 01 03:14:54 2017 -0400 +++ b/peptide_pi_annotator.py Thu Sep 14 11:55:02 2017 -0400 @@ -43,10 +43,10 @@ fp.write('\n') -def get_first_matching_pattern(patterns, string): - for pattern in patterns: +def get_strip(strips, string): + for pattern in strips.keys(): if re.search(pattern, string): - return pattern + return strips[pattern] return False @@ -71,11 +71,6 @@ yield header + ['Experimental pI', 'Predicted pI', 'Delta pI'] for line in fp: line = line.strip('\n').split('\t') - strip = strips[get_first_matching_pattern(strips.keys(), - line[stripcol])] - exp_pi = (strip['fr_width'] * int(line[frac_col]) + - strip['intercept']) - sequence = line[seqcol] for weight in ignoremods: if weight == '*': @@ -90,12 +85,26 @@ not_predicted_count += 1 pred_pi, delta_pi = 'NA', 'NA' else: - delta_pi = exp_pi - pred_pi predicted_count += 1 + strip = get_strip(strips, line[stripcol]) + if not strip: + exp_pi, delta_pi = 'NA', 'NA' + else: + try: + exp_pi = (strip['fr_width'] * int(line[frac_col]) + + strip['intercept']) + except ValueError: + print('Cannot detect fraction for PSM {}'.format(sequence)) + exp_pi, delta_pi = 'NA', 'NA' + else: + if pred_pi != 'NA': + delta_pi = exp_pi - pred_pi + else: + delta_pi = 'NA' yield line + [exp_pi, pred_pi, delta_pi] print('Number of peptides without pI prediction: {}\n' - 'Number of peptides with predicion: {}\n'.format(not_predicted_count, - predicted_count)) + 'Number of peptides predicted: {}\n'.format(not_predicted_count, + predicted_count)) def parse_commandline():
--- a/pi_dbspec_align.xml Fri Sep 01 03:14:54 2017 -0400 +++ b/pi_dbspec_align.xml Thu Sep 14 11:55:02 2017 -0400 @@ -2,7 +2,7 @@ <description>to resemble spectra fraction scheme</description> <requirements> <requirement type="package" version="3.6">python</requirement> - <requirement type="package" version="1.62">biopython</requirement> + <requirement type="package" version="1.70">biopython</requirement> </requirements> <command detect_errors="exit_code"> <![CDATA[
--- a/test-data/peptable.txt Fri Sep 01 03:14:54 2017 -0400 +++ b/test-data/peptable.txt Thu Sep 14 11:55:02 2017 -0400 @@ -3,3 +3,5 @@ FLWLKIIVYIM+15.994915IILSFLCNCLLLCVDFLK strip1_fr50 0.3 50 IIVYIMIILSFLCNCLLLCVDFLK strip2_fr50 0 50 IIVYIMIILSFLCNCLLLCVDFLKISFEVNTNPISCGFLSFT strip2_fr43 0.01 43 +TSESLIPKSLNL cannotfind_strip 0.1 NA +TSESLIPKSLNL strip1_nofr_fr20 0.1 NA
--- a/test-data/peptable_deltapi.txt Fri Sep 01 03:14:54 2017 -0400 +++ b/test-data/peptable_deltapi.txt Thu Sep 14 11:55:02 2017 -0400 @@ -3,3 +3,5 @@ FLWLKIIVYIM+15.994915IILSFLCNCLLLCVDFLK strip1_fr50 0.3 50 8.860000000000001 7.6171 1.2429000000000014 IIVYIMIILSFLCNCLLLCVDFLK strip2_fr50 0 50 8.11 5.99038 2.1196199999999994 IIVYIMIILSFLCNCLLLCVDFLKISFEVNTNPISCGFLSFT strip2_fr43 0.01 43 7.83 4.55361 3.27639 +TSESLIPKSLNL cannotfind_strip 0.1 NA NA 6.13955 NA +TSESLIPKSLNL strip1_nofr_fr20 0.1 NA NA 6.13955 NA
--- a/test-data/peptable_missed_ox.txt Fri Sep 01 03:14:54 2017 -0400 +++ b/test-data/peptable_missed_ox.txt Thu Sep 14 11:55:02 2017 -0400 @@ -3,3 +3,5 @@ FLWLKIIVYIM+15.994915IILSFLCNCLLLCVDFLK strip1_fr50 0.3 50 8.860000000000001 NA NA IIVYIMIILSFLCNCLLLCVDFLK strip2_fr50 0 50 8.11 5.99038 2.1196199999999994 IIVYIMIILSFLCNCLLLCVDFLKISFEVNTNPISCGFLSFT strip2_fr43 0.01 43 7.83 4.55361 3.27639 +TSESLIPKSLNL cannotfind_strip 0.1 NA NA 6.13955 NA +TSESLIPKSLNL strip1_nofr_fr20 0.1 NA NA 6.13955 NA