@@ -185,7 +185,9 @@ template <typename T> bool DBReader<T>::open(int accessType){
185
185
}
186
186
187
187
compression = isCompressed (dbtype);
188
- if (compression == COMPRESSED){
188
+ padded = (getExtendedDbtype (dbtype) & Parameters::DBTYPE_EXTENDED_GPU);
189
+
190
+ if (compression == COMPRESSED || padded){
189
191
compressedBufferSizes = new size_t [threads];
190
192
compressedBuffers = new char *[threads];
191
193
dstream = new ZSTD_DStream*[threads];
@@ -530,6 +532,29 @@ template <typename T> size_t DBReader<T>::bsearch(const Index * index, size_t N,
530
532
return std::upper_bound (index , index + N, val, Index::compareByIdOnly) - index ;
531
533
}
532
534
535
+
536
+ template <typename T> char * DBReader<T>::getUnpadded(size_t id, int thrIdx) {
537
+ char *data = getDataUncompressed (id);
538
+ size_t seqLen = getSeqLen (id);
539
+
540
+ static const char CODE_TO_CHAR[21 ] = {
541
+ ' A' , /* 0 */ ' C' , /* 1 */ ' D' , /* 2 */
542
+ ' E' , /* 3 */ ' F' , /* 4 */ ' G' , /* 5 */
543
+ ' H' , /* 6 */ ' I' , /* 7 */ ' K' , /* 8 */
544
+ ' L' , /* 9 */ ' M' , /* 10 */ ' N' , /* 11 */
545
+ ' P' , /* 12 */ ' Q' , /* 13 */ ' R' , /* 14 */
546
+ ' S' , /* 15 */ ' T' , /* 16 */ ' V' , /* 17 */
547
+ ' W' , /* 18 */ ' Y' , /* 19 */ ' X' /* 20 */
548
+ };
549
+
550
+ for (size_t i = 0 ; i < seqLen; i++){
551
+ unsigned char code = static_cast <unsigned char >(data[i]);
552
+ unsigned char baseCode = (code >= 32 ) ? code - 32 : code;
553
+ compressedBuffers[thrIdx][i] = CODE_TO_CHAR[baseCode];
554
+ }
555
+ return compressedBuffers[thrIdx];
556
+ }
557
+
533
558
template <typename T> char * DBReader<T>::getDataCompressed(size_t id, int thrIdx) {
534
559
char *data = getDataUncompressed (id);
535
560
@@ -573,7 +598,9 @@ template <typename T> size_t DBReader<T>::getAminoAcidDBSize() {
573
598
template <typename T> char * DBReader<T>::getData(size_t id, int thrIdx){
574
599
if (compression == COMPRESSED){
575
600
return getDataCompressed (id, thrIdx);
576
- }else {
601
+ }else if (padded) {
602
+ return getUnpadded (id, thrIdx);
603
+ } else {
577
604
return getDataUncompressed (id);
578
605
}
579
606
}
@@ -628,7 +655,9 @@ template <typename T> char* DBReader<T>::getDataByDBKey(T dbKey, int thrIdx) {
628
655
size_t id = getId (dbKey);
629
656
if (compression == COMPRESSED ){
630
657
return (id != UINT_MAX) ? getDataCompressed (id, thrIdx) : NULL ;
631
- }else {
658
+ } if (padded) {
659
+ return (id != UINT_MAX) ? getUnpadded (id, thrIdx) : NULL ;
660
+ } else {
632
661
return (id != UINT_MAX) ? getDataByOffset (index [id].offset ) : NULL ;
633
662
}
634
663
}
@@ -1016,6 +1045,7 @@ int DBReader<T>::isCompressed(int dbtype) {
1016
1045
return (dbtype & (1 << 31 )) ? COMPRESSED : UNCOMPRESSED;
1017
1046
}
1018
1047
1048
+
1019
1049
template <typename T>
1020
1050
void DBReader<T>::setSequentialAdvice() {
1021
1051
#ifdef HAVE_POSIX_MADVISE
0 commit comments