Coder Social home page Coder Social logo

numpy_alignments's Introduction

Numpy alignments.

Fast way of representing mapped read positions and comparing two sets of mapped reads using numpy. This package can make nice report pretty fast, comparing mapping accuracies of different sets of alignments.

Install

Clone repo and enter directory, then run:

pip3 install .

.. or just pip install it (Python3):

pip3 install numpy_alignments

Usage

Important: Numpy alignments always needs to know the number of reads when it is run. This package is specifically made to work with simulated reads, and requires all reads to have names from 0 to the number of reads (such as reads simulated by Graph Read Simulator). This makes it able to efficiently represent the reads in numppy arrays of the given size. The following examples assume there are 100 reads.

Example

Map reads with BWA-MEM and pipe directly to numpy alignments to avoid storing large BAM-files on disk:

bwa mem ref.fa reads.fa | numpy_alignments store sam bwa 100

Save truth positions:

cat positions.tsv | numpy_alignments store truth truth 265154

Compare bwa to truth:

numpy_alignments get_correct_rates truth bwa

Create html report:

numpy_alignments make_report -f my-report-name --names="bwa" truth bwa purple

You can specify more names, alignments sets and colors by separating them with commas.

Use as python library

from numpy_alignments.comparer import Comparer
from numpy_alignments import NumpyAlignments
bwa = NumpyAlignments.from_file("bwa.npz")
truth = NumpyAlignments.from_file("truth.npz")
comparer = Comparer(truth, {"bwa": bwa})
rate = comparer.get_correct_rates()
print(rate)

numpy_alignments's People

Contributors

ivargr avatar dvaskil avatar

Stargazers

 avatar Xiao avatar

Watchers

James Cloos avatar Lex Nederbragt avatar sandve avatar Torbjørn Rognes avatar  avatar Milena Pavlovic avatar  avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.