[BioPython] Information content for sequences

Sebastian Bassi sbassi@asalup.org
Thu, 28 Nov 2002 21:43:29 -0300


Hi,

According to the Biopython cookbook, the information content works on 
aligments.
According to the tutorial:
info_content = summary_align.information_content(5,30)
Where summary_align should be an aligment summary information.

But I want to calculate the information content of a sequence. It seems 
I can't do it.

Then I tried to get the summaryinfo of the sequence.
When I try this:

--------------------------------------------------------------------

from Bio import Fasta
from Bio.Align import AlignInfo

parser=Fasta.RecordParser()
entrada=open("C:\\bioinfo-adv\\blast\\data\\vector.nn","r")
cur_record=1
iterator=Fasta.Iterator(entrada,parser)


while cur_record:
     cur_record=iterator.next()
     if cur_record is None:
         break
     tamseq=len(cur_record.sequence)
     print tamseq
     for ini in range(tamseq-20):
         fin=ini+20
         sum_alin=AlignInfo.SummaryInfo(cur_record)
         ic=sum_alin.information_content(ini,fin,chars_to_ignore=['N'])
         #print ic

entrada.close()

--------------------------------------------------------------------

I get:

--------------------------------------------------------------------

2687
Traceback (most recent call last):
   File "C:\Program Files\Python22\lcc.py", line 19, in ?
     ic=sum_alin.information_content(ini,fin,chars_to_ignore=['N'])
   File "C:\Program 
Files\Python22\lib\site-packages\Bio\Align\AlignInfo.py", line 383, in 
information_content
     if start < 0 or end > len(self.alignment._records[0].seq):
AttributeError: Record instance has no attribute '_records'

--------------------------------------------------------------------

Is there a way to get the information content for a sequence? (istead of 
an aligment).



-- 
Best regards,

//=\ Sebastian Bassi - Diplomado en Ciencia y Tecnologia, UNQ   //=\
\=// IT Manager Advanta Seeds - Balcarce Research Center -      \=//
//=\ Pro secretario ASALUP - www.asalup.org - PGP key available //=\
\=// E-mail: sbassi@genesdigitales.com - ICQ UIN: 3356556 -     \=//

               Linux para todos: http://Linuxfacil.info