https://github.com/brentp/pbr

drunk on perbase pileups and lua expressions

https://github.com/brentp/pbr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

drunk on perbase pileups and lua expressions

Basic Info
  • Host: GitHub
  • Owner: brentp
  • License: mit
  • Language: Rust
  • Default Branch: main
  • Size: 29.3 KB
Statistics
  • Stars: 18
  • Watchers: 2
  • Forks: 2
  • Open Issues: 2
  • Releases: 11
Created about 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

pbr

Rust drunk on perbase pileups and lua expressions.

An example use is in calculating mutation rates. Variant callers have filters such as these that affect the number of mutations called; we also want to scale the denominator in similar way so we can compare rates across samples.

Expression

The following attributes are available on the read object in lua expressions:

``` mapping_quality flags # integer. must use bit32 lua module (builtin here) to do operations tid start stop

where in the current read is the pileup given by qpos with convenience of distancefrom[left/right]_end

qpos distancefrom5prime distancefrom3prime insertsize qname bq # basequality at current site length # length of the read sequence sequence nproportion5prime(bases:number) nproportion3prime(bases:number) indelcount softclips3prime softclips5_prime tag(name: string) ```

An example expression could be:

lua -- high mapping-q and base-quality for this column read.mapping_quality > 10 and read.bq > 20 \ -- and not within 10 bases of left end or right end and read.distance_from_5prime > 10 and read.distance_from_3prime > 10 \ -- and exclude read if unmapped, not primary, qc_fail, or duplicate. and bit32.band(read.flags, bit32.bor(4, 256, 512, 1024)) == 0 \ -- and exclude read if it has more than 5% N's in the sequence and string_count(read.sequence, 'N') < 0.05 * read.length

this runs as:

pbr $bam "return $expression" > out.pileup

where the $expression argument is the lua expression.

  • Note that we can use, e.g. print(read.qname, read.flags); return $expression) to help with debugging.
  • Note that the expression must contain 'return'

Usage

``` pileups filtered with lua expressions

Usage: pbr [OPTIONS]

Arguments: Path to the bamfile Lua expression to evaluate

Options: -t, --threads Number of threads to use [default: 2] -m, --max-depth maximum depth in the pileup [default: 100000] -b, --bedfile optional path to the BED of include regions -f, --fasta optional path to the reference fasta file -e, --exclude optional path to BED of exclude regions --mate-fix adjust depth to not double count overlapping mates -p, --pile-expression optional expression required for the pileup -h, --help Print help -V, --version Print version ```

PileExpression

Note that the pile-expression is also a lua expression; it is applied to the Pileup (column) rather than to the reads. The available attributes on the pile object are:

depth,a,c,g,t,n,fail,ins,del,ref_skip

An example --pile-expression would look like:

return pile.n / pile.depth < 0.05

To require that fewer than 5% of the reads in the pile are 'N'. Positions that do not pass this expression will not be printed.

Owner

  • Name: Brent Pedersen
  • Login: brentp
  • Kind: user
  • Location: Oregon, USA

Doing genomics

GitHub Events

Total
  • Create event: 4
  • Issues event: 4
  • Release event: 2
  • Issue comment event: 11
  • Push event: 8
  • Pull request review comment event: 6
  • Pull request review event: 2
  • Pull request event: 1
Last Year
  • Create event: 4
  • Issues event: 4
  • Release event: 2
  • Issue comment event: 11
  • Push event: 8
  • Pull request review comment event: 6
  • Pull request review event: 2
  • Pull request event: 1

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 8
  • Total pull requests: 1
  • Average time to close issues: 7 days
  • Average time to close pull requests: 9 days
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 3.75
  • Average comments per pull request: 3.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • y9c (5)
  • brentp (4)
  • mkyriak (1)
Pull Request Authors
  • y9c (2)
Top Labels
Issue Labels
Pull Request Labels