欢迎来到传世资源网!
加载中...
正在加载,请耐心等待...
本站为收藏、学习站,如有侵权,请联系管理员删除!

Biopython Tutorial.pdf

介绍 评论 失效链接反馈

Biopython Tutorial.pdf Python-第1张Biopython Tutorial.pdf Python-第2张Biopython Tutorial.pdf Python-第3张Biopython Tutorial.pdf Python-第4张Biopython Tutorial.pdf Python-第5张Biopython Tutorial.pdf Python-第6张Biopython Tutorial.pdf Python-第7张Biopython Tutorial.pdf Python-第8张Biopython Tutorial.pdf Python-第9张
Contents1 Introduction 91.1 What is Biopython? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.2 What can I find in the Biopython package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.3 Installing Biopython . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.4 Frequently Asked Questions (FAQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Quick Start – What can you do with Biopython? 152.1 General overview of what Biopython provides . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2 Working with sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3 A usage example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.4 Parsing sequence file formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.4.1 Simple FASTA parsing example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.4.2 Simple GenBank parsing example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.4.3 I love parsing – please don’t stop talking about it! . . . . . . . . . . . . . . . . . . . . 182.5 Connecting with biological databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.6 What to do next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Sequence objects 203.1 Sequences and Alphabets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.2 Sequences act like strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3 Slicing a sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.4 Turning Seq objects into strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.5 Concatenating or adding sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.6 Changing case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.7 Nucleotide sequences and (reverse) complements . . . . . . . . . . . . . . . . . . . . . . . . . 253.8 Transcription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.9 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.10 Translation Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293.11 Comparing Seq objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303.12 MutableSeq objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313.13 UnknownSeq objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333.14 Working with strings directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 Sequence annotation objects 354.1 The SeqRecord object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354.2 Creating a SeqRecord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364.2.1 SeqRecord objects from scratch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364.2.2 SeqRecord objects from FASTA files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.2.3 SeqRecord objects from GenBank files . . . . . . . . . . . . . . . . . . . . . . . . . . . 384.3 Feature, location and position objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3914.3.1 SeqFeature objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.3.2 Positions and locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.3.3 Sequence described by a feature or location . . . . . . . . . . . . . . . . . . . . . . . . 434.4 Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.6 The format method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.7 Slicing a SeqRecord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.8 Adding SeqRecord objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.9 Reverse-complementing SeqRecord objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Sequence Input/Output 515.1 Parsing or Reading Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515.1.1 Reading Sequence Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525.1.2 Iterating over the records in a sequence file . . . . . . . . . . . . . . . . . . . . . . . . 525.1.3 Getting a list of the records in a sequence file . . . . . . . . . . . . . . . . . . . . . . . 535.1.4 Extracting data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545.2 Parsing sequences from compressed files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565.3 Parsing sequences from the net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575.3.1 Parsing GenBank records from the net . . . . . . . . . . . . . . . . . . . . . . . . . . . 575.3.2 Parsing SwissProt sequences from the net . . . . . . . . . . . . . . . . . . . . . . . . . 585.4 Sequence files as Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595.4.1 Sequence files as Dictionaries – In memory . . . . . . . . . . . . . . . . . . . . . . . . 595.4.2 Sequence files as Dictionaries – Indexed files . . . . . . . . . . . . . . . . . . . . . . . . 615.4.3 Sequence files as Dictionaries – Database indexed files . . . . . . . . . . . . . . . . . . 635.4.4 Indexing compressed files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645.4.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.5 Writing Sequence Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665.5.1 Round trips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675.5.2 Converting between sequence file formats . . . . . . . . . . . . . . . . . . . . . . . . . 675.5.3 Converting a file of sequences to their reverse complements . . . . . . . . . . . . . . . 685.5.4 Getting your SeqRecord objects as formatted strings . . . . . . . . . . . . . . . . . . . 695.6 Low level FASTA and FASTQ parsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 Multiple Sequence Alignment objects 716.1 Parsing or Reading Sequence Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716.1.1 Single Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726.1.2 Multiple Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.1.3 Ambiguous Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766.2 Writing Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786.2.1 Converting between sequence alignment file formats . . . . . . . . . . . . . . . . . . . 796.2.2 Getting your alignment objects as formatted strings . . . . . . . . . . . . . . . . . . . 816.3 Manipulating Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826.3.1 Slicing alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826.3.2 Alignments as arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856.4 Alignment Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856.4.1 ClustalW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 866.4.2 MUSCLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876.4.3 MUSCLE using stdout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886.4.4 MUSCLE using stdin and stdout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896.4.5 EMBOSS needle and water . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916.4.6 Biopython’s pairwise2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 936.5 Pairwise sequence alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9526.5.1 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 956.5.2 The pairwise aligner object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966.5.3 Match and mismatch scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966.5.4 Affine gap scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 976.5.5 General gap scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 986.5.6 Iterating over alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006.5.7 Alignment objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1016.5.8 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027 BLAST 1057.1 Running BLAST over the Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057.2 Running BLAST locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077.2.2 Standalone NCBI BLAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077.2.3 Other versions of BLAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087.3 Parsing BLAST output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087.4 The BLAST record class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1107.5 Deprecated BLAST parsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1117.5.1 Parsing plain-text BLAST output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1117.5.2 Parsing a plain-text BLAST file full of BLAST runs . . . . . . . . . . . . . . . . . . . 1147.5.3 Finding a bad record somewhere in a huge plain-text BLAST file . . . . . . . . . . . . 1157.6 Dealing with PSI-BLAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1167.7 Dealing with RPS-BLAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1168 BLAST and other sequence search tools 1178.1 The SearchIO object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1178.1.1 QueryResult . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1188.1.2 Hit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1238.1.3 HSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1258.1.4 HSPFragment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1298.2 A note about standards and conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1308.3 Reading search output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318.4 Dealing with large search output files with indexing . . . . . . . . . . . . . . . . . . . . . . . 1318.5 Writing and converting search output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1329 Accessing NCBI’s Entrez databases 1349.1 Entrez Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1359.2 EInfo: Obtaining information about the Entrez databases . . . . . . . . . . . . . . . . . . . . 1369.3 ESearch: Searching the Entrez databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1389.4 EPost: Uploading a list of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1399.5 ESummary: Retrieving summaries from primary IDs . . . . . . . . . . . . . . . . . . . . . . . 1399.6 EFetch: Downloading full records from Entrez . . . . . . . . . . . . . . . . . . . . . . . . . . . 1409.7 ELink: Searching for related items in NCBI Entrez . . . . . . . . . . . . . . . . . . . . . . . . 1439.8 EGQuery: Global Query - counts for search terms . . . . . . . . . . . . . . . . . . . . . . . . 1449.9 ESpell: Obtaining spelling suggestions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.10 Parsing huge Entrez XML files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.11 Handling errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469.12 Specialized parsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489.12.1 Parsing Medline records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489.12.2 Parsing GEO records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509.12.3 Parsing UniGene records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509.13 Using a proxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15239.14 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.14.1 PubMed and Medline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.14.2 Searching, downloading, and parsing Entrez Nucleotide records . . . . . . . . . . . . . 1549.14.3 Searching, downloading, and parsing GenBank records . . . . . . . . . . . . . . . . . . 1559.14.4 Finding the lineage of an organism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1579.15 Using the history and WebEnv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1589.15.1 Searching for and downloading sequences using the history . . . . . . . . . . . . . . . 1589.15.2 Searching for and downloading abstracts using the history . . . . . . . . . . . . . . . . 1599.15.3 Searching for citations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16010 Swiss-Prot and ExPASy 16210.1 Parsing Swiss-Prot files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16210.1.1 Parsing Swiss-Prot records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16210.1.2 Parsing the Swiss-Prot keyword and category list . . . . . . . . . . . . . . . . . . . . . 16410.2 Parsing Prosite records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16510.3 Parsing Prosite documentation records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16610.4 Parsing Enzyme records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16710.5 Accessing the ExPASy server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16810.5.1 Retrieving a Swiss-Prot record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16810.5.2 Searching Swiss-Prot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16910.5.3 Retrieving Prosite and Prosite documentation records . . . . . . . . . . . . . . . . . . 16910.6 Scanning the Prosite database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17011 Going 3D: The PDB module 17211.1 Reading and writing crystal structure files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17211.1.1 Reading a PDB file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17211.1.2 Reading an mmCIF file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17311.1.3 Reading files in the MMTF format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17311.1.4 Reading files in the PDB XML format . . . . . . . . . . . . . . . . . . . . . . . . . . . 17411.1.5 Writing PDB files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17411.1.6 Writing mmCIF files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17411.2 Structure representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17511.2.1 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17711.2.2 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17711.2.3 Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17711.2.4 Residue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17811.2.5 Atom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17911.2.6 Extracting a specific Atom/Residue/Chain/Model from a Structure . . . . . . . . . . . 18011.3 Disorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18011.3.1 General approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18011.3.2 Disordered atoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18011.3.3 Disordered residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18111.4 Hetero residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18111.4.1 Associated problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18111.4.2 Water residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18111.4.3 Other hetero residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18211.5 Navigating through a Structure object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18211.6 Analyzing structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18511.6.1 Measuring distances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18511.6.2 Measuring angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18511.6.3 Measuring torsion angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18511.6.4 Determining atom-atom contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185411.6.5 Superimposing two structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18511.6.6 Mapping the residues of two related structures onto each other . . . . . . . . . . . . . 18611.6.7 Calculating the Half Sphere Exposure . . . . . . . . . . . . . . . . . . . . . . . . . . . 18611.6.8 Determining the secondary structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18611.6.9 Calculating the residue depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18611.7 Common problems in PDB files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18711.7.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18811.7.2 Automatic correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18811.7.3 Fatal errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18811.8 Accessing the Protein Data Bank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18911.8.1 Downloading structures from the Protein Data Bank . . . . . . . . . . . . . . . . . . . 18911.8.2 Downloading the entire PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18911.8.3 Keeping a local copy of the PDB up to date . . . . . . . . . . . . . . . . . . . . . . . . 19011.9 General questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19011.9.1 How well tested is Bio.PDB? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19011.9.2 How fast is it? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19011.9.3 Is there support for molecular graphics? . . . . . . . . . . . . . . . . . . . . . . . . . . 19011.9.4 Who’s using Bio.PDB? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19112 Bio.PopGen: Population genetics 19212.1 GenePop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19213 Phylogenetics with Bio.Phylo 19413.1 Demo: What’s in a Tree? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19413.1.1 Coloring branches within a tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.2 I/O functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19813.3 View and export trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19913.4 Using Tree and Clade objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20313.4.1 Search and traversal methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20313.4.2 Information methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20513.4.3 Modification methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20513.4.4 Features of PhyloXML trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20613.5 Running external applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20613.6 PAML integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20713.7 Future plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20714 Sequence motif analysis using Bio.motifs 20914.1 Motif objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20914.1.1 Creating a motif from instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20914.1.2 Creating a sequence logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21114.2 Reading motifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21214.2.1 JASPAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21214.2.2 MEME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21814.2.3 TRANSFAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22114.3 Writing motifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22414.4 Position-Weight Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22514.5 Position-Specific Scoring Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22614.6 Searching for instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22714.6.1 Searching for exact matches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22714.6.2 Searching for matches using the PSSM score . . . . . . . . . . . . . . . . . . . . . . . 22814.6.3 Selecting a score threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22814.7 Each motif object has an associated Position-Specific Scoring Matrix . . . . . . . . . . . . . . 229514.8 Comparing motifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23214.9 De novo motif finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23314.9.1 MEME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23314.10Useful links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23415 Cluster analysis 23515.1 Distance functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23615.2 Calculating cluster properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23915.3 Partitioning algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24115.4 Hierarchical clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24415.5 Self-Organizing Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24815.6 Principal Component Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25015.7 Handling Cluster/TreeView-type files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25115.8 Example calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25716 Supervised learning methods 25816.1 The Logistic Regression Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25816.1.1 Background and Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25816.1.2 Training the logistic regression model . . . . . . . . . . . . . . . . . . . . . . . . . . . 25916.1.3 Using the logistic regression model for classification . . . . . . . . . . . . . . . . . . . 26116.1.4 Logistic Regression, Linear Discriminant Analysis, and Support Vector Machines . . . 26316.2 k-Nearest Neighbors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26316.2.1 Background and purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26316.2.2 Initializing a k-nearest neighbors model . . . . . . . . . . . . . . . . . . . . . . . . . . 26416.2.3 Using a k-nearest neighbors model for classification . . . . . . . . . . . . . . . . . . . . 26416.3 Na¨ıve Bayes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26616.4 Maximum Entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26616.5 Markov Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26617 Graphics including GenomeDiagram 26717.1 GenomeDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26717.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26717.1.2 Diagrams, tracks, feature-sets and features . . . . . . . . . . . . . . . . . . . . . . . . 26717.1.3 A top down example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26817.1.4 A bottom up example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27017.1.5 Features without a SeqFeature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27017.1.6 Feature captions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27117.1.7 Feature sigils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27317.1.8 Arrow sigils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27317.1.9 A nice example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27717.1.10Multiple tracks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27817.1.11 Cross-Links between tracks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28117.1.12 Further options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.1.13 Converting old code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.2 Chromosomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.2.1 Simple Chromosomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.2.2 Annotated Chromosomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28918 KEGG 29118.1 Parsing KEGG records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29118.2 Querying the KEGG API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291619 Bio.phenotype: analyse phenotypic data 29419.1 Phenotype Microarrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29419.1.1 Parsing Phenotype Microarray data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29419.1.2 Manipulating Phenotype Microarray data . . . . . . . . . . . . . . . . . . . . . . . . . 29519.1.3 Writing Phenotype Microarray data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29820 Cookbook – Cool things to do with it 29920.1 Working with sequence files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29920.1.1 Filtering a sequence file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29920.1.2 Producing randomised genomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30020.1.3 Translating a FASTA file of CDS entries . . . . . . . . . . . . . . . . . . . . . . . . . . 30220.1.4 Making the sequences in a FASTA file upper case . . . . . . . . . . . . . . . . . . . . . 30220.1.5 Sorting a sequence file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30320.1.6 Simple quality filtering for FASTQ files . . . . . . . . . . . . . . . . . . . . . . . . . . 30420.1.7 Trimming off primer sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30520.1.8 Trimming off adaptor sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30620.1.9 Converting FASTQ files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30720.1.10 Converting FASTA and QUAL files into FASTQ files . . . . . . . . . . . . . . . . . . . 30920.1.11 Indexing a FASTQ file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30920.1.12 Converting SFF files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31020.1.13 Identifying open reading frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31120.2 Sequence parsing plus simple plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31320.2.1 Histogram of sequence lengths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31320.2.2 Plot of sequence GC% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31420.2.3 Nucleotide dot plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31520.2.4 Plotting the quality scores of sequencing read data . . . . . . . . . . . . . . . . . . . . 31720.3 Dealing with alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31820.3.1 Calculating summary information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31920.3.2 Calculating a quick consensus sequence . . . . . . . . . . . . . . . . . . . . . . . . . . 31920.3.3 Position Specific Score Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32020.3.4 Information Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32120.4 Substitution Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32320.4.1 Using common substitution matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32320.4.2 Creating your own substitution matrix from an alignment . . . . . . . . . . . . . . . . 32320.5 BioSQL – storing sequences in a relational database . . . . . . . . . . . . . . . . . . . . . . . 32521 The Biopython testing framework 32621.1 Running the tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32621.1.1 Running the tests using Tox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32721.2 Writing tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32721.2.1 Writing a print-and-compare test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32821.2.2 Writing a unittest-based test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32921.3 Writing doctests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33221.4 Writing doctests in the Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33322 Advanced 33422.1 Parser Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33422.2 Substitution Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33422.2.1 SubsMat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33422.2.2 FreqTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337723 Where to go from here – contributing to Biopython 33923.1 Bug Reports Feature Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33923.2 Mailing lists and helping newcomers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33923.3 Contributing Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33923.4 Contributing cookbook examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33923.5 Maintaining a distribution for a platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34023.6 Contributing Unit Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34023.7 Contributing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34124 Appendix: Useful stuff about Python 34224.1 What the heck is a handle? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34224.1.1 Creating a handle from a string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

下载声明:

本站资源均有第三方用户自行上传分享推荐,非本站自制,仅供玩家做交流学习之用!切勿用于商业用途!游戏作品版权归原作者享有,如有版权问题,请附带版权证明至邮件,本平台将应您的要求删除。
相关推荐:

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复