Code Monkey home page Code Monkey logo

samtag's Introduction

samtag

MIT license GitHub release (latest SemVer) Docker Image Version (latest semver)

samtag is a command-line tool for tagging reads in a BAM/CRAM file whose name appear in an input list. It is possible to specify default a tag/flag applied to every read and/or per-read tags/flags. samtag can also generate statistics about tags and their values based on regular expressions.

Usage

The minimal input is a BAM/CRAM file and a TSV specifying read names in the first column, a tag in the second column (optional), and flags in the third column (optional). The format for tags is TAG:VALUE, unless a default tag is provided with the --tag option without a value, in which case the TAG names in the input file can be ommitted (i.e. just specify VALUE).

# Add "ZA:Z:FOO" tag to all reads in test/reads1.tsv,
# in addition to tags/flags specified in test/reads1.tsv.
$ samtag tag --tag ZA:BAR -o tagged1.bam test/test.bam test/reads1.tsv

# Add "ZA" tag to all reads in test/reads2.tsv,
# with the values specified in test/reads2.tsv.
$ samtag tag --tag ZA -o tagged2.bam test/test.bam test/reads2.tsv

To compute statistics about tags:

$ samtag stats --tag ZA tagged1.bam
tag     value   count   fraction
*       *       3859    1
ZA      *       8       0.00207308

$ samtag stats --tag ZA --split --sort tagged1.bam
tag     value   count   fraction
*       *       3859    1
ZA      *       8       0.00207308
ZA      BAR     7       0.00181394
ZA      FOO     1       0.000259134

$ samtag stats --tag ZA:BAR tagged1.bam
tag     value   count   fraction
*       *       3859    1
ZA      BAR     7       0.00181394

samtag's People

Stargazers

Asif Zubair avatar Matthew Galvin avatar Richard avatar

Watchers

Daniel Cooke 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.