robert.elder commited on
Commit ·
67094dd
1
Parent(s): 4cf8bbb
better error checking and xlsx->tsv
Browse files- ChemID.py +5 -3
- Comptox_pred_data.tsv +3 -0
- PHYSPROP_MP_data.tsv +3 -0
- exposure_module/exposure.py +10 -4
ChemID.py
CHANGED
|
@@ -33,9 +33,11 @@ from rdkit.Chem import Descriptors,Descriptors3D,Draw,Crippen
|
|
| 33 |
db = chemicals.identifiers.get_pubchem_db()
|
| 34 |
db.load('custom_chemicals_db.tsv')
|
| 35 |
## load experimental and predicted properties
|
| 36 |
-
dfmp_expt = pd.read_excel('PHYSPROP_MP_data.xlsx')
|
|
|
|
| 37 |
#dfmp_pred = pd.read_excel('DSSTOX_MP_pred_data.xlsx')
|
| 38 |
-
df_pred = pd.read_excel('Comptox_pred_data.xlsx')
|
|
|
|
| 39 |
|
| 40 |
def ResolveChemical(chemName, IDtype):
|
| 41 |
|
|
@@ -1046,7 +1048,7 @@ def getLogP(cas,mol):
|
|
| 1046 |
if sum(mask):
|
| 1047 |
LogP = float(df_pred[mask]['OCTANOL_WATER_PARTITION_LOGP_OPERA_PRED'])
|
| 1048 |
LogP_origin = 'pred'
|
| 1049 |
-
if LogP
|
| 1050 |
LogP = Crippen.MolLogP(mol)
|
| 1051 |
LogP_origin = 'calc'
|
| 1052 |
return LogP, LogP_origin
|
|
|
|
| 33 |
db = chemicals.identifiers.get_pubchem_db()
|
| 34 |
db.load('custom_chemicals_db.tsv')
|
| 35 |
## load experimental and predicted properties
|
| 36 |
+
#dfmp_expt = pd.read_excel('PHYSPROP_MP_data.xlsx')
|
| 37 |
+
dfmp_expt = pd.read_csv('PHYSPROP_MP_data.tsv', sep='\t')
|
| 38 |
#dfmp_pred = pd.read_excel('DSSTOX_MP_pred_data.xlsx')
|
| 39 |
+
#df_pred = pd.read_excel('Comptox_pred_data.xlsx')
|
| 40 |
+
df_pred = pd.read_csv('Comptox_pred_data.tsv', sep='\t')
|
| 41 |
|
| 42 |
def ResolveChemical(chemName, IDtype):
|
| 43 |
|
|
|
|
| 1048 |
if sum(mask):
|
| 1049 |
LogP = float(df_pred[mask]['OCTANOL_WATER_PARTITION_LOGP_OPERA_PRED'])
|
| 1050 |
LogP_origin = 'pred'
|
| 1051 |
+
if pd.isna(LogP) and mol:
|
| 1052 |
LogP = Crippen.MolLogP(mol)
|
| 1053 |
LogP_origin = 'calc'
|
| 1054 |
return LogP, LogP_origin
|
Comptox_pred_data.tsv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f40a87a423f3d3cf4662ac21fda9ec13f3ca46d40d319c4d7acf0992386f4838
|
| 3 |
+
size 23524153
|
PHYSPROP_MP_data.tsv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a076dc715c14055e872256fd9bb7fff1e8c860e022b1b0cef559cb56e872a2f4
|
| 3 |
+
size 131440
|
exposure_module/exposure.py
CHANGED
|
@@ -28,12 +28,15 @@ def exp_post():
|
|
| 28 |
|
| 29 |
if MW < 100.:
|
| 30 |
MW = SigFigs(MW, 6)
|
| 31 |
-
LogP
|
|
|
|
|
|
|
|
|
|
| 32 |
if rho:
|
| 33 |
rho = SigFigs(rho, 4)
|
| 34 |
else:
|
| 35 |
rho = 'Not found'
|
| 36 |
-
if mp is None:
|
| 37 |
mp = 'Not found'
|
| 38 |
return render_template('MwError.html', chemName=chemName, MW=MW, LogP=LogP, rho=rho, mp=mp, iupac=iupac, cas=cas, smiles=smiles, molImage=molImage)
|
| 39 |
|
|
@@ -73,12 +76,15 @@ def exp_post():
|
|
| 73 |
MOS = SigFigs(MOS, 2)
|
| 74 |
diff = SigFigs(diff, 2)
|
| 75 |
MW = SigFigs(MW, 6)
|
| 76 |
-
LogP
|
|
|
|
|
|
|
|
|
|
| 77 |
if rho:
|
| 78 |
rho = SigFigs(rho, 4)
|
| 79 |
else:
|
| 80 |
rho = 'Not found'
|
| 81 |
-
if mp is None:
|
| 82 |
mp = 'Not found'
|
| 83 |
|
| 84 |
# Generate the rate plot using matplotlib
|
|
|
|
| 28 |
|
| 29 |
if MW < 100.:
|
| 30 |
MW = SigFigs(MW, 6)
|
| 31 |
+
if LogP is np.nan or LogP is None:
|
| 32 |
+
LogP = 'Not found'
|
| 33 |
+
else:
|
| 34 |
+
LogP = SigFigs(LogP, 6)
|
| 35 |
if rho:
|
| 36 |
rho = SigFigs(rho, 4)
|
| 37 |
else:
|
| 38 |
rho = 'Not found'
|
| 39 |
+
if mp is np.nan or mp is None:
|
| 40 |
mp = 'Not found'
|
| 41 |
return render_template('MwError.html', chemName=chemName, MW=MW, LogP=LogP, rho=rho, mp=mp, iupac=iupac, cas=cas, smiles=smiles, molImage=molImage)
|
| 42 |
|
|
|
|
| 76 |
MOS = SigFigs(MOS, 2)
|
| 77 |
diff = SigFigs(diff, 2)
|
| 78 |
MW = SigFigs(MW, 6)
|
| 79 |
+
if LogP is np.nan or LogP is None:
|
| 80 |
+
LogP = 'Not found'
|
| 81 |
+
else:
|
| 82 |
+
LogP = SigFigs(LogP, 6)
|
| 83 |
if rho:
|
| 84 |
rho = SigFigs(rho, 4)
|
| 85 |
else:
|
| 86 |
rho = 'Not found'
|
| 87 |
+
if mp is np.nan or mp is None:
|
| 88 |
mp = 'Not found'
|
| 89 |
|
| 90 |
# Generate the rate plot using matplotlib
|