Biopython Tutorial and Cookbook Jeff Chang, Brad Chapman, Iddo Friedberg, Thomas Hamelryck, Michiel de Hoon, Peter Cock, Tiago Ant~ao Last Update { 15 December 2009 (Biopython 1.53) Contents 1 Introduction 6 1.1 What is Biopython?.........................................6 1.2 What can I find in the Biopython package.............................6 1.3 Installing Biopython.........................................7 1.4 FAQ..................................................7 2 Quick Start { What can you do with Biopython? 10 2.1 General overview of what Biopython provides........................... 10 2.2 Working with sequences....................................... 10 2.3 A usage example........................................... 11 2.4 Parsing sequence file formats.................................... 12 2.4.1 Simple FASTA parsing example............................... 12 2.4.2 Simple GenBank parsing example............................. 13 2.4.3 I love parsing { please don't stop talking about it!.................... 13 2.5 Connecting with biological databases................................ 13 2.6 What to do next........................................... 14 3 Sequence objects 15 3.1 Sequences and Alphabets...................................... 15 3.2 Sequences act like strings...................................... 16 3.3 Slicing a sequence.......................................... 17 3.4 Turning Seq objects into strings................................... 18 3.5 Concatenating or adding sequences................................. 18 3.6 Changing case............................................. 19 3.7 Nucleotide sequences and (reverse) complements......................... 19 3.8 Transcription............................................. 20 3.9 Translation.............................................. 21 3.10 Translation Tables.......................................... 23 3.11 Comparing Seq objects........................................ 25 3.12 MutableSeq objects.......................................... 26 3.13 UnknownSeq objects......................................... 27 3.14 Working with directly strings.................................... 28 4 Sequence Record objects 29 4.1 The SeqRecord object........................................ 29 4.2 Creating a SeqRecord........................................ 30 4.2.1 SeqRecord objects from scratch............................... 30 4.2.2 SeqRecord objects from FASTA files............................ 31 4.2.3 SeqRecord objects from GenBank files........................... 32 4.3 SeqFeature objects.......................................... 33 1 4.3.1 SeqFeatures themselves................................... 33 4.3.2 Locations........................................... 35 4.4 References............................................... 36 4.5 The format method.......................................... 37 4.6 Slicing a SeqRecord......................................... 37 4.7 Adding SeqRecord objects...................................... 40 5 Sequence Input/Output 42 5.1 Parsing or Reading Sequences.................................... 42 5.1.1 Reading Sequence Files................................... 42 5.1.2 Iterating over the records in a sequence file........................ 43 5.1.3 Getting a list of the records in a sequence file....................... 44 5.1.4 Extracting data........................................ 45 5.2 Parsing sequences from the net................................... 47 5.2.1 Parsing GenBank records from the net........................... 47 5.2.2 Parsing SwissProt sequences from the net......................... 48 5.3 Sequence files as Dictionaries.................................... 49 5.3.1 Specifying the dictionary keys................................ 50 5.3.2 Indexing a dictionary using the SEGUID checksum.................... 50 5.3.3 Indexing really large files.................................. 51 5.4 Writing Sequence Files........................................ 52 5.4.1 Converting between sequence file formats......................... 54 5.4.2 Converting a file of sequences to their reverse complements............... 55 5.4.3 Getting your SeqRecord objects as formatted strings................... 56 6 Sequence Alignment Input/Output, and Alignment Tools 57 6.1 Parsing or Reading Sequence Alignments............................. 57 6.1.1 Single Alignments...................................... 58 6.1.2 Multiple Alignments..................................... 60 6.1.3 Ambiguous Alignments................................... 62 6.2 Writing Alignments.......................................... 64 6.2.1 Converting between sequence alignment file formats................... 65 6.2.2 Getting your Alignment objects as formatted strings................... 67 6.3 Alignment Tools........................................... 68 6.3.1 ClustalW........................................... 68 6.3.2 MUSCLE........................................... 71 6.3.3 MUSCLE using stdout.................................... 72 6.3.4 MUSCLE using stdin and stdout.............................. 72 6.3.5 EMBOSS needle and water................................. 73 7 BLAST 76 7.1 Running BLAST over the Internet................................. 76 7.2 Running BLAST locally....................................... 78 7.2.1 Introduction......................................... 78 7.2.2 Standalone NCBI \legacy" BLAST............................. 78 7.2.3 Standalone NCBI BLAST+................................. 78 7.2.4 WU-BLAST and AB-BLAST................................ 79 7.3 Parsing BLAST output....................................... 79 7.4 The BLAST record class....................................... 81 7.5 Deprecated BLAST parsers..................................... 82 7.5.1 Parsing plain-text BLAST output............................. 82 7.5.2 Parsing a plain-text BLAST file full of BLAST runs................... 85 2 7.5.3 Finding a bad record somewhere in a huge plain-text BLAST file............ 86 7.6 Dealing with PSI-BLAST...................................... 87 7.7 Dealing with RPS-BLAST...................................... 87 8 Accessing NCBI's Entrez databases 88 8.1 Entrez Guidelines........................................... 89 8.2 EInfo: Obtaining information about the Entrez databases.................... 89 8.3 ESearch: Searching the Entrez databases.............................. 91 8.4 EPost: Uploading a list of identifiers................................ 92 8.5 ESummary: Retrieving summaries from primary IDs....................... 93 8.6 EFetch: Downloading full records from Entrez........................... 93 8.7 ELink: Searching for related items in NCBI Entrez........................ 96 8.8 EGQuery: Global Query - counts for search terms........................ 97 8.9 ESpell: Obtaining spelling suggestions............................... 98 8.10 Parsing huge Entrez XML files................................... 98 8.11 Specialized parsers.......................................... 99 8.11.1 Parsing Medline records................................... 99 8.11.2 Parsing GEO records..................................... 101 8.11.3 Parsing UniGene records................................... 102 8.12 Using a proxy............................................. 103 8.13 Examples............................................... 103 8.13.1 PubMed and Medline.................................... 103 8.13.2 Searching, downloading, and parsing Entrez Nucleotide records............. 105 8.13.3 Searching, downloading, and parsing GenBank records.................. 106 8.13.4 Finding the lineage of an organism............................. 108 8.13.5 Searching for citations.................................... 109 8.14 Using the history and WebEnv................................... 109 8.14.1 Searching for and downloading sequences using the history............... 109 8.14.2 Searching for and downloading abstracts using the history................ 110 9 Swiss-Prot and ExPASy 112 9.1 Parsing Swiss-Prot files....................................... 112 9.1.1 Parsing Swiss-Prot records................................. 112 9.1.2 Parsing the Swiss-Prot keyword and category list..................... 114 9.2 Parsing Prosite records........................................ 115 9.3 Parsing Prosite documentation records............................... 116 9.4 Parsing Enzyme records....................................... 116 9.5 Accessing the ExPASy server.................................... 118 9.5.1 Retrieving a Swiss-Prot record............................... 118 9.5.2 Searching Swiss-Prot..................................... 119 9.5.3 Retrieving Prosite and Prosite documentation records.................. 119 9.6 Scanning the Prosite database.................................... 120 10 Going 3D: The PDB module 122 10.1 Structure representation....................................... 122 10.1.1 Structure........................................... 124 10.1.2 Model............................................. 125 10.1.3 Chain............................................. 125 10.1.4 Residue............................................ 125 10.1.5 Atom............................................. 126 10.2 Disorder................................................ 127 10.2.1 General approach....................................... 127 3 10.2.2 Disordered atoms....................................... 127 10.2.3 Disordered residues...................................... 127 10.3 Hetero residues............................................ 128 10.3.1 Associated
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages203 Page
-
File Size-