处理hhsearch文件的小程序包。

hhsearch-python的Python项目详细描述


hhsearch python

作者:蒂姆。d

当前版本:1.12-python 3.7

这个小软件包是用来处理软件套件hhsearch输出的数据的。它通过hhsearch版本1.5的输出进行了测试。该项目的想法和草案本身来源于施密特博士,并作为他的一个大学模块的最终任务完成。

< Buff行情>

hhsearch是一个软件套件,用于检测蛋白质的远程同系物,并生成用于同源性建模和功能预测的高质量比对。

hh suite githubhhsearch快速指南

安装

您只需通过PIP版本安装此软件包即可。

pip install hhsearch-python

在pypi上找到这个包!


要求

要获得完整的功能,您还需要以下软件包。

pandas==0.23.4
matplotlib==3.0.2
numpy==1.15.4
Pillow==6.0.0
pymol==0.1.0

除了pymol之外,一切都可以通过pip安装轻松安装。pymol需要单独安装,也可以通过pip安装,以便在常规python环境中使用。

pip安装:

pip安装-c schrodinger pymolpip安装-c schrodinger pymol

<表><广告>Pymol版本文档 < /广告><正文> MAC < /TD>https://pymolwiki.org/index.php/mac_install窗口https://pymolwiki.org/index.php/windows_installLinuxhttps://pymolwiki.org/index.php/linux_install

包装纸-Jupyter笔记本

对于整个模块,一个带有ui的包装器已经创建为jupyter笔记本。 你只需要用jupyter打开这个repo中的jupyter笔记本,把你的.hhm.hhs文件放在同一文件夹的某个子文件夹中,然后用pip install hhsearch python安装模块。整个笔记本本身是非常不言而喻的,作为一个不错的用户界面,它提供了这个模块中几乎所有功能的选项。

如果您喜欢通过用户界面使用实现自动化和简单化,建议您这样做。


功能

有关查询和点击的详细信息

这个包中有一些函数可以用来生成一个像样的有组织(可视化)输出。但是,要使所有这些都正常工作,您需要将所有需要的.hhm以及所有.hhs文件放在当前工作目录中的某个位置。

# lets first import all our functions from the module.fromhhsearch_pythonimport*hhs_file="data/hhs/d1e0ta1.hhs"# path to your .hhs file.# first, we can use extract_HHSearch_data() to extract the whole HHSearch statistics into a pandas.DataFrame.hhs_hits_statistics=extract_HHSearch_data(hhs_file)

但是,我们还需要有关查询本身以及所选点击的常规信息。为此,我们可以使用两个单独的函数extract\u hhsearch\u main来查询.hhs文件,并使用get\u alignment\u term来获取先前创建的pandas.dataframe

query_dict=extract_HHSearch_main(hhs_file)# As an example how this dict() output looks like: print(query_dict)>>{'Query':'Query d1e0ta1 b.58.1.1 (A:70-167) Pyruvate kinase (PK) {Escherichia coli [TaxId: 562]}','pdb_id':'1e0t','alignment_term':'/1e0t//A/70-167/CA','full_term':'/1e0t//A//CA','file_name':'d1e0ta1'}# alignment_term is needed for a proper PyMol alignment later down the road, # as well as full_term, ignoring the specific residues. # Let's get information about the second hit of the statistics from the .hhs file. hit_dict=get_alignment_term(hhs_hits_statistics,2)print(hit_dict)>>{'pdb_id':'2vgb','alignment_term':'/2vgb//A/160-261/CA','full_term':'/2vgb//A//CA','file_name':'d2vgba1'}# except for the key "Query", get_alignment_term() outputs a structure identical dict() as extract_HHSearch_main()

彩色对齐-HTML格式

选择了第二条路线作为我们的选择目标后,我们现在需要更多关于路线本身的信息,因此我们使用get full\u alignment提取实际的路线。它有两个参数:查询的.hhs文件,以及.hhs文件中的命中次数,就像获取对齐项一样。因此,最好是查看以前创建的pandas.dataframehhs\u hits\u statistics并选择很有意思。

# This also creates a html formatted file in a separate folder - /alignments_highlighted/<query>/<NoX-name>.html# and also the same file as alignment.html in a folder called /lastrun/, all for your convenience. alignment_of_interest=get_full_alignment(hhs_file,2)

HTML格式的输出如下所示。如您所见,helices和sheets是彩色的。

< Buff行情>

此外,如果您希望将此格式应用于整个.hhs文件,则可以使用函数highlight戆hs戆full(hhs戆file)并将所需的.hhs文件的路径用作参数。它将给定的hhs文件作为彩色html格式的字符串返回,并存储在单独的文件夹/alignments_highlighted/<;query name>;_full.html中,以及文件名hhs_full_colorized.html下的/lastrun文件夹中。

# outputs the whole .hhs file colorized in the above-shown pattern. full_hhs_colorized=highlight_hhs_full(hhs_file)

Pymol对齐-可视化动画

对路线进行组织和着色是非常有用的,但我们也希望实际创建所选路线的更直观的表示。为此,我们可以使用以前创建的字典query-dicthit-dict并将它们的信息作为函数pymol\u alignment()的参数。此函数还返回中原子位置的rmsd值

