ccccc

Exercise 2-1: Group Discussion
Objectives
● Perform the task of the Application Solution Development module of the System
RVP work stream.
Scenario
During this discussion, the Application Solution Development module of the System RVP
work stream will be discussed in detail.
Step 1. What is the purpose of placing all development work outside of the Windchill load
point?
Step 2. What RVP module defines unit testing?
Step 3. How is unit testing performed?
Step 4. What are the cache directories that need to be cleared?
12 Application Solution Development
Review
Take a few minutes to answer the following questions and then review them with your
instructor.
1. Question: Should customization be developed inside the Windchill load point?
2. Question: Which step includes unit testing?
3. Question: What are the three “cache” directories which should be cleared when installing
customization?
Windchill 9.0 Server Customization - Basic - PTC Student Guide 13
Summary
After completing this module, you should be able to:
• Understand tasks related to the customization process as defined in the Application
Solution Development module of the System RVP work stream.
14 Application Solution Development

 

目标
●执行的应用解决方案开发的系统模块任务
雷德蒸气压的工作流。
方案
在这一讨论中,应用解决方案开发的系统模块的RVP
工作流将被详细讨论。
第1步。是什么把Windchill的负荷之外的所有发展工作的目的
点?
第2步。什么的RVP模块定义单元测试?
第3步。单元测试是如何进行的?
第4步。什么是缓存目录,需要清除?
12应用解决方案开发
回顾
花几分钟时间回答以下问题,然后检查它们与您的
导师。
1。问:如果定制开发的Windchill内负荷点?
2。问:哪些步骤包括单元测试?
3。问:什么是三个“缓存”,这应该被清除时,安装目录
定制?
Windchill的9.0服务器定制 - 基本 - PTC的学生手册13
综述
在完成这个模块,你应该能够:
•了解有关任务的定制过程中定义的应用
模块解决方案的开发工作流系统的RVP。
14个应用解决方案开发

 

  目标

  ●执行任务的应用方案开发模块的系统

  RVP工作。

  场景

  在此讨论的应用方案,开发模块的系统RVP

  工作流将详细讨论。

  第一步。目的是什么把所有的开发工作以外的Windchill负荷

  一点吗?

  第2步。什么RVP模块定义的单元测试吗?

  第三步。单元测试是如何进行的?

  第四步。什么是缓存目录,需要清理吗?

  12应用方案的发展

  回顾

  花几分钟的时间回答以下问题,然后用你的评论

  老师。

  1。问:应该定制开发Windchill里面?负荷

  2。问:哪一步包括单元测试吗?

  3。问:什么是三个“缓存目录应清除”时,安装

  定制?

  Windchill 9.0服务器定制-基本- PTC学生导游

  总结

  这个模块完成后,你应该可以:

  了解有关•任务的过程中所定义的定制

  开发模块的系统解决方案RVP工作。

  14应用方案的发展

