[BioPython] getting the positions as a string for comparison reason

Willem Ligtenberg wligtenberg at gmail.com
Sat May 7 10:28:47 EDT 2005


Hello,
I am trying to parse a genbank file and want to compare the start (or
end) positions of a gene with start (or end) positions I already may
have parsed from Ensembl.
These positions have been stored as a string and the string is empty
"" if none is yet stored in the gene object.

[code snippet]
for gen in record.features:
    if gen.location != "":
        gene.addStartBP(gen.location.start)
        gene.addStartBP(gen.location.end)
[/code snippet]

[code from gene class]
def addStartBP(self, startBP):
		if self.startBP == "":
			self.startBP = startBP
[/code from gene class]

Gives (ofcourse) this error:
AssertionError: We can only do comparisons between Biopython Position objects.

But how can I throw this position object to a string?

Thanks in advance,

Willem Ligtenberg



More information about the BioPython mailing list