Skip to content

Commit 4aee4bd

Browse files
author
seaver
committed
Merge branch 'master' of ssh://github.com/ModelSEED/ModelSEEDDatabase
2 parents 2060c88 + c4ba1c6 commit 4aee4bd

8 files changed

+414
-232
lines changed

.travis.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: python
2+
python:
3+
- "3.6"
4+
before_install:
5+
- sudo apt-get update
6+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
7+
- bash miniconda.sh -b -p $HOME/miniconda
8+
- export PATH="$HOME/miniconda/bin:$PATH"
9+
- hash -r
10+
- conda config --set always_yes yes --set changeps1 no
11+
- conda update -q conda
12+
install:
13+
- conda create -q -y -c rdkit -n test-environment python=$TRAVIS_PYTHON_VERSION rdkit
14+
- source activate test-environment
15+
script:
16+
- python scripts/Validate_Compounds.py Biochemistry/compounds.master.tsv
17+
- python scripts/Validate_Reactions.py -c Biochemistry/compounds.master.tsv Biochemistry/reactions.master.tsv
18+
- python scripts/Validate_Complex_Roles.py Mappings/ComplexRoles.kegg.tsv
19+
- python scripts/Validate_Templates.py

Templates/Core/BiomassCompounds.tsv

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
biomass_id id coefficient coefficient_type class linked_compounds compartment
2-
bio1 cpd00002 -1 MULTIPLIER energy cpd00001:-1|cpd00008:-1|cpd00009:-1|cpd00067:1 c0
3-
bio1 cpd11416 1 EXACT energy null c0
4-
bio2 cpd00072 -0.0709 EXACT other null c0
5-
bio2 cpd00101 -0.8977 EXACT other null c0
6-
bio2 cpd00236 -0.8977 EXACT other null c0
7-
bio2 cpd00102 -0.129 EXACT other null c0
8-
bio2 cpd00169 -1.496 EXACT other null c0
9-
bio2 cpd00061 -0.5191 EXACT other null c0
10-
bio2 cpd00020 -2.8328 EXACT other null c0
11-
bio2 cpd00022 -3.7478 EXACT other null c0
12-
bio2 cpd00032 -1.7867 EXACT other null c0
13-
bio2 cpd00024 -1.0789 EXACT other null c0
14-
bio2 cpd00079 -0.205 EXACT other null c0
15-
bio2 cpd00005 -1.8225 EXACT other cpd00067:-1 c0
16-
bio2 cpd00003 -3.547 EXACT other cpd00067:-1 c0
17-
bio2 cpd00010 3.7478 EXACT other null c0
18-
bio2 cpd11416 1 EXACT other null c0
19-
bio2 cpd00006 1.8225 EXACT other null c0
20-
bio2 cpd00004 3.547 EXACT other null c0
21-
bio2 cpd00002 -1 MULTIPLIER energy cpd00001:-1|cpd00008:-1|cpd00009:-1|cpd00067:1 c0
2+
bio1 cpd00002 -1 MULTIPLIER energy cpd00001:-1|cpd00008:-1|cpd00009:-1|cpd00067:1 c
3+
bio1 cpd11416 1 EXACT energy null c
4+
bio2 cpd00072 -0.0709 EXACT other null c
5+
bio2 cpd00101 -0.8977 EXACT other null c
6+
bio2 cpd00236 -0.8977 EXACT other null c
7+
bio2 cpd00102 -0.129 EXACT other null c
8+
bio2 cpd00169 -1.496 EXACT other null c
9+
bio2 cpd00061 -0.5191 EXACT other null c
10+
bio2 cpd00020 -2.8328 EXACT other null c
11+
bio2 cpd00022 -3.7478 EXACT other null c
12+
bio2 cpd00032 -1.7867 EXACT other null c
13+
bio2 cpd00024 -1.0789 EXACT other null c
14+
bio2 cpd00079 -0.205 EXACT other null c
15+
bio2 cpd00005 -1.8225 EXACT other cpd00067:-1 c
16+
bio2 cpd00003 -3.547 EXACT other cpd00067:-1 c
17+
bio2 cpd00010 3.7478 EXACT other null c
18+
bio2 cpd11416 1 EXACT other null c
19+
bio2 cpd00006 1.8225 EXACT other null c
20+
bio2 cpd00004 3.547 EXACT other null c
21+
bio2 cpd00002 -1 MULTIPLIER energy cpd00001:-1|cpd00008:-1|cpd00009:-1|cpd00067:1 c

