Open Babel 的使用说明

Open Babel是很好用的生化数据格式转换工具,有window和linux的版本,今天介绍linux版里的相关命令。

零、安装

这里介绍的是conda安装openbabel3.1.1的方法:

conda install -c conda-forge openbabel==3.1.1

一、使用说明

用法:

obabel[-i<input-type>] <infilename> [-o<output-type>] -O<outfilename> [Options]

The extension of a file decides the format, unless it is overridden
by -i or -o options, e.g. -icml, or -o smi
See below for available format-types, which are the same as the
file extensions and are case independent.
If no input or output file is given stdin or stdout are used instead.

More than one input file can be specified and their names can contain
wildcard chars (* and ?). The format of each file can be different unless
the -i option has been used, when they are all the same.
By default, the molecules are aggregated in the output file,
but see -m option, Splitting, below.

Options, 像是 -i -o -O -m, 必须在输入文件后。

1. 转换options

-f <#> Start import at molecule # specified
-l <#> End import at molecule # specified
-e Continue with next object after error, if possible
-z Compress the output with gzip
-zin Decompress the input with gzip
-k Attempt to translate keywords
-H Outputs this help text
-Hxxx (xxx is file format ID e.g. -Hcml) gives format info
-Hall Outputs details of all formats
-V Outputs version number
-L Lists plugin classes of this category, e.g.
Use just -L for a list of plugin categories.
Use -L e.g. -L sdf for details of a format or other plugin.
-m Produces multiple output files, to allow:
Splitting: e.g. obabel infile.mol -O new.smi -m
puts each molecule into new1.smi new2.smi etc
Batch conversion: e.g. obabel *.mol -osmi -m
converts each input file to a .smi file

2. 对于转换后的分子额外的options

-d Delete hydrogens (make implicit)
-h Add hydrogens (make explicit)
-p Add hydrogens appropriate for this pH
-b Convert dative bonds e.g.-N+=O to -N(=O)=O
-B Make dative bonds e.g.-N+=O from -N(=O)=O
-r Remove all but the largest contiguous fragment
-c Center Coordinates
-C Combine mols in first file with others by name
–filter Filter: convert only when tests are true:
–add Add properties from descriptors
–delete Delete properties in list
–append Append properties or descriptors in list to title:
-s"smarts" Convert only if match SMARTS or mols in file:
-v"smarts" Convert only if NO match to SMARTS or mols in file(not displayed in GUI)
–join Join all input molecules into a single output molecule
–separate Output disconnected fragments separately
–property add or replace a property (SDF)
–title Add or replace molecule title<br/> –addtotitle <text> Append text to title<br/> –writeconformers Output multiple conformers separately<br/> –addoutindex Append output index to title<br/> –0xout <file.xxx> Additional file output<br/> –addfilename Append input filename to title<br/> –AddInIndex Append input index to title<br/> –AddNonPolarH Adds hydrogen to nonpolar atoms only<br/> –AddPolarH Adds hydrogen to polar atoms only<br/> –canonical Canonicalize the atom order<br/> –ChangeCell Change cell size:<br/> –DelNonPolarH Deletes hydrogen from nonpolar atoms only<br/> –DelPolarH Deletes hydrogen from polar atoms only<br/> –fillUC Fill the unit cell (strict or keepconnect)<br/> –gen2D Generate 2D coordinates<br/> –gen3D Generate 3D coordinates<br/> –genalias Generate aliases as an alternative representation.<br/> –highlight Highlight substructures in 2D depictions<br/> –largest # Output # mols with largest values<br/> –partialcharge Calculate partial charges by specified method<br/> –readconformer Adjacent conformers combined into a single molecule<br/> –sort <desc> Sort by descriptor(~desc for reverse)<br/> –split [param] split, each filename from param;default title<br/> –unique [param] remove duplicates by descriptor;default inchi</desc></text>

3. OBAPI内部接口

API options, e.g. —errorlevel 2

errorlevel # min warning level displayed

4. 看可识别的格式有哪些

babel -L formats [read] [write]

5.看特别的格式的细节和用法

e.g CML, 用

babel -L cml

二、用法例子

1. 格式转换

比如从mol2到pdb:

obabel -ipdb mol.pdb -omol2 -O mol.mol2

其中文件名为mol。

2. 给分子删氢

对于mol分子中本来是有H的,想对它进行删除所有H的操作:

obabel -imol2 mol.mol2 -omol2 -O mol.mol2 -d

3. 给分子加氢

对于mol分子中本来就没有H,想对它进行加上所有H的操作:

obabel -imol2 mol.mol2 -omol2 -O mol.mol2 -h

4. 对文件进行分割

对于mol文件中含多个分子内容的情况,想对它进行分割的操作:

obabel -imol2 mol.mol2 -omol2 -O mol.mol2 -m

分割出的文件将是mol1.mol2、mol2.mol2、mol3.mol2…

总结

其它Open Babel的用法可以参考使用说明和用法的例子进行自己的DIY,简单总结了一下,主要是供自己之后没记住的方便回来查看,希望有用。

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值