### Check Biopython Installation Source: https://biopython.org/wiki/Documentation/wiki/Getting_Started Verify if Biopython is correctly installed by attempting to import the Bio module. An ImportError indicates a problem with the installation. ```Python import Bio ``` -------------------------------- ### Install Biopython from local source directory using pip Source: https://biopython.org/wiki/Documentation/wiki/Download Installs Biopython from the current directory, assuming it contains the source code. This is an alternative to `setup.py install` for installing local packages. ```Bash pip install . ``` -------------------------------- ### Install Biopython on FreeBSD using Ports Source: https://biopython.org/wiki/Documentation/wiki/Packages Install Biopython on FreeBSD systems using the Ports Collection. This command navigates to the port directory and initiates the build and installation process. ```Shell cd /usr/ports/biology/py-biopython make install clean ``` -------------------------------- ### Build and install Biopython from source using setup.py Source: https://biopython.org/wiki/Documentation/wiki/Download Compiles, tests, and installs Biopython from its source code using the traditional `setup.py` script. This method requires a C compiler and Python development headers. ```Bash python setup.py build python setup.py test python setup.py install ``` -------------------------------- ### Install Biopython on Gentoo using emerge Source: https://biopython.org/wiki/Documentation/wiki/Packages Install Biopython on Gentoo Linux using the emerge package manager from the portage tree. ```Shell emerge -va biopython ``` -------------------------------- ### Install and Test Biopython from Source Tarball Source: https://biopython.org/wiki/Documentation/wiki/Building_a_release This snippet shows how to install the extracted Biopython source distribution into a temporary prefix and then run its comprehensive test suite. This step ensures the integrity and functionality of the distributed package, with common failures indicating missing example files in `MANIFEST.in`. ```bash python -m pip install . --prefix /tmp/test-install cd Tests && python run_tests.py ``` -------------------------------- ### Install Biopython on Ubuntu or Debian using apt-get Source: https://biopython.org/wiki/Documentation/wiki/Packages Install Biopython and its dependencies on Ubuntu or Debian systems using apt-get. Separate commands are provided for the core library, documentation, unit tests, and BioSQL support. ```Shell sudo apt-get install python-biopython ``` ```Shell sudo apt-get install python-biopython-doc ``` ```Shell sudo apt-get install python-biopython-sql ``` ```Shell sudo apt-get build-dep python-biopython ``` -------------------------------- ### Biopython 1.70 Release Downloads Source: https://biopython.org/wiki/Documentation/wiki/Download Download options for Biopython version 1.70, including source code archives, PyPI wheels, and the tutorial PDF. ```APIDOC Biopython 1.70: Source Tarball: http://biopython.org/DIST/biopython-1.70.tar.gz (15Mb, 11 July 2017) Source Zip: http://biopython.org/DIST/biopython-1.70.zip (16Mb) PyPI Wheels: https://pypi.python.org/pypi/biopython/1.70 Tutorial PDF: http://biopython.org/DIST/docs/tutorial/Tutorial-1.70.pdf ``` -------------------------------- ### Demonstrate Biopython Seq Object and Methods Source: https://biopython.org/wiki/Documentation/wiki/Getting_Started Illustrates basic usage of Biopython's Seq object. It creates a sequence, then prints its length, reverse complement, and protein translation, showcasing fundamental sequence manipulation. ```Python from Bio.Seq import Seq # create a sequence object my_seq = Seq("CATGTAGACTAG") # print out some details about it print("seq %s is %i bases long" % (my_seq, len(my_seq))) print("reverse complement is %s" % my_seq.reverse_complement()) print("protein translation is %s" % my_seq.translate()) ``` -------------------------------- ### Biopython 1.71 Release Downloads Source: https://biopython.org/wiki/Documentation/wiki/Download Download options for Biopython version 1.71, including source code archives, PyPI wheels, and the tutorial PDF. ```APIDOC Biopython 1.71: Source Tarball: http://biopython.org/DIST/biopython-1.71.tar.gz (16Mb, 4 April 2018) Source Zip: http://biopython.org/DIST/biopython-1.71.zip (17Mb) PyPI Wheels: https://pypi.python.org/pypi/biopython/1.71 Tutorial PDF: http://biopython.org/DIST/docs/tutorial/Tutorial-1.71.pdf ``` -------------------------------- ### Biopython 1.72 Release Downloads Source: https://biopython.org/wiki/Documentation/wiki/Download Download options for Biopython version 1.72, including source code, PyPI wheels, and the tutorial PDF. ```APIDOC Biopython 1.72: Source Zip: http://biopython.org/DIST/biopython-1.72.zip (17Mb) PyPI Wheels: https://pypi.python.org/pypi/biopython/1.72 Tutorial PDF: http://biopython.org/DIST/docs/tutorial/Tutorial-1.72.pdf ``` -------------------------------- ### Install Xcode command line tools on macOS Source: https://biopython.org/wiki/Documentation/wiki/Download Installs Apple's command line developer tools, which are required for compiling Biopython from source on macOS. This command initiates the installation process. ```Bash xcode-select --install ``` -------------------------------- ### Install Biopython using pip Source: https://biopython.org/wiki/Documentation/wiki/Packages Recommended method to install Biopython using Python's package manager pip. This command installs the core Biopython library. ```Shell pip install biopython ``` -------------------------------- ### Install Biopython using pip Source: https://biopython.org/wiki/Documentation/wiki/Download Installs the latest stable version of Biopython using the Python package installer, pip. This is the recommended method for most users. ```Bash pip install biopython ``` -------------------------------- ### Biopython 1.69 Release Downloads Source: https://biopython.org/wiki/Documentation/wiki/Download Download options for Biopython version 1.69, including source code, various 32-bit Windows installers for Python 2.7, 3.3, 3.4, 3.5, 3.6, and the tutorial PDF. ```APIDOC Biopython 1.69: Source Tarball: http://biopython.org/DIST/biopython-1.69.tar.gz (15Mb, 7 April 2017) Source Zip: http://biopython.org/DIST/biopython-1.69.zip (16Mb) Windows Installers (32-bit): Python 2.7: .exe (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py2.7.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py2.7.msi Python 3.3: .exe (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.3.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.3.msi Python 3.4: .exe (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.4.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.4.msi Python 3.5: .exe (3Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.5.exe, .msi (3Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.5.msi Python 3.6: .exe (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.6.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.69.win32-py3.6.msi Tutorial PDF: http://biopython.org/DIST/docs/tutorial/Tutorial-1.69.pdf ``` -------------------------------- ### Install Biopython on Windows using full pip path Source: https://biopython.org/wiki/Documentation/wiki/Download Demonstrates how to install Biopython on Windows by providing the full path to the pip executable. This is necessary if Python and pip are not added to the system's PATH environment variable. ```Bash C:\Python39\Scripts\pip install biopython ``` -------------------------------- ### Launch IPython with Matplotlib integration Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_phylo Start the IPython interpreter with the `-pylab` flag to enable `matplotlib` integration. This setup allows graphics to pop up automatically, which is useful for interactive visualization during the demo. ```Bash $ ipython -pylab ``` -------------------------------- ### Run all Biopython tests during setup Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_testing This command executes the entire Biopython test suite as part of the `setup.py` build and installation process. It's typically run from the top-level Biopython source directory to ensure all components are working correctly. ```Shell python setup.py test ``` -------------------------------- ### Biopython 1.68 Release Downloads Source: https://biopython.org/wiki/Documentation/wiki/Download Download options for Biopython version 1.68, including source code, various 32-bit Windows installers for Python 2.6, 2.7, 3.3, 3.4, 3.5, and the tutorial PDF. ```APIDOC Biopython 1.68: Source Tarball: http://biopython.org/DIST/biopython-1.68.tar.gz (14Mb, 26 August 2016) Source Zip: http://biopython.org/DIST/biopython-1.68.zip (15Mb) Windows Installers (32-bit): Python 2.6: .exe (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py2.6.exe Python 2.7: .exe (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py2.7.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py2.7.msi Python 3.3: .exe (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py3.3.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py3.3.msi Python 3.4: .exe (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py3.4.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py3.4.msi Python 3.5: .exe (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py3.5.exe, .msi (2Mb) http://biopython.org/DIST/biopython-1.68.win32-py3.5.msi Tutorial PDF: http://biopython.org/DIST/docs/tutorial/Tutorial-1.68.pdf ``` -------------------------------- ### Biopython 1.67 Release Downloads Source: https://biopython.org/wiki/Documentation/wiki/Download Download options for Biopython version 1.67, including source code archives. ```APIDOC Biopython 1.67: Source Tarball: http://biopython.org/DIST/biopython-1.67.tar.gz (14Mb, 8 June 2016) Source Zip: http://biopython.org/DIST/biopython-1.67.zip (15Mb) ``` -------------------------------- ### Example Fasta File Content Source: https://biopython.org/wiki/Documentation/wiki/SeqIO Shows an example of the resulting Fasta file content after conversion, highlighting the identifier, description, and sequence lines. ```Text >X55053.1 A.thaliana cor6.6 mRNA. AACAAAACACACATCAAAAACGATTTTACAAGAAAAAAATA... ... ``` -------------------------------- ### Install Git on Ubuntu/Debian Linux Source: https://biopython.org/wiki/Documentation/wiki/GitUsage This command installs the 'git-core' package on Ubuntu or Debian-based Linux distributions using the apt-get package manager. It is the recommended way to get Git on these systems. ```bash sudo apt-get install git-core ``` -------------------------------- ### Install Biopython on Archlinux using pacman Source: https://biopython.org/wiki/Documentation/wiki/Packages Install Biopython for Python 2 or Python 3 on Archlinux using the pacman package manager from the official repository. ```Shell pacman -S python2-biopython ``` ```Shell pacman -S python-biopython ``` -------------------------------- ### Install Biopython Python Package via pip Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_introduction This command-line snippet shows the recommended way to install the Biopython library. Using `pip`, Python's package installer, ensures that Biopython and its dependencies are correctly downloaded and set up in your environment, making all its functionalities available for use. ```Shell pip install biopython ``` -------------------------------- ### FASTQ Parsing Edge Case Example (Raw) Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.SeqIO.QualityIO Provides an example of a FASTQ header line, illustrating a potential issue where the "@" character can appear in the quality string, which might conflict with the start of a new sequence. ```FASTQ @071113_EAS56_0053:1:1:998:236 ``` -------------------------------- ### Example BWA MEM Command Line Usage in Biopython Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Sequencing.Applications Demonstrates how to initialize and print a BwaMemCommandline object for aligning reads to a reference genome using Biopython. It shows the basic setup for a single-end alignment command. ```Python from Bio.Sequencing.Applications import BwaMemCommandline reference_genome = "/path/to/reference_genome.fasta" read_file = "/path/to/read_1.fq" output_sam_file = "/path/to/output.sam" align_cmd = BwaMemCommandline(reference=reference_genome, read_file1=read_file) print(align_cmd) ``` -------------------------------- ### Python Example: Initializing SamtoolsCalmdCommandline Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Sequencing.Applications A Python code example demonstrating how to import and instantiate the SamtoolsCalmdCommandline class. It shows how to pass input BAM and reference FASTA file paths to construct the command line, which can then be printed. ```Python from Bio.Sequencing.Applications import SamtoolsCalmdCommandline input_bam = "/path/to/aln.bam" reference_fasta = "/path/to/reference.fasta" calmd_cmd = SamtoolsCalmdCommandline(input_bam=input_bam, reference=reference_fasta) print(calmd_cmd) ``` -------------------------------- ### Build Biopython Documentation PDF Source: https://biopython.org/wiki/Documentation/wiki/Building_a_release This snippet details the steps to install Sphinx requirements, build the Biopython documentation as a PDF, copy the generated PDF to the Doc directory, and clean up build artifacts. This process requires `latexmk` and other LaTeX tools to be installed. ```bash pip install -r .circleci/requirements-sphinx.txt make -C Doc latexpdf cp Doc/_build/latex/Biopython_doc.pdf Doc/ make clean -C Doc ``` -------------------------------- ### Print Biopython BLAST Records for Overview Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_blast This example demonstrates how to quickly get a summary of the parsed BLAST records by simply printing the `blast_records` object. The output provides a concise overview including the BLAST program, database, query details, and a list of top hits with their descriptions. ```Python >>> from Bio import Blast >>> with Blast.parse("my_blast.xml") as blast_records: ... print(blast_records) ... Program: BLASTN 2.2.27+ db: refseq_rna Query: 42291 (length=61) mystery_seq Hits: ---- ----- ---------------------------------------------------------- # # HSP ID + description ---- ----- ---------------------------------------------------------- 0 1 gi|262205317|ref|NR_030195.1| Homo sapiens microRNA 52... 1 1 gi|301171311|ref|NR_035856.1| Pan troglodytes microRNA... 2 1 gi|270133242|ref|NR_032573.1| Macaca mulatta microRNA ... 3 2 gi|301171322|ref|NR_035857.1| Pan troglodytes microRNA... 4 1 gi|301171267|ref|NR_035851.1| Pan troglodytes microRNA... 5 2 gi|262205330|ref|NR_030198.1| Homo sapiens microRNA 52... 6 1 gi|262205302|ref|NR_030191.1| Homo sapiens microRNA 51... 7 1 gi|301171259|ref|NR_035850.1| Pan troglodytes microRNA... 8 1 gi|262205451|ref|NR_030222.1| Homo sapiens microRNA 51... 9 2 gi|301171447|ref|NR_035871.1| Pan troglodytes microRNA... 10 1 gi|301171276|ref|NR_035852.1| Pan troglodytes microRNA... 11 1 gi|262205290|ref|NR_030188.1| Homo sapiens microRNA 51... 12 1 gi|301171354|ref|NR_035860.1| Pan troglodytes microRNA... 13 1 gi|262205281|ref|NR_030186.1| Homo sapiens microRNA 52... 14 2 gi|262205298|ref|NR_030190.1| Homo sapiens microRNA 52... 15 1 gi|301171394|ref|NR_035865.1| Pan troglodytes microRNA... 16 1 gi|262205429|ref|NR_030218.1| Homo sapiens microRNA 51... 17 1 gi|262205423|ref|NR_030217.1| Homo sapiens microRNA 52... 18 1 gi|301171401|ref|NR_035866.1| Pan troglodytes microRNA... 19 1 gi|270133247|ref|NR_032574.1| Macaca mulatta microRNA ... 20 1 gi|262205309|ref|NR_030193.1| Homo sapiens microRNA 52... 21 2 gi|270132717|ref|NR_032716.1| Macaca mulatta microRNA ... 22 2 gi|301171437|ref|NR_035870.1| Pan troglodytes microRNA... 23 2 gi|270133306|ref|NR_032587.1| Macaca mulatta microRNA ... 24 2 gi|301171428|ref|NR_035869.1| Pan troglodytes microRNA... 25 1 gi|301171211|ref|NR_035845.1| Pan troglodytes microRNA... 26 2 gi|301171153|ref|NR_035838.1| Pan troglodytes microRNA... 27 2 gi|301171146|ref|NR_035837.1| Pan troglodytes microRNA... ``` -------------------------------- ### Example Sanger FASTQ File Content Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.SeqIO.QualityIO An example of a Sanger-style FASTQ file containing three short reads, demonstrating the sequence and corresponding PHRED quality strings. ```text @EAS54_6_R1_2_1_413_324 CCCTTCTTGTCTTCAGCGTTTCTCC + ;;3;;;;;;;;;;;;7;;;;;;;88 @EAS54_6_R1_2_1_540_792 TTGGCAGGCCAAGGCCGATGGATCA + ;;;;;;;;;;;7;;;;;-;;;3;83 @EAS54_6_R1_2_1_443_348 GTTGCTTCTGGCGTGGGTGGGGGGG + ;;;;;;;;;;;9;7;;.7;393333 ``` -------------------------------- ### Test Git Installation Source: https://biopython.org/wiki/Documentation/wiki/GitUsage This command is used to verify that Git has been successfully installed on your system. Running it should display the Git help message, indicating that the 'git' command is recognized and executable. ```bash git --help ``` -------------------------------- ### Bio.Emboss.Applications.SeqmatchallCommandline API and Usage Example Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Emboss.Applications Detailed API documentation for the SeqmatchallCommandline class, including its constructor, base class, and properties. An example demonstrates how to instantiate and configure the command-line object for the 'seqmatchall' EMBOSS program. ```APIDOC class Bio.Emboss.Applications.SeqmatchallCommandline(cmd='seqmatchall', **kwargs) Bases: _EmbossCommandLine Description: Commandline object for the seqmatchall program from EMBOSS. Methods: __init__(cmd='seqmatchall', **kwargs) Description: Initialize the class. Properties: - aformat (string): Display output in a different specified output format. This controls the addition of the -aformat parameter and its associated value. Set this property to the argument value required. - auto (boolean): Turn off prompts. Automatic mode disables prompting, so we recommend you set this argument all the time when calling an EMBOSS tool from Biopython. This property controls the addition of the -auto switch, treat this property as a boolean. - debug (boolean): Write debug output to program.dbg. This property controls the addition of the -debug switch, treat this property as a boolean. - die (boolean): Report dying program messages. This property controls the addition of the -die switch, treat this property as a boolean. - error (boolean): Report errors. This property controls the addition of the -error switch, treat this property as a boolean. - filter (boolean): Read standard input, write standard output. This property controls the addition of the -filter switch, treat this property as a boolean. ``` ```python cline = SeqmatchallCommandline(sequence="opuntia.fasta", outfile="opuntia.txt") cline.auto = True cline.wordsize = 18 cline.aformat = "pair" print(cline) ``` -------------------------------- ### FastTreeCommandline __init__ Method Documentation Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Phylo.Applications Documentation for the `__init__` method of the Bio.Phylo.Applications.FastTreeCommandline class, explaining its initialization parameters. ```APIDOC __init__(cmd='fasttree', **kwargs) Initialize the class. ``` -------------------------------- ### Install Biopython on Fedora using yum Source: https://biopython.org/wiki/Documentation/wiki/Packages Install Biopython for Python 2 or Python 3 on Fedora systems using the yum package manager. ```Shell yum install python-biopython ``` ```Shell yum install python3-biopython ``` -------------------------------- ### Test Biopython Genepop EasyController Installation Source: https://biopython.org/wiki/Documentation/wiki/PopGen_Genepop This snippet demonstrates how to test the Biopython Genepop EasyController installation. It initializes an `EasyController` instance with a Genepop formatted file and attempts to retrieve basic information. An `IOError` indicates that the Genepop executable is not found. ```python from Bio.PopGen.GenePop.EasyController import EasyController ctrl = EasyController(your_file_here) print(ctrl.get_basic_info()) ``` -------------------------------- ### Get Help for Biopython's qblast Function Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_blast Shows how to use Python's built-in `help()` function to view the documentation and available arguments for the `Bio.Blast.qblast` function directly within the interpreter. ```python from Bio import Blast help(Blast.qblast) ``` -------------------------------- ### Install or update Biopython using Conda Source: https://biopython.org/wiki/Documentation/wiki/Packages Install or update Biopython using the Conda package manager from the conda-forge channel. This is recommended for users with Conda environments. ```Shell conda install -c conda-forge biopython ``` ```Shell conda update -c conda-forge biopython ``` -------------------------------- ### Example Sanger FASTQ File Content Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.SeqIO.QualityIO A short example of a FASTQ file demonstrating the Sanger convention with PHRED style qualities and an ASCII offset of 33. It contains three reads. ```text @EAS54_6_R1_2_1_413_324 CCCTTCTTGTCTTCAGCGTTTCTCC + ;;3;;;;;;;;;;;;7;;;;;;;88 @EAS54_6_R1_2_1_540_792 TTGGCAGGCCAAGGCCGATGGATCA + ;;;;;;;;;;;7;;;;;-;;;3;83 @EAS54_6_R1_2_1_443_348 GTTGCTTCTGGCGTGGGTGGGGGGG + ;;;;;;;;;;;9;7;;.7;393333 ``` -------------------------------- ### Example GenBank File Header Source: https://biopython.org/wiki/Documentation/wiki/SeqIO Provides an example of the typical header content found in a GenBank file, including LOCUS, DEFINITION, ACCESSION, and VERSION fields. ```Text LOCUS       ATCOR66M      513 bp    mRNA            PLN       02-MAR-1992 DEFINITION  A.thaliana cor6.6 mRNA. ACCESSION   X55053 VERSION     X55053.1  GI:16229 ... ``` -------------------------------- ### Get Aligned Subsequences with alignment.aligned in Biopython Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Align This snippet demonstrates how to use the `aligned` property of a `Bio.Align.Alignment` object to retrieve the start and end indices of aligned subsequences. It shows examples with different gap placements and how the property reflects the aligned regions, even when alignments differ only by gap positions. ```python >>> alignment.aligned array([[[0, 2], [4, 5]], [[0, 2], [2, 3]]]) >>> alignment = alignments[1] >>> print(alignment) target 0 GAACT 5 0 |-|-| 5 query 0 G-A-T 3 >>> alignment.aligned array([[[0, 1], [2, 3], [4, 5]], [[0, 1], [1, 2], [2, 3]]]) ``` ```python >>> aligner.mismatch_score = -10 >>> alignments = aligner.align("AAACAAA", "AAAGAAA") >>> len(alignments) 2 >>> print(alignments[0]) target 0 AAAC-AAA 7 0 |||--||| 8 query 0 AAA-GAAA 7 >>> alignments[0].aligned array([[[0, 3], [4, 7]], [[0, 3], [4, 7]]]) >>> print(alignments[1]) target 0 AAA-CAAA 7 0 |||--||| 8 query 0 AAAG-AAA 7 >>> alignments[1].aligned array([[[0, 3], [4, 7]], [[0, 3], [4, 7]]]) ``` -------------------------------- ### Ensure pip is installed for Python Source: https://biopython.org/wiki/Documentation/wiki/Download Verifies and installs the pip package manager for Python if it's not already present. This is a prerequisite for using pip to manage Python packages. ```Bash python -m ensurepip ``` -------------------------------- ### Update Biopython using pip Source: https://biopython.org/wiki/Documentation/wiki/Download Upgrades an existing Biopython installation to the latest version. This command also removes older versions of Biopython and NumPy before installing the new ones. ```Bash pip install biopython --upgrade ``` -------------------------------- ### Access Biopython qblast Function Documentation Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_blast Shows how to use Python's built-in `help()` function to view the documentation for the `NCBIWWW.qblast` function, providing details on its arguments and usage. ```python from Bio.Blast import NCBIWWW help(NCBIWWW.qblast) ``` -------------------------------- ### Build and Test Biopython Distribution Source: https://biopython.org/wiki/Documentation/wiki/Building_a_release Execute the `setup.py` script to build the Biopython distribution and then run its comprehensive test suite to verify functionality before the release. Note that running tests simultaneously with multiple Python versions is risky due to potential file conflicts. ```Shell drevil:~biopython> python setup.py build drevil:~biopython> python setup.py test ``` -------------------------------- ### Install Biopython for specific Python interpreters Source: https://biopython.org/wiki/Documentation/wiki/Download Installs Biopython using pip for a particular Python version or interpreter, such as Python 3.13 or PyPy. This is useful when multiple Python environments are present. ```Bash python3.13 -m pip install biopython pypy -m pip install biopython ``` -------------------------------- ### API Documentation for FSeqBootCommandline Class Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Emboss Documents the `FSeqBootCommandline` class, part of Biopython's `Bio.Emboss.Applications` module. It outlines the constructor and various properties/methods for configuring the FSeqBoot command-line tool. ```APIDOC FSeqBootCommandline: __init__() auto blocksize catergories debug die dotdiff error filter fracsample help jusweights options ``` -------------------------------- ### Uninstall Biopython using pip Source: https://biopython.org/wiki/Documentation/wiki/Download Removes the Biopython package from your Python environment. Use this command if you no longer need Biopython installed. ```Bash pip uninstall biopython ``` -------------------------------- ### Clone Biopython Repository for Release Preparation Source: https://biopython.org/wiki/Documentation/wiki/Building_a_release This snippet shows how to clone the Biopython Git repository into a temporary directory and navigate into it, preparing the environment for subsequent build and distribution steps. ```bash git clone https://github.com/biopython/biopython.git cd biopython ``` -------------------------------- ### BWA Samse Command Line Syntax Example Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Sequencing.Applications Illustrates the basic command-line syntax for the BWA `samse` tool, showing required input files and optional parameters for generating SAM output. ```bash $ bwa samse [-n maxOcc] > ``` -------------------------------- ### Biopython Fasta Module: Deprecation and Removal Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_introduction Informs users that the `Bio.Fasta` module was deprecated in Biopython 1.51 (August 2009) and subsequently removed in Biopython 1.55 (August 2010). Directs users to the `DEPRECATED.rst` file for examples on converting old code to use `Bio.SeqIO` instead. ```APIDOC Bio.Fasta ``` -------------------------------- ### Construct and Print Complete Bio.Application.AbstractCommandline Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Application Provides a comprehensive example of setting all necessary parameters for a `WaterCommandline` object and then converting it into a complete command-line string suitable for execution. ```Python from Bio.Emboss.Applications import WaterCommandline water_cmd = WaterCommandline(gapopen=10, gapextend=0.5) water_cmd.asequence = "asis:ACCCGGGCGCGGT" water_cmd.bsequence = "asis:ACCCGAGCGCGGT" water_cmd.outfile = "temp_water.txt" print(water_cmd) water_cmd ``` -------------------------------- ### Install Perl on Debian/Ubuntu Source: https://biopython.org/wiki/Documentation/wiki/BioSQL This command installs the Perl interpreter on Debian or Ubuntu Linux distributions. Perl is required to run some of the BioSQL setup scripts. ```Shell sudo apt-get install perl ``` -------------------------------- ### BWA MEM Command Line Syntax Example Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Sequencing.Applications Illustrates the typical shell command syntax for running BWA MEM, showing input and output file conventions for alignment. ```Shell $ bwa mem [...] > ``` -------------------------------- ### Renumbering Residues in Biopython PDB Structure Source: https://biopython.org/wiki/Documentation/wiki/GSOC2010_Joao This example demonstrates how to renumber residues within a Biopython PDB structure. The `renumber_residues()` method adjusts the residue numbering to start from 1 (by default), while preserving information about gaps. It can also accept a `start` argument to set a custom starting number. ```Python from Bio.PDB import PDBParser p = PDBParser() s = p.get_structure("example", "1IHM.pdb") print(list(s.get_residues())[0]) # s.renumber_residues() print(list(s.get_residues())[0]) # ``` -------------------------------- ### Biopython SeqIO: Using index_db Function Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_introduction Explains that the `Bio.SeqIO.index_db()` function requires Biopython 1.57 or later and a Python installation with SQLite3 support. Earlier versions of Biopython do not include this function. ```APIDOC Bio.SeqIO.index_db(filename, format) ``` -------------------------------- ### Execute PAML Codeml with Biopython wrapper Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_phylo This example illustrates the typical workflow for using Biopython's `Bio.Phylo.PAML.codeml` wrapper. It demonstrates initializing the Codeml object, setting input files (alignment, tree), specifying output and working directories, configuring runtime options via `set_options`, running the analysis, and accessing the parsed results. ```Python >>> from Bio.Phylo.PAML import codeml >>> cml = codeml.Codeml() >>> cml.alignment = "Tests/PAML/Alignments/alignment.phylip" >>> cml.tree = "Tests/PAML/Trees/species.tree" >>> cml.out_file = "results.out" >>> cml.working_dir = "./scratch" >>> cml.set_options( ... seqtype=1, ... verbose=0, ... noisy=0, ... RateAncestor=0, ... model=0, ... NSsites=[0, 1, 2], ... CodonFreq=2, ... cleandata=1, ... fix_alpha=1, ... kappa=4.54006, ... ) >>> results = cml.run() >>> ns_sites = results.get("NSsites") >>> m0 = ns_sites.get(0) >>> m0_params = m0.get("parameters") >>> print(m0_params.get("omega")) ``` -------------------------------- ### Build Biopython RPM Package Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_contributing This command demonstrates how to build a platform-specific RPM package and a source RPM for Biopython using the `setup.py` script. The resulting packages will be placed in the `dist` directory. A C compiler is essential for this process. ```Shell $ python setup.py bdist_rpm ``` -------------------------------- ### Constructing and Executing Primer3Commandline Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Emboss.Applications Demonstrates how to initialize `Primer3Commandline` with various parameters, set boolean flags and numeric options, and shows the resulting command-line string. It also illustrates the `ValueError` raised for invalid parameters. ```python cline = Primer3Commandline(sequence="mysequence.fas", auto=True, hybridprobe=True) cline.explainflag = True cline.osizeopt=20 cline.psizeopt=200 cline.outfile = "myresults.out" cline.bogusparameter = 1967 # Invalid parameter Traceback (most recent call last): ... ValueError: Option name bogusparameter was not found. print(cline) eprimer3 -auto -outfile=myresults.out -sequence=mysequence.fas -hybridprobe=True -psizeopt=200 -osizeopt=20 -explainflag=True ``` -------------------------------- ### Get Start and End Indices with get_start_end() in Bio.Nexus.Nexus Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Nexus This snippet documents the `get_start_end()` function. It is used to determine the start and end indices within a sequence or data range, often employed in parsing or slicing operations. ```APIDOC get_start_end() ``` -------------------------------- ### PHYLIP Format: Example Output with Modified Identifiers Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_msa This block displays an example of the strict PHYLIP format output generated after the sequence identifiers have been compressed and renamed. It highlights the fixed-width format and the simplified identifiers, along with the continuation lines for longer sequences. ```Text 7 52 seq0 AEPNAATNYA TEAMDSLKTQ AIDLISQTWP VVTTVVVAGL VIRLFKKFSS seq1 AEPNAATNYA TEAMDSLKTQ AIDLISQTWP VVTTVVVAGL VIKLFKKFVS seq2 DGTSTATSYA TEAMNSLKTQ ATDLIDQTWP VVTSVAVAGLAIRLFKKFSS seq3 AEGDDP---A KAAFNSLQAS ATEYIGYAWA MVVVIVGATIGIKLFKKFTS seq4 AEGDDP---A KAAFDSLQAS ATEYIGYAWA MVVVIVGATIGIKLFKKFAS seq5 AEGDDP---A KAAFDSLQAS ATEYIGYAWA MVVVIVGATIGIKLFKKFTS seq6 FAADDATSQA KAAFDSLTAQ ATEMSGYAWA LVVLVVGATV GIKLFKKFVS KA RA KA KA KA KA RA ``` -------------------------------- ### Load Starting Tree with Bio.Phylo Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Phylo.TreeConstruction Illustrates loading an existing phylogenetic tree from a Newick file using `Bio.Phylo.read`. This tree can serve as a starting point for tree construction algorithms. ```Python starting_tree = Phylo.read('TreeConstruction/nj.tre', 'newick') print(starting_tree) ``` -------------------------------- ### Create SimpleLocation Objects in Biopython Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.SeqFeature Provides examples of instantiating `SimpleLocation` objects with different start, end, and strand values, demonstrating how the object represents the location and how its attributes (`start`, `end`, `strand`) are accessed. It highlights the zero-based indexing and the handling of forward and reverse strands. ```python from Bio.SeqFeature import SimpleLocation f = SimpleLocation(122, 150) print(f) print(f.start) print(f.end) print(f.strand) ``` ```python from Bio.SeqFeature import SimpleLocation f = SimpleLocation(122, 150, strand=+1) print(f) print(f.strand) ``` ```python from Bio.SeqFeature import SimpleLocation r = SimpleLocation(122, 150, strand=-1) print(r) print(r.start) print(r.end) print(r.strand) ``` -------------------------------- ### Get Length of Biopython SeqFeature or Location Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_seq_annot This example shows how to determine the length of a SeqFeature or SimpleLocation object. It highlights that the length corresponds to the described sequence region and for CompoundLocation objects, it's the sum of constituent regions, using objects defined in prior examples. ```Python print(len(feature_seq)) print(len(feature)) print(len(feature.location)) ``` -------------------------------- ### Biopython Command Line Tools: Application Wrappers Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_introduction Discusses the deprecation of direct command-line tool execution from Biopython application wrappers (deprecated in 1.78, available from 1.55). Recommends using Python's `subprocess` module directly for running external commands. ```APIDOC subprocess.run(...) ``` -------------------------------- ### Get Length of SimpleLocation Object Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.SeqFeature Illustrates how to obtain the length of the region described by a SimpleLocation object, including examples with fuzzy locations. ```python >>> from Bio.SeqFeature import SimpleLocation >>> from Bio.SeqFeature import BeforePosition, AfterPosition >>> loc = SimpleLocation(BeforePosition(5), AfterPosition(10)) >>> len(loc) 5 ``` -------------------------------- ### TRANSFAC File Example with Multiple Motifs Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_motifs This example demonstrates a TRANSFAC file containing multiple motifs, showing the general structure for files with more than one motif entry, including version information. ```text VV EXAMPLE January 15, 2013 XX // ID motif1 P0 A C G T 01 1 2 2 0 S 02 2 1 2 0 R 03 3 0 1 1 A ... 11 0 2 0 3 Y 12 1 0 3 1 G // ID motif2 P0 A C G T 01 2 1 2 0 R 02 1 2 2 0 S ... 09 0 0 0 5 T 10 0 2 0 3 Y // ``` -------------------------------- ### Example FASTA File Content Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_seq_annot This block shows the initial lines of the example FASTA file used throughout the documentation. It contains a single sequence record for Yersinia pestis plasmid pPCP1, demonstrating the standard FASTA header and sequence format. ```text >gi|45478711|ref|NC_005816.1| Yersinia pestis biovar Microtus ... pPCP1, complete sequence TGTAACGAACGGTGCAATAGTGATCCACACCCAACGCCTGAAATCAGATCCAGGGGGTAATCTGCTCTCC ... ``` -------------------------------- ### Accessing Help Documentation for Bio.SeqIO.convert Source: https://biopython.org/wiki/Documentation/docs/latest/Tutorial/chapter_seqio Illustrates how to use Python's built-in `help()` function to view the documentation for the `Bio.SeqIO.convert` function, providing details on its usage, parameters, and behavior directly within the Python interpreter. ```python >>> from Bio import SeqIO >>> help(SeqIO.convert) ``` -------------------------------- ### Example Usage of Bio.Data.CodonTable.__str__ Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Data.CodonTable Demonstrates how to use the `__str__` method of the `CodonTable` class to get a formatted string representation of standard DNA and generic codon tables. ```Python >>> import Bio.Data.CodonTable >>> print(Bio.Data.CodonTable.standard_dna_table) Table 1 Standard, SGC0 | T | C | A | G | --+---------+---------+---------+---------+-- T | TTT F | TCT S | TAT Y | TGT C | T T | TTC F | TCC S | TAC Y | TGC C | C ... G | GTA V | GCA A | GAA E | GGA G | A G | GTG V | GCG A | GAG E | GGG G | G --+---------+---------+---------+---------+-- >>> print(Bio.Data.CodonTable.generic_by_id[1]) Table 1 Standard, SGC0 | U | C | A | G | --+---------+---------+---------+---------+-- U | UUU F | UCU S | UAU Y | UGU C | U U | UUC F | UCC S | UAC Y | UGC C | C ... G | GUA V | GCA A | GAA E | GGA G | A G | GUG V | GCG A | GAG E | GGG G | G --+---------+---------+---------+---------+-- ``` -------------------------------- ### Bio.Sequencing.Applications.SamtoolsMpileupCommandline API Reference Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.Sequencing.Applications This section provides the API documentation for the SamtoolsMpileupCommandline class, detailing its constructor and initial properties that correspond to `samtools mpileup` command-line options. Each property controls the addition of a specific parameter or switch to the command. ```APIDOC Bio.Sequencing.Applications.SamtoolsMpileupCommandline: Bases: Bio.Application.AbstractCommandline Description: Command line wrapper for samtools mpileup. Generate BCF or pileup for one or multiple BAM files, equivalent to: $ samtools mpileup [-EBug] [-C capQcoef] [-r reg] [-f in.fa] [-l list] [-M capMapQ] [-Q minBaseQ] [-q minMapQ] in.bam [in2.bam [...]] __init__(cmd='samtools', **kwargs) Description: Initialize the class. Properties: A: Description: Do not skip anomalous read pairs in variant calling. This property controls the addition of the -A switch, treat this property as a boolean. B: Description: Disable probabilistic realignment for the computation of base alignment quality (BAQ). This property controls the addition of the -B switch, treat this property as a boolean. ``` -------------------------------- ### Example GenBank CDS Feature Data Source: https://biopython.org/wiki/Documentation/docs/latest/api/Bio.GenBank.Scanner An example of a GenBank CDS (Coding Sequence) feature entry, illustrating the structure including location, locus tag, notes, codon start, translation table, product, protein ID, database cross-references, and the translated protein sequence. This format is parsed by the `parse_feature` method. ```Text CDS complement(join(490883..490885,1..879)) /locus_tag="NEQ001" /note="conserved hypothetical [Methanococcus jannaschii]; COG1583:Uncharacterized ACR; IPR001472:Bipartite nuclear localization signal; IPR002743: Protein of unknown function DUF57" /codon_start=1 /transl_table=11 /product="hypothetical protein" /protein_id="NP_963295.1" /db_xref="GI:41614797" /db_xref="GeneID:2732620" /translation="MRLLLELKALNSIDKKQLSNYLIQGFIYNILKNTEYSWLHNWKK EKYFNFTLIPKKDIIENKRYYLIISSPDKRFIEVLHNKIKDLDIITIGLAQFQLRKTK KFDPKLRFPWVTITPIVLREGKIVILKGDKYYKVFVKRLEELKKYNLIKKKEPILEEP IEISLNQIKDGWKIIDVKDRYYDFRNKSFSAFSNWLRDLKEQSLRKYNNFCGKNFYFE EAIFEGFTFYKTVSIRIRINRGEAVYIGTLWKELNVYRKLDKEEREFYKFLYDCGLGS LNSMGFGFVNTKKNSAR" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.