Skip to content

Commit

Permalink
Corrected bug in file io
Browse files Browse the repository at this point in the history
  • Loading branch information
Chirag Jain committed Jul 4, 2020
1 parent f081bba commit 902ce0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/cgi/include/computeCoreIdentity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ namespace cgi
for(auto &e : parameters.querySequences)
{
//Open the file using kseq
FILE *file = fopen(e.c_str(), "r");
gzFile fp = gzdopen(fileno(file), "r");
gzFile fp = gzopen(e.c_str(), "r");
kseq_t *seq = kseq_init(fp);
int l; uint64_t genomeLen = 0;

Expand All @@ -62,16 +61,14 @@ namespace cgi

kseq_destroy(seq);
gzclose(fp); //close the file handler
fclose(file);
}

for(auto &e : parameters.refSequences)
{
if( genomeLengths.find(e) == genomeLengths.end() )
{
//Open the file using kseq
FILE *file = fopen(e.c_str(), "r");
gzFile fp = gzdopen(fileno(file), "r");
gzFile fp = gzopen(e.c_str(), "r");
kseq_t *seq = kseq_init(fp);
int l; uint64_t genomeLen = 0;

Expand All @@ -82,7 +79,6 @@ namespace cgi

kseq_destroy(seq);
gzclose(fp); //close the file handler
fclose(file);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/map/include/computeMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ namespace skch

{
//Open the file using kseq
FILE *file = fopen(queryFileName.c_str(), "r");
gzFile fp = gzdopen(fileno(file), "r");
gzFile fp = gzopen(queryFileName.c_str(), "r");
kseq_t *seq = kseq_init(fp);

#ifdef DEBUG
Expand Down
5 changes: 1 addition & 4 deletions src/map/include/winSketch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ namespace skch
#endif

//Open the file using kseq
FILE *file = fopen(fileName.c_str(), "r");
gzFile fp = gzdopen(fileno(file), "r");
gzFile fp = gzopen(fileName.c_str(), "r");
kseq_t *seq = kseq_init(fp);


//size of sequence
offset_t len;

Expand Down Expand Up @@ -166,7 +164,6 @@ namespace skch

kseq_destroy(seq);
gzclose(fp); //close the file handler
fclose(file);
}

if ( omp_get_thread_num() == 0)
Expand Down

0 comments on commit 902ce0a

Please sign in to comment.