Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove any barcode integer suffix not just -1 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ string retrieveNucleotidesContent(const string& barcode);
A barcode is considered as valid if it is not empty, if it does not contain any "N" for 10x and TELL-Seq,
if it is not "0_0_0" for stLFR data, and does not contain a "00" substring for Haplotagging data.
The function takes care of determining the employed sequencing technology.
It also removes the unwanted "-1" if it exsits at the end of the barcode.
It also removes the integer suffix, e.g. "-1", if it exsits at the end of the barcode.

@param barcode the barcode to verify
@throws runtime_error thrown if the sequencing technology could not be recognized
Expand Down
7 changes: 4 additions & 3 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ bool isValidBarcode(string& barcode) {
return false;
}

// first remove "-1" at the end of the barcode if exists
if (barcode.substr(barcode.length() - 2) == "-1"){
barcode = barcode.substr(0, barcode.length() - 2);
// first remove integer suffix, e.g. "-1", at the end of the barcode if exists
std::size_t found = barcode.find("-");
if (found != std::string::npos){
barcode = barcode.substr(0, found);
}

if (techno == Undefined) {
Expand Down