Beispiel #1
0
#!/usr/bin/env python
import os, sys
from csv import DictReader
temp = list()
header = 1

sys.path.append('../../Libs/Python')
from BiochemPy import Reactions, Compounds, InChIs

CompoundsHelper = Compounds()
Compounds_Dict = CompoundsHelper.loadCompounds()
Aliases_Dict = CompoundsHelper.loadMSAliases()
Names_Dict = CompoundsHelper.loadNames()

Source_Classes = dict()
reader = DictReader(
    open('../../../Biochemistry/Aliases/Source_Classifiers.txt'),
    dialect='excel-tab')
for line in reader:
    if (line['Source Type'] not in Source_Classes):
        Source_Classes[line['Source Type']] = dict()
    Source_Classes[line['Source Type']][line['Source ID']] = 1

for cpd in sorted(Compounds_Dict.keys()):
    if (cpd not in Aliases_Dict):
        continue

    Cpd_Aliases = dict()
    Alias_Count = 0
    for source_type in 'Primary Database', 'Secondary Database', 'Published Model':
        for source in sorted(Aliases_Dict[cpd].keys()):
#!/usr/bin/env python
import os, sys
temp=list();
header=1;

sys.path.append('../../Libs/Python')
from BiochemPy import Reactions, Compounds, InChIs

compounds_helper = Compounds()
compounds_dict = compounds_helper.loadCompounds()
cpds_aliases_dict = compounds_helper.loadMSAliases()
cpds_names_dict = compounds_helper.loadNames()

# We actually don't want obsolete reactions and compounds in our database
# So we're striving to remove any 'new' ones that are obsolete
# Any information attached to them should be associated with their linked counterpart
# We need to retain older compounds that are now obsolete as these may be present in prior published models

# The number used here is the last compound entered before we re-integrated updates from KEGG and MetaCyc
# In the fall of 2018, so after this point, we'll take out obsolete compounds
last_cpd_str='cpd31000'
last_cpd_int=int(last_cpd_str[3:])

delete_cpds=list()
for cpd in compounds_dict:
    cpd_int = int(cpd[3:])
    if(cpd_int > last_cpd_int and compounds_dict[cpd]['is_obsolete']):
        delete_cpds.append(cpd)

for cpd in delete_cpds:
Beispiel #3
0
if (compounds_dict[disambiguating_cpd]['is_obsolete'] == 1):
    print("Warning: compound " + disambiguating_cpd +
          " is obsolete, consider using the non-obsolete version")

Disambiguation_Object['from'] = {
    'id': disambiguating_cpd,
    'structures': {},
    'aliases': {},
    'names': {},
    'formula': compounds_dict[disambiguating_cpd]['formula'],
    'charge': compounds_dict[disambiguating_cpd]['charge'],
    'mass': compounds_dict[disambiguating_cpd]['mass']
}

Aliases_Dict = compounds_helper.loadMSAliases()
Names_Dict = compounds_helper.loadNames()
Structures_Dict = compounds_helper.loadStructures(["InChI", "SMILE"],
                                                  ["KEGG", "MetaCyc"])

#For reverse lookup
reverse_aliases_dict = dict()
for cpd in Aliases_Dict:
    for source in Aliases_Dict[cpd]:
        for alias in Aliases_Dict[cpd][source]:
            if (alias not in reverse_aliases_dict):
                reverse_aliases_dict[alias] = dict()
            if (source not in reverse_aliases_dict[alias]):
                reverse_aliases_dict[alias][source] = dict()
            reverse_aliases_dict[alias][source][cpd] = 1

reverse_structures_dict = dict()