Templates/Core/Compartments.tsv

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
index id name hierarchy pH aliases
2-
0 c0 Cytosol 3 7 null
3-
1 e0 Extracellular 0 7 null
2+
0 c Cytosol 3 7 null
3+
1 e Extracellular 0 7 null

scripts/BiochemHelper.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def readCompoundsFile(self, path, includeLinenum=True, noFormat=False):
4747
linenum += 1
4848
fields = line.strip().split('\t')
4949
if len(fields) < len(fieldNames):
50-
print 'WARNING: Compound on line %d is missing one or more fields, %s' %(linenum, fields)
50+
print('WARNING: Compound on line %d is missing one or more fields, %s' %(linenum, fields))
5151
continue
5252
cpd = dict()
5353
if noFormat:
@@ -132,7 +132,7 @@ def readReactionsFile(self, path, includeLinenum=True, noFormat=False):
132132
linenum += 1
133133
fields = line.strip('\n ').split('\t')
134134
if len(fields) < len(fieldNames):
135-
print 'WARNING: Reaction on line %d is missing one or more fields, %s' %(linenum, fields)
135+
print('WARNING: Reaction on line %d is missing one or more fields, %s' %(linenum, fields))
136136
continue
137137
rxn = dict()
138138
if noFormat:
@@ -202,7 +202,7 @@ def readCompartmentsFile(self, path, includeLinenum=True):
202202
linenum += 1
203203
fields = line.strip('\n ').split('\t')
204204
if len(fields) < len(fieldNames):
205-
print 'WARNING: Compartment on line %d is missing one or more fields, %s' %(linenum, fields)
205+
print('WARNING: Compartment on line %d is missing one or more fields, %s' %(linenum, fields))
206206
continue
207207
cmp = dict()
208208
cmp['id'] = fields[fieldNames['id']]
@@ -242,7 +242,7 @@ def readComplexRolesFile(self, path, includeLinenum=True):
242242
linenum += 1
243243
fields = line.strip('\n ').split('\t')
244244
if len(fields) < len(fieldNames):
245-
print 'WARNING: Complex role mapping on line %d is missing one or more fields, %s' %(linenum, fields)
245+
print('WARNING: Complex role mapping on line %d is missing one or more fields, %s' %(linenum, fields))
246246
continue
247247
cpxrole = dict()
248248
cpxrole['complex_id'] = fields[fieldNames['complex_id']]
@@ -291,7 +291,7 @@ def readAliasFiles(self, aliasDir):
291291
(source, ext) = os.path.splitext(aliasFiles[index])
292292
if ext != '.aliases':
293293
continue
294-
print 'Processing aliases in '+aliasFiles[index]
294+
print('Processing aliases in '+aliasFiles[index])
295295
source = source.replace('_', ' ') # Replace the underscores used in file names
296296
with open(os.path.join(aliasDir, aliasFiles[index]), 'r') as handle:
297297
header = handle.readline().strip().split('\t')
@@ -517,7 +517,7 @@ def isTransportReaction(self, equation):
517517
# compound IDs.
518518
reactants, products = self.parseEquation(equation)
519519
if len(reactants) == 0 and len(products) == 0:
520-
print 'This reaction has no reactants and no products: '+equation
520+
print('This reaction has no reactants and no products: '+equation)
521521
return False
522522

523523
# Figure out if the compounds are identified by ID or by name.

scripts/Validate_Complex_Roles.py

+48-45
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@
6262
args.showBadNames = True
6363

6464
# Read the complex role mapping from the specified file.
65-
print 'Complex role mapping file: %s' %(args.cpxrolefile)
65+
print('Complex role mapping file: %s' % args.cpxrolefile)
6666
helper = BiochemHelper()
6767
complexRoles = helper.readComplexRolesFile(args.cpxrolefile)
6868
if complexRoles is None:
69-
print 'Error reading complex role mapping file'
69+
print('Error reading complex role mapping file')
7070
exit(1)
71-
print 'Number of mappings: %d' %(len(complexRoles))
71+
print('Number of mappings: %d' % len(complexRoles))
7272

