Skip to content

Commit 4d24c65

Browse files
authored
Merge branch 'dev' into integrate/pyratez
2 parents a38df85 + 54c01a0 commit 4d24c65

File tree

5 files changed

+189
-138
lines changed

5 files changed

+189
-138
lines changed

.appveyor.yml

-81
This file was deleted.

.travis.yml

+67-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,78 @@
1-
language: python
2-
python:
3-
- '3.6'
41
sudo: false
2+
3+
py35-steps: &py35-steps
4+
env:
5+
- PATH=/c/Users/travis/AppData/Roaming/Python/Python35/Scripts:/c/Python35:/c/Python35/Scripts:/c/Users/travis/AppData/Roaming/Python/Python35/Scripts:$PATH
6+
- TOXENV=py35
7+
before_install:
8+
- choco install python --version 3.5.4
9+
- python -m pip install --upgrade pip
10+
- pip install --user tox
11+
12+
py36-steps: &py36-steps
13+
env:
14+
- PATH=/c/Users/travis/AppData/Roaming/Python/Python36/Scripts:/c/Python36:/c/Python36/Scripts:/c/Users/travis/AppData/Roaming/Python/Python36/Scripts:$PATH
15+
- TOXENV=py36
16+
before_install:
17+
- choco install python --version 3.6.8
18+
- python -m pip install --upgrade pip
19+
- pip install --user tox
20+
21+
py37-steps: &py37-steps
22+
env:
23+
env:
24+
- PATH=/c/Users/travis/AppData/Roaming/Python/Python37/Scripts:/c/Python37:/c/Python37/Scripts:/c/Users/travis/AppData/Roaming/Python/Python37/Scripts:$PATH
25+
- TOXENV=py37
26+
before_install:
27+
- choco install python --version 3.7.8
28+
- pip install --user tox
29+
530
matrix:
631
include:
7-
- python: 3.5
32+
- name: 'py35-linux'
33+
python: 3.5
834
env: TOXENV=py35
9-
- python: 3.6
35+
os: linux
36+
language: python
37+
- name: 'py36-linux'
38+
python: 3.6
1039
env: TOXENV=py36
11-
- python: 3.7
40+
os: linux
41+
language: python
42+
- name: 'py37-linux'
43+
python: 3.7
1244
env: TOXENV=py37
1345
dist: xenial
14-
- python: 3.6
46+
os: linux
47+
language: python
48+
- name: 'docu'
49+
python: 3.6
1550
env: TOXENV=docu
16-
- python: 3.6
51+
os: linux
52+
language: python
53+
- name: 'coverage'
54+
python: 3.6
1755
env: TOXENV=coverage
18-
script: tox
56+
os: linux
57+
language: python
58+
- name: 'py35-windows'
59+
python: 3.5
60+
env: TOXENV=py35
61+
os: windows
62+
language: shell
63+
<<: *py35-steps
64+
- name: 'py36-windows'
65+
env: TOXENV=py36
66+
os: windows
67+
language: shell
68+
<<: *py36-steps
69+
- name: 'py37-windows'
70+
env: TOXENV=py37
71+
os: windows
72+
language: shell
73+
<<: *py37-steps
74+
script:
75+
- tox -e "${TOXENV}"
1976
deploy:
2077
provider: pypi
2178
user: pyratez
@@ -27,3 +84,4 @@ deploy:
2784
all_branches: true
2885
skip_existing: true
2986
skip_cleanup: true
87+

setup.py

+30-28
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,39 @@ def run(self):
4343
os.chmod(fn, mode)
4444

4545

