Presentation is loading. Please wait.

Presentation is loading. Please wait.

BioPython Tutorial Joe Steele Ishwor Thapa. BioPython home page ial.html.

Similar presentations


Presentation on theme: "BioPython Tutorial Joe Steele Ishwor Thapa. BioPython home page ial.html."— Presentation transcript:

1 BioPython Tutorial Joe Steele Ishwor Thapa

2 BioPython home page ial.html ial.html

3 Content Automatically parses files into python data structures, with support for : BLAST output Clustalw FASTA GenBank PubMed and Medline SwissProt UniGene Interfaces to: Standalone Blast Clustalw EMBOSS command line tools BioSQL many others….

4 Where? Requires python Installed on biobase.ist.unomaha.edu bio-linux.ist.unomaha.edu >python my_biopython_routine.py

5 Handling Sequences from Bio.Seq import Seq #from Bio import * #from Bio import Entrez my_seq = Seq("AGTACACTGGTT") print my_seq print my_seq.alphabet print "my_seq complement" print my_seq.complement() print "my_seq reverse_complement" print my_seq.reverse_complement() print "Change the case." print my_seq.lower() print my_seq.upper()

6 Sequences from Bio import SeqIO from Bio.Seq import Seq my_seq = Seq("AGTACACTGGTT") print "How many G's are in my_seq?" print my_seq.count("G") print "my_seq is an array. Print elements 2 to 7." print my_seq[2:8] print "Print every other element." print my_seq[0::2] print "Reverse it." print my_seq[::-1] print "I just want a regular string." print str(my_seq) print "Make the sequence longer." more_seq = Seq("GGGGGGGGG") print my_seq + more_seq

7 Translate print "my_seq is a CDS. What protein does it make?" print my_seq.translate()

8 Read a FASTA file print "Run over a fasta file:" for seq_record in SeqIO.parse("af fasta","fasta"): print seq_record.id print repr(seq_record.seq) print len(seq_record)

9 Read a GenBank file print "Run over a genbank file:" for seq_record in SeqIO.parse("ls_orchid.gbk","genbank"): print seq_record.id print repr(seq_record.seq) print len(seq_record) count = SeqIO.write(seq_record, "ls_orchid.fasta", "fasta") print "Converted %i records" % count

10 Convert files count = SeqIO.convert("ls_orchid.gbk", "genbank", "ls_orchid.fasta", "fasta") print "Converted %i records" % count ##help(SeqIO.convert) Write out the reverse complement: records = (make_rc_record(rec) for rec in SeqIO.parse("ls_orchid.fasta", "fasta") if len(rec)<700) SeqIO.write(records, "rev_comp.fasta", "fasta")


Download ppt "BioPython Tutorial Joe Steele Ishwor Thapa. BioPython home page ial.html."

Similar presentations


Ads by Google