[med-svn] [Git][med-team/covtobed][master] 4 commits: New upstream version 1.3.1+dfsg
Nilesh Patra (@nilesh)
gitlab at salsa.debian.org
Wed Nov 3 16:03:12 GMT 2021
Nilesh Patra pushed to branch master at Debian Med / covtobed
Commits:
15f7e4d4 by Nilesh Patra at 2021-11-03T21:01:28+05:30
New upstream version 1.3.1+dfsg
- - - - -
8bc99d60 by Nilesh Patra at 2021-11-03T21:01:59+05:30
Update upstream source from tag 'upstream/1.3.1+dfsg'
Update to upstream version '1.3.1+dfsg'
with Debian dir 14897f31f1c6667383ab680c7675149c5142bb68
- - - - -
45e38c41 by Nilesh Patra at 2021-11-03T21:22:28+05:30
Refresh patch
- - - - -
5b871a55 by Nilesh Patra at 2021-11-03T21:22:28+05:30
Upload to unstable
- - - - -
10 changed files:
- + .github/workflows/c-cpp.yml
- − .travis.yml
- README.md
- base.cpp
- debian/changelog
- debian/patches/test_use_system_installed_binary.patch
- + 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 {
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+covtobed (1.3.1+dfsg-1) unstable; urgency=medium
+
+ * New upstream version 1.3.1+dfsg
+ * Refresh patch
+
+ -- Nilesh Patra <nilesh at debian.org> Wed, 03 Nov 2021 21:09:46 +0530
+
covtobed (1.2.0+dfsg-2) unstable; urgency=medium
* Team upload.
=====================================
debian/patches/test_use_system_installed_binary.patch
=====================================
@@ -1,10 +1,6 @@
-Description: modify test script so it works with autopkgtest
-Author: Shayan Doust <hello at shayandoust.me>
-Last-Update: 2020-06-04
----
---- covtobed.orig/test/test.sh
-+++ covtobed/test/test.sh
-@@ -7,40 +7,20 @@
+--- a/test/test.sh
++++ b/test/test.sh
+@@ -7,38 +7,18 @@
# ./test/mock.bam
REMOVE=0
@@ -21,116 +17,137 @@ Last-Update: 2020-06-04
- 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
+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 ) -eq "1" ];
+-if [ $(./covtobed --version | grep covtobed | wc -l ) -gt "1" ];
++if [ $(covtobed --version | grep covtobed | wc -l ) -gt "1" ];
then
- echo PASS 1
+- echo PASS $(./covtobed --version | grep covtobed |head -n 1)
++ echo PASS $(covtobed --version | grep covtobed |head -n 1)
+ else
+- echo FAIL $(./covtobed --version | grep covtobed | wc -l )
++ echo FAIL $(covtobed --version | grep covtobed | wc -l )
+ exit
fi
+@@ -46,7 +26,7 @@
+
# 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" ];
-+if [ $(covtobed -m 15 /usr/share/doc/covtobed-examples/examples/demo.bam | wc -l) -eq "12" ];
++if [ $(covtobed -m 15 demo.bam | wc -l) -eq "12" ];
then
echo PASS 2
else
-@@ -50,7 +30,7 @@
+@@ -56,7 +36,7 @@
# Checking thath --physical-coverage will work, and it fits the expected number of lines
echo -n " - Physical coverage, expected BED lines check: "
-if [ $(./covtobed --physical-coverage test/mp.bam | wc -l) -eq "136" ];
-+if [ $(covtobed --physical-coverage /usr/share/doc/covtobed-examples/examples/mp.bam | wc -l) -eq "136" ];
++if [ $(covtobed --physical-coverage mp.bam | wc -l) -eq "136" ];
then
echo PASS 3
else
-@@ -60,7 +40,7 @@
+@@ -66,7 +46,7 @@
# Checking stranded output: it should produce content in the fifth column of the bed file
echo -n " - Stranded output, testing column #5: "
-if [ $(./covtobed --out test/demo.bam | cut -f 5 | sort -u | wc -l) -eq "10" ];
-+if [ $(covtobed --out /usr/share/doc/covtobed-examples/examples/demo.bam | cut -f 5 | sort -u | wc -l) -eq "10" ];
++if [ $(covtobed --out demo.bam | cut -f 5 | sort -u | wc -l) -eq "10" ];
then
echo PASS 4
else
-@@ -70,7 +50,7 @@
+@@ -76,7 +56,7 @@
# Checking the "counts" output (counting the lines containing a ">")
echo -n " - Testing 'counts' format (printed headers): "
-if [ $(./covtobed --format counts test/demo.bam | grep '>' | wc -l) -eq "2" ];
-+if [ $(covtobed --format counts /usr/share/doc/covtobed-examples/examples/demo.bam | grep '>' | wc -l) -eq "2" ];
++if [ $(covtobed --format counts demo.bam | grep '>' | wc -l) -eq "2" ];
then
echo PASS 5
else
-@@ -78,7 +58,7 @@
+@@ -84,29 +64,29 @@
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 /usr/share/doc/covtobed-examples/examples/demo.bam | grep -v '>' | wc -l) -eq "202" ];
+-if [ $(./covtobed --format counts test/demo.bam | grep -v \> | wc -l) -eq "202" ];
++if [ $(covtobed --format counts demo.bam | grep -v \> | wc -l) -eq "202" ];
then
echo PASS 6
else
-@@ -88,11 +68,11 @@
+- echo FAIL $(./covtobed --format counts test/demo.bam | grep -v \> | wc -l) when 202 expected
++ echo FAIL $(covtobed --format counts 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" ]];
++if [[ $(covtobed stranded.bam | wc -l) -eq "1" && $(covtobed --output-strands 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
++ echo FAIL $(covtobed --format counts 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" ];
-+covtobed /usr/share/doc/covtobed-examples/examples/demo.bam > output.test
-+if [ $(diff output.test /usr/share/doc/covtobed-examples/examples/output.bed | wc -l) -eq "0" ];
++covtobed demo.bam > output.test
++if [ $(diff output.test output.bed | wc -l) -eq "0" ];
then
- echo PASS 7
+ echo PASS 8
- rm test/output.test
+ rm output.test
else
echo FAIL
exit 1
-@@ -100,11 +80,11 @@
+@@ -114,11 +94,11 @@
## Synthetic BAM test
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" ];
-+covtobed -m 1 /usr/share/doc/covtobed-examples/examples/mock.bam > output.test
-+if [ $(diff output.test /usr/share/doc/covtobed-examples/examples/mock.bed | wc -l) -eq "0" ];
++covtobed -m 1 mock.bam > output.test
++if [ $(diff output.test mock.bed | wc -l) -eq "0" ];
then
- echo PASS 8
+ echo PASS 9
- rm test/output.test
+ rm output.test
else
echo FAIL
exit 1
-@@ -112,23 +92,23 @@
+@@ -126,23 +106,23 @@
## Filter non valid alignments
echo -n " - Checking filtering of invalid alignments: "
-if [ $(./covtobed -m 1 -d test/filtered.bam | wc -l) -eq "2" ] ; then
-+if [ $(covtobed -m 1 -d /usr/share/doc/covtobed-examples/examples/filtered.bam | wc -l) -eq "2" ] ; then
- echo -n "PASS 9,"
++if [ $(covtobed -m 1 -d filtered.bam | wc -l) -eq "2" ] ; then
+ echo -n "PASS 10,"
else
echo FAIL
exit 1
fi
-if [ $(./covtobed -m 1 test/filtered.bam | wc -l) -eq "6" ] ; then
-+if [ $(covtobed -m 1 /usr/share/doc/covtobed-examples/examples/filtered.bam | wc -l) -eq "6" ] ; then
++if [ $(covtobed -m 1 filtered.bam | wc -l) -eq "6" ] ; then
echo 10
else
- echo "FAIL: $(./covtobed -m 1 -d test/filtered.bam | wc -l)"
-+ echo "FAIL: $(covtobed -m 1 -d /usr/share/doc/covtobed-examples/examples/filtered.bam | wc -l)"
++ echo "FAIL: $(covtobed -m 1 -d filtered.bam | wc -l)"
exit 1
fi
@@ -138,15 +155,14 @@ Last-Update: 2020-06-04
# covered exactly {n}X times
echo " - Checking artificial coverage values:"
-./covtobed test/test_cov.bam -m 1 |cut -f 1,4| while read LINE;
-+covtobed /usr/share/doc/covtobed-examples/examples/test_cov.bam -m 1 |cut -f 1,4| while read LINE;
++covtobed test_cov.bam -m 1 |cut -f 1,4| while read LINE;
do
echo "$LINE" | perl -ne '($exp, $cov)=split /\s+/, $_; if ("$exp" ne "${cov}X") {
die "$exp != $cov\n";
-@@ -137,7 +117,3 @@
- }'
- done
+@@ -153,5 +133,5 @@
echo "ALL TESTS: PASSED"
--
--if [[ $REMOVE -eq 1 ]]; then
+
+ if [[ $REMOVE -eq 1 ]]; then
- rm ./covtobed
--fi
++ rm covtobed
+ fi
=====================================
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/-/compare/761ae720607b2c255cd10ec51448d34f2e13f3c3...5b871a5527ac9f9b0e8c5010b14a62e21b930957
--
View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/compare/761ae720607b2c255cd10ec51448d34f2e13f3c3...5b871a5527ac9f9b0e8c5010b14a62e21b930957
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/98587605/attachment-0001.htm>
More information about the debian-med-commit
mailing list