46+
def install_resources():
47+
working_directory = os.path.join(
48+
os.path.dirname(os.path.realpath(__file__)),
49+
)
50+
if os.path.exists(os.path.join(working_directory, 'ursgal')) is False:
51+
print('Could not find ursgal directory')
52+
sys.exit(1)
53+
import ursgal
54+
uc = ursgal.UController()
55+
downloaded_zips = uc.download_resources(resources=['msgfplus_v2019_01_22'])
56+
if len(downloaded_zips) == 0:
57+
print('[ INFO ] No engines were downloaded, all should be available')
58+
else:
59+
print(
60+
'[ INFO ] Downloaded and installed {0} engine(s)'.format(
61+
len(downloaded_zips)
62+
)
63+
)
64+
for engine, zip_file in downloaded_zips:
65+
print(
66+
'[ INFO ] Engine: {0} has been installed from {1}'.format(
67+
engine,
68+
zip_file
69+
)
70+
)
71+
72+
4673
class BuildPyWithResources(setuptools.command.build_py.build_py):
4774
"""Includes install_resources.py before the setuptools build"""
4875

4976
def run(self):
50-
self.run_command('install_resources')
77+
# self.run_command('install_resources')
78+
install_resources()
5179
setuptools.command.build_py.build_py.run(self)
5280

5381

