0

試してみるとバグが発生したようです:

>>> from Bio.Align import AlignInfo
>>> summary_align = AlignInfo.SummaryInfo('/home/ivan/Elasmo only')
>>> consensus = summary_align.dumb_consensus()
Traceback (most recent call last):
  File "<pyshell#148>", line 1, in <module>
    consensus = summary_align.dumb_consensus()
  File "/usr/local/lib/python2.7/dist-packages/Bio/Align/AlignInfo.py", line 76, in dumb_consensus
    con_len = self.alignment.get_alignment_length()
AttributeError: 'str' object has no attribute 'get_alignment_length'

誰かが私を助けてくれることを願っています。

乾杯、

4

1 に答える 1

2

配置オブジェクトではなく、文字列を使用して SummaryInfo クラスをインスタンス化しました。

文字列に対して .dumb_consensus() を呼び出そうとしていますが、このメソッドは、SummaryInfo クラスを文字列ではなくアライメントでインスタンス化する場合にのみ機能します。

http://biopython.org/DIST/docs/api/Bio.Align.Generic.Alignment-class.html#get_alignment_length

これを試して:

# Make an example alignment object
>>> from Bio.Align.Generic import Alignment
>>> from Bio.Alphabet import IUPAC, Gapped
>>> align = Alignment(Gapped(IUPAC.unambiguous_dna, "-"))
>>> align.add_sequence("Alpha", "ACTGCTAGCTAG")
>>> align.add_sequence("Beta",  "ACT-CTAGCTAG")
>>> align.add_sequence("Gamma", "ACTGCTAGATAG")

# Instantiate SummaryInfo class and pass 'align' to it.

>>> from Bio.Align import AlignInfo
>>> summary_align = AlignInfo.SummaryInfo(align)
>>> consensus = summary_align.dumb_consensus()

注意点として、Alignment オブジェクトが減価償却されているように見えるので、MultipleSeqAlignmentの使用を検討してください。

于 2015-02-26T23:47:53.917 に答える