7373
# Check for duplicates, missing and invalid values.
7474
complexIdDict = dict()
@@ -92,13 +92,13 @@
9292
duplicateComplexId += 1
9393
complexIdDict[cpxrole['complex_id']].append(index)
9494
else:
95-
complexIdDict[cpxrole['complex_id']] = [ index ]
95+
complexIdDict[cpxrole['complex_id']] = [index]
9696
if cpxrole['role_id'] in complexIdDict:
9797
if len(complexIdDict[cpxrole['role_id']]) == 1:
9898
duplicateComplexId += 1
9999
complexIdDict[cpxrole['role_id']].append(index)
100100
else:
101-
complexIdDict[cpxrole['role_id']] = [ index ]
101+
complexIdDict[cpxrole['role_id']] = [index]
102102

103103
# Check for invalid characters in the ID.
104104
match = re.search(r'cpx.\d+', cpxrole['complex_id'])
@@ -114,83 +114,86 @@
114114
duplicateComplexName += 1
115115
complexNameDict[cpxrole['complex_name']].append(index)
116116
else:
117-
complexNameDict[cpxrole['complex_name']] = [ index ]
117+
complexNameDict[cpxrole['complex_name']] = [index]
118118
if cpxrole['role_name'] in roleNameDict:
119119
if len(roleNameDict[cpxrole['role_name']]) == 1:
120120
duplicateRoleName += 1
121121
roleNameDict[cpxrole['role_name']].append(index)
122122
else:
123-
roleNameDict[cpxrole['role_name']] = [ index ]
123+
roleNameDict[cpxrole['role_name']] = [index]
124124

125125
# Check for invalid characters in the name.
126126
try:
127-
cpxrole['complex_name'].decode('ascii')
128-
except UnicodeDecodeError:
127+
cpxrole['complex_name'].encode('ascii')
128+
except UnicodeEncodeError:
129129
badComplexNameChars.append(index)
130130
try:
131-
cpxrole['role_name'].decode('ascii')
132-
except UnicodeDecodeError:
131+
cpxrole['role_name'].encode('ascii')
132+
except UnicodeEncodeError:
133133
badRoleNameChars.append(index)
134134

135135
# Print summary data.
136-
print 'Number of mappings with duplicate complex IDs: %d' %(duplicateComplexId)
137-
print 'Number of mappings with role complex IDs: %d' %(duplicateRoleId)
138-
print 'Number of mappings with bad characters in complex ID: %d' %(len(badComplexIdChars))
139-
print 'Number of mappings with bad characters in role ID: %d' %(len(badComplexIdChars))
140-
print 'Number of mappings with duplicate complex names: %d' %(duplicateComplexName)
141-
print 'Number of mappings with duplicate role names: %d' %(duplicateRoleName)
142-
print 'Number of mappings with bad characters in complex name: %d' %(len(badComplexNameChars))
143-
print 'Number of mappings with bad characters in role name: %d' %(len(badRoleNameChars))
144-
print
136+
print('Number of mappings with duplicate complex IDs: %d' % duplicateComplexId)
137+
print('Number of mappings with role complex IDs: %d' % duplicateRoleId)
138+
print('Number of mappings with bad characters in complex ID: %d' % len(badComplexIdChars))
139+
print('Number of mappings with bad characters in role ID: %d' % len(badComplexIdChars))
140+
print('Number of mappings with duplicate complex names: %d' % duplicateComplexName)
141+
print('Number of mappings with duplicate role names: %d' % duplicateRoleName)
142+
print('Number of mappings with bad characters in complex name: %d' % len(badComplexNameChars))
143+
print('Number of mappings with bad characters in role name: %d' % len(badRoleNameChars))
144+
print()
145145

