Nilesh Patra pushed to branch upstream at Debian Med / covtobed


Commits:
67aa1fbc by Nilesh Patra at 2020-09-22T18:25:28+05:30
New upstream version 1.1.4+dfsg
- - - - -


4 changed files:

- .gitignore
- CONTRIBUTING.md
- base.cpp
- benchmark/disk_file.sh


Changes:

=====================================
.gitignore
=====================================
@@ -18,3 +18,6 @@ pannelli
 paper/paper.md~
 TE
 split_sam_by_flag.pl
+mini_tests
+.vscode
+prova.sh


=====================================
CONTRIBUTING.md
=====================================
@@ -1,4 +1,6 @@
-If you wish to fix a bug or add new features to the software we welcome Pull 
Requests. 
+# Contributing to `covtobed`
+
+If you wish to fix a bug or add new features to the software we welcome **Pull 
Requests**. 
 
 We use [GitHub Flow style 
development](https://guides.github.com/introduction/flow/). 
 


=====================================
base.cpp
=====================================
@@ -1,4 +1,4 @@
-       #include <queue>
+#include <queue>
 #include <vector>
 #include <iostream>
 #include <map>
@@ -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.1.2"
+const string VERSION = "%prog 1.1.4"
        "\nCopyright (C) 2014-2019 Giovanni Birolo and Andrea Telatin\n"
        "https://github.com/telatin/covtobed - License MIT"
        ".\n"
@@ -61,11 +61,17 @@ class Input {
                bool get_next_alignment(BamAlignment & alignment) {
                        bool more_alignments, good_alignment;
                        do {
-                               debug cerr << "[M] " << alignment.Name << ":" 
<< alignment.Position << " | Is mapped? " << alignment.IsMapped() << endl;
+                               debug cerr << "[M] Read  on ref#" << 
alignment.RefID << " pos:" << alignment.Position << 
+                                   "\n\t| Is mapped? " << alignment.IsMapped() 
<< " | AlignmentFlag:" << alignment.AlignmentFlag << endl;
                                more_alignments = 
input_bams.GetNextAlignmentCore(alignment);
                                if (discard_invalid_alignments) {
                                        good_alignment = alignment.IsMapped() 
&& alignment.MapQuality >= min_mapq
-                                                                       && 
!alignment.IsDuplicate() && !alignment.IsFailedQC() && 
alignment.IsPrimaryAlignment() ;
+                                                                       && 
!alignment.IsDuplicate() && !alignment.IsFailedQC() && 
alignment.IsPrimaryAlignment();
+
+                                       // 1.2.0 ProperPair
+                                       if (alignment.IsPaired() && ! 
alignment.IsProperPair() ) {
+                                           good_alignment = false;
+                                       }
                                } else {
                                        good_alignment = alignment.IsMapped() 
&& alignment.MapQuality >= min_mapq;
                                }
@@ -210,6 +216,7 @@ int main(int argc, char *argv[]) {
                min_mapq = options.get("min_mapq");
        }
 
+
        try {
                // open input and output
                Input input(parser.args(), min_mapq, only_valid);
@@ -247,6 +254,7 @@ int main(int argc, char *argv[]) {
                                while (more_alignments_for_ref && next_change 
== alignment.Position) {
                                        if (physical_coverage) {
                                                if (alignment.InsertSize > 0) {
+                                                       debug cerr << "   [phy] 
pos:" << alignment.Position << " size:" << alignment.InsertSize << endl;
                                                        
coverage_ends.push({alignment.Position + alignment.InsertSize, 
alignment.IsReverseStrand()});
                                                        
coverage.inc(alignment.IsReverseStrand());
                                                }
@@ -266,9 +274,13 @@ 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 << endl;
+                       debug cerr << "[_] Completed at " << ref.RefName << ":" 
<< last_pos << " [coverage:"  << coverage_ends.size() << "]" << endl;
                        // reference ended
-                       assert(coverage_ends.empty());
+                       if (!coverage_ends.empty()) {
+                           cerr << "Coverage is not zero at the end of " << 
ref.RefName << endl;
+                           cerr << "Try samtools fixmate on the input file" << 
endl;
+                       }
+                       // 1.2.0 -- removed: assert(coverage_ends.empty());
                }
                //assert(!more_alignments);
                if (more_alignments) {


=====================================
benchmark/disk_file.sh
=====================================
@@ -20,14 +20,13 @@ if [ ! -e "$FILE" ]; then
        exit
 fi
 
-       TAG=$(basename $FILE | cut -f1 -d.)
+TAG=$(basename $FILE | cut -f1 -d.)
 
-       echo "$TAG [$FILE]"
-       hyperfine --warmup 2 --min-runs 6 --cleanup 'rm *.bed mos?_*.* || true' 
\
+echo "$TAG [$FILE]"
+hyperfine --warmup 2 --min-runs 6 --cleanup 'rm *.bed mos?_*.* || true' \
                --export-markdown disk_$TAG.md \
                "mosdepth -F 4 -x -t 4 mos4_ $FILE" \
                "mosdepth -F 4 -x      mos1_ $FILE" \
                "covtobed $FILE > covtobed_$TAG.bed" \
-               "sambamba depth base -F 'not unmapped' $FILE > 
sambamba.txt.bed" \
-               "sambamba depth window -F 'not unmapped' -w 1000 $FILE > 
sambamba2.txt.bed"\
                "bedtools genomecov -bga -ibam $FILE > bedtools_$TAG.bed"
+



View it on GitLab: 
https://salsa.debian.org/med-team/covtobed/-/commit/67aa1fbca9e3e37bd888f184c377867a3ad5a13f

-- 
View it on GitLab: 
https://salsa.debian.org/med-team/covtobed/-/commit/67aa1fbca9e3e37bd888f184c377867a3ad5a13f
You're receiving this email because of your account on salsa.debian.org.


_______________________________________________
debian-med-commit mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to