pyranges | Performant Pythonic GenomicRanges | Genomics library

 by   biocore-ntnu Python Version: 0.0.111 License: MIT

kandi X-RAY | pyranges Summary

kandi X-RAY | pyranges Summary

pyranges is a Python library typically used in Artificial Intelligence, Genomics applications. pyranges has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub.

GenomicRanges and genomic Rle-objects for Python. "Finally ... This was what Python badly needed for years." - Heng Li.

            kandi-support Support

              pyranges has a highly active ecosystem.
              It has 340 star(s) with 37 fork(s). There are 11 watchers for this library.
              It had no major release in the last 12 months.
              There are 78 open issues and 100 have been closed. On average issues are closed in 61 days. There are 4 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of pyranges is 0.0.111

            kandi-Quality Quality

              pyranges has 0 bugs and 0 code smells.

            kandi-Security Security

              pyranges has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pyranges code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pyranges is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pyranges releases are available to install and integrate.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              pyranges saves you 2389 person hours of effort in developing the same functionality from scratch.
              It has 5209 lines of code, 334 functions and 69 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pyranges and discovered the below as its top functions. This is intended to give you an instant insight into pyranges implemented functionality, and help decide if they suit your requirements.
            • Calculate k nearest neighbors
            • Concatenate multiple pyranges
            • Return a copy of the DataFrame
            • Process results dictionary
            • Split the range
            • Write a bigwig to a bigwig file
            • Return the lengths of the DataFrames in the DataFrame
            • Merge the ranges
            • Count the number of overlapping gaps
            • Apply a function to this range
            • Return a pandas DataFrame containing only the intersections
            • Remove duplicate positions
            • Apply the bounds to the given chromosome
            • Tiles a genome
            • Return a spliced subseq
            • Find the closest cluster in a scipy
            • Apply chunks from f to f
            • Compute tss of the protein sequence
            • Generate a dataframe of random chromosomes
            • Return a subset of this range
            • Calculate the nearest range to other
            • Return a subset of the ranges
            • Split this range into a PyRanges
            • Calculate similarity for each chromosome
            • Return an iterator of grs
            • Write this chromosome to a bigwig file
            • Returns a string representation of the Ranges
            Get all kandi verified functions for this library.

            pyranges Key Features

            No Key Features are available at this moment for pyranges.

            pyranges Examples and Code Snippets

            No Code Snippets are available at this moment for pyranges.

            Community Discussions


            Using pyranges library, How to check if a chromosome position is contained in any interval?
            Asked 2020-Oct-01 at 16:37

            I have a .vcf file containing variants information and a .bed file containing region studied information. I am using pyranges library to read the .bed file. I want to filter out all the variants in .vcf file that lies in the region studied intervals specified in .bed file. Since, pyranges provides a pandas dataframe, i could iterate over each row and check for containment of my variant position; But, I am looking for an API that helps me achieve this.




            Answered 2020-Jun-24 at 19:25
            gr = pr.PyRanges(df)
            gr['chr1', 125:126]



            Fishers Exact Test from Pandas Dataframe
            Asked 2020-Sep-30 at 21:06

            I'm trying to work out the best way to create a p-value using Fisher's Exact test from four columns in a dataframe. I have already extracted the four parts of a contingency table, with 'a' being top-left, 'b' being top-right, 'c' being bottom-left and 'd' being bottom-right. I have started including additional calculated columns via simple pandas calculations, but these aren't necessary if there's an easier way to just use the 4 initial columns. I have over 1 million rows when including an additional set (x.type = high), so want to use an efficient method. So far this is my code:



            Answered 2020-Sep-30 at 21:05

            Following the answer here which came from the author of pyranges (i think), let's say you data is something like:



            How to convert chromosome name to same format in pyranges before performing a join
            Asked 2020-Aug-01 at 06:17

            I have multiple .bed files and I want to perform join, intersection etc. operation on them. I am using pyranges library to read the .bed files and perform these operations. As .bed files allows naming chromosome with or without "chr" prefix, I would like to format all chromosome name in different .bed files to the same format before performing the operations. Therefore, operations results in outputs as expected.

            I tried,



            Answered 2020-Aug-01 at 06:17

            The data in PyRanges class are stored in multiple places. Apart from .Chromosome, you have .dfs which is a dict. This keys in this dict are used when you do the py1["1"] call.

            You need to also update the dict



            Grouping the range of intervals based on 2 columns
            Asked 2020-May-23 at 00:09

            I am a geologist needing to clean up data. I have a .csv file containing drilling intervals, that I imported as a pandas dataframe that looks like this:



            Answered 2020-May-22 at 23:54

            This should do the trick:



            Difference between overlap and intersect methods in Pyranges
            Asked 2020-May-12 at 07:17

            Pyranges class from similarly named package has two methods with slightly different functionality: intersect and overlap. Intersect method description is quite similar to overlap's one: Return overlapping subintervals. vs Return overlapping intervals. I can't quite glimpse the difference between those two (Yeah, I noticed that sub prefix).

            Is overlap intended to reveal full intervals that do overlap at least at one position?



            Answered 2020-May-11 at 15:06


            Finding overlaps between millions of ranges/intervals
            Asked 2019-Aug-19 at 08:37

            I am trying to find pairs of intervals that overlap by at least some minimum overlap length that is set by the user. The intervals are from this pandas dataframe:



            Answered 2019-Jul-15 at 03:55

            Here's an algorithm.

            1. Prepare a set of intervals sorted by starting point. Initially the set is empty.
            2. Sort all starting and ending points.
            3. Traverse the points. If a starting point is encountered, add the corresponding interval to the set. If an ending point is encountered, remove the corresponding interval from the set.
            4. When removing an interval, look at other intervals in the set. They all overlap the interval being removed, and they are sorted by the length of the overlap, longest first. Traverse the set until the length is too short, and report each overlap.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install pyranges

            The preferred way to install pyranges is through the bioconda channel:.


            most importantly, cite pyranges if you use it. It is the main metric funding sources care about.use pyranges in Stack Overflow/biostars questions and answersstar the repo (possibly important for github visibility and as a proxy for project popularity)if you are a business using pyranges, please give to one of the charities listed at
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone biocore-ntnu/pyranges

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with pyranges

            Consider Popular Genomics Libraries

            Try Top Libraries by biocore-ntnu


            by biocore-ntnuC


            by biocore-ntnuPython


            by biocore-ntnuPython


            by biocore-ntnuPython


            by biocore-ntnuPython