146146
# Print details if requested.
147147
if args.showDupIds:
148148
for id in complexIdDict:
149149
if len(complexIdDict[id]) > 1:
150-
print 'Duplicate complex ID: %s' %(id)
150+
print('Duplicate complex ID: %s' % id)
151151
for dup in complexIdDict[id]:
152-
print 'Line %05d: %s' %(complexRoles[dup]['linenum'], complexRoles[dup])
153-
print
152+
print('Line %05d: %s' % (complexRoles[dup]['linenum'], complexRoles[dup]))
153+
print()
154154
for id in roleIdDict:
155155
if len(roleIdDict[id]) > 1:
156-
print 'Duplicate role ID: %s' %(id)
156+
print('Duplicate role ID: %s' % id)
157157
for dup in roleIdDict[id]:
158-
print 'Line %05d: %s' %(complexRoles[dup]['linenum'], complexRoles[dup])
159-
print
158+
print('Line %05d: %s' % (complexRoles[dup]['linenum'], complexRoles[dup]))
159+
print()
160160
if args.showBadIds:
161161
if len(badComplexIdChars) > 0:
162-
print 'Complex IDs with bad characters:'
162+
print('Complex IDs with bad characters:')
163163
for index in range(len(badComplexIdChars)):
164-
print 'Line %05d: %s' %(complexRoles[badComplexIdChars[index]]['linenum'], complexRoles[badComplexIdChars[index]])
165-
print
164+
print('Line %05d: %s' % (complexRoles[badComplexIdChars[index]]['linenum'], complexRoles[badComplexIdChars[index]]))
165+
print()
166166
if len(badRoleIdChars) > 0:
167-
print 'Role IDs with bad characters:'
167+
print('Role IDs with bad characters:')
168168
for index in range(len(badRoleIdChars)):
169-
print 'Line %05d: %s' %(complexRoles[badRoleIdChars[index]]['linenum'], complexRoles[badRoleIdChars[index]])
170-
print
169+
print('Line %05d: %s' % (complexRoles[badRoleIdChars[index]]['linenum'], complexRoles[badRoleIdChars[index]]))
170+
print()
171171
if args.showDupNames:
172172
for name in complexNameDict:
173173
if len(complexNameDict[name]) > 1:
174-
print 'Duplicate complex name: %s' %(name)
174+
print('Duplicate complex name: %s' % name)
175175
for dup in complexNameDict[name]:
176-
print 'Line %05d: %s' %(complexRoles[dup]['linenum'], complexRoles[dup])
177-
print
176+
print('Line %05d: %s' % (complexRoles[dup]['linenum'], complexRoles[dup]))
177+
print()
178178
for name in roleNameDict:
179179
if len(roleNameDict[name]) > 1:
180-
print 'Duplicate role name: %s' %(name)
180+
print('Duplicate role name: %s' % name)
181181
for dup in roleNameDict[name]:
182-
print 'Line %05d: %s' %(complexRoles[dup]['linenum'], complexRoles[dup])
183-
print
182+
print('Line %05d: %s' % (complexRoles[dup]['linenum'], complexRoles[dup]))
183+
print()
184184
if args.showBadNames:
185185
if len(badComplexNameChars) > 0:
186-
print 'Complex names with bad characters:'
186+
print('Complex names with bad characters:')
187187
for index in range(len(badComplexNameChars)):
188-
print 'Line %05d: %s' %(complexRoles[badComplexNameChars[index]]['linenum'], complexRoles[badComplexNameChars[index]])
189-
print
188+
print('Line %05d: %s' % (complexRoles[badComplexNameChars[index]]['linenum'], complexRoles[badComplexNameChars[index]]))
189+
print()
190190
if len(badRoleNameChars) > 0:
191-
print 'Role names with bad characters:'
191+
print('Role names with bad characters:')
192192
for index in range(len(badRoleNameChars)):
193-
print 'Line %05d: %s' %(complexRoles[badRoleNameChars[index]]['linenum'], complexRoles[badRoleNameChars[index]])
194-
print
193+
print('Line %05d: %s' % (complexRoles[badRoleNameChars[index]]['linenum'], complexRoles[badRoleNameChars[index]]))
194+
print()
195195

196-
exit(0)
196+
if any([duplicateComplexId, duplicateRoleId, badComplexIdChars,
197+
duplicateComplexName, duplicateRoleName, badComplexNameChars,
198+
badRoleNameChars]):
199+
exit(0)

0 commit comments

Comments
 (0)