import pandas as pd import numpy as np from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error, r2_score from rdkit import Chem from rdkit.Chem import AllChem, Descriptors import joblib import warnings warnings.filterwarnings('ignore') class CompoundPredictor: def __init__(self): self.model = None self.feature_names = None def smiles_to_features(self, smiles): """将SMILES转换为分子特征""" try: mol = Chem.MolFromSmiles(smiles) if mol is None: return None # 基本描述符 features = [] features.append(Descriptors.MolWt(mol)) features.append(Descriptors.MolLogP(mol)) features.append(Descriptors.NumHDonors(mol)) features.append(Descriptors.NumHAcceptors(mol)) features.append(Descriptors.NumRotatableBonds(mol)) features.append(Descriptors.TPSA(mol)) # Morgan指纹(简化版) fp = AllChem.GetMorganFingerprintAsBitVect(mol, 2, nBits=64) features.extend(list(fp)) return np.array(features) except: return None def preprocess_data(self, df): """预处理数据""" # 筛选IC50数据(最常用的活性指标) ic50_data = df[df['Standard Type'] == 'IC50'].copy() # 转换活性值为数值并取对数(pIC50) ic50_data['pIC50'] = -np.log10(ic50_data['Standard Value'] / 1e9) # 提取特征 X = [] y = [] valid_smiles = [] for idx, row in ic50_data.iterrows(): features = self.smiles_to_features(row['Smiles']) if features is not None: X.append(features) y.append(row['pIC50']) valid_smiles.append(row['Smiles']) return np.array(X), np.array(y), valid_smiles def train(self, df): """训练模型""" print("正在预处理数据...") X, y, _ = self.preprocess_data(df) print(f"有效数据点: {len(X)}") # 划分训练测试集 X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42 ) # 训练随机森林模型 print("正在训练模型...") self.model = RandomForestRegressor( n_estimators=100, max_depth=20, random_state=42, n_jobs=-1 ) self.model.fit(X_train, y_train) # 评估模型 y_pred = self.model.predict(X_test) mse = mean_squared_error(y_test, y_pred) r2 = r2_score(y_test, y_pred) print(f"模型评估结果:") print(f"均方误差 (MSE): {mse:.4f}") print(f"R² 分数: {r2:.4f}") return self.model def predict_activity(self, compound_name, smiles): """预测化合物活性""" if self.model is None: raise ValueError("模型未训练,请先调用train方法") features = self.smiles_to_features(smiles) if features is None: return None pIC50_pred = self.model.predict([features])[0] IC50_nM = 10**(9 - pIC50_pred) # 转换回nM单位 return { 'compound': compound_name, 'smiles': smiles, 'predicted_pIC50': pIC50_pred, 'predicted_IC50_nM': IC50_nM, 'activity_level': self.classify_activity(IC50_nM) } def classify_activity(self, ic50_nM): """根据IC50值分类活性水平""" if ic50_nM < 10: return "高活性" elif ic50_nM < 100: return "中等活性" elif ic50_nM < 1000: return "低活性" else: return "微弱活性" # 主程序 if __name__ == "__main__": # 读取数据 print("正在读取数据...") df = pd.read_csv('clean_data.csv') # 创建预测器并训练模型 predictor = CompoundPredictor() model = predictor.train(df) # 保存模型 print("正在保存模型...") joblib.dump(predictor, 'compound_activity_predictor.pkl') print("模型已保存为 'compound_activity_predictor.pkl'") # 要预测的化合物 test_compounds = [ ("10,11-dihydroxy-1,2-dimethoxynoraporphine", "COC1=C(C2=C3C(CC4=C2C(=C(C=C4)O)O)NCCC3=C1)OC"), ("10,13-Methyl octadecadienoate", "CCCCCC=CC=CCCCCCCCCC(=O)OC"), ("10,13- octadecadienoic acid", "CCCCC=CCC=CCCCCCCCCC(=O)O"), ("10,13-octadecadienoicacid ethyl ester", "CCCCCC=CCC=CCCCCCCCC(=O)OCC"), ("10,13-Octadecadienoic acid", "CCCCC=CCC=CCCCCCCCCC(=O)OC"), ("10-acetylpanaxytriol", "CCCCCCCC(C(CC#CC#CC(C=C)O)O)OC(=O)C"), ("10-deacetyl-10-oxo-7-epitaxol", "CC1=C2C(=O)C(=O)C3(C(CC4C(C3C(C(C2(C)C)(CC1OC(=O)C(C(C5=CC=CC=C5)NC(=O)C6=CC=CC=C6)O)O)OC(=O)C7=CC=CC=C7)(CO4)OC(=O)C)O)C") ] print("\n正在预测化合物活性...") print("=" * 80) results = [] for name, smiles in test_compounds: result = predictor.predict_activity(name, smiles) if result: results.append(result) print(f"化合物: {result['compound']}") print(f"SMILES: {result['smiles']}") print(f"预测 pIC50: {result['predicted_pIC50']:.2f}") print(f"预测 IC50: {result['predicted_IC50_nM']:.2f} nM") print(f"活性水平: {result['activity_level']}") print("-" * 50) # 保存预测结果 results_df = pd.DataFrame(results) results_df.to_csv('prediction_results.csv', index=False) print("预测结果已保存为 'prediction_results.csv'") 仿照这个代码 预测一个文件名为HERB_ingredient_info_cleaned.csv(文件里的化学成分有CC12CCC3CC1CCC2OCCC4C3CCCC4O CC1C2CCC3CC2CCC1OCCOCC4C3CCC5C4CCCC5CCOOCCCC CC1C2CCCO1CC2CC CCCCCOO C1CCCCC1OOOC2CCOC3CCCCC3O2OOO CN1C2CCCC1CC2OOCOCCOC3CCCCC3 C1CCCCC1C2CCOC3CCCCC3O2OOO CCOC1CCCCC1OOC CCCCCCCCCCCCCCCCCCCCOO C1CCCCC1OOC2CCCCO2COOOO CN1CCCCC1COOC CC1CCC2CCOOC3C24C1CCCO3OO4CC CC1CCC2CCC3CCCC4C3CCC5C4CCCC5CCOOOCCC2C1CCCOO CC1CCC2CCC3CCCC4C3CCC5C4CCCC5CCOOOCCC2C1CCCOOC6CCCCO6COC7CCCCO7COOC8CCCCO8COOOOOOOO COC1CC2CN3CCC2CC1C4CC5CCC4CC3OCO5OC CC1CCCCC1CCCCCCCCCCCCCCCCCCCCCCC2CCCCC2CCCCC CNCCCCOO CCCCCCCC1CCC2C1CCC3C2CCC4C3CCCC4OCCCCC CN1CCC2CC3CCC2C1C4C5CC6CCC5OCO6COO4OCO3 CC1CCCCC1CCCCOCCCC CCOC1CCC2C1CCC3C2CCC4CCOCCC34CC C1CCCCC1COOO C1CCCCC1COOOO C1CCCCC1C2COC3CC2OCCCC3C4CCCCO4COOOOOO CCCCCC1CCC2C3CCCCC3COC2C1CCCO COC1CC2CCC3C4CCCCC4CCN3C2OCOCCC1OC CC1CNCCN1CCC CN1CCC2CCC3CC2C1CC4CCCCC4OC5CCCCC5CC6C7CO3CCCC7CCN6COCOCOCOC CN1CNC2C1CONCON2C CC1CCCCC1CCCO CC1CCCCC1 CCCC12CO1C3C4O3C5CCC6CC5CC7C4C2OO7COC6OC C1CCCCC1CCNO CCCCCCCCCCCO C1CNCONC1O C1CNCONC1OC2CCCO2COOO CC1CCC2CCC3CCCC4C3CCC5C4CCCC5CCOCCC2C1CCCOO COC1CCCCC1COOO COC1CCCCC1COO COC1CCCCC1COO CC1CCCCC1CCCCCCCCCCCOCC CCC1CCCOO1OOOO COCOC1CCCC2C1CC3C4CCCN3C2C5CCCCC5N4O CCCCNC1NCNC2C1NCN2CO CCOCCC1CCCCC1OOC )的活性值再找出活性分子
最新发布
12-23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值