chemaxon.formats.recognizer
Class PeptideRecognizer

java.lang.Object
  extended by chemaxon.formats.recognizer.Recognizer
      extended by chemaxon.formats.recognizer.PeptideRecognizer

public class PeptideRecognizer
extends Recognizer

Peptide format recognizer.

Since:
Marvin 5.0, 06/07/2007
Version:
5.1, 07/29/2008
Author:
Rita Vereb, Peter Csizmadia

Constructor Summary
PeptideRecognizer(java.lang.String fmt)
          Creates a Peptide format recognizer.
 
Method Summary
static boolean canBe1LetterPeptide(java.lang.String s)
          Tests whether a string can be one-letter-abbreviated peptide name.
static boolean canBe3LetterPeptide(java.lang.String s)
          Tests whether a string can be three-letter-abbreviated peptide name.
static java.lang.String guessPeptideFormat(java.lang.String header)
          Tries to distinguish between one letter and two letter peptides.
 boolean needsMore()
          Should we read more lines?
 void tryToRecognize(java.lang.String line, int linenum, RecognizerList reclist)
          Tries to recognize a line.
 
Methods inherited from class chemaxon.formats.recognizer.Recognizer
getLastProcessedLineNum, getPriority, isLastLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeptideRecognizer

public PeptideRecognizer(java.lang.String fmt)
Creates a Peptide format recognizer.

Parameters:
fmt - the codename of the format
Method Detail

tryToRecognize

public void tryToRecognize(java.lang.String line,
                           int linenum,
                           RecognizerList reclist)
Tries to recognize a line. If a format becomes impossible, then it is removed from the set of possible formats.

Specified by:
tryToRecognize in class Recognizer
Parameters:
line - the line
linenum - the line number
reclist - the list of recognizers

needsMore

public boolean needsMore()
Should we read more lines?

Specified by:
needsMore in class Recognizer
Returns:
true if more lines are needed, false otherwise

canBe1LetterPeptide

public static boolean canBe1LetterPeptide(java.lang.String s)
Tests whether a string can be one-letter-abbreviated peptide name.
A valid name contains only uppercase letters.

Parameters:
s - the input string
Returns:
true if it can be, false if it cannot be one-letter-abbreviated peptide name

guessPeptideFormat

public static java.lang.String guessPeptideFormat(java.lang.String header)
Tries to distinguish between one letter and two letter peptides.

Parameters:
header - first few chars of the input stream
Returns:
"peptide:1" or "peptide:3" if it was able to find out the format, using "peptide:1" as default (ie for tryalatyr it will give "peptide:1")

canBe3LetterPeptide

public static boolean canBe3LetterPeptide(java.lang.String s)
Tests whether a string can be three-letter-abbreviated peptide name.
Each peptide's first letter must be uppercase and the other two are lowercase.
e.g. ValAlaTyr

Parameters:
s - the input string
Returns:
true if it can be, false if it cannot be three-letter-abbreviated peptide name