How To Transform A Location-Type Coordinate Into Integer Or String?
2
1
Entering edit mode
12.7 years ago

I have set of SecRecord objects with SeqFeature.location.start and I want to transform this coordinate into integer to compare to other sets of coordinates, add shifts etc.. How can I do that? I have read Biopython cookbook, but I still can't solve the problem.

biopython • 2.6k views
ADD COMMENT
2
Entering edit mode
ADD REPLY
1
Entering edit mode

In the soon to be released Biopython 1.59 the position objects will be subclasses of int, so you won't need to do anything.

ADD REPLY
0
Entering edit mode
start = int(str(seqRecord.features[0].location.start))

Well, I converted it first into string, then into integer, is there a more elegant solution?

ADD REPLY
0
Entering edit mode

Goog idea.thanks!

ADD REPLY
0
Entering edit mode

can you give more of your code?

ADD REPLY
1
Entering edit mode
12.7 years ago

I think you need to get the position of the start.

So if currFeat is a SeqFeature from your SeqRecord object:

location = currFeat.location

start = location.start.position

end = location.end.position

start and end should be integers.

ADD COMMENT
1
Entering edit mode

Exactly - although in the soo to be released Biopython 1.59 the position objects will subclass int so you can use them directly.

ADD REPLY
0
Entering edit mode
4 weeks ago

I apologize for revealing this ancient thread, but since the discussion is listed among search results for the question, some updates are required. In the current biopython, one should use

start = int(feature.location.start)

The feature.location.start.position is now abandoned as well feature.location.end.position.

Best regards

Asan

ADD COMMENT

Login before adding your answer.

Traffic: 2048 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6