Skip to content

Commit

Permalink
Added informative error messages to fasta.cpp and FaQCs.cpp to help …
Browse files Browse the repository at this point in the history
…users diagnose corrupted input files.
  • Loading branch information
chienchi committed Aug 17, 2018
1 parent 0fa3653 commit 54c31da
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ Version 2.07b (Mar 16, 2018)
vector += function).

Version 2.08 (May 1, 2018)
* Fixed a bug in ployA option which required argument should turn off. ( options.cpp)
* Fixed a bug due to the "--polyA" command line argument expecting an argument (it should be a boolean flag).

Version 2.09 (Aug 17, 2018)
* Added informative error messages to fasta.cpp and FaQCs.cpp to help users diagnose corrupted input files.
4 changes: 2 additions & 2 deletions FaQCs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ void process_paired(vector<size_t> &m_filter_stats,
if(ret1 != ret2){

if(ret1){
cerr << "Found an unmatched read one" << endl;
cerr << "Did not find a match to read one: " << r1.def << endl;
}
else{
cerr << "Found an unmatched read two" << endl;
cerr << "Did not find a match to read two: " << r2.def << endl;
}

throw __FILE__ "I/O error";
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ FULL USAGE

```
Usage: FaQCs [options] [-u unpaired.fastq] -p reads1.fastq reads2.fastq -d out_directory
Version 2.08
Version 2.09
Input File(s):
-u <File> Unpaired reads
-1 <File> First paired read file
Expand Down
10 changes: 10 additions & 0 deletions fastq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ bool next_read(gzFile m_fin, string &m_def, string &m_seq, string &m_quality)
while(true){

if(gzgets(m_fin, buffer, buffer_len) == NULL){

cerr << "Error in read: " << m_def << endl;
throw __FILE__ ":next_read: Unable to read sequence";
}

Expand All @@ -77,10 +79,14 @@ bool next_read(gzFile m_fin, string &m_def, string &m_seq, string &m_quality)
// Skip the '+'. Note that we *don't* actually test to make sure we read a single '+' on a line
// by itself.
if(gzgets(m_fin, buffer, buffer_len) == NULL){

cerr << "Error in read: " << m_def << endl;
throw __FILE__ ":next_read: Unable to read '+'";
}

if( strpbrk(buffer, "\n\r") == NULL ){

cerr << "Error in read: " << m_def << endl;
throw __FILE__ ":next_read: Error reading '+' delimiter";
}

Expand All @@ -93,6 +99,8 @@ bool next_read(gzFile m_fin, string &m_def, string &m_seq, string &m_quality)
while(true){

if(gzgets(m_fin, buffer, buffer_len) == NULL){

cerr << "Error in read: " << m_def << endl;
throw __FILE__ ":next_read: Unable to read quality";
}

Expand All @@ -108,6 +116,8 @@ bool next_read(gzFile m_fin, string &m_def, string &m_seq, string &m_quality)
}

if( m_seq.size() != m_quality.size() ){

cerr << "Error in read: " << m_def << endl;
throw __FILE__ ":next_read: |Sequence| != |Quality|";
}

Expand Down

0 comments on commit 54c31da

Please sign in to comment.