com.compomics.util.protein
Class Header

java.lang.Object
  extended by com.compomics.util.protein.Header
All Implemented Interfaces:
Serializable, Cloneable

public class Header
extends Object
implements Cloneable, Serializable

This class represents the header for a Protein instance. It is meant to work closely with FASTA format notation. The Header class knows how to handle certain often-used headers such as SwissProt and NCBI formatted FASTA headers.
Note that the Header class is it's own factory, and should be used as such.

Author:
Lennart Martens, Harald Barsnes
See Also:
Serialized Form

Nested Class Summary
static class Header.DatabaseType
          A list of the database types.
 
Method Summary
 void addAddendum(String aAddendum)
          This method allows the addition of an addendum to the list.
 Object clone()
          This method provides a deep copy of the Header instance.
 String getAbbreviatedFASTAHeader()
          This method returns an abbreviated version of the Header, suitable for inclusion in FASTA formatted files.
 String getAbbreviatedFASTAHeaderWithAddenda()
          This method returns an abbreviated version of the Header, suitable for inclusion in FASTA formatted files.
 String getAccession()
           
 String getAddenda()
          This method allows the caller to retrieve all addenda for the current header, or 'null' if there aren't any.
 String getCoreHeader()
          This method reports on the core information for the header, which is comprised of the ID and the accession String:
 Header.DatabaseType getDatabaseType()
           
 String getDescription()
           
 int getEndLocation()
          This method reports on the end index of the header.
 String getForeignAccession()
           
 String getForeignDescription()
           
 String getForeignID()
           
 String getFullHeaderWithAddenda()
          This method reports on the full header, with the addenda (if present).
 String getGeneName()
           
 String getID()
           
 String getProteinEvidence()
           
 String getRest()
           
 int getScore()
          This method will attribute a score to the current header, based on the following scoring list: SwissProt : 4 IPI, SwissProt reference : 3 IPI, TrEMBL or REFSEQ_NP reference : 2 IPI, without SwissProt, TrEMBL or REFSEQ_NP reference : 1 NCBI, SwissProt reference : 2 NCBI, other reference : 1 Unknown header format : 0
 int getStartLocation()
          This method reports on the start index of the header.
 String getTaxonomy()
           
 boolean hasAddenda()
          This method reports on the presence of addenda for this header.
static Header parseFromFASTA(String aFASTAHeader)
          Factory method that constructs a Header instance based on a FASTA header line.
 void setAccession(String aAccession)
           
 void setDatabaseType(Header.DatabaseType aDatabaseType)
           
 void setDescription(String aDescription)
           
 void setForeignAccession(String aForeignAccession)
           
 void setForeignDescription(String aForeignDescription)
           
 void setForeignID(String aForeignID)
           
 void setGeneName(String aGeneName)
           
 void setID(String aID)
           
 void setLocation(int aStart, int aEnd)
          This method allows the caller to add information to the header about location of the sequence in a certain master sequence.
 void setProteinEvidence(String aProteinEvidence)
           
 void setRest(String aRest)
           
 void setTaxonomy(String aTaxonomy)
           
 String toString()
          This method reports on the entire header.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

parseFromFASTA

public static Header parseFromFASTA(String aFASTAHeader)
Factory method that constructs a Header instance based on a FASTA header line.

Parameters:
aFASTAHeader - the String with the original FASTA header line.
Returns:
Header with the Header instance representing the given header. The object returned will have been parsed correctly if it is a standard SwissProt or NCBI formatted header, and will be plain in all other cases.

getID

public String getID()

setID

public void setID(String aID)

getForeignID

public String getForeignID()

setForeignID

public void setForeignID(String aForeignID)

getAccession

public String getAccession()

setAccession

public void setAccession(String aAccession)

getDatabaseType

public Header.DatabaseType getDatabaseType()

setDatabaseType

public void setDatabaseType(Header.DatabaseType aDatabaseType)

getForeignAccession

