[Biopython] Strand

Brad Chapman chapmanb at 50mail.com
Wed Dec 30 12:59:42 UTC 2009


Hello;

> I downloaded data from Phytozome Biomart:
> 
> >AC159145_38|MtChr2|AC159145_38|Mtruncatula|17915949|17918990|-1
> ATTTCCTCCAGACTTGTTAAAGAAGTTGAGTACAGATTGTATTGTCATGCAAAATCATCA
> ATATGGCATATCCCCAGTAAAACTCCTGGGAAATCAAAAGCTATCGAGTTTTTTCGAGAT
> CTTGACAACTTCCAACGATCAAGATGATAAGGTTTATGTCTCTACAGTACGTTCACGTAA
> CTATCCCGTGACTGGCTTCCAATGGCATCCTGAGAAAAATGCCTTCGAATGGGGCTCACC
> AAGCATTCCACACACAGAGGATGCCATTCGAACAACTCAGTATGCTGCAAACTATTTGGT
> CAGTGAAGCGAGGAAGTCCTTAAACAGACCAGTTGCTCAGGAATTGTTAGACAATCTCAT
> ATACAATTACAGACCCACTTATTGTGGGTATGCAGGTTGTCCACCGCCTAATCCGAACCT
> CTACTACCAGCCGGTCATTGGAATTCTCAGCCACCCCGGCGATGGCACTTCAGGCCGCCA
> CAGTAATGCTACGGGCGCTTCCTTCATTCACGCCTCTTATGTGAAATTCGTGGAGGCTGC
> TGGCGCTAGAGTAGTTCCTCTCATTTACAACGAACCGGAGGAGAAGATTCTCAAGGTATC
> AGAAAAGGCCAAAGCTTGA
> 
> The above data is from -1 strand, but how could I convert it +1 strand?

If you got this from BioMart and retrieved something like cDNA
sequence or transcript, this is probably already reverse
complemented for you. In this case it looks like a coding sequence
starting at base 47 and proceeding to the stop codon at the end.

To answer your question, please see the Tutorial documentation,
specifically Chapter 5 Sequence Input/Output:

http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc44

and section 3.7 Nucleotide sequences and (reverse) complements:

http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc23

This should lead you to:

in_file = "your_data.fa"
with open(in_file) as in_handle:
    rec = SeqIO.read(in_handle, "fasta")

rc = rec.seq.reverse_complement()

Hope this helps,
Brad



More information about the Biopython mailing list