示例#1
0
 def predict_ms(self):
     base = 'RIKEN_PlaSMA_'
     mode = self.ModInput.currentText()[0:3]
     eneg = self.EgyInput.currentText()[0:2]
     smi = self.SmiInput.toPlainText()
     model = load_model(base + mode + '_' + eneg)
     ms = model_predict(smi, model)
     # plot_ms(ms)
     self.F = MyFigure(width=3, height=2, dpi=100)
     self.F.axes.cla()
     self.F.axes.vlines(ms['mz'], np.zeros(ms.shape[0]),
                        np.array(ms['intensity']), 'red')
     self.F.axes.axhline(0, color='black')
     self.gridlayout = QtWidgets.QGridLayout(self.groupBox)
     self.gridlayout.addWidget(self.F, 0, 1)
     self.gridlayout.deleteLater()
"""

import numpy as np
import pandas as pd
import keras
import matplotlib.pyplot as plt
from rdkit import Chem
from tqdm import tqdm
from libmetgem import msp
from PyCFMID.PyCFMID import cfm_predict
from DeepFrag.utils import load_model, ms_correlation
from DeepFrag.utils import read_ms, morgan_fp, ms2vec, model_predict, plot_compare_ms
from DeepFrag.loss import pearson, loss

pretrain_model = 'simulated_Pos_10V'
model = load_model(pretrain_model)
msp_file = 'RIKEN_PlaSMA/RIKEN_PlaSMA_Pos.msp'

# parser dataset
ms = []
smiles = []
energies = []
modes = []
parser = msp.read(msp_file)
for i, (params, data) in enumerate(parser):
    if 'collisionenergy' in params:
        energy = params['collisionenergy']
    else:
        energy = ''
    if 'precursortype' in params:
        ion_mode = params['precursortype']
示例#3
0
import pandas as pd
import keras
import matplotlib.pyplot as plt
from tqdm import tqdm
from libmetgem import msp
from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
from PyCFMID.PyCFMID import cfm_predict, fraggraph_gen
from DeepFrag.utils import load_model, ms_correlation
from DeepFrag.utils import read_ms, morgan_fp, ms2vec, model_predict, plot_compare_ms
from DeepFrag.loss import pearson, loss
from DeepFrag.annotate import annotate_ms

msp_file = 'RIKEN_PlaSMA/RIKEN_PlaSMA_Pos.msp'
model = load_model('RIKEN_PlaSMA_Pos_10')
pretrain = load_model('simulated_Pos_10V')
result = pd.read_csv('Result/RIKEN_PlaSMA_Pos_10.csv')

# parser dataset
ms = []
smiles = []
energies = []
modes = []
parser = msp.read(msp_file)
for i, (params, data) in enumerate(parser):
    if 'collisionenergy' in params:
        energy = params['collisionenergy']
    else:
        energy = ''
    if 'precursortype' in params: