[med-svn] [Git][med-team/covtobed][upstream] 2 commits: New upstream version 1.3.5+dfsg
Andreas Tille (@tille)
gitlab at salsa.debian.org
Sun Jan 16 14:06:42 GMT 2022
Andreas Tille pushed to branch upstream at Debian Med / covtobed
Commits:
5af791e2 by Andreas Tille at 2022-01-16T14:39:39+01:00
New upstream version 1.3.5+dfsg
- - - - -
c9ebde84 by Andreas Tille at 2022-01-16T14:59:15+01:00
New upstream version 1.3.5+dfsg
- - - - -
6 changed files:
- − .github/workflows/c-cpp.yml
- − .gitignore
- base.cpp
- + test/mini-sorted.bam
- + test/mini-unsorted.bam
- test/test.sh
Changes:
=====================================
.github/workflows/c-cpp.yml deleted
=====================================
@@ -1,31 +0,0 @@
-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
=====================================
.gitignore deleted
=====================================
@@ -1,23 +0,0 @@
-flag.*
-build.sh
-a.out
-*.bam.bai
-mos*
-.DS_Store
-README.md~
-exome
-test_local
-*.0.?
-._*
-*.sam
-time.*
-test2.bam
-*.cpp~
-*bak
-pannelli
-paper/paper.md~
-TE
-split_sam_by_flag.pl
-mini_tests
-.vscode
-prova.sh
=====================================
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.3.1"
+const string VERSION = "%prog 1.3.5"
"\nCopyright (C) 2014-2019 Giovanni Birolo and Andrea Telatin\n"
"https://github.com/telatin/covtobed - License MIT"
".\n"
@@ -205,7 +205,7 @@ int main(int argc, char *argv[]) {
parser.add_option("-l", "--min-len").metavar("MINLEN").type("int").set_default("1").help("print BED feature only if its length is bigger (or equal to) than MINLELN (default: %default)");
parser.add_option("-z", "--min-ctg-len").metavar("MINCTGLEN").type("int").help("Skip reference sequences (contigs) shorter than this value");
parser.add_option("-d", "--discard-invalid-alignments").action("store_true").set_default("0").help("skip duplicates, failed QC, and non primary alignment, minq>0 (or user-defined if higher) (default: %default)");
-
+ parser.add_option("--keep-invalid-alignments").action("store_true").set_default("0").help("Keep duplicates, failed QC, and non primary alignment, min=0 (or user-defined if higher) (default: %default)");
// output options
parser.add_option("--output-strands").action("store_true").set_default("0").help("output coverage and stats separately for each strand");
@@ -216,13 +216,34 @@ int main(int argc, char *argv[]) {
optparse::Values options = parser.parse_args(argc, argv);
const bool physical_coverage = options.get("physical_coverage");
- const bool only_valid = options.get("discard_invalid_alignments");
+ bool only_valid = options.get("discard_invalid_alignments");
+ const bool keep_invalid = options.get("keep_invalid_alignments");
const int minimum_coverage = options.get("min_cov");
const int maximum_coverage = options.get("max_cov");
const int minimum_length = options.get("min_len");
const int minimum_contig_len= options.get("min_ctg_len");
int min_mapq = options.get("min_mapq");
+ // since 1.3.2 deprecate --discard-invalid-alignments
+
+ if (only_valid and keep_invalid) {
+ cerr << "ERROR: --discard-invalid-alignments and --keep-invalid-alignments are incompatible." << endl << "In the future --discard-invalid-alignments will be the default." << endl;
+ exit(1);
+ } else if (!only_valid and !keep_invalid) {
+ if (getenv("COVTOBED_QUIET") == NULL) {
+ cerr << "WARNING: --discard-invalid-alignments in the future will be activated by default." << endl;
+ }
+ // only_valid = false by default as legacy behaviour
+ } else if (only_valid) {
+ if (getenv("COVTOBED_QUIET") == NULL) {
+ cerr << "WARNING: --discard-invalid-alignments will be automatically enabled in the future." << endl;
+ }
+ only_valid = true;
+ } else if (keep_invalid) {
+ // this if statement will remain: in the future only_valid will be the default
+ only_valid = false;
+ }
+
if (only_valid and !min_mapq) {
min_mapq = 1;
} else {
@@ -264,7 +285,14 @@ int main(int argc, char *argv[]) {
// output coverage
assert(coverage_ends.size() == coverage);
+
+ // check unsorted 1.3.4
+ if ( last_pos > next_change ) {
+ throw string("Position going backward, is the BAM sorted? last_pos=" +
+ to_string(last_pos) + " next_change=" + to_string(next_change));
+ }
output({ref.RefName, last_pos, next_change}, coverage);
+
// increment coverage with alignments that start here
while (more_alignments_for_ref && next_change == alignment.Position) {
@@ -289,6 +317,8 @@ int main(int argc, char *argv[]) {
debug cerr << "[<] Coverage is " << coverage << " from " << next_change << endl;
last_pos = next_change;
+
+
} while (last_pos != ref.RefLength);
debug cerr << "[_] Completed at " << ref.RefName << ":" << last_pos << " [coverage:" << coverage_ends.size() << "]" << endl;
// reference ended
@@ -297,6 +327,7 @@ int main(int argc, char *argv[]) {
cerr << "Try samtools fixmate on the input file" << endl;
}
// 1.2.0 -- removed: assert(coverage_ends.empty());
+
}
//assert(!more_alignments);
if (more_alignments) {
=====================================
test/mini-sorted.bam
=====================================
Binary files /dev/null and b/test/mini-sorted.bam differ
=====================================
test/mini-unsorted.bam
=====================================
Binary files /dev/null and b/test/mini-unsorted.bam differ
=====================================
test/test.sh
=====================================
@@ -6,6 +6,7 @@
# REQUIRES: ./test/demo.bam
# ./test/mock.bam
+export COVTOBED_QUIET=1
REMOVE=0
if [ ! -e "test/demo.bam" ]; then
echo "WARNING: running this test from a bad location"
@@ -42,8 +43,24 @@ else
exit
fi
+# Testing sortedness
+echo -n " - Working with sorted file: "
+if [[ $(./covtobed test/mini-sorted.bam 2> /dev/null || echo "FAIL" ) != "FAIL" ]];
+then
+ echo PASS
+else
+ echo FAIL
+ exit
+fi
-
+echo -n " - Working with unsorted file (should raise error): "
+if [[ $(./covtobed test/mini-unsorted.bam 2> /dev/null >/dev/null || echo "FAIL" ) == "FAIL" ]];
+then
+ echo PASS
+else
+ echo FAIL
+ 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" ];
View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/compare/15f7e4d4050ff0c34c6ab978af2b527555068f60...c9ebde84f216da81f3458b03f0e40914fb8e6ce7
--
View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/compare/15f7e4d4050ff0c34c6ab978af2b527555068f60...c9ebde84f216da81f3458b03f0e40914fb8e6ce7
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/20220116/e60bfb13/attachment-0001.htm>
More information about the debian-med-commit
mailing list