Skip to content

Commit

Permalink
per sequence mode: .txt extension and removed phantom file
Browse files Browse the repository at this point in the history
  • Loading branch information
rizkg committed Oct 26, 2016
1 parent d5742fd commit 9ba1f5f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/kmerinshort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ typedef typename modelT::Iterator KmerIterator;

char _outfile_seq_name[10000];

sprintf(_outfile_seq_name,"%s_%s",_outputFilename.c_str(),sequence.getComment().c_str());
sprintf(_outfile_seq_name,"%s_%s.txt",_outputFilename.c_str(),sequence.getComment().c_str());
FILE * _outfile_seq = fopen(_outfile_seq_name,"w");


Expand Down Expand Up @@ -282,12 +282,16 @@ void kis::execute ()
if(getParser()->saw(STR_URI_OUTPUT))
{
_outputFilename = getInput()->getStr(STR_URI_OUTPUT);
_outfile = fopen(_outputFilename.c_str(),"w");

if(_outfile==NULL)
if(! _sepmode)
{
fprintf(stderr,"cannot open %s \n",_outputFilename.c_str());
exit(1);
_outfile = fopen(_outputFilename.c_str(),"w");

if(_outfile==NULL)
{
fprintf(stderr,"cannot open %s \n",_outputFilename.c_str());
exit(1);
}
}
}
else
Expand Down Expand Up @@ -344,7 +348,7 @@ void kis::execute ()

std::vector<std::string> tabnames;

if(itBanks.size() > 1)
if(itBanks.size() > 1 && ! _sepmode)
{
fprintf(_outfile,"-----Bank %zu ------\n",ii);
}
Expand Down Expand Up @@ -376,7 +380,7 @@ void kis::execute ()

//output result

if(_kismode)
if(_kismode && ! _sepmode)
{
for (u_int64_t nk= 0; nk<_nbSeq; nk++ )
{
Expand Down Expand Up @@ -407,7 +411,7 @@ void kis::execute ()
}


if(!_kismode)
if(!_kismode && ! _sepmode)
{
for(uint64_t km = 0; km <_nbDiffKmers; km++ )
{
Expand All @@ -428,7 +432,7 @@ void kis::execute ()
}
}

if(getParser()->saw(STR_URI_OUTPUT))
if(getParser()->saw(STR_URI_OUTPUT) && ! _sepmode)
fclose(_outfile);

if(_kismode)
Expand Down

0 comments on commit 9ba1f5f

Please sign in to comment.