public String getForeignAccession()

setForeignAccession

public void setForeignAccession(String aForeignAccession)

getDescription

public String getDescription()

setDescription

public void setDescription(String aDescription)

getGeneName

public String getGeneName()

setGeneName

public void setGeneName(String aGeneName)

getProteinEvidence

public String getProteinEvidence()

setProteinEvidence

public void setProteinEvidence(String aProteinEvidence)

getTaxonomy

public String getTaxonomy()

setTaxonomy

public void setTaxonomy(String aTaxonomy)

getForeignDescription

public String getForeignDescription()

setForeignDescription

public void setForeignDescription(String aForeignDescription)

getRest

public String getRest()

setRest

public void setRest(String aRest)

getAbbreviatedFASTAHeader

public String getAbbreviatedFASTAHeader()
This method returns an abbreviated version of the Header, suitable for inclusion in FASTA formatted files.
The abbreviated header is composed in the following way:
     >[ID]|[accession_string]|([foreign_ID]|[foreign_accession_string]|[foreign_description] )[description]
 

Returns:
String with the abbreviated header.

toString

public String toString()
This method reports on the entire header.

Overrides:
toString in class Object
Returns:
String with the full header.

getScore

public int getScore()
This method will attribute a score to the current header, based on the following scoring list:

Returns:
int with the header score. The higher the score, the more interesting a Header is.

getCoreHeader

public String getCoreHeader()
This method reports on the core information for the header, which is comprised of the ID and the accession String:
     [ID]|[accession_string]
   
This is mostly useful for appending this core as an addendum to another header.

Returns:
String with the header core data ([ID]|[accession_string]).

addAddendum

public void addAddendum(String aAddendum)
This method allows the addition of an addendum to the list. If the addendum is already preceded with '^A', it is added as is, otherwise '^A' is prepended before addition to the list.

Parameters:
aAddendum - String with the addendum, facultatively preceded by '^A'.

getAddenda

public String getAddenda()
This method allows the caller to retrieve all addenda for the current header, or 'null' if there aren't any.

Returns:
String with the addenda, or 'null' if there aren't any.

hasAddenda

public boolean hasAddenda()
This method reports on the presence of addenda for this header.

Returns:
boolean whether addenda are present.

getFullHeaderWithAddenda

public String getFullHeaderWithAddenda()
This method reports on the full header, with the addenda (if present). If no addenda are present, this method reports the same information as the 'toString()' method.

Returns:
String with the header and addenda (if any).

getAbbreviatedFASTAHeaderWithAddenda

public String getAbbreviatedFASTAHeaderWithAddenda()
This method returns an abbreviated version of the Header, suitable for inclusion in FASTA formatted files.
The abbreviated header is composed in the following way:
     >[ID]|[accession_string]|([foreign_ID]|[foreign_accession_string]|[foreign_description] )[description]([addenda])
 
Note that the output of this method is identical to that of the getAbbreviatedFASTAHeader() if no addenda are present.

Returns:
String with the abbreviated header and addenda (if any).

setLocation

public void setLocation(int aStart,
                        int aEnd)
This method allows the caller to add information to the header about location of the sequence in a certain master sequence.
This information is typically specified right after the accession number:
     [id]|[accession_string] ([startindex]-[endindex])|...
   
Please note the following:

Parameters:
aStart - int with the startindex.
aEnd - int with the endindex.

getStartLocation

public int getStartLocation()
This method reports on the start index of the header. It returns '-1' if no location is specified.

Returns:
int with the start location, or '-1' if none was defined.

getEndLocation

public int getEndLocation()
This method reports on the end index of the header. It returns '-1' if no location is specified.

Returns:
int with the end location, or '-1' if none was defined.

clone

public Object clone()
This method provides a deep copy of the Header instance.

Overrides:
clone in class Object
Returns:
Object Header that is a deep copy of this Header.


Copyright © 2012. All Rights Reserved.