[med-svn] [Git][med-team/bamtools][master] 2 commits: New upstream version 2.5.3+dfsg
Dominique Belhachemi (@domibel)
gitlab at salsa.debian.org
Sat Sep 27 03:36:53 BST 2025
Dominique Belhachemi pushed to branch master at Debian Med / bamtools
Commits:
d2083b11 by Dominique Belhachemi at 2025-09-26T22:36:23-04:00
New upstream version 2.5.3+dfsg
- - - - -
b90a2526 by Dominique Belhachemi at 2025-09-26T22:36:24-04:00
Update upstream source from tag 'upstream/2.5.3+dfsg'
Update to upstream version '2.5.3+dfsg'
with Debian dir f3495f0e210c4a4c072b15cdb17929967abc3351
- - - - -
11 changed files:
- CMakeLists.txt
- src/CMakeLists.txt
- src/api/BamAlignment.cpp
- src/api/BamReader.cpp
- src/api/BamReader.h
- src/api/algorithms/Sort.h
- src/api/internal/bam/BamMultiMerger_p.h
- src/api/internal/bam/BamWriter_p.cpp
- src/toolkit/bamtools_filter.cpp
- src/utils/bamtools_fasta.cpp
- src/utils/bamtools_fasta.h
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -1,9 +1,10 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.11)
+# need 3.11 for INCLUDE_GUARD_NAME in GENERATE_EXPORT_HEADER
project(
BamTools
LANGUAGES CXX
- VERSION 2.5.2)
+ VERSION 2.5.3)
# Set Release type for builds where CMAKE_BUILD_TYPE is unset
# This is usually a good default as this implictly enables
=====================================
src/CMakeLists.txt
=====================================
@@ -87,6 +87,9 @@ target_include_directories(
BamTools PRIVATE
${ZLIB_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ SYSTEM INTERFACE
+ ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(
BamTools PRIVATE
=====================================
src/api/BamAlignment.cpp
=====================================
@@ -870,7 +870,6 @@ void BamAlignment::RemoveTag(const std::string& tag)
char* pOriginalTagData = (char*)TagData.data();
char* pTagData = pOriginalTagData;
const unsigned int originalTagDataLength = TagData.size();
- unsigned int newTagDataLength = 0;
unsigned int numBytesParsed = 0;
// skip if tag not found
@@ -885,7 +884,6 @@ void BamAlignment::RemoveTag(const std::string& tag)
pTagData -= 3;
numBytesParsed -= 3;
const unsigned int beginningTagDataLength = numBytesParsed;
- newTagDataLength += beginningTagDataLength;
std::memcpy(newTagData.Buffer, pOriginalTagData, numBytesParsed);
// attemp to skip to next tag
=====================================
src/api/BamReader.cpp
=====================================
@@ -400,3 +400,8 @@ bool BamReader::SetRegion(const int& leftRefID, const int& leftBound, const int&
{
return d->SetRegion(BamRegion(leftRefID, leftBound, rightRefID, rightBound));
}
+
+int64_t BamReader::Tell() const
+{
+ return d->Tell();
+}
=====================================
src/api/BamReader.h
=====================================
@@ -53,6 +53,7 @@ public:
// sets the target region of interest
bool SetRegion(const int& leftRefID, const int& leftPosition, const int& rightRefID,
const int& rightPosition);
+ int64_t Tell() const;
// ----------------------
// access alignment data
=====================================
src/api/algorithms/Sort.h
=====================================
@@ -60,9 +60,6 @@ struct API_EXPORT Sort
return false; // <-- unreachable
}
- //! Base class for our sorting function objects
- typedef std::binary_function<BamAlignment, BamAlignment, bool> AlignmentSortBase;
-
/*! \struct BamTools::Algorithms::Sort::ByName
\brief Function object for comparing alignments by name
@@ -79,7 +76,7 @@ struct API_EXPORT Sort
std::sort( a.begin(), a.end(), Sort::ByName(Sort::DescendingOrder) );
\endcode
*/
- struct ByName : public AlignmentSortBase
+ struct ByName
{
// ctor
@@ -120,7 +117,7 @@ struct API_EXPORT Sort
std::sort( a.begin(), a.end(), Sort::ByPosition(Sort::DescendingOrder) );
\endcode
*/
- struct ByPosition : public AlignmentSortBase
+ struct ByPosition
{
// ctor
@@ -177,7 +174,7 @@ struct API_EXPORT Sort
\endcode
*/
template <typename T>
- struct ByTag : public AlignmentSortBase
+ struct ByTag
{
// ctor
@@ -227,7 +224,7 @@ struct API_EXPORT Sort
std::set<BamAlignment, Sort::Unsorted>; // STL set, unsorted (but probably insertion order)
\endcode
*/
- struct Unsorted : public AlignmentSortBase
+ struct Unsorted
{
// comparison function
=====================================
src/api/internal/bam/BamMultiMerger_p.h
=====================================
@@ -49,7 +49,7 @@ struct API_NO_EXPORT MergeItem
};
template <typename Compare>
-struct API_NO_EXPORT MergeItemSorter : public std::binary_function<MergeItem, MergeItem, bool>
+struct API_NO_EXPORT MergeItemSorter
{
public:
=====================================
src/api/internal/bam/BamWriter_p.cpp
=====================================
@@ -349,7 +349,7 @@ void BamWriterPrivate::WriteAlignment(const BamAlignment& al)
char* cigarData = new char[packedCigarLength]();
std::memcpy(cigarData, packedCigar.data(), packedCigarLength);
if (m_isBigEndian) {
- for (size_t i = 0; i < packedCigarLength; ++i) {
+ for (size_t i = 0; i < packedCigarLength; i += sizeof(uint32_t)) {
BamTools::SwapEndian_32p(&cigarData[i]);
}
}
@@ -500,8 +500,7 @@ void BamWriterPrivate::WriteAlignment(const BamAlignment& al)
char* cigarData = new char[packedCigarLength]();
std::memcpy(cigarData, packedCigar.data(), packedCigarLength);
if (m_isBigEndian) {
- for (size_t i = 0; i < packedCigarLength;
- ++i) { // FIXME: similarly, this should be "i += 4", not "++i"
+ for (size_t i = 0; i < packedCigarLength; i += sizeof(uint32_t)) {
BamTools::SwapEndian_32p(&cigarData[i]);
}
}
=====================================
src/toolkit/bamtools_filter.cpp
=====================================
@@ -540,22 +540,18 @@ const std::string FilterTool::FilterToolPrivate::GetScriptContents()
// read in entire script contents
char buffer[1024];
std::ostringstream docStream;
- while (true) {
-
- // peek ahead, make sure there is data available
- char ch = fgetc(inFile);
- ungetc(ch, inFile);
- if (feof(inFile)) {
+ while (!feof(inFile)) {
+ // read next block of data
+ const char* data = fgets(buffer, sizeof(buffer), inFile);
+ if (!data) {
break;
}
-
- // read next block of data
- if (fgets(buffer, 1024, inFile) == 0) {
+ if (ferror(inFile)) {
std::cerr << "bamtools filter ERROR: could not read script contents" << std::endl;
- return std::string();
+ return {};
}
- docStream << buffer;
+ docStream << data;
}
// close script file
@@ -1020,7 +1016,7 @@ FilterTool::FilterTool()
const std::string isFirstMateDesc = "keep only alignments marked as first mate?";
const std::string isMappedDesc = "keep only alignments that were mapped?";
const std::string isMateMappedDesc = "keep only alignments with mates that mapped";
- const std::string isMateReverseDesc = "keep only alignments with mate on reverese strand?";
+ const std::string isMateReverseDesc = "keep only alignments with mate on reverse strand?";
const std::string isPairedDesc = "keep only alignments that were sequenced as paired?";
const std::string isPrimaryDesc = "keep only alignments marked as primary?";
const std::string isProperPairDesc = "keep only alignments that passed PE resolution?";
=====================================
src/utils/bamtools_fasta.cpp
=====================================
@@ -52,6 +52,7 @@ struct Fasta::FastaPrivate
bool CreateIndex(const std::string& indexFilename);
bool GetBase(const int& refId, const int& position, char& base);
bool GetSequence(const int& refId, const int& start, const int& stop, std::string& sequence);
+ bool GetLength(const int& refId, int& length);
bool Open(const std::string& filename, const std::string& indexFilename);
// internal methods
@@ -174,7 +175,6 @@ bool Fasta::FastaPrivate::CreateIndex(const std::string& indexFilename)
}
// iterate through fasta entries
- int currentId = 0;
std::string header;
std::string sequence;
while (GetNextHeader(header)) {
@@ -206,9 +206,6 @@ bool Fasta::FastaPrivate::CreateIndex(const std::string& indexFilename)
// store index entry
Index.push_back(data);
-
- // update ref Id
- ++currentId;
}
// open index file
@@ -509,6 +506,26 @@ bool Fasta::FastaPrivate::GetSequence(const int& refId, const int& start, const
return true;
}
+bool Fasta::FastaPrivate::GetLength(const int& refId, int& length)
+{
+ // make sure FASTA file is open
+ if (!IsOpen) {
+ std::cerr << "FASTA error : file not open for reading\n";
+ return false;
+ }
+
+ // make sure index if available
+ if (!HasIndex && Index.empty()) {
+ std::cerr << "FASTA error : could not read from index file\n";
+ return false;
+ }
+
+ length = Index.at(refId).Length;
+
+ // return success
+ return true;
+}
+
bool Fasta::FastaPrivate::LoadIndexData()
{
@@ -670,3 +687,8 @@ bool Fasta::Open(const std::string& filename, const std::string& indexFilename)
{
return d->Open(filename, indexFilename);
}
+
+bool Fasta::GetLength(const int& refId, int& length)
+{
+ return d->GetLength(refId, length);
+}
=====================================
src/utils/bamtools_fasta.h
=====================================
@@ -32,6 +32,7 @@ public:
public:
bool GetBase(const int& refID, const int& position, char& base);
bool GetSequence(const int& refId, const int& start, const int& stop, std::string& sequence);
+ bool GetLength(const int& refId, int& length);
// index-handling methods
public:
View it on GitLab: https://salsa.debian.org/med-team/bamtools/-/compare/8ad51a8e88c0f482021f28b3e0b27cd118d465db...b90a25268621f8df076ce9e3fcbf44689f66946e
--
View it on GitLab: https://salsa.debian.org/med-team/bamtools/-/compare/8ad51a8e88c0f482021f28b3e0b27cd118d465db...b90a25268621f8df076ce9e3fcbf44689f66946e
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/20250927/d594ef9c/attachment-0001.htm>
More information about the debian-med-commit
mailing list