[Biojava-dev] "No match found" in MSFFormatReader
Thomas Down
thomas at derkholm.net
Sat May 17 09:09:30 EDT 2003
Hi...
Once upon a time, Bradford Powell wrote:
>
> 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).
Okay, that seems to work -- I've just applied this and
checked it in. Thanks.
I've just added a simple test for MSFAlignmentFormat to the
test suite, so hopefully we'll spot any future regressions.
Thomas.
More information about the biojava-dev
mailing list