[med-svn] [Git][med-team/covtobed][master] 9 commits: routine-update: New upstream version

Andreas Tille (@tille) gitlab at salsa.debian.org
Sun Jan 16 14:06:35 GMT 2022



Andreas Tille pushed to branch master at Debian Med / covtobed


Commits:
c2fc6037 by Andreas Tille at 2022-01-16T14:39:32+01:00
routine-update: New upstream version

- - - - -
5af791e2 by Andreas Tille at 2022-01-16T14:39:39+01:00
New upstream version 1.3.5+dfsg
- - - - -
8d148751 by Andreas Tille at 2022-01-16T14:40:34+01:00
Update upstream source from tag 'upstream/1.3.5+dfsg'

Update to upstream version '1.3.5+dfsg'
with Debian dir 71d16e1ef88d2e98dea30aa8c3f38181a066a5ca
- - - - -
b7166568 by Andreas Tille at 2022-01-16T14:56:20+01:00
Exclude covtobed binary from upstream source

- - - - -
a4eba060 by Andreas Tille at 2022-01-16T14:57:58+01:00
Once we are removing something just also remove .git* metadata

- - - - -
c9ebde84 by Andreas Tille at 2022-01-16T14:59:15+01:00
New upstream version 1.3.5+dfsg
- - - - -
f6de69ee by Andreas Tille at 2022-01-16T14:59:46+01:00
Update upstream source from tag 'upstream/1.3.5+dfsg'

Update to upstream version '1.3.5+dfsg'
with Debian dir d14eabe886e14dfea826402dee484e4f2472b976
- - - - -
4d2e30a4 by Andreas Tille at 2022-01-16T15:03:06+01:00
Update patches + DEP3

- - - - -
20f6c7fa by Andreas Tille at 2022-01-16T15:05:44+01:00
Upload to unstable

- - - - -


9 changed files:

- − .github/workflows/c-cpp.yml
- − .gitignore
- base.cpp
- debian/changelog
- debian/copyright
- debian/patches/test_use_system_installed_binary.patch
- + 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) {


=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+covtobed (1.3.5+dfsg-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream version
+  * Exclude covtobed binary from upstream source
+
+ -- Andreas Tille <tille at debian.org>  Sun, 16 Jan 2022 15:03:30 +0100
+
 covtobed (1.3.1+dfsg-1) unstable; urgency=medium
 
   * New upstream version 1.3.1+dfsg


=====================================
debian/copyright
=====================================
@@ -5,6 +5,9 @@ Comment: Directories not needed as they contain pre-compiled binaries
 Files-Excluded:
          Docker
          binaries
+         covtobed
+         .gitignore
+         .github
 
 Files: *
 Copyright: 2019 Giovanni Birolo and Andrea Telatin


=====================================
debian/patches/test_use_system_installed_binary.patch
=====================================
@@ -1,8 +1,12 @@
+Author: Shayan Doust
+Last-Update: 2020-06-04 13:39:11 +0100
+Description: Use system libraries in test
+
 --- a/test/test.sh
 +++ b/test/test.sh
-@@ -7,38 +7,18 @@
- #           ./test/mock.bam
+@@ -8,38 +8,18 @@
  
+ export COVTOBED_QUIET=1
  REMOVE=0
 -if [ ! -e "test/demo.bam" ]; then
 -	echo "WARNING: running this test from a bad location"
@@ -43,8 +47,8 @@
  		exit
  fi
  
-@@ -46,7 +26,7 @@
- 
+@@ -63,7 +43,7 @@ else
+ 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" ];
@@ -52,7 +56,7 @@
  then
  	echo PASS 2
  else
-@@ -56,7 +36,7 @@
+@@ -73,7 +53,7 @@ fi
  
  # Checking thath --physical-coverage will work, and it fits the expected number of lines
  echo -n " - Physical coverage, expected BED lines check: "
@@ -61,7 +65,7 @@
  then
  	echo PASS 3
  else
-@@ -66,7 +46,7 @@
+@@ -83,7 +63,7 @@ fi
  
  # Checking stranded output: it should produce content in the fifth column of the bed file
  echo -n " - Stranded output, testing column #5: "
@@ -70,7 +74,7 @@
  then
  	echo PASS 4
  else
-@@ -76,7 +56,7 @@
+@@ -93,7 +73,7 @@ fi
  
  # Checking the "counts" output (counting the lines containing a ">")
  echo -n " - Testing 'counts' format (printed headers): "
@@ -79,7 +83,7 @@
  then
  	echo PASS 5
  else
-@@ -84,29 +64,29 @@
+@@ -101,29 +81,29 @@ else
  	exit 1
  fi
  echo -n " - Testing 'counts' format (printed lines): "
@@ -116,7 +120,7 @@
  else
  	echo FAIL
  	exit 1
-@@ -114,11 +94,11 @@
+@@ -131,11 +111,11 @@ fi
  
  ## Synthetic BAM test
  echo -n " - Checking computed coverage for a synthetic BAM file: "
@@ -131,7 +135,7 @@
  else
  	echo FAIL
  	exit 1
-@@ -126,23 +106,23 @@
+@@ -143,23 +123,23 @@ fi
  
  ## Filter non valid alignments
  echo -n " - Checking filtering of invalid alignments: "
@@ -159,7 +163,7 @@
  do
  	echo "$LINE" | perl -ne '($exp, $cov)=split /\s+/, $_; if ("$exp" ne "${cov}X") {
  		die "$exp != $cov\n";
-@@ -153,5 +133,5 @@
+@@ -170,5 +150,5 @@ done
  echo "ALL TESTS: PASSED"
  
  if [[ $REMOVE -eq 1 ]]; then


=====================================
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/5b871a5527ac9f9b0e8c5010b14a62e21b930957...20f6c7fa7c710304c0db63a44d6c30e8bc6d8543

-- 
View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/compare/5b871a5527ac9f9b0e8c5010b14a62e21b930957...20f6c7fa7c710304c0db63a44d6c30e8bc6d8543
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/0046dbc6/attachment-0001.htm>


More information about the debian-med-commit mailing list