Comments (6)
Thanks for reporting this. Unfortunately, I don't understand yet. Could you explain more? SamRecord.get0BasedPosition()
returns the leftmost position of the record, the first record always starts before the second, and CigarHelper::softClipEndByRefPos
handles forward/reverse reads correctly, right?
from bamutil.
the first record always starts before the second
is the assumption I am referring to. This could fail given an exotic data set.
firstRecord ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
secondRecord |||||||||||||||||||||||||||||||||||||||||||||||||
is just one possibility if the data is not sorted by coordinate.
from bamutil.
Thanks for clarifying that. Would an assertion be a good approach?
if (firstRecord.get0BasedPosition() > secondRecord.get0BasedPosition()) {
std::ostringstream errmsg;
errmsg
<< "BamUtil's OverlapClipLowerBaseQual::handleOverlapPair encountered paired reads"
<< " in the wrong order where firstRecord's leftmost 0-based position is "
<< firstRecord.get0BasedPosition()
<< " and secondRecord's leftmost 0-based position is "
<< secondRecord.get0BasedPosition()
<< std::endl;
throw(std::runtime_error(errmsg.str()));
}
Or just fixing the problem?
void OverlapClipLowerBaseQual::handleOverlapPair(SamRecord& firstRecord,
SamRecord& secondRecord)
{
SamRecord *first = &firstRecord;
SamRecord *second = &secondRecord;
if (first->get0BasedPosition() > second->get0BasedPosition()) {
SamRecord *tmp = first;
first = second;
second = tmp;
}
// replace `firstRecord.` with `first->` and `f(firstRecord)` with `f(*first)`
}
from bamutil.
Depending on how robust you want the code to be you have a few options.
Ideally you would handle any data set by just comparing the start and ends of each record and retain the inner region.
Something along the lines of
int32_t overlapStart = firstRecord.get0BasedPosition() > secondRecord.get0BasedPosition() ? firstRecord.get0BasedPosition() : secondRecord.get0BasedPosition();
int32_t overlapEnd = firstRecord.get0BasedAlignmentEnd() > secondRecord.get0BasedAlignmentEnd() ? secondRecord.get0BasedAlignmentEnd() : firstRecord.get0BasedAlignmentEnd();
I haven't fully dissected the rest of this function to understand how this change would affect it otherwise I would just submit a pull request.
Given my assumption of how the function handles these variables it should be able to handle my previous example as well as
first ||||||||||||||||
second |||||||||||||||||||||||||||||||||||||
or
first |||||||||||||||||||||||||||||||||||||
second ||||||||||||||
from bamutil.
It already handles
first |||||||||||||||||||||||||||||||||||||
second ||||||||||||||
from bamutil.
Unless the average quality of second is greater.
from bamutil.
Related Issues (20)
- Building bamUtil returns error: undefined reference HOT 4
- Cut middle of reads HOT 2
- `bam diff` should exit with a return code
- Dedup does not work from std/in HOT 2
- Cannot Compile NonPrimaryDedup Branch HOT 5
- cannot consume -.ubam on a pipe HOT 2
- Makefile should not ignore system LDFLAGS
- `bam diff` seems to return the reads that look identical between A and B HOT 1
- the clang compiler does not support -pg option on versions of OS X 10.9 and later HOT 4
- Error building from source: libStatGen HOT 3
- BamUtil: recab error: failed to open reference genome HOT 6
- bam2FastQ generates empty fastq files
- bash -x testBam2FastQ.sh and bash -x testMergeBam.sh failed on centos8_aarch64
- can not install with conda HOT 2
- bamutil diff - Get record for every read being compared HOT 2
- build is broken due to deprecated git protocol HOT 1
- Odd stats reported for clipOverlap
- License? HOT 1
- splitChromosome without header?
- Erroneous CIGAR string after clipOverlap HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bamutil.