Code Monkey home page Code Monkey logo

wigtools's Introduction

wigtools

A set of tools for wiggle file

Installation

pip install wigtools

Usage

> wigtools

Description:
  A set of tools for wiggle file

Usage:
  wigtools <command> [OPTIONS]

Global optional options:
  -h, -H, --help      - Show help message and exit.

Available commands:
  switch-base         - Switch the coordinate base of a wiggle file.
  sort                - Sort the blocks in a wiggle file by chrom and start. Chromosomes will be \
                        sorted the way  sort -V  does.
  stats               - Statistics for data in a wiggle file for each block
  reshape             - Generate a new wiggle file and reshape the blocks to the query regions
  query               - Find the blocks that intersect with the query regions
  help [COMMAND]      - Print help message for the command and exit.

Switch coordinate base for a wiggle file

> cat test.wig
variableStep chrom=chr
1	1.0
2	2.0

> cat test.wig | wigtools switch-base --to 0
variableStep chrom=chr span=1
0	1.0
1	2.0

Sort a wiggle file

> cat test-unsorted.wig
variableStep chrom=chr
5	1.0
6	2.0
variableStep chrom=chr
1	1.0
2	2.0

> cat test.wig-unsorted.wig | wigtools sort
variableStep chrom=chr span=1
1	1.0
2	2.0
variableStep chrom=chr span=1
5	1.0
6	2.0

Calculate the statistics of each block

> cat test-unsorted.wig | wigtools sort | wigtools stats
Chrom   Start   End     min     max     mean    median  sum     count   bp
chr     1	2	1.0     2.0     1.5     1.5     3.0     2	2
chr     5	6	1.0     2.0     1.5     1.5     3.0     2	2

> cat test-unsorted.wig | wigtools sort | wigtools stats --stats mean count --nohead
chr     1	2	1.5     2
chr     5	6	1.5     2

Query a wiggle file to find blocks

> cat query.bed
chr	2	3

> wigtools query -i test-unsorted.wig --qfile query.bed
variableStep chrom=chr span=1
1	1.0
2	2.0

> wigtools query -i test-unsorted.wig --qfile query.bed --qbase 0
# No overlapping blocks

Reshape the blocks in query regions

> cat reshape.bed
chr	1	8

> cat test-unsorted.wig | wigtools sort | wigtools reshape --qfile reshape.bed
variableStep chrom=chr span=1
1	1.0
2	2.0
5	1.0
6	2.0

Split blocks into different files

> wigtools split -i test-unsorted.wig --outprefix outdir/split

> ls outdir/
split_chr_1_2.wig split_chr_5_6.wig

> cat split_chr_1_2.wig
variableStep chrom=chr span=1
1	1.0
2	2.0

wigtools's People

Contributors

pwwang 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.