Bio.Motifs软件包¶
子包¶
子模块¶
- Bio.Motifs.Alignace模块
- Bio.Motifs.clusterbuster模块
- Bio.Motifs.Mast模块
- Bio.Motifs.Matrix模块
GenericPositionMatrix
FrequencyPositionMatrix
PositionWeightMatrix
PositionSpecificScoringMatrix
PositionSpecificScoringMatrix.calculate()
PositionSpecificScoringMatrix.search()
PositionSpecificScoringMatrix.max
PositionSpecificScoringMatrix.min
PositionSpecificScoringMatrix.gc_content
PositionSpecificScoringMatrix.mean()
PositionSpecificScoringMatrix.std()
PositionSpecificScoringMatrix.dist_pearson()
PositionSpecificScoringMatrix.dist_pearson_at()
PositionSpecificScoringMatrix.distribution()
- Bio.Motifs.Meme模块
- Bio.Motifs.Minimal模块
- Bio.Motifs.pfm模块
- Bio.Motifs.Thresholds模块
- Bio.Motifs.transfac模块
- Bio.Motifs.xms模块
模块内容¶
序列基序分析工具。
Bio.Motifs包含核心Motif类,该类包含各种I/O方法以及用于序列中的Motif比较和Motif搜索的方法。它还包括解析AlignACE、Meme和Mast程序的输出以及TRANSFAC格式文件的功能。
- Bio.motifs.create(instances, alphabet='ACGT')¶
创建Motif对象。
- Bio.motifs.parse(handle, fmt, strict=True)¶
解析来自Motif查找程序的输出文件。
- 当前支持的格式(忽略大小写):
AlignAce:AlignAce输出文件格式
ClusterBuster:ClusterBuster位置频率矩阵格式
XMS:XMS矩阵格式
Meme:Meme输出文件Motif
Minimal:最小模因输出文件Motif
MAST:MAST输出文件主题
TRANSFAC:TRANSFAC数据库文件格式
PFM-四列:具有四列的通用位置-频率矩阵格式。(cisbp、homer、hocomoco、neph、tiffin)
PFM-4行:通用位置-频率矩阵格式,共4行。(scertf,yetFasco,hdpi,idmmpmm,flyfactor调查)
PFM:Jaspar风格的位置-频率矩阵
Jaspar:Jaspar风格的多PFM格式
站点:Jaspar样式的站点文件
由于PFM和SITES格式的文件只包含单个主题,因此对这些文件使用Bio.Motifs.read()比使用Bio.Motifs.parse()更容易。
例如:
>>> from Bio import motifs >>> with open("motifs/alignace.out") as handle: ... for m in motifs.parse(handle, "AlignAce"): ... print(m.consensus) ... TCTACGATTGAG CTGCACCTAGCTACGAGTGAG GTGCCCTAAGCATACTAGGCG GCCACTAGCAGAGCAGGGGGC CGACTCAGAGGTT CCACGCTAAGAGAAGTGCCGGAG GCACGTCCCTGAGCA GTCCATCGCAAAGCGTGGGGC GAGATCAGAGGGCCG TGGACGCGGGG GACCAGAGCCTCGCATGGGGG AGCGCGCGTG GCCGGTTGCTGTTCATTAGG ACCGACGGCAGCTAAAAGGG GACGCCGGGGAT CGACTCGCGCTTACAAGG
如果Strict为True(默认值),则如果文件内容不严格符合指定的文件格式,解析器将引发ValueError。
- Bio.motifs.read(handle, fmt, strict=True)¶
使用指定的文件格式从句柄读取主题。
它支持与Bio.Motifs.parse()相同的格式,但只支持包含一个Motif的文件。例如,读取Jaspar样式的PFM文件:
>>> from Bio import motifs >>> with open("motifs/SRF.pfm") as handle: ... m = motifs.read(handle, "pfm") >>> m.consensus Seq('GCCCATATATGG')
或者是一个单一主题的模因文件,
>>> from Bio import motifs >>> with open("motifs/meme.psp_test.classic.zoops.xml") as handle: ... m = motifs.read(handle, "meme") >>> m.consensus Seq('GCTTATGTAA')
如果句柄不包含任何记录或多个记录,则会引发异常:
>>> from Bio import motifs >>> with open("motifs/alignace.out") as handle: ... motif = motifs.read(handle, "AlignAce") Traceback (most recent call last): ... ValueError: More than one motif found in handle
但是,如果您想要包含多个主题的文件中的第一个主题,则此函数将引发异常(如上面的示例所示)。请改用:
>>> from Bio import motifs >>> with open("motifs/alignace.out") as handle: ... record = motifs.parse(handle, "alignace") >>> motif = record[0] >>> motif.consensus Seq('TCTACGATTGAG')
如果要从句柄读取多条记录,请使用Bio.Motifs.parse(Handle,fmt)函数。
如果Strict为True(默认值),则如果文件内容不严格符合指定的文件格式,解析器将引发ValueError。
- class Bio.motifs.Instances(instances=None, alphabet='ACGT')¶
基类:
list
类的新实例,该类包含构成主题的序列列表。
- __init__(instances=None, alphabet='ACGT')¶
初始化类。
- __str__()¶
返回包含主题序列的字符串。
- count()¶
计算一个位置上的核苷酸。
- search(sequence)¶
找出给定序列中的主题位置。
这是一个生成器函数,返回在给定序列中找到的Motif实例的位置。
- reverse_complement()¶
计算序列的逆补。
- class Bio.motifs.Motif(alphabet='ACGT', instances=None, counts=None)¶
基类:
object
表示序列模体的类。
- __init__(alphabet='ACGT', instances=None, counts=None)¶
初始化类。
- property mask¶
- property pseudocounts¶
- property background¶
- property pwm¶
计算仓位权重矩阵。
- property pssm¶
计算职位特定评分矩阵。
- __str__(masked=False)¶
返回Motif的字符串表示形式。
- __len__()¶
返回主题的长度。
请使用此方法(即调用len(M)),而不是直接引用m.length。
- reverse_complement()¶
将主题的反向补语作为新主题返回。
- property consensus¶
返回一致序列。
- property anticonsensus¶
返回从该主题生成的可能性最小的模式。
- property degenerate_consensus¶
返回退化的共识序列。
遵循D.R.Cavener改编的规则:“果蝇和脊椎动物翻译起始点两侧的一致序列的比较。”核酸研究15(4):1353-1361。(1987)。
TRANSFAC使用相同的规则。
- weblogo(fname, fmt='PNG', version='2.8.2', **kwds)¶
使用Berkeley weblogo服务下载并保存weblogo。
需要互联网连接。
中的参数
**kwds
被直接传递到weblogo服务器。目前,此方法使用的是WebLogo版本3.3。以下是传递到WebLogo3.3的参数及其默认值;有关详细信息,请参阅其网站http://weblogo.threeplusone.com:
'stack_width' : 'medium', 'stacks_per_line' : '40', 'alphabet' : 'alphabet_dna', 'ignore_lower_case' : True, 'unit_name' : "bits", 'first_index' : '1', 'logo_start' : '1', 'logo_end': str(self.length), 'composition' : "comp_auto", 'percentCG' : '', 'scale_width' : True, 'show_errorbars' : True, 'logo_title' : '', 'logo_label' : '', 'show_xaxis': True, 'xaxis_label': '', 'show_yaxis': True, 'yaxis_label': '', 'yaxis_scale': 'auto', 'yaxis_tic_interval' : '1.0', 'show_ends' : True, 'show_fineprint' : True, 'color_scheme': 'color_auto', 'symbols0': '', 'symbols1': '', 'symbols2': '', 'symbols3': '', 'symbols4': '', 'color0': '', 'color1': '', 'color2': '', 'color3': '', 'color4': '',
- __format__(format_spec)¶
返回给定格式的Motif的字符串表示形式。
- 当前支持的格式:
ClusterBuster:ClusterBuster位置频率矩阵格式
PFM:Jaspar单位频率矩阵
Jaspar:Jaspar多位置频率矩阵
Transfac:类似于TRANSFAC的文件
- format(format_spec)¶
返回给定格式的Motif的字符串表示形式。
- 当前支持的格式:
ClusterBuster:ClusterBuster位置频率矩阵格式
PFM:Jaspar单位频率矩阵
Jaspar:Jaspar多位置频率矩阵
Transfac:类似于TRANSFAC的文件
- Bio.motifs.write(motifs, fmt)¶
返回给定格式的主题的字符串表示形式。
- 当前支持的格式(忽略大小写):
ClusterBuster:ClusterBuster位置频率矩阵格式
PFM:Jaspar简单单位置频率矩阵
Jaspar:Jaspar多PFM格式
Transfac:类似于TRANSFAC的文件