@@ -66,30 +94,7 @@ def run(self):
6694
Download all resources from our webpage to ursgal/resources.
6795
6896
'''
69-
working_directory = os.path.join(
70-
os.path.dirname(os.path.realpath(__file__)),
71-
)
72-
if os.path.exists(os.path.join(working_directory, 'ursgal')) is False:
73-
print('Could not find ursgal directory')
74-
sys.exit(1)
75-
import ursgal
76-
uc = ursgal.UController()
77-
downloaded_zips = uc.download_resources(resources=None)
78-
if len(downloaded_zips) == 0:
79-
print('[ INFO ] No engines were downloaded, all should be available')
80-
else:
81-
print(
82-
'[ INFO ] Downloaded and installed {0} engine(s)'.format(
83-
len(downloaded_zips)
84-
)
85-
)
86-
for engine, zip_file in downloaded_zips:
87-
print(
88-
'[ INFO ] Engine: {0} has been installed from {1}'.format(
89-
engine,
90-
zip_file
91-
)
92-
)
97+
install_resources()
9398

9499
# We store our version number in a simple text file:
95100
version_path = os.path.join(
@@ -117,9 +122,6 @@ def run(self):
117122
'resources/*/*/*/*/*',
118123
]
119124
},
120-
build_requires=[
121-
'numpy',
122-
],
123125
install_requires=requirements,
124126
long_description='Universal Python module combining common bottom-up proteomics tools for large-scale analysis',
125127
author='Lukas P. M. Kremer, Purevdulam Oyunchimeg, Johannes Barth, Stefan Schulze and Christian Fufezan',

tests/digest_test.py

+62-4
Original file line numberDiff line numberDiff line change
@@ -40,38 +40,73 @@
4040
{
4141
'sequence' : 'RKRK',
4242
'result' : ['R','K','R','K'],
43+
'mc3_result':['RK', 'RKR', 'RKRK', 'KR', 'KRK', 'RK', 'R', 'K', 'R', 'K'],
44+
'no_missed_cleavages_result': ['RK', 'RKR', 'KR', 'KRK', 'RK', 'R', 'K', 'R', 'K'],
4345
'enzyme' : ('KR', 'C'),
4446
},
4547
{
4648
'sequence' : 'IKI',
4749
'result' : ['IK','I',],
50+
'mc3_result' : ['IKI', 'IK', 'I'],
51+
'no_missed_cleavages_result': ['IKI', 'IK', 'I'],
4852
'enzyme' : ('KR', 'C'),
4953
},
5054
{
5155
'sequence' : 'FMWY',
5256
'result' : ['F','M','W','Y'],
57+
'mc3_result': ['FM', 'FMW', 'FMWY', 'MW', 'MWY', 'WY', 'F', 'M', 'W', 'Y'],
58+
'no_missed_cleavages_result': ['FM', 'FMW', 'MW', 'MWY', 'WY', 'F', 'M', 'W', 'Y'],
5359
'enzyme' : ('FMWY', 'C'),
5460
},
5561
{
5662
'sequence' : 'RKRK',
5763
'result' : ['RK','RK'],
64+
'mc3_result' : ['RKRK', 'RK', 'RK'],
65+
'no_missed_cleavages_result': ['RKRK', 'RK', 'RK'],
5866
'enzyme' : ('K', 'C'),
5967
},
6068
{
6169
'sequence' : 'RKRK',
6270
'result' : ['R','KR', 'K'],
71+
'mc3_result' : ['RKR', 'RKRK', 'KRK', 'R', 'KR', 'K'],
72+
'no_missed_cleavages_result': ['RKR', 'RKRK', 'KRK', 'R', 'KR', 'K'],
6373
'enzyme' : ('K', 'N'),
6474
},
6575
{
6676
'sequence' : 'PEPTID',
6777
'result' : ['P','EP','TID'],
78+
'mc3_result': ['PEP', 'PEPTID', 'EPTID', 'P', 'EP', 'TID'],
79+
'no_missed_cleavages_result': ['PEP', 'PEPTID', 'EPTID', 'P', 'EP', 'TID'],
80+
6881
'enzyme' : ('P', 'C'),
6982
},
83+
{
84+
'sequence': 'PEPTIDELIVSRPPAWVMLEHFPYQFRSVAPDDVDIDIEEEK',
85+
'result':['PEPTIDELIVSR', 'PPAWVMLEHFPYQFR', 'SVAPDDVDIDIEEEK'],
86+
'mc3_result':['PEPTIDELIVSRPPAWVMLEHFPYQFR',
87+
'PEPTIDELIVSRPPAWVMLEHFPYQFRSVAPDDVDIDIEEEK',
88+
'PPAWVMLEHFPYQFRSVAPDDVDIDIEEEK',
89+
'PEPTIDELIVSR',
90+
'PPAWVMLEHFPYQFR', 'SVAPDDVDIDIEEEK'],
91+
'no_missed_cleavages_result': ['PEPTIDELIVSRPPAWVMLEHFPYQFR',
92+
'PEPTIDELIVSRPPAWVMLEHFPYQFRSVAPDDVDIDIEEEK',
93+
'PPAWVMLEHFPYQFRSVAPDDVDIDIEEEK', 'PEPTIDELIVSR',
94+
'PPAWVMLEHFPYQFR', 'SVAPDDVDIDIEEEK'],
95+
'enzyme': ('KR', 'C'),
96+
},
7097
]
7198

7299
def digest_test():
73-
for test_id, test_dict in enumerate(TESTS):
74-
yield digest, test_dict
100+
for test_id, test_dict in enumerate(TESTS):
101+
yield digest_msc1, test_dict
102+
103+
for test_id, test_dict in enumerate(TESTS):
104+
yield digest, test_dict
105+
106+
for test_id, test_dict in enumerate(TESTS):
107+
yield digest_not_missed_cl, test_dict
108+
109+
75110

76111
def digest( test_dict ):
77112
'''
@@ -82,12 +117,35 @@ def digest( test_dict ):
82117
test_dict['enzyme'],
83118
no_missed_cleavages = True
84119
)
85-
86120
assert digest_result == test_dict['result']
87121

122+
def digest_msc1( test_dict ):
123+
'''
124+
peptide_regex(self, database, protein_id, peptide):
125+
'''
126+
digest_result = ursgal.ucore.digest(
127+
test_dict['sequence'],
128+
test_dict['enzyme'],
129+
count_missed_cleavages=3
130+
)
131+
132+
assert digest_result == test_dict['mc3_result']
133+
134+
def digest_not_missed_cl( test_dict ):
135+
'''
136+
peptide_regex(self, database, protein_id, peptide):
137+
'''
138+
digest_result = ursgal.ucore.digest(
139+
test_dict['sequence'],
140+
test_dict['enzyme'],
141+
no_missed_cleavages = False
142+
)
143+
assert digest_result == test_dict['no_missed_cleavages_result']
144+
88145

89146

90147
if __name__ == '__main__':
91148
print(__doc__)
92149
for test_id, test_dict in enumerate(TESTS):
93-
digest(test_dict)
150+
#digest(test_dict)
151+
digest_msc1(test_dict)

0 commit comments

Comments
 (0)