How to sort PDB name
1
0
Entering edit mode
9.8 years ago
Jason Lin • 0

Hey guys,

So I have a file contains PDB ID and SEG signal regions. which looks like this:

1JCE  339 340 341 342 343 344
1RQE 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
1VRA  7 8 9 10 11 12  186 187 188 189 190 191 192 193 194 195 196 197 198 199
2H17  3 4 5 6 7 8 9 10 11 12
2WBY 2 3 4 5 6 7  255 256 257 258 259 260 261 262 263 264 265 266 267 268 269

So I would like to know how to sort the file so that PDBID appears in order. in this case they are in order. So I would like the order to be like first compare the first charter of the PDBID and then second and then third and then forth and form an order

How to I do that with python? I've tried to use sorted. But I'm still quit confused.

PDB python sort name • 2.0k views
ADD COMMENT
3
Entering edit mode
9.8 years ago
David Fredman ★ 1.1k

Sorting a textfile (which is what you are dealing with) is a very basic and general problem. It's probably been asked before.. Yep:

http://stackoverflow.com/questions/3002392/sorting-content-of-a-text-file-in-python

If you're on mac os x or linux, just open a terminal and try

sort pdb_textfile.txt > sorted_pdb_textfile.txt

ADD COMMENT
0
Entering edit mode

Thank you so much! Since I'm using mac and sort in terminal really helped!

ADD REPLY

Login before adding your answer.

Traffic: 3252 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