-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
77 lines (63 loc) · 2.92 KB
/
main.py
File metadata and controls
77 lines (63 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from __future__ import print_function
from pyteomics import biolccc
import click
@click.group()
def main():
pass
@main.command()
def chemGroups():
for label, chemicalGroup in biolccc.rpAcnFaRod['chemicalGroups'].items():
print('Name', chemicalGroup['name'])
print('Label', chemicalGroup['label'])
print('Binding energy', chemicalGroup['bindEnergy'])
print('Average mass', chemicalGroup['averageMass'])
print('Monoisotopic mass', chemicalGroup['monoisotopicMass'])
@main.command()
@click.option('--column-length', default=100.0, show_default=True,
help='the column length in mm')
@click.option('--diameter', default=0.1, show_default=True,
help='the internal column diameter in mm')
@click.option('--pore-size', default=300.0, show_default=True,
help='average pore size in Angstroms')
@click.option('--concA', default=5.0, show_default=True,
help='Concentration (%) of the eluting solvent (ACN for reverse phase) of component A')
@click.option('--concB', default=95, show_default=True,
help='Concentration (%) of the eluting solvent (ACN for reverse phase) of component B')
@click.option('--flow-rate', default=0.0005, show_default=True,
help='flow rate in mL/min')
@click.option('--gradientStart', default=0.0, show_default=True,
help='Gradient start percent B')
@click.option('--gradientStop', default=90.0, show_default=True,
help='Gradient stop percent B')
@click.option('--gradientLength', default=60.0, show_default=True,
help='Gradient length in minutes')
@click.option('--input-type', type=click.Choice(['string', 'file']), default='string',
show_default=True, help='Whether or not the input is a string of peptides or files of peptides')
@click.argument('peptide', nargs=-1)
def run(column_length, diameter, pore_size, conca, concb, flow_rate,
gradientstart, gradientstop, gradientlength, input_type, peptide):
"""See biolccc documentation"""
if len(peptide) == 0:
raise ValueError('Must supply at least 1 peptide')
if input_type == 'file':
peptide = [x for y in [open(x).read().split() for x in peptide] for x in y]
chroma = biolccc.ChromoConditions()
chroma['columnLength'] = column_length
chroma['columnDiameter'] = diameter
chroma['columnPoreSize'] = pore_size
chroma['secondSolventConcentrationA'] = conca
chroma['secondSolventConcentrationB'] = concb
chroma['gradient'] = biolccc.Gradient(gradientstart, gradientstop, gradientlength)
chroma['flowRate'] = flow_rate
results = dict()
for p in peptide:
RT = biolccc.calculateRT(str(p),
biolccc.rpAcnFaRod,
chroma
)
results[p] = RT
print('Peptide', '\t', 'RTmin')
for p, rt in results.items():
print(p, '\t', rt)
if __name__ == '__main__':
main()