Creative Commons License
This blog by Tommy Tang is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

My github papge

Thursday, October 31, 2013

python code for getting the reverse complement DNA strand

Following pythonforbiologist http://pythonforbiologists.com/index.php/business-card-solutions/, I wrote a very simple python script to get the reverse complement DNA strand:


It is a very simple script but several things I want to mention:
1. what is the fast string concatenation method in python?
in the first function, we tend to write something like:

out_seq = ' '
for base in reversed(seq):
    out_seq += seq_dict[base]

but it turned out to be very slow. Read this post for more details  http://www.skymind.com/~ocrow/python_string/
the list comprehension is the fastest and most elegant way to concatenate a string.


2. for more complicated IUPAC ambiguity codes, read this post:
http://pythonforbiologists.com/index.php/how-to-count-non-dna-bases-in-a-sequence-using-python/
Nucleotide Code:  Base:
----------------  -----
A.................Adenine
C.................Cytosine
G.................Guanine
T (or U)..........Thymine (or Uracil)
R.................A or G
Y.................C or T
S.................G or C
W.................A or T
K.................G or T
M.................A or C
B.................C or G or T
D.................A or G or T
H.................A or C or T
V.................A or C or G
N.................any base
. or -............gap

6 comments:

  1. tanie i modne zegarki internetowy , combining elegant style and cutting-edge technology, a variety of styles of tanie i modne vacheron constantin zegarki internetowy , the pointer walks between your exclusive taste style.

    ReplyDelete
    Replies
    1. <Investment is one of the best ways to achieve financial freedom. For a beginner there are so many challenges you face. It’s hard to know how to get started. Trading the Crypto market has really been a life changer for me. I almost gave up on crypto currency at some point not until I got a proficient trader Bernie Doran, he gave me all the information required to succeed in trading. I made more profit than I could ever imagine. I’m not here to converse much but to share my testimony, I invested $2000.00 and got back $21,500.00 within 5 days of investment. His strategies and signals are the best and I have gained more knowledge.
      If you are new to cryptocurrency. You can reach to him on Telegram: @BERNIE_FX
      Or through Email : Bernie.doranfx01@gmail.com

      Delete
  2. Python Training in Delhi
    Thanks for sharing the information about the Python and keep updating us.This information is really useful to me.

    Python Classes in Delhi

    ReplyDelete
  3. All thanks to Mr Anderson for helping with my profits and making my fifth withdrawal possible. I'm here to share an amazing life changing opportunity with you. its called Bitcoin / Forex trading options. it is a highly lucrative business which can earn you as much as $2,570 in a week from an initial investment of just $200. I am living proof of this great business opportunity. If anyone is interested in trading on bitcoin or any cryptocurrency and want a successful trade without losing notify Mr Anderson now.Whatsapp: (+447883246472 )
    Email: tdameritrade077@gmail.com

    ReplyDelete
  4. SCAMS COME IN MANY FORMS, BUT ALL ARE DESIGNED TO GET A HOLD OF YOUR HARD-EARNED MONEY.
    The first mistake I made was thinking I could multiply my income by investing in cryptocurrency, I fell for a popular investment scam and was swindled of $60,000 in bitcoins. After a few weeks, I came across a pop-up while browsing the internet about a recovery team called Wardrivers Cyber Service that could help me recover my bitcoins in a matter of hours, I was doubtful about it at first but I finally contacted them and in a space of 48 hours, Wardrivers cyber-service was able to recover all of my money lost in bitcoins. They are the best bitcoins recovery team out there and if you face similar issues, you should contact them immediately.
    Contact information: Wardriverscyberservice@techie.com.

    ReplyDelete

  5. THE BEST AND MOST TRUSTED BITCOIN HACKER...

    I'M THE HAPPIEST WOMAN ON THE PLANET...I still can't believe my lost Bitcoin was recovered; Captain WebGenesis is a true godsend; I received my missing Bitcoin within 48 hours. I had read some fantastic testimonials about Captain WebGenesis before calling him and explaining how a bogus investment organization had stolen my Bitcoin and I needed assistance recovering it... Captain WebGenesis was so precise, I had no idea it would work so quickly for me... After hearing about my predicament, he did all humanly possible to recover my lost Bitcoin from those scammers. I volunteer to share my testimony with anyone else who has been fooled and requires the services of a recovery agency to reclaim their funds, that Captain WebGenesis is a genuine and trustworthy Bitcoin recovery agency that reclaims any bitcoin stolen from victims by fraudulent investment firms. Never give up on recovering your missing funds; please contact CAPTAIN WEBGENESIS from anywhere in the world at any time.

    E-MAIL: (Captainwebgenesis@hackermail.com)
    VERIFIED WEBSITE: https://captainwebgenesis.com
    CALL OR WHATSAPP +1 205 336 1020

    courtesy of Faith Tyler...

    ReplyDelete