Skip to content

Commit

Permalink
BUGFIX: missing handling of empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
'qubsq01' committed Mar 28, 2022
1 parent 0887967 commit c96a9e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@
# changes in development version since last release
################################################################################

# IntaRNA
- BUGFIX: empty lines with white spaces within FASTA input were causing parsing
errors

################################################################################
################################################################################


220328 Martin Raden
* bin/CommandLineParsing :
* parseSequencesFasta() :
* BUGFIX: missing handling of empty lines with white spaces only within
FASTA input (were causing parsing errors)

################################################################################
### version 3.3.0
################################################################################
Expand Down
23 changes: 13 additions & 10 deletions src/bin/CommandLineParsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,16 +2195,19 @@ parseSequencesFasta( const std::string & paramName,
if( !name.empty() ){
// trim leading/trailing whitespaces
trimStart = line.find_first_not_of(" \t");
line = line.substr( trimStart, std::max(0,(int)line.find_last_not_of(" \t\n\r")+1-trimStart) );
// check for enclosed whitespaces
if( line.find(' ') != std::string::npos ){ // Invalid sequence--no spaces allowed
LOG(ERROR) <<"FASTA parsing of "<<paramName<<" : sequence for ID '"<<name<<"' contains spaces";
updateParsingCode( ReturnCode::STOP_PARSING_ERROR );
name.clear();
sequence.clear();
} else {
// store sequence line
sequence += line;
// check if not an empty lines with white spaces only
if (trimStart < line.size()) {
line = line.substr( trimStart, std::max(0,(int)line.find_last_not_of(" \t\n\r")+1-trimStart) );
// check for enclosed whitespaces
if( line.find(' ') != std::string::npos ){ // Invalid sequence--no spaces allowed
LOG(ERROR) <<"FASTA parsing of "<<paramName<<" : sequence for ID '"<<name<<"' contains spaces";
updateParsingCode( ReturnCode::STOP_PARSING_ERROR );
name.clear();
sequence.clear();
} else {
// store sequence line
sequence += line;
}
}
} else {
LOG(ERROR) <<"FASTA parsing of "<<paramName<<" : found sequence data without leading ID";
Expand Down

0 comments on commit c96a9e6

Please sign in to comment.