Skip to content

Instantly share code, notes, and snippets.

View chenyuxiang0425's full-sized avatar
🎯
Focusing

Yuxiang Chen chenyuxiang0425

🎯
Focusing
  • 18:41 (UTC +08:00)
View GitHub Profile
@chenyuxiang0425
chenyuxiang0425 / smiles2molfile.py
Created March 9, 2022 10:27
covert smiles to .mol files
import pandas as pd
from rdkit.Chem import AllChem as Chem
import argparse
def smiles2molfile(smiles):
""" smiles to mol file
@parma molecule_name
@return None
@obtain a file
@chenyuxiang0425
chenyuxiang0425 / run_multi_ms_file_in_cloud.py
Last active March 9, 2022 10:22
Batch run Material Studio files on the server
import os
import sys
def get_qstat_length():
result=os.popen('qstat')
context = result.read()
length=len(context)
result.close()
return length
@chenyuxiang0425
chenyuxiang0425 / mol2car.pl
Last active March 9, 2022 10:26
convert *.mol to *.car
#!perl
use strict;
use Getopt::Long;
use MaterialsScript qw(:all);
my $exportDir="D:\\scripts\\car\\";
my $folderPath = "D:\\scripts\\mol\\";
opendir(THISDIR,$folderPath)or die "bad";
@chenyuxiang0425
chenyuxiang0425 / draw_structures.py
Last active March 9, 2022 10:07
draw_structures
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
import os
import pandas as pd
import argparse
def get_all_file(path):
filename_list=[]
files = os.listdir(path)
@chenyuxiang0425
chenyuxiang0425 / cas2property.py
Last active March 9, 2022 10:07
cas to property
import pandas as pd
import pubchempy as pcp
import argparse
def search_molecule_from_cas(CAS):
""" search molecules from CAS number
@parma molecule_name
@return molecule
"""
searched_results = pcp.get_compounds(CAS,"name") # gget a compounds list
@chenyuxiang0425
chenyuxiang0425 / get_all_path.py
Created October 13, 2020 03:52
得到文件路径在 path 中包含 filenmane_content 的文件名的 list
# path_list 是获得的所有包含 text 的绝对路径的list
def get_all_path(path_list,path,filenmane_content):
paths = os.listdir(path) # 列出指定路径下的所有目录和文件
for i in paths:
com_path = os.path.join(path,i)
if os.path.isdir(com_path):
get_all_path(path_list,com_path,filenmane_content) # 如果该路径是目录,则调用自身方法
elif os.path.isfile(com_path):
if filenmane_content in com_path:
path_list.append(com_path) # 如果该路径是文件,则追加到path_list中
@chenyuxiang0425
chenyuxiang0425 / 原理.md
Created August 22, 2020 19:44
后缀数组

后缀数组

B-树

数据压缩
- 霍夫曼压缩
@chenyuxiang0425
chenyuxiang0425 / 原理.md
Created August 22, 2020 19:43
子字符串查找

子字符串查找