biopython

Reverse complement of DNA strand using Python

感情迁移 提交于 2019-11-30 14:20:25
I have a DNA sequence and would like to get reverse complement of it using Python. It is in one of the columns of a CSV file and I'd like to write the reverse complement to another column in the same file. The tricky part is, there are a few cells with something other than A, T, G and C. I was able to get reverse complement with this piece of code: def complement(seq): complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'} bases = list(seq) bases = [complement[base] for base in bases] return ''.join(bases) def reverse_complement(s): return complement(s[::-1]) print "Reverse Complement:" print

Phylo BioPython building trees

谁说胖子不能爱 提交于 2019-11-30 05:39:51
问题 I trying to build a tree with BioPython, Phylo module. What I've done so far is this image: each name has a four digit number followed by - and a number: this number refer to the number of times that sequence is represented. That means 1578 - 22, that node should represent 22sequences. the file with the sequences aligned: file the file with the distance to build a tree: file So now I known how to change each size of the node. Each node has a different size, this is easy doing an array of the

Calculating the distance between atomic coordinates

若如初见. 提交于 2019-11-28 05:31:32
问题 I have a text file as shown below ATOM 920 CA GLN A 203 39.292 -13.354 17.416 1.00 55.76 C ATOM 929 CA HIS A 204 38.546 -15.963 14.792 1.00 29.53 C ATOM 939 CA ASN A 205 39.443 -17.018 11.206 1.00 54.49 C ATOM 947 CA GLU A 206 41.454 -13.901 10.155 1.00 26.32 C ATOM 956 CA VAL A 207 43.664 -14.041 13.279 1.00 40.65 C . . . ATOM 963 CA GLU A 208 45.403 -17.443 13.188 1.00 40.25 C I would like to calculate the distance between two alpha carbon atoms i.e calculate the distance between first and

Why can't python find some modules when I'm running CGI scripts from the web?

坚强是说给别人听的谎言 提交于 2019-11-27 05:20:53
I have no idea what could be the problem here: I have some modules from Biopython which I can import easily when using the interactive prompt or executing python scripts via the command-line. The problem is, when I try and import the same biopython modules in a web-executable cgi script, I get a "Import Error" : No module named Bio Any ideas here? Here are a couple of possibilities: Apache (on Unix) generally runs as a different user, and with a different environment, to python from the command line. Try making a small script that just prints out sys.version and sys.prefix , and compare the

Why can't python find some modules when I'm running CGI scripts from the web?

拥有回忆 提交于 2019-11-26 11:35:11
问题 I have no idea what could be the problem here: I have some modules from Biopython which I can import easily when using the interactive prompt or executing python scripts via the command-line. The problem is, when I try and import the same biopython modules in a web-executable cgi script, I get a \"Import Error\" : No module named Bio Any ideas here? 回答1: Here are a couple of possibilities: Apache (on Unix) generally runs as a different user, and with a different environment, to python from