[med-svn] [Git][med-team/libssw][upstream] New upstream version 1.2.5
Andreas Tille (@tille)
gitlab at salsa.debian.org
Sat Jul 15 12:00:14 BST 2023
Andreas Tille pushed to branch upstream at Debian Med / libssw
Commits:
89416347 by Andreas Tille at 2023-07-15T12:49:06+02:00
New upstream version 1.2.5
- - - - -
6 changed files:
- src/example.cpp
- src/main.c
- src/ssw.c
- src/ssw.h
- src/ssw_cpp.cpp
- src/ssw_cpp.h
Changes:
=====================================
src/example.cpp
=====================================
@@ -5,7 +5,7 @@
// 1) g++ -Wall ssw_cpp.cpp ssw.c example.cpp
// 2) ./a.out
// Created by Wan-Ping Lee on 09/04/12.
-// Last revision by Mengyao Zhao on 2017-06-05
+// Last revision by Mengyao Zhao on 2023-Apr-21
// ==========================
#include <iostream>
@@ -24,8 +24,6 @@ int main() {
const string query = "CTGAGCCGGTAAATC";
int32_t maskLen = strlen(query.c_str())/2;
maskLen = maskLen < 15 ? 15 : maskLen;
- //const string ref = "CCGTTTATCGCA";
- //const string query = "CCTTTTATCGCA";
// Declares a default Aligner
StripedSmithWaterman::Aligner aligner;
=====================================
src/main.c
=====================================
@@ -42,14 +42,14 @@ KSEQ_INIT(gzFile, gzread)
static void reverse_comple(const char* seq, char* rc) {
int32_t end = strlen(seq), start = 0;
static const int8_t rc_table[128] = {
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 84, 4, 71, 4, 4, 4, 67, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 65, 65, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 84, 4, 71, 4, 4, 4, 67, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 65, 65, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 84, 4, 71, 4, 4, 4, 67, 4, 4, 4, 4, 4, 4, 78, 4,
+ 4, 4, 4, 4, 65, 65, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 84, 4, 71, 4, 4, 4, 67, 4, 4, 4, 4, 4, 4, 78, 4,
+ 4, 4, 4, 4, 65, 65, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
rc[end] = '\0';
-- end;
=====================================
src/ssw.c
=====================================
@@ -56,7 +56,7 @@
*
* Created by Mengyao Zhao on 6/22/10.
* Copyright 2010 Boston College. All rights reserved.
- * Version 1.2.4
+ * Version 1.2.5
* Last revision by Mengyao Zhao on 2022-Apr-17.
*
* The lazy-F loop implementation was derived from SWPS3, which is
@@ -208,8 +208,8 @@ static alignment_end* sw_sse2_byte (const int8_t* ref,
uint8_t bias, /* Shift 0 point to a positive value. */
int32_t maskLen) {
-// Put the largest number of the 16 numbers in vm into m.
-#define max16(m, vm) (vm) = _mm_max_epu8((vm), _mm_srli_si128((vm), 8)); \
+ // Put the largest number of the 16 numbers in vm into m.
+ #define max16(m, vm) (vm) = _mm_max_epu8((vm), _mm_srli_si128((vm), 8)); \
(vm) = _mm_max_epu8((vm), _mm_srli_si128((vm), 4)); \
(vm) = _mm_max_epu8((vm), _mm_srli_si128((vm), 2)); \
(vm) = _mm_max_epu8((vm), _mm_srli_si128((vm), 1)); \
@@ -304,16 +304,17 @@ static alignment_end* sw_sse2_byte (const int8_t* ref,
for (j = 0; LIKELY(j < segLen); ++j) {
vH = _mm_load_si128(pvHStore + j);
vH = _mm_max_epu8(vH, vF);
- vMaxColumn = _mm_max_epu8(vMaxColumn, vH); // newly added line
+ vMaxColumn = _mm_max_epu8(vMaxColumn, vH); // newly added line
_mm_store_si128(pvHStore + j, vH);
vH = _mm_subs_epu8(vH, vGapO);
vF = _mm_subs_epu8(vF, vGapE);
- if (UNLIKELY(! _mm_movemask_epi8(_mm_cmpgt_epi8(vF, vH)))) goto end;
+ vTemp = _mm_subs_epu8(vF, vH);
+ vTemp = _mm_cmpeq_epi8 (vTemp, vZero);
+ if (UNLIKELY(_mm_movemask_epi8(vTemp) == 0xffff)) goto end;
}
}
end:
-
vMaxScore = _mm_max_epu8(vMaxScore, vMaxColumn);
vTemp = _mm_cmpeq_epi8(vMaxMark, vMaxScore);
cmp = _mm_movemask_epi8(vTemp);
=====================================
src/ssw.h
=====================================
@@ -4,7 +4,7 @@
* Created by Mengyao Zhao on 6/22/10.
* Copyright 2010 Boston College. All rights reserved.
* Version 1.2.3
- * Last revision by Mengyao Zhao on 2022-Apr-15.
+ * Last revision by Mengyao Zhao on 2022-May-24.
*
*/
@@ -46,7 +46,7 @@ typedef struct _profile s_profile;
@field read_begin1 0-based best alignment beginning position on read; read_begin1 = -1 when the best alignment beginning
position is not available
@field read_end1 0-based best alignment ending position on read
- @field read_end2 0-based sub-optimal alignment ending position on read
+ @field ref_end2 0-based sub-optimal alignment ending position on reference
@field cigar best alignment cigar; stored the same as that in BAM format, high 28 bits: length, low 4 bits: M/I/D (0/1/2);
cigar = 0 when the best alignment path is not available
@field cigarLen length of the cigar string; cigarLen = 0 when the best alignment path is not available
=====================================
src/ssw_cpp.cpp
=====================================
@@ -1,6 +1,6 @@
// ssw_cpp.cpp
// Created by Wan-Ping Lee
-// Last revision by Mengyao Zhao on 2017-05-30
+// Last revision by Mengyao Zhao on 2023-Apr-21
#include "ssw_cpp.h"
#include "ssw.h"
@@ -290,25 +290,18 @@ int Aligner::SetReferenceSequence(const char* seq, const int& length) {
int len = 0;
if (translation_matrix_) {
- // calculate the valid length
- //int calculated_ref_length = static_cast<int>(strlen(seq));
- //int valid_length = (calculated_ref_length > length)
- // ? length : calculated_ref_length;
- int valid_length = length;
// delete the current buffer
CleanReferenceSequence();
// allocate a new buffer
- translated_reference_ = new int8_t[valid_length];
+ translated_reference_ = new int8_t[length];
- len = TranslateBase(seq, valid_length, translated_reference_);
+ len = TranslateBase(seq, length, translated_reference_);
} else {
// nothing
}
reference_length_ = len;
return len;
-
-
}
int Aligner::TranslateBase(const char* bases, const int& length,
@@ -326,7 +319,7 @@ int Aligner::TranslateBase(const char* bases, const int& length,
}
-bool Aligner::Align(const char* query, const Filter& filter,
+uint16_t Aligner::Align(const char* query, const Filter& filter,
Alignment* alignment, const int32_t maskLen) const
{
if (!translation_matrix_) return false;
@@ -351,18 +344,18 @@ bool Aligner::Align(const char* query, const Filter& filter,
alignment->Clear();
ConvertAlignment(*s_al, query_len, alignment);
alignment->mismatches = CalculateNumberMismatch(&*alignment, translated_reference_, translated_query, query_len);
-
+ uint16_t align_flag = s_al->flag;
// Free memory
delete [] translated_query;
align_destroy(s_al);
init_destroy(profile);
- return true;
+ return align_flag;
}
-bool Aligner::Align(const char* query, const char* ref, const int& ref_len,
+uint16_t Aligner::Align(const char* query, const char* ref, const int& ref_len,
const Filter& filter, Alignment* alignment, const int32_t maskLen) const
{
if (!translation_matrix_) return false;
@@ -392,6 +385,7 @@ bool Aligner::Align(const char* query, const char* ref, const int& ref_len,
alignment->Clear();
ConvertAlignment(*s_al, query_len, alignment);
alignment->mismatches = CalculateNumberMismatch(&*alignment, translated_ref, translated_query, query_len);
+ uint16_t align_flag = s_al->flag;
// Free memory
delete [] translated_query;
@@ -399,7 +393,7 @@ bool Aligner::Align(const char* query, const char* ref, const int& ref_len,
align_destroy(s_al);
init_destroy(profile);
- return true;
+ return align_flag;
}
void Aligner::Clear(void) {
=====================================
src/ssw_cpp.h
=====================================
@@ -1,6 +1,6 @@
// ssw_cpp.h
// Created by Wan-Ping Lee
-// Last revision by Mengyao Zhao on 2017-05-30
+// Last revision by Mengyao Zhao on 2023-Apr-21
#ifndef COMPLETE_STRIPED_SMITH_WATERMAN_CPP_H_
#define COMPLETE_STRIPED_SMITH_WATERMAN_CPP_H_
@@ -109,7 +109,7 @@ class Aligner {
// and replaced.
// @param seq The reference bases;
// [NOTICE] It is not necessary null terminated.
- // @param length The length of bases will be be built.
+ // @param length The length of bases will be built.
// @return The length of the built bases.
// =========
int SetReferenceSequence(const char* seq, const int& length);
@@ -134,9 +134,9 @@ class Aligner {
// @param maskLen The distance between the optimal and suboptimal alignment ending position will >= maskLen. We suggest to
// use readLen/2, if you don't have special concerns. Note: maskLen has to be >= 15, otherwise this function
// will NOT return the suboptimal alignment information.
- // @return True: succeed; false: fail.
+ // @return If the alignment path is accurate (or has missing part). 0: accurate; 1: banded_sw is totally failed; 2: banded_sw returned path has missing part
// =========
- bool Align(const char* query, const Filter& filter, Alignment* alignment, const int32_t maskLen) const;
+ uint16_t Align(const char* query, const Filter& filter, Alignment* alignment, const int32_t maskLen) const;
// =========
// @function Align the query againt the reference.
@@ -151,9 +151,9 @@ class Aligner {
// @param maskLen The distance between the optimal and suboptimal alignment ending position will >= maskLen. We suggest to
// use readLen/2, if you don't have special concerns. Note: maskLen has to be >= 15, otherwise this function
// will NOT return the suboptimal alignment information.
- // @return True: succeed; false: fail.
+ // @return If the alignment path is accurate (or has missing part). 0: accurate; 1: banded_sw is totally failed; 2: banded_sw returned path has missing part
// =========
- bool Align(const char* query, const char* ref, const int& ref_len,
+ uint16_t Align(const char* query, const char* ref, const int& ref_len,
const Filter& filter, Alignment* alignment, const int32_t maskLen) const;
// @function Clear up all containers and thus the aligner is disabled.
View it on GitLab: https://salsa.debian.org/med-team/libssw/-/commit/8941634731efd19c09d7ea3505f24857eb758158
--
View it on GitLab: https://salsa.debian.org/med-team/libssw/-/commit/8941634731efd19c09d7ea3505f24857eb758158
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/20230715/8eae25bb/attachment-0001.htm>
More information about the debian-med-commit
mailing list