[med-svn] [flexbar] 03/05: New upstream version 3.0.3
Andreas Tille
tille at debian.org
Sat Aug 26 21:23:39 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository flexbar.
commit b166ffcb0d8542c6a78ee4d4b08ee379343470b6
Author: Andreas Tille <tille at debian.org>
Date: Sat Aug 26 23:22:58 2017 +0200
New upstream version 3.0.3
---
CMakeLists.txt | 2 +-
README.md | 10 +++--
src/CMakeLists.txt | 17 +++----
src/Flexbar.cpp | 6 +--
src/FlexbarTypes.h | 38 ++++++++--------
src/Options.h | 5 +++
src/PairedAlign.h | 130 +++++++++++++++++++++++++++++------------------------
src/PairedInput.h | 75 +++++++++++++++++--------------
src/PairedOutput.h | 8 ++--
src/SeqAlign.h | 5 ++-
src/SeqAlignAlgo.h | 4 +-
11 files changed, 161 insertions(+), 139 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0a7853..560fc93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required( VERSION 2.8.2 )
project( FLEXBAR )
-set( SEQAN_APP_VERSION "3.0.0" )
+set( SEQAN_APP_VERSION "3.0.3" )
include_directories( ${FLEXBAR_SOURCE_DIR}/include )
# link_directories( ${FLEXBAR_SOURCE_DIR}/lib )
diff --git a/README.md b/README.md
index 5b8cf9b..4b80340 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@ The program Flexbar preprocesses high-throughput sequencing data efficiently. It
Refer to the [manual](https://github.com/seqan/flexbar/wiki) or contact [jtroehr](https://github.com/jtroehr) for support with this application.
+![Flexbar logo](https://github.com/seqan/flexbar/wiki/images/flexbar-logo.png)
+
### Reference
@@ -22,20 +24,20 @@ Flexbar source code as well as binaries for Linux and Mac OS can be downloaded o
Make sure that `cmake` is available, as well as development and runtime files of the TBB library 4.0 or later (Intel Threading Building Blocks). Using a package manager is a simple way to install them. Furthermore, the SeqAn library and a compiler that supports C++14 is required:
* Get SeqAn library version 2.2.0 [here](https://github.com/seqan/seqan/releases/download/seqan-v2.2.0/seqan-library-2.2.0.tar.xz)
-* Download Flexbar 3.0 source code [release](https://github.com/seqan/flexbar/releases)
+* Download Flexbar 3.0.3 source code [release](https://github.com/seqan/flexbar/releases)
Decompress both files:
- tar xzf flexbar-3.0.0.tar.gz
+ tar xzf flexbar-3.0.3.tar.gz
tar xJf seqan-library-2.2.0.tar.xz
Move SeqAn include folder to Flexbar:
- mv seqan-library-2.2.0/include flexbar-3.0.0
+ mv seqan-library-2.2.0/include flexbar-3.0.3
Use these commands for building:
- cd flexbar-3.0.0
+ cd flexbar-3.0.3
cmake .
make
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index eb94641..722a8a0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,14 +1,8 @@
cmake_minimum_required( VERSION 2.8.2 )
include(CheckCXXCompilerFlag)
-# CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
-CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
-# if(COMPILER_SUPPORTS_CXX11)
-# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-# else()
-# message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Use a different compiler.")
-# endif()
+CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
@@ -59,6 +53,10 @@ else()
message( STATUS "Build will not support bzip2." )
endif()
+# find_package( TBB REQUIRED )
+# if( NOT TBB_FOUND )
+# message( FATAL_ERROR "TBB library not found." )
+# endif()
set( SEQAN_CTD_EXECUTABLES ${SEQAN_CTD_EXECUTABLES} flexbar CACHE INTERNAL "" )
@@ -70,8 +68,3 @@ set( SEQAN_CTD_EXECUTABLES ${SEQAN_CTD_EXECUTABLES} flexbar CACHE INTERNAL "" )
# include_directories( ${SEQAN_INCLUDE_DIRS} )
# target_link_libraries( flexbar ${SEQAN_LIBRARIES} )
# set( SEQAN_HAS_ZLIB FALSE )
-
-# find_package( TBB REQUIRED )
-# if( NOT TBB_FOUND )
-# message( FATAL_ERROR "TBB library not found." )
-# endif()
diff --git a/src/Flexbar.cpp b/src/Flexbar.cpp
index 91b4fe7..6a9ee12 100644
--- a/src/Flexbar.cpp
+++ b/src/Flexbar.cpp
@@ -2,7 +2,7 @@
Flexbar - flexible barcode and adapter removal
- Version 3.0.0
+ Version 3.0.3
uses SeqAn library release 2.2.0
and TBB library 4.0 or later
@@ -27,8 +27,8 @@ int main(int argc, const char* argv[]){
using namespace std;
using namespace seqan;
- const string version = "3.0";
- const string date = "March 2017";
+ const string version = "3.0.3";
+ const string date = "May 2017";
ArgumentParser parser("flexbar");
diff --git a/src/FlexbarTypes.h b/src/FlexbarTypes.h
index 2c3b2c2..4bc70f9 100644
--- a/src/FlexbarTypes.h
+++ b/src/FlexbarTypes.h
@@ -8,13 +8,12 @@ template <typename TSeqStr, typename TString>
class SeqRead {
public:
- TSeqStr &seq;
- TString &id, &qual;
+ TSeqStr seq;
+ TString id, qual;
SeqRead(TSeqStr& sequence, TString& seqID) :
seq(sequence),
- id(seqID),
- qual(seqID){
+ id(seqID){
}
SeqRead(TSeqStr& sequence, TString& seqID, TString& quality) :
@@ -83,7 +82,6 @@ namespace flexbar{
typedef seqan::Align<FSeqStr, seqan::ArrayGaps> TAlign;
typedef seqan::StringSet<TAlign> TAlignSet;
typedef seqan::String<int> TAlignScores;
- // typedef std::pair<TAlignSet, TAlignScores> TAlignments;
struct Alignments {
TAlignSet aset;
@@ -91,25 +89,25 @@ namespace flexbar{
};
typedef std::vector<Alignments> TAlignBundle;
- typedef std::vector<TPairedRead* > TPairedReads;
+ typedef std::vector<TPairedRead* > TPairedReadBundle;
// typedef seqan::StringSet<TAlign, seqan::Dependent<seqan::Tight> > TAlignSet;
- struct SeqReadData {
- TSeqStrs seqs;
- TStrings ids, quals;
- TBools uncalled;
-
- SeqReadData(){}
- };
-
- struct PairedReadBundle {
- SeqReadData srd, srd2, srdBR;
- TPairedReads pReads;
-
- PairedReadBundle(){}
- };
+ // struct SeqReadData {
+ // TSeqStrs seqs;
+ // TStrings ids, quals;
+ // TBools uncalled;
+ //
+ // SeqReadData(){}
+ // };
+
+ // struct PairedReadBundle {
+ // SeqReadData srd, srd2, srdBR;
+ // TPairedReads pReads;
+ //
+ // PairedReadBundle(){}
+ // };
struct TBar {
diff --git a/src/Options.h b/src/Options.h
index 4e722a8..47c1854 100644
--- a/src/Options.h
+++ b/src/Options.h
@@ -572,6 +572,11 @@ void loadOptions(Options &o, seqan::ArgumentParser &parser){
getOptionValue(o.min_readLen, parser, "min-read-length");
*out << "min-read-length: " << o.min_readLen << endl;
+ if(o.min_readLen < 1){
+ cerr << "\n" << "Minimum read length should be 1 or higher.\n" << endl;
+ exit(1);
+ }
+
// quality-based trimming
diff --git a/src/PairedAlign.h b/src/PairedAlign.h
index 952f049..db757e5 100644
--- a/src/PairedAlign.h
+++ b/src/PairedAlign.h
@@ -66,14 +66,12 @@ public:
};
- void alignPairedRead(flexbar::TPairedRead* pRead, flexbar::TAlignBundle &alBundle, std::vector<flexbar::ComputeCycle> &cycle, std::vector<unsigned int> &idxAl){
+ void alignPairedReadBarcode(flexbar::TPairedRead* pRead, flexbar::TAlignBundle &alBundle, std::vector<flexbar::ComputeCycle> &cycle, std::vector<unsigned int> &idxAl){
using namespace flexbar;
- bool skipAdapRem = false;
-
- // barcode detection
if(m_barType != BOFF){
+
switch(m_barType){
case BARCODE_READ: pRead->barID = m_b1->alignSeqRead(pRead->b, false, alBundle[0], cycle[0], idxAl[0]); break;
case WITHIN_READ_REMOVAL2: pRead->barID2 = m_b2->alignSeqRead(pRead->r2, true, alBundle[2], cycle[2], idxAl[2]);
@@ -86,18 +84,23 @@ public:
if(pRead->barID == 0 || (m_twoBarcodes && pRead->barID2 == 0)){
if(cycle[0] != PRELOAD) m_unassigned++;
- if(! m_writeUnassigned) skipAdapRem = true;
}
}
+ }
+
+
+ void alignPairedReadAdapter(flexbar::TPairedRead* pRead, flexbar::TAlignBundle &alBundle, std::vector<flexbar::ComputeCycle> &cycle, std::vector<unsigned int> &idxAl){
- // adapter removal
- if(m_adapRem != AOFF && ! skipAdapRem){
+ using namespace flexbar;
+
+ if(m_adapRem != AOFF){
+
if(m_adapRem != ATWO)
- m_a1->alignSeqRead(pRead->r1, true, alBundle[3], cycle[3], idxAl[3]);
+ m_a1->alignSeqRead(pRead->r1, true, alBundle[0], cycle[0], idxAl[0]);
if(pRead->r2 != NULL && m_adapRem != AONE){
- if(m_adapRem != NORMAL2) m_a1->alignSeqRead(pRead->r2, true, alBundle[4], cycle[4], idxAl[4]);
- else m_a2->alignSeqRead(pRead->r2, true, alBundle[4], cycle[4], idxAl[4]);
+ if(m_adapRem != NORMAL2) m_a1->alignSeqRead(pRead->r2, true, alBundle[1], cycle[1], idxAl[1]);
+ else m_a2->alignSeqRead(pRead->r2, true, alBundle[1], cycle[1], idxAl[1]);
}
}
}
@@ -110,62 +113,71 @@ public:
if(item != NULL){
- PairedReadBundle *prBundle = static_cast<PairedReadBundle* >(item);
-
- TAlignBundle alBundle;
- alBundle.reserve(5);
+ TPairedReadBundle *prBundle = static_cast<TPairedReadBundle* >(item);
- Alignments r1AlignmentsB, r2AlignmentsB, bAlignmentsB;
- Alignments r1AlignmentsA, r2AlignmentsA;
+ // barcode detection
- alBundle.push_back(bAlignmentsB);
- alBundle.push_back(r1AlignmentsB);
- alBundle.push_back(r2AlignmentsB);
- alBundle.push_back(r1AlignmentsA);
- alBundle.push_back(r2AlignmentsA);
-
- std::vector<unsigned int> idxAl;
-
- idxAl.push_back(0);
- idxAl.push_back(0);
- idxAl.push_back(0);
- idxAl.push_back(0);
- idxAl.push_back(0);
-
- std::vector<ComputeCycle> cycle;
-
- cycle.push_back(PRELOAD);
- cycle.push_back(PRELOAD);
- cycle.push_back(PRELOAD);
- cycle.push_back(PRELOAD);
- cycle.push_back(PRELOAD);
-
- for(unsigned int i = 0; i < prBundle->pReads.size(); ++i)
- alignPairedRead(prBundle->pReads.at(i), alBundle, cycle, idxAl);
-
- idxAl[0] = 0;
- idxAl[1] = 0;
- idxAl[2] = 0;
- idxAl[3] = 0;
- idxAl[4] = 0;
+ if(m_barType != BOFF){
+
+ TAlignBundle alBundle;
+ Alignments r1AlignmentsB, r2AlignmentsB, bAlignmentsB;
+
+ alBundle.push_back(bAlignmentsB);
+ alBundle.push_back(r1AlignmentsB);
+ alBundle.push_back(r2AlignmentsB);
+
+ std::vector<unsigned int> idxAl;
+ std::vector<ComputeCycle> cycle;
+
+ for(unsigned int i = 0; i < 3; ++i){
+ idxAl.push_back(0);
+ cycle.push_back(PRELOAD);
+ }
+
+ for(unsigned int i = 0; i < prBundle->size(); ++i){
+ alignPairedReadBarcode(prBundle->at(i), alBundle, cycle, idxAl);
+ }
+
+ for(unsigned int i = 0; i < 3; ++i){
+ idxAl[i] = 0;
+ cycle[i] = COMPUTE;
+ }
+
+ for(unsigned int i = 0; i < prBundle->size(); ++i){
+ alignPairedReadBarcode(prBundle->at(i), alBundle, cycle, idxAl);
+ }
+ }
- cycle[0] = COMPUTE;
- cycle[1] = COMPUTE;
- cycle[2] = COMPUTE;
- cycle[3] = COMPUTE;
- cycle[4] = COMPUTE;
+ // adapter removal
- for(unsigned int i = 0; i < prBundle->pReads.size(); ++i){
+ if(m_adapRem != AOFF){
- if(i > 0){
- cycle[0] = RESULTS;
- cycle[1] = RESULTS;
- cycle[2] = RESULTS;
- cycle[3] = RESULTS;
- cycle[4] = RESULTS;
+ TAlignBundle alBundle;
+ Alignments r1AlignmentsA, r2AlignmentsA;
+
+ alBundle.push_back(r1AlignmentsA);
+ alBundle.push_back(r2AlignmentsA);
+
+ std::vector<unsigned int> idxAl;
+ std::vector<ComputeCycle> cycle;
+
+ for(unsigned int i = 0; i < 2; ++i){
+ idxAl.push_back(0);
+ cycle.push_back(PRELOAD);
+ }
+
+ for(unsigned int i = 0; i < prBundle->size(); ++i){
+ alignPairedReadAdapter(prBundle->at(i), alBundle, cycle, idxAl);
+ }
+
+ for(unsigned int i = 0; i < 2; ++i){
+ idxAl[i] = 0;
+ cycle[i] = COMPUTE;
}
- alignPairedRead(prBundle->pReads.at(i), alBundle, cycle, idxAl);
+ for(unsigned int i = 0; i < prBundle->size(); ++i){
+ alignPairedReadAdapter(prBundle->at(i), alBundle, cycle, idxAl);
+ }
}
return prBundle;
diff --git a/src/PairedInput.h b/src/PairedInput.h
index ca76a93..5807ad3 100644
--- a/src/PairedInput.h
+++ b/src/PairedInput.h
@@ -56,12 +56,15 @@ public:
using namespace std;
using namespace flexbar;
- PairedReadBundle *b = new PairedReadBundle();
+ TSeqStrs seqs, seqs2, seqsBR;
+ TStrings ids, ids2, idsBR;
+ TStrings quals, quals2, qualsBR;
+ TBools uncalled, uncalled2, uncalledBR;
- unsigned int nReads = m_f1->loadSeqReads(b->srd.uncalled, b->srd.ids, b->srd.seqs, b->srd.quals, m_bundleSize);
+ unsigned int nReads = m_f1->loadSeqReads(uncalled, ids, seqs, quals, m_bundleSize);
if(m_isPaired){
- unsigned int nReads2 = m_f2->loadSeqReads(b->srd2.uncalled, b->srd2.ids, b->srd2.seqs, b->srd2.quals, m_bundleSize);
+ unsigned int nReads2 = m_f2->loadSeqReads(uncalled2, ids2, seqs2, quals2, m_bundleSize);
if(nReads != nReads2){
cerr << "\nERROR: Read without counterpart in paired input mode.\n" << endl;
@@ -70,7 +73,7 @@ public:
}
if(m_useBarRead){
- unsigned int nBarReads = m_b->loadSeqReads(b->srdBR.uncalled, b->srdBR.ids, b->srdBR.seqs, b->srdBR.quals, m_bundleSize);
+ unsigned int nBarReads = m_b->loadSeqReads(uncalledBR, idsBR, seqsBR, qualsBR, m_bundleSize);
if(nReads > nBarReads){
cerr << "\nERROR: Read without barcode read in input.\n" << endl;
@@ -82,20 +85,20 @@ public:
}
}
- if(nReads == 0){
- delete b;
- return NULL;
- }
+ if(nReads == 0) return NULL;
+
+
+ TPairedReadBundle *prBundle = new TPairedReadBundle();
- for(unsigned int i = 0; i < length(b->srd.ids); ++i){
+ for(unsigned int i = 0; i < length(ids); ++i){
- if(b->srd.uncalled[i] || (m_isPaired && b->srd2.uncalled[i])){
+ if(uncalled[i] || (m_isPaired && uncalled2[i])){
- if(b->srd.uncalled[i]) ++m_uncalled;
- if(m_isPaired && b->srd2.uncalled[i]) ++m_uncalled;
- if(m_isPaired) ++m_uncalledPairs;
+ if(uncalled[i]) ++m_uncalled;
+ if(m_isPaired && uncalled2[i]) ++m_uncalled;
+ if(m_isPaired) ++m_uncalledPairs;
}
- // else if(m_useBarRead && b->srdBR.uncalled[i]){
+ // else if(m_useBarRead && uncalledBR[i]){
//
// // to be handled
// }
@@ -106,35 +109,29 @@ public:
converter << ++m_tagCounter;
TString tagCount = converter.str();
- b->srd.ids[i] = tagCount;
- if(m_isPaired) b->srd2.ids[i] = tagCount;
- if(m_useBarRead) b->srdBR.ids[i] = tagCount;
+ ids[i] = tagCount;
+ if(m_isPaired) ids2[i] = tagCount;
+ if(m_useBarRead) idsBR[i] = tagCount;
}
TSeqRead *read1 = NULL, *read2 = NULL, *barRead = NULL;
if(m_format == FASTA){
- read1 = new TSeqRead(b->srd.seqs[i], b->srd.ids[i]);
- if(m_isPaired) read2 = new TSeqRead(b->srd2.seqs[i], b->srd2.ids[i]);
- if(m_useBarRead) barRead = new TSeqRead(b->srdBR.seqs[i], b->srdBR.ids[i]);
+ read1 = new TSeqRead(seqs[i], ids[i]);
+ if(m_isPaired) read2 = new TSeqRead(seqs2[i], ids2[i]);
+ if(m_useBarRead) barRead = new TSeqRead(seqsBR[i], idsBR[i]);
}
else{
- read1 = new TSeqRead(b->srd.seqs[i], b->srd.ids[i], b->srd.quals[i]);
- if(m_isPaired) read2 = new TSeqRead(b->srd2.seqs[i], b->srd2.ids[i], b->srd2.quals[i]);
- if(m_useBarRead) barRead = new TSeqRead(b->srdBR.seqs[i], b->srdBR.ids[i], b->srdBR.quals[i]);
+ read1 = new TSeqRead(seqs[i], ids[i], quals[i]);
+ if(m_isPaired) read2 = new TSeqRead(seqs2[i], ids2[i], quals2[i]);
+ if(m_useBarRead) barRead = new TSeqRead(seqsBR[i], idsBR[i], qualsBR[i]);
}
- b->pReads.push_back(new TPairedRead(read1, read2, barRead));
+ prBundle->push_back(new TPairedRead(read1, read2, barRead));
}
}
- if(b->pReads.size() == 0){
- delete b;
- b = NULL;
- return loadPairedReadBundle();
- }
-
- return b;
+ return prBundle;
}
@@ -143,9 +140,21 @@ public:
using namespace flexbar;
- PairedReadBundle *prBundle = NULL;
+ TPairedReadBundle *prBundle = NULL;
- prBundle = static_cast< PairedReadBundle* >(loadPairedReadBundle());
+ prBundle = static_cast< TPairedReadBundle* >(loadPairedReadBundle());
+
+ if(prBundle != NULL){
+
+ while(prBundle->size() == 0){
+ delete prBundle;
+ prBundle = NULL;
+
+ prBundle = static_cast< TPairedReadBundle* >(loadPairedReadBundle());
+
+ if(prBundle == NULL) return prBundle;
+ }
+ }
return prBundle;
}
diff --git a/src/PairedOutput.h b/src/PairedOutput.h
index bb13dc2..f8ef29d 100644
--- a/src/PairedOutput.h
+++ b/src/PairedOutput.h
@@ -334,12 +334,12 @@ public:
if(item != NULL){
- PairedReadBundle *prBundle = static_cast< PairedReadBundle* >(item);
+ TPairedReadBundle *prBundle = static_cast< TPairedReadBundle* >(item);
- for(unsigned int i = 0; i < prBundle->pReads.size(); ++i){
+ for(unsigned int i = 0; i < prBundle->size(); ++i){
- writePairedRead(prBundle->pReads.at(i));
- delete prBundle->pReads.at(i);
+ writePairedRead(prBundle->at(i));
+ delete prBundle->at(i);
}
delete prBundle;
}
diff --git a/src/SeqAlign.h b/src/SeqAlign.h
index cb3a27a..0c0841b 100644
--- a/src/SeqAlign.h
+++ b/src/SeqAlign.h
@@ -69,6 +69,9 @@ public:
// return 0;
}
+ if(readLength < 1) return 0;
+
+
if(cycle == PRELOAD){
if(idxAl == 0) reserve(alignments.aset, m_bundleSize * m_queries->size());
@@ -109,8 +112,6 @@ public:
// align each query sequence and store best one
for(unsigned int i = 0; i < m_queries->size(); ++i){
- if(i > 0) cycle = RESULTS;
-
TAlignResults a;
// global sequence alignment
diff --git a/src/SeqAlignAlgo.h b/src/SeqAlignAlgo.h
index 2daf23b..5380ae3 100644
--- a/src/SeqAlignAlgo.h
+++ b/src/SeqAlignAlgo.h
@@ -50,7 +50,7 @@ public:
};
- void alignGlobal(TAlignResults &a, flexbar::Alignments &alignments, const flexbar::ComputeCycle &cycle, const unsigned int idxAl){
+ void alignGlobal(TAlignResults &a, flexbar::Alignments &alignments, flexbar::ComputeCycle &cycle, const unsigned int idxAl){
using namespace std;
using namespace seqan;
@@ -67,6 +67,8 @@ public:
if(cycle == COMPUTE){
+ cycle = RESULTS;
+
if(m_trimEnd == RIGHT || m_trimEnd == RTAIL){
AlignConfig<true, false, true, true> ac;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/flexbar.git
More information about the debian-med-commit
mailing list