Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wwood committed Aug 28, 2020
1 parent dd95f8f commit 2e8d49c
Show file tree
Hide file tree
Showing 12 changed files with 2,260 additions and 201 deletions.
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coverm"
version = "0.4.0"
version = "0.5.0"
authors = ["Ben Woodcroft <[email protected]>"]
license = "GPL-3.0"
description = "Read coverage calculator for metagenomics"
Expand All @@ -19,17 +19,18 @@ rust-htslib = { version="0.32.*", default-features = false }
clap = "2.*"
log = "0.4.*"
env_logger = "0.7.*"
nix = "0.17.*"
nix = "0.18.*"
tempdir = "0.3.*"
tempfile = "3.*"
ansi_term = "0.12"
lazy_static = "1.4.0"
rand = "0.7.*"
serde = "1.0"
version-compare = "0.0.10"
bird_tool_utils = {git = "https://github.com/wwood/bird_tool_utils", rev = "3b16f11ed421ae74c1a140f3894da02584bcb5b5"}
galah = {git = "https://github.com/wwood/galah", rev = "e55f48cf4c9f23a1f362df6f05be518895f2b480"}
man = {git = "https://github.com/wwood/man", rev = "6aed86ec55ab6c867b391658586a597770c6dcb1"}
version-compare = "0.0.11"
bird_tool_utils = "0.2.0"
galah = "0.2.0"
bird_tool_utils-man = "0.4.0"
roff = "0.1.*"

[dev-dependencies]
assert_cli = "0.6.*"
Expand Down
34 changes: 11 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
CoverM aims to be a configurable, easy to use and fast DNA read coverage and
relative abundance calculator focused on metagenomics applications.

CoverM calculates coverage of genomes/MAGs (`coverm genome`) or individual
contigs (`coverm contig`). Calculating coverage by read mapping, its input can
either be BAM files sorted by reference, or raw reads and reference FASTA
sequences.
CoverM calculates coverage of genomes/MAGs `coverm genome` ([help](https://wwood.github.io/coverm/coverm-genome.html)) or individual
contigs `coverm contig` ([help](https://wwood.github.io/coverm/coverm-contig.html)). Calculating coverage by read mapping, its input can
either be BAM files sorted by reference, or raw reads and reference genomes in various formats.

## Installation

Expand Down Expand Up @@ -97,27 +96,16 @@ coverm shell-completion --shell bash --output-file /dev/stdout >>~/.bash_complet
In both cases, to take effect, the terminal will likely need to be restarted. To test, type `coverm gen` and it should complete after pressing the TAB key.

## Usage
```
Mapping coverage analysis for metagenomics
Usage: coverm <subcommand> ...
Main subcommands:
contig Calculate coverage of contigs
genome Calculate coverage of genomes

Less used utility subcommands:
make Generate BAM files through alignment
filter Remove (or only keep) alignments with insufficient identity
cluster Dereplicate and cluster genomes
shell-completion
Generate shell completion scripts
Other options:
-V, --version Print version information
```
CoverM operates in several modes. Detailed usage information is given at the links below, or alternatively by using the `-h` or `--full-help` flags for each mode:
* [genome](https://wwood.github.com/coverm/coverm-genome.html) - Calculate coverage of genomes
* [contig](https://wwood.github.com/coverm/coverm-contig.html) - Calculate coverage of contigs

For more detailed usage see `coverm <command> -h` or `coverm <command> --full-help`.
There are several utility modes as well:
* [make](https://wwood.github.com/coverm/coverm-make.html) - Generate BAM files through alignment
* [filter](https://wwood.github.com/coverm/coverm-filter.html) - Remove (or only keep) alignments with insufficient identity
* [cluster](https://wwood.github.com/coverm/coverm-cluster.html) - Dereplicate and cluster genomes
* shell-completion - Generate shell completion scripts

## Calculation methods

Expand Down
325 changes: 325 additions & 0 deletions docs/coverm-cluster.html

Large diffs are not rendered by default.

451 changes: 451 additions & 0 deletions docs/coverm-contig.html

Large diffs are not rendered by default.

254 changes: 254 additions & 0 deletions docs/coverm-filter.html

Large diffs are not rendered by default.

614 changes: 614 additions & 0 deletions docs/coverm-genome.html

Large diffs are not rendered by default.

292 changes: 292 additions & 0 deletions docs/coverm-make.html

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "coverm SUBCOMMAND usage"
author: "Ben Woodcroft, Centre for Microbiome Research, Queensland University of Technology"
date: "`r Sys.Date()` (`r system('cargo run -- --version',intern=T)`)"
output:
prettydoc::html_pretty:
theme: leonids
highlight: github
toc: true
---
26 changes: 19 additions & 7 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

set -o pipefail

export LIBCLANG_PATH=~/.guix-profile/lib
echo "Building normally .."
cargo build --release

export VERSION=`cargo run -- --version |awk '{print $2}'`

# For minimap header fix binary
export PATH=target/debug:$PATH
export PATH=target/release:$PATH

echo "Found version $VERSION .."

echo "Building normally .."
cargo build --release


echo "Testing release version .."
cargo test --release

echo "Building musl static binary .."
cargo build --target x86_64-unknown-linux-musl --release
# Use cross not cargo here so htslib is OK - see https://github.com/rust-bio/rust-htslib
cross build --target x86_64-unknown-linux-musl --release

echo "Making static dist .."
mkdir dist/coverm-x86_64-unknown-linux-musl-$VERSION
mkdir -p dist/coverm-x86_64-unknown-linux-musl-$VERSION
cp \
target/x86_64-unknown-linux-musl/release/coverm \
target/x86_64-unknown-linux-musl/release/remove_minimap2_duplicated_headers \
Expand All @@ -31,4 +32,15 @@ cd dist
tar czf coverm-x86_64-unknown-linux-musl-$VERSION.tar.gz coverm-x86_64-unknown-linux-musl-$VERSION
cd ..

echo "Now make sure git is up to date, and run LIBCLANG_PATH=~/.guix-profile/lib cargo publish"
echo "Building HTML versions of man pages .."
for SUBCOMMAND in genome cluster contig filter make
do
echo "Documenting $SUBCOMMAND .."
cargo run -- $SUBCOMMAND --full-help-roff |pandoc - -t markdown -f man |sed 's/\\\[/[/g; s/\\\]/]/g' |cat <(sed s/SUBCOMMAND/$SUBCOMMAND/ prelude) - >docs/coverm-$SUBCOMMAND.Rmd
echo "library(prettydoc); setwd('docs'); rmarkdown::render('coverm-$SUBCOMMAND.Rmd','prettydoc::html_pretty','coverm-$SUBCOMMAND.html')" |R --no-save
rm docs/coverm-$SUBCOMMAND.Rmd
echo "Finished documenting $SUBCOMMAND"
done


echo "Now make sure git is up to date, the documentation HTML has been properly generated and run cargo publish"
6 changes: 5 additions & 1 deletion src/bin/coverm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,11 @@ fn main() {
); // Where write the completions to
}
Some("cluster") => {
galah::cluster_argument_parsing::run_cluster_subcommand(&matches);
galah::cluster_argument_parsing::run_cluster_subcommand(
&matches,
"coverm",
crate_version!(),
);
}
_ => {
app.print_help().unwrap();
Expand Down
Loading

0 comments on commit 2e8d49c

Please sign in to comment.