[Biojava-dev] "No match found" in MSFFormatReader

Bradford Powell bcpowell at email.unc.edu
Fri May 16 17:49:53 EDT 2003


I think this may be a bug that appears as the result of the switch-over to
the 1.4 regex instead of jakarta-regexp:

When trying to read an MSF-formatted alignment (either using
SeqIOTools.fileToBiojava or using MSFAlignmentFormat directly) I get an
error message saying "MSFFormatReader No match found".

I think what needs to happen is for matcher.find() to be called before
trying to get the sequence name out of the match. I suggest changing the
code that reads: (starting with line 29 of MSFAlignmentFormat.java)

------------------
                Matcher matcher = mtc.matcher(line);
                sequenceName = matcher.group(1).trim();
                if (sequenceName == null) {            
                    break;
                }               //end of sequence names
                //sequenceName = line.substring(rem.getSubStartIndex(1),
                //                              rem.getSubEndIndex(1));        
                if ((line.trim()).length() == 0) {                     
                    break;
                }
                sequenceNames.add(sequenceName);
-------------------
so that it becomes:
-------------------
                Matcher matcher = mtc.matcher(line);
                if (!matcher.find()) {            
                    break;
                }               //end of sequence names
                //sequenceName = line.substring(rem.getSubStartIndex(1),
                //                              rem.getSubEndIndex(1));        
                if ((line.trim()).length() == 0) {                     
                    break;
                }
                sequenceName = matcher.group(1).trim();
                sequenceNames.add(sequenceName);
-------------------
(i.e. change the break condition to not finding a match and move the
matcher.group(1).trim() call to after matcher.find() has been called).

-- Bradford Powell
-- bradford_powell at unc.edu




More information about the biojava-dev mailing list