This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Biopython How To Access Fa_Z-Score In Bio.Align.Multipleseqalign

I'm new to biopython.

I can see through my debugger that the alignment I have loaded has 2 SeqRecords (as expected). Now I can see through my debugger that some of the descriptions of this alignment are hidden deep in the data structure in a dictionary. Specifically, I can see that there is a variable called fa_z-score that I would like to be able to access the value of.

My code, which is pretty much exactly a copy from the biopython tutorials:

f = open("fasta.out", 'r')
for a in AlignIO.parse(f, "fasta-m10"):
print(a)
print "Alignment length %i" % a.get_alignment_length()
for record in a:
    print record.seq, record.name, record.id

Who can tell me how to access the fa_z-score variable in my "a"?

biopython

1 answer

Ahhh. It was an underscore that was holding me back.

zscore = a._annotations["fa_z-score"]

For now, yes, do that. In Python a leading underscore indicates a private method/function that isn't considered part of the public API. In this case, that is because we don't have a proper setup for storing alignment level annotation yet - but parsing FASTA pairwise alignments is something being worked on this summer by a Biopython Google Summer of Code (GSoC) student project.

Log in to answer this question.