jpayne@68: Metadata-Version: 2.1 jpayne@68: Name: pybedtools jpayne@68: Version: 0.11.0 jpayne@68: Summary: Wrapper around BEDTools for bioinformatics work jpayne@68: Home-page: https://github.com/daler/pybedtools jpayne@68: Download-URL: jpayne@68: Maintainer: Ryan Dale jpayne@68: Maintainer-email: ryan.dale@nih.gov jpayne@68: License: MIT jpayne@68: Classifier: Development Status :: 5 - Production/Stable jpayne@68: Classifier: Intended Audience :: Science/Research jpayne@68: Classifier: License :: OSI Approved :: MIT License jpayne@68: Classifier: Topic :: Scientific/Engineering :: Bio-Informatics jpayne@68: Classifier: Programming Language :: Python jpayne@68: Classifier: Programming Language :: Python :: 3 jpayne@68: Classifier: Programming Language :: Python :: 3.6 jpayne@68: Classifier: Programming Language :: Python :: 3.7 jpayne@68: Classifier: Programming Language :: Python :: 3.8 jpayne@68: Classifier: Topic :: Software Development :: Libraries :: Python Modules jpayne@68: License-File: LICENSE.txt jpayne@68: Requires-Dist: pysam jpayne@68: Requires-Dist: numpy jpayne@68: jpayne@68: jpayne@68: Overview jpayne@68: -------- jpayne@68: jpayne@68: .. image:: https://badge.fury.io/py/pybedtools.svg?style=flat jpayne@68: :target: https://badge.fury.io/py/pybedtools jpayne@68: jpayne@68: .. image:: https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg jpayne@68: :target: https://bioconda.github.io jpayne@68: jpayne@68: The `BEDTools suite of programs `_ is widely jpayne@68: used for genomic interval manipulation or "genome algebra". `pybedtools` wraps jpayne@68: and extends BEDTools and offers feature-level manipulations from within jpayne@68: Python. jpayne@68: jpayne@68: See full online documentation, including installation instructions, at jpayne@68: https://daler.github.io/pybedtools/. jpayne@68: jpayne@68: The GitHub repo is at https://github.com/daler/pybedtools. jpayne@68: jpayne@68: Why `pybedtools`? jpayne@68: ----------------- jpayne@68: jpayne@68: Here is an example to get the names of genes that are <5 kb away from jpayne@68: intergenic SNPs: jpayne@68: jpayne@68: .. code-block:: python jpayne@68: jpayne@68: from pybedtools import BedTool jpayne@68: jpayne@68: snps = BedTool('snps.bed.gz') # [1] jpayne@68: genes = BedTool('hg19.gff') # [1] jpayne@68: jpayne@68: intergenic_snps = snps.subtract(genes) # [2] jpayne@68: nearby = genes.closest(intergenic_snps, d=True, stream=True) # [2, 3] jpayne@68: jpayne@68: for gene in nearby: # [4] jpayne@68: if int(gene[-1]) < 5000: # [4] jpayne@68: print gene.name # [4] jpayne@68: jpayne@68: Useful features shown here include: jpayne@68: jpayne@68: * `[1]` support for all BEDTools-supported formats (here gzipped BED and GFF) jpayne@68: * `[2]` wrapping of all BEDTools programs and arguments (here, `subtract` and `closest` and passing jpayne@68: the `-d` flag to `closest`); jpayne@68: * `[3]` streaming results (like Unix pipes, here specified by `stream=True`) jpayne@68: * `[4]` iterating over results while accessing feature data by index or by attribute jpayne@68: access (here `[-1]` and `.name`). jpayne@68: jpayne@68: In contrast, here is the same analysis using shell scripting. Note that this jpayne@68: requires knowledge in Perl, bash, and awk. The run time is identical to the jpayne@68: `pybedtools` version above: jpayne@68: jpayne@68: .. code-block:: bash jpayne@68: jpayne@68: snps=snps.bed.gz jpayne@68: genes=hg19.gff jpayne@68: intergenic_snps=/tmp/intergenic_snps jpayne@68: jpayne@68: snp_fields=`zcat $snps | awk '(NR == 2){print NF; exit;}'` jpayne@68: gene_fields=9 jpayne@68: distance_field=$(($gene_fields + $snp_fields + 1)) jpayne@68: jpayne@68: intersectBed -a $snps -b $genes -v > $intergenic_snps jpayne@68: jpayne@68: closestBed -a $genes -b $intergenic_snps -d \ jpayne@68: | awk '($'$distance_field' < 5000){print $9;}' \ jpayne@68: | perl -ne 'm/[ID|Name|gene_id]=(.*?);/; print "$1\n"' jpayne@68: jpayne@68: rm $intergenic_snps jpayne@68: jpayne@68: See the `Shell script comparison `_ in the docs jpayne@68: for more details on this comparison, or keep reading the full documentation at jpayne@68: http://daler.github.io/pybedtools.