Skip to content

Commit

Permalink
updated to change uint32 to uint64 for file size and disabled EOF req…
Browse files Browse the repository at this point in the history
…uirement for gz files (#87)
  • Loading branch information
kishorikonwar committed Nov 3, 2020
1 parent 4813538 commit 65ac1a0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN cd /sctools/fastqpreprocessing &&\
tar -zxvf v${libStatGen_version}.tar.gz &&\
mv libStatGen-${libStatGen_version} libStatGen &&\
patch libStatGen/fastq/FastQFile.cpp patches/FastQFile.cpp.patch &&\
patch libStatGen/general/BgzfFileType.cpp patches/BgzfFileType.cpp.patch &&\
patch libStatGen/Makefile patches/Makefile.patch &&\
patch libStatGen/general/Makefile patches/general.Makefile.patch &&\
make -C libStatGen &&\
Expand Down
11 changes: 11 additions & 0 deletions fastqpreprocessing/patches/BgzfFileType.cpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- libStatGen/general/BgzfFileType.cpp 2015-07-08 20:03:23.000000000 +0000
+++ /tmp/BgzfFileType.cpp 2020-11-03 12:25:36.168474179 +0000
@@ -23,7 +23,7 @@
#include "BgzfFileType.h"

// Default to require the EOF block at the end of the file.
-bool BgzfFileType::ourRequireEofBlock = true;
+bool BgzfFileType::ourRequireEofBlock = false;

BgzfFileType::BgzfFileType(const char * filename, const char * mode)
{
6 changes: 3 additions & 3 deletions fastqpreprocessing/src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ using namespace std;
namespace fs = std::experimental::filesystem;

/** @copydoc filesize */
int32_t filesize(const char *filename) {
int64_t filesize(const char *filename) {
FILE *f = fopen(filename, "rb"); /* open the file in read only */

int32_t size = 0;
int64_t size = 0;
if (fseek(f, 0, SEEK_END) ==0 ) /* seek was successful */
size = ftell(f);
fclose(f);
Expand Down Expand Up @@ -286,7 +286,7 @@ void _print_file_info(const std::vector<std::string> &fastqs,


/** @copydoc get_num_blocks */
int32_t get_num_blocks(const INPUT_OPTIONS &options) {
int64_t get_num_blocks(const INPUT_OPTIONS &options) {
double tot_size = 0;
for (int i= 0; i < options.R1s.size(); i++) {
if (options.I1s.size()) {
Expand Down
8 changes: 4 additions & 4 deletions fastqpreprocessing/src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef std::pair<std::string, bool> STRING_BOOL_PAIR;

typedef std::vector<std::string> STRING_VECTOR;

typedef std::unordered_map <std::string, int32_t> STRING_INT32_MAP;
typedef std::unordered_map <std::string, int64_t> STRING_INT32_MAP;

// structure for correcting the barcodes
typedef struct _white_list_data {
Expand Down Expand Up @@ -61,7 +61,7 @@ typedef struct _input_options {
* @param options Input options structure that contains file name
*/
int32_t get_num_blocks(const INPUT_OPTIONS &options);
int64_t get_num_blocks(const INPUT_OPTIONS &options);

/**
* @brief Build barcode correction map white list barcodes & mutations
Expand Down Expand Up @@ -95,7 +95,7 @@ void read_options(int, char **, INPUT_OPTIONS &);
* @param filename file name whose size is computed
* @return size of the file in bytes
*/
int32_t filesize(const char *filename);
int64_t filesize(const char *filename);


/**
Expand All @@ -104,7 +104,7 @@ int32_t filesize(const char *filename);
* @param filename file name whose size is computed
* @return size of the file in bytes
*/
int32_t getFileSize(const std::string &fileName);
int64_t getFileSize(const std::string &fileName);

/**
* @brief Print system error and exit
Expand Down

0 comments on commit 65ac1a0

Please sign in to comment.