[med-svn] [Git][med-team/covtobed][upstream] New upstream version 1.3.1+dfsg
Nilesh Patra (@nilesh)
gitlab at salsa.debian.org
Wed Nov 3 16:03:20 GMT 2021
Nilesh Patra pushed to branch upstream at Debian Med / covtobed
Commits:
15f7e4d4 by Nilesh Patra at 2021-11-03T21:01:28+05:30
New upstream version 1.3.1+dfsg
- - - - -
8 changed files:
- + .github/workflows/c-cpp.yml
- − .travis.yml
- README.md
- base.cpp
- + test/filt.bam
- + test/nano.bam
- + test/stranded.bam
- test/test.sh
Changes:
=====================================
.github/workflows/c-cpp.yml
=====================================
@@ -0,0 +1,31 @@
+name: covtobed
+'on':
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+jobs:
+ Build:
+ runs-on: '${{ matrix.os }}'
+ strategy:
+ matrix:
+ os:
+ - ubuntu-18.04
+ steps:
+ - name: Install dependencies (Ubuntu)
+ if: runner.os == 'Linux'
+ run: |-
+ sudo apt-get update
+ sudo apt-get install -y clang-3.9 g++-6 libbamtools-dev
+ - uses: actions/checkout at v2
+ - run: '[ $CXX = g++ ] && export CXX=g++-6 || true'
+ - run: '[ $CXX = clang++ ] && export CXX=clang++-3.9 || true'
+ - run: >-
+ g++ -std=c++11 *.cpp -I/usr/include/bamtools
+ /usr/lib/x86_64-linux-gnu/libbamtools.a -o covtobed -lz
+ - run: ./covtobed -h
+ - run: ./covtobed test/demo.bam > /dev/null
+ - run: ./covtobed --physical-coverage test/mp.bam > /dev/null
+ - run: bash test/test.sh
=====================================
.travis.yml deleted
=====================================
@@ -1,22 +0,0 @@
-language: cpp
-compiler:
- - gcc
- - clang
-addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- - llvm-toolchain-precise-3.8
- packages:
- - g++-6
- - clang-3.8
- - libbamtools-dev
-install:
-- "[ $CXX = g++ ] && export CXX=g++-6 || true"
-- "[ $CXX = clang++ ] && export CXX=clang++-3.8 || true"
-script:
- - $CXX -std=c++11 *.cpp -I/usr/include/bamtools /usr/lib/x86_64-linux-gnu/libbamtools.a -o covtobed -lz
- - ./covtobed -h
- - ./covtobed test/demo.bam > /dev/null
- - ./covtobed --physical-coverage test/mp.bam > /dev/null
- - bash test/test.sh
=====================================
README.md
=====================================
@@ -3,8 +3,7 @@
[![install with bioconda](https://img.shields.io/conda/vn/bioconda/covtobed?label=install%20from%20bioconda)](http://bioconda.github.io/recipes/covtobed/README.html)
[![Bioconda installs](https://img.shields.io/conda/dn/bioconda/covtobed)](https://anaconda.org/bioconda/covtobed)
-[![TravisCI Build Status](https://travis-ci.org/telatin/covtobed.svg?branch=master)](https://travis-ci.org/telatin/covtobed)
-[![Docker build](https://img.shields.io/docker/pulls/andreatelatin/covtobed)](https://hub.docker.com/r/andreatelatin/covtobed)
+[![covtobed](https://github.com/telatin/covtobed/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/telatin/covtobed/actions/workflows/c-cpp.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/36944efb0d2b44cca850964e96c036a4)](https://www.codacy.com/manual/telatin/covtobed?utm_source=github.com&utm_medium=referral&utm_content=telatin/covtobed&utm_campaign=Badge_Grade)
[![status](https://joss.theoj.org/papers/0ed74df9f40a58a852bf3fff512acd2b/status.svg)](https://joss.theoj.org/papers/0ed74df9f40a58a852bf3fff512acd2b)
@@ -15,7 +14,7 @@
Reads one (or more) [alignment](https://en.wikipedia.org/wiki/Sequence_alignment) files
(sorted [BAM](https://en.wikipedia.org/wiki/SAM_(file_format))) and prints a [BED](https://en.wikipedia.org/wiki/BED_(file_format)) with the [coverage](https://en.wikipedia.org/wiki/Coverage_(genetics)). It will join consecutive bases with the same coverage, and can be used to only print a BED file with the regions having a specific coverage range.
-:book: **[Read more in the wiki](https://github.com/telatin/covtobed/wiki)** - this is the **main** documentation source
+:book: **[Read more in the wiki](https://github.com/telatin/covtobed/wiki)** - this is the **main** documentation source
Features:
* Can read (sorted) BAMs from stream (like `bwa mem .. | samtools view -b | samtools sort - | covtobed`)
@@ -101,6 +100,12 @@ sudo docker run --rm -ti andreatelatin/covtobed coverage -h
singularity exec covtobed.simg coverage -h
```
+## Startup message
+
+When invoked without arguments, covtobed will print a message to inform the user that it
+is waiting for input from STDIN.
+To suppress this message, set the environment variable `COVTOBED_QUIET` to `1`.
+
## Performance
*covtobed* is generally faster than *bedtools*. More details are in the [benchmark](benchmark) page.
@@ -132,7 +137,7 @@ This program was finalized with a Flexible Talent Mobility Award funded by BBSRC
## Citation
-If you use this tool, why not citing the paper?
+If you use this tool, we would really appreciate if you will cite its paper:
> Birolo et al., (2020). covtobed: a simple and fast tool to extract coverage tracks from BAM files. Journal of Open Source Software, 5(47), 2119, https://doi.org/10.21105/joss.02119
=====================================
base.cpp
=====================================
@@ -16,7 +16,7 @@ using namespace std;
typedef uint32_t DepthType; // type for depth of coverage, kept it small
const char ref_char = '>'; // reference prefix for "counts" output
-const string VERSION = "%prog 1.2.0"
+const string VERSION = "%prog 1.3.1"
"\nCopyright (C) 2014-2019 Giovanni Birolo and Andrea Telatin\n"
"https://github.com/telatin/covtobed - License MIT"
".\n"
@@ -45,7 +45,12 @@ class Input {
Input(const vector<string> &paths, const int q, const int v) : min_mapq(q), discard_invalid_alignments(v) {
if (paths.empty()) {
// no input files, use standard input
- cerr << "Reading from STDIN... [try 'covtobed -h' for options]" << endl;
+ // 1.3.0 - provide feedback unless $COVTOBED_QUIET is set to 1
+ // Check environment variable COVTOBED_QUIET
+ if (getenv("COVTOBED_QUIET") == NULL) {
+ cerr << "Reading from STDIN... [Ctrl+C to exit; 'covtobed -h' for help]" << endl;
+ }
+
if (!input_bams.OpenFile("-"))
throw string("cannot read BAM from standard input, are you piping a BAM file?");
//throw input_bams.GetErrorString();
@@ -100,6 +105,12 @@ struct Coverage {
else
--f;
}
+ bool equal(const Coverage &o, bool stranded) const {
+ if (stranded)
+ return f == o.f && r == o.r;
+ else
+ return f + r == o.f + o.r;
+ }
};
// Class for output handling: writes coverage in the specified format
@@ -114,7 +125,7 @@ class Output {
// write interval to bed
void operator() (const Interval &i, const Coverage &c) {
// can the last interval be extended with the same coverage?
- if (i.ref == last_interval.ref && i.start == last_interval.end && last_coverage == c)
+ if (i.ref == last_interval.ref && i.start == last_interval.end && last_coverage.equal(c, strands))
// extend previous interval
last_interval.end = i.end;
else {
=====================================
test/filt.bam
=====================================
Binary files /dev/null and b/test/filt.bam differ
=====================================
test/nano.bam
=====================================
Binary files /dev/null and b/test/nano.bam differ
=====================================
test/stranded.bam
=====================================
Binary files /dev/null and b/test/stranded.bam differ
=====================================
test/test.sh
=====================================
@@ -20,24 +20,30 @@ if [ ! -e "./covtobed" ]; then
if [ `uname` == 'Darwin' ]; then
echo " - Copying macOS binary" || echo " ERROR: pre-compiled binary not working"
cp ./binaries/covtobed_mac ./covtobed
- covtobed --version
+ covtobed --version >/dev/null || echo " ERROR: pre-compiled binary not working"
else
echo " - Trying Ubuntu binary"
cp ./binaries/covtobed ./covtobed
- covtobed --version || echo " ERROR: pre-compiled binary not working"
+ covtobed --version >/dev/null || echo " ERROR: pre-compiled binary not working"
fi
fi
./covtobed --version
+echo " ================================================ "
set -eou pipefail
# Compilation success, checking that --version emits the expected "progname" string
echo -n " - Compiled binary prints version: "
-if [ $(./covtobed --version | grep covtobed | wc -l ) -eq "1" ];
+if [ $(./covtobed --version | grep covtobed | wc -l ) -gt "1" ];
then
- echo PASS 1
+ echo PASS $(./covtobed --version | grep covtobed |head -n 1)
+else
+ echo FAIL $(./covtobed --version | grep covtobed | wc -l )
+ exit
fi
+
+
# Testing that -m MIN produces an output, and it fits the expectation for demo.bam (n. lines)
echo -n " - Minimum coverage, expected BED lines check: "
if [ $(./covtobed -m 15 test/demo.bam | wc -l) -eq "12" ];
@@ -78,20 +84,28 @@ else
exit 1
fi
echo -n " - Testing 'counts' format (printed lines): "
-if [ $(./covtobed --format counts test/demo.bam | grep -v '>' | wc -l) -eq "202" ];
+if [ $(./covtobed --format counts test/demo.bam | grep -v \> | wc -l) -eq "202" ];
then
echo PASS 6
else
- echo FAIL
+ echo FAIL $(./covtobed --format counts test/demo.bam | grep -v \> | wc -l) when 202 expected
exit 1
fi
+echo -n " - Testing strand with adjacent intervals: "
+if [[ $(./covtobed test/stranded.bam | wc -l) -eq "1" && $(./covtobed --output-strands test/stranded.bam | wc -l) -eq "2" ]];
+then
+ echo PASS 7
+else
+ echo FAIL $(./covtobed --format counts test/demo.bam | grep -v \> | wc -l) when 202 expected
+ exit 1
+fi
# Checking BED output with reference output file
echo -n " - Checking identity of BED output with pre-calculated: "
./covtobed test/demo.bam > test/output.test
if [ $(diff test/output.test test/output.bed | wc -l) -eq "0" ];
then
- echo PASS 7
+ echo PASS 8
rm test/output.test
else
echo FAIL
@@ -103,7 +117,7 @@ echo -n " - Checking computed coverage for a synthetic BAM file: "
./covtobed -m 1 test/mock.bam > test/output.test
if [ $(diff test/output.test test/mock.bed | wc -l) -eq "0" ];
then
- echo PASS 8
+ echo PASS 9
rm test/output.test
else
echo FAIL
@@ -113,7 +127,7 @@ fi
## Filter non valid alignments
echo -n " - Checking filtering of invalid alignments: "
if [ $(./covtobed -m 1 -d test/filtered.bam | wc -l) -eq "2" ] ; then
- echo -n "PASS 9,"
+ echo -n "PASS 10,"
else
echo FAIL
exit 1
View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/commit/15f7e4d4050ff0c34c6ab978af2b527555068f60
--
View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/commit/15f7e4d4050ff0c34c6ab978af2b527555068f60
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20211103/38f0e47c/attachment-0001.htm>
More information about the debian-med-commit
mailing list