# building up the information from the query. pdb_1=query_dict.get("pdb_id")aln_term_1=query_dict.get("pdb_id")full_term_1=query_dict.get("pdb_id")# buildung up the needed information from the chosen hit. pdb_2=hit_dict.get("pdb_id")aln_term_2=hit_dict.get("pdb_id")full_term_2=hit_dict.get("pdb_id")# Also returns the RMSD values for the alignment. rmsd=pymol_alignment(pdb_1,pdb_2,aln_term_1,aln_term_2,full_term_1,full_term_2)print(rmsd)>>(0.8026888370513916,85,5,1.2078778743743896,98,160.0,98)# In this example RMSD Value is about 0.803 Å over 85 C-αlpha atoms. 

这将在一个不同的文件夹中创建两个图像,以及一个无缩放.pse文件,该文件可以用pymol打开,同时将pdb条目的必要.cif文件放入一个名为/cif/的单独文件夹中。 关于图片:放大到aln_term_1的区域,在我们的示例中是:/1e0t//a/70-167/ca,显示感兴趣的区域,以及在我们的示例中的/1e0t//a//ca的图片中的未缩放区域。 这些图像存储在/lastrun/文件夹中,以及/pymol_img/<;pdb_1>;/<;pdb_1>;-<;pdb_2>;/文件夹中。 <表><广告>缩放 不缩放 < /广告><正文>

但是,pymol_alignment还有一个选项可以输出动画图片,而不仅仅是静态图片,还有一个选项可以输出帧乘数,帧乘数需要是4的整数。但是这个选项需要更多的时间来处理,但是当然,它提供了一个更好的输出。每一帧乘法器基本上将创建模型360度视图所需的时间加倍。帧与动画gif一起存储在lastrun/文件夹中的subdir/animation中,以及单独的文件夹pymol_img/<;pdb_1>;/<;pdb_1>;-<;pdb_2>;/animation/<;framemultiplier>;中,而动画gif则存储在上方的文件夹/animation

# as an example we will create an animated gif with the frame multiplier of 4pymol_alignment(pdb_1,pdb_2,aln_term_1,aln_term_2,full_term_1,full_term_2,animation=True,framemultiplier=4)

请注意,每次运行时,LastRun文件夹的"动画"子文件夹都将被清除,因此,如果一次运行动画功能,而下一次运行时没有动画功能,则不会出现混淆。

< Buff行情>

动画示例=真,帧乘数=我们示例的4

选定跨距的条形图

最后,我们希望根据hhms和我们选择的命中率,创建查询中氨基酸频率的条形图。为此,我们首先需要提取.hhm文件的频率。这给了我们一个pandas.dataframe,所有的频率都被赋为一个,根据hhsuit wiki的信息计算。

Frequency calculation:  
entry = -1000 * log_2(frequency) 
frequency = 2^(-entry/1000)
pip install hhsearch-python
0

频率的输出数据帧最终看起来如下:

<表><广告>< POS < /Th >< < < < / > >< < < / > >< C >< < d>< < < >< >< < (…)< /广告><正文> M10.0300190.0000000.0043250.0146700.0371110.012379(…)(…)(…)(…)(…)(…)(…)(…)(…)(…)

然而,拥有频率是一回事,我们也希望将它们可视化。为此,可以使用plot_frequencies函数。此函数总共接受七个参数,而只有一个是必需的。您需要传递创建的pandas.dataframe频率。如果需要,可以更改创建的子文件夹的名称。我个人建议使用query-dicthit-dict中的文件名,同时使用query-dict.get("file-name")hit-dict.get("file-name")。阈值描述了必须达到的最小频率,因此它最终出现在图中。推荐值约为0.1,等于10%。接下来,我们需要设置我们的情节的开始和结束。作为一个例子,我们将选择第一个余数作为开始,第50个余数作为跨度的结束。文件名描述文件将存储在/lastrun文件夹中的名称。另外,如果你喜欢的话,可以给情节加个标题,不过,我个人不喜欢这个选项,因为它扰乱了干净的外观。根据您选择的范围,此过程也可能需要一些适当的时间。

pip install hhsearch-python
1 <表><广告>查询:d1e0ta1,1-50,最小10%命中:d2vgba1,1-50,最小10%< /广告><正文>

联系方式:

<表><广告>电报 电子邮件 < /广告><正文>

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Selenium Web驱动程序。负载策略不稳定   JAVAsql。SQLException:没有合适的驱动程序无法创建“oracle”类的JDBC驱动程序。jdbc。驾驶员用于连接URL的OracleDriver   java谷歌地图“优化路径点”如何解决旅行推销员的问题?   java这段代码可能会造成潜在的内存泄漏吗?   java更改JCombobox的高度   java如何清除jtable中的数据   JavaHadoop:错误安全性。UserGroupInformation:MapReduce程序中的PriviledgedActionException   java如何将sonarlint添加到gradle任务中?   性能为什么Java排序优于原语计数排序   java Spring属性PlaceHolderConfigure从数据库加载   java从泛型获取类不起作用   java Spring@Transactional传播属性   java试图拥有主菜单和子菜单类   XSL的java后处理步骤   java第一个字母和最后一个字母、第二个字母和倒数第二个字母之间的差值之和,依此类推,直到单词的中心   switch语句在Java中的下一个出发点   java 安卓如何在OnBackpress()时设置viewpager的特定项目位置?