owltools.gaf
Class GafDocument

java.lang.Object
  extended by owltools.gaf.GafDocument

public class GafDocument
extends Object

Representation of a gene annotation file (GAF). It holds all relevant GeneAnnotation and Bioentity objects.

See Also:
GafObjectsBuilder

Constructor Summary
GafDocument(String id, String documentPath)
          Create a new document instance.
GafDocument(String id, String documentPath, Map<String,Bioentity> bioentities)
          Create a new document instance.
 
Method Summary
 Bioentity addBioentity(Bioentity bioentity)
          Add a Bioentity object to the document.
 void addComment(String c)
          Add a comment line.
 void addGeneAnnotation(GeneAnnotation ga)
          Add a single annotation to the document.
 Collection<Bioentity> getBioentities()
          Get all registered Bioentity objects.
 Bioentity getBioentity(String id)
          Retrieve the Bioentity object for the given id.
 List<String> getComments()
          Get the current set of comments.
 String getDocumentPath()
          Retrieve the source path for this document
 GeneAnnotation getGeneAnnotationByLineNumber(int lineNumber)
          Retrieve the (first) annotation for the given line number or null.
 List<GeneAnnotation> getGeneAnnotations()
          Get all annotations from this document.
 Collection<GeneAnnotation> getGeneAnnotations(String bioentity)
          Get all annotations for a given Bioentity id.
 List<GeneAnnotation> getGeneAnnotationsByDirectGoCls(String cls)
          Search for all annotations with the given cls String.
 String getId()
           
 void index()
          Index all current annotations of this document.
 void setGeneAnnotations(List<GeneAnnotation> annotations)
          Replace the current set of annotations with the given list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GafDocument

public GafDocument(String id,
                   String documentPath)
Create a new document instance.

Parameters:
id -
documentPath -

GafDocument

public GafDocument(String id,
                   String documentPath,
                   Map<String,Bioentity> bioentities)
Create a new document instance.

Parameters:
id -
documentPath -
bioentities -
Method Detail

getId

public String getId()
Returns:
documentId

getDocumentPath

public String getDocumentPath()
Retrieve the source path for this document

Returns:
path or null.

getBioentity

public Bioentity getBioentity(String id)
Retrieve the Bioentity object for the given id.

Parameters:
id -
Returns:
entity or null

getBioentities

public Collection<Bioentity> getBioentities()
Get all registered Bioentity objects.

Returns:
entities, never null

getGeneAnnotations

public List<GeneAnnotation> getGeneAnnotations()
Get all annotations from this document.

Returns:
annotations, never

getGeneAnnotations

public Collection<GeneAnnotation> getGeneAnnotations(String bioentity)
Get all annotations for a given Bioentity id. If index() was called, this is a lookup operation, otherwise this is a linear scan of all annotations.

Parameters:
bioentity -
Returns:
annotations, never null
See Also:
index()

index

public void index()
Index all current annotations of this document. Creates an internal cache for mappings from bioentity-id to set of annotations.

See Also:
getGeneAnnotations(String)

getGeneAnnotationsByDirectGoCls

public List<GeneAnnotation> getGeneAnnotationsByDirectGoCls(String cls)
Search for all annotations with the given cls String.

Parameters:
cls -
Returns:
annotations, never null

getGeneAnnotationByLineNumber

public GeneAnnotation getGeneAnnotationByLineNumber(int lineNumber)
Retrieve the (first) annotation for the given line number or null.

Parameters:
lineNumber -
Returns:
annotation or null

addBioentity

public Bioentity addBioentity(Bioentity bioentity)
Add a Bioentity object to the document. Will return the canonical instance for the entity in this GAF.

Parameters:
bioentity -
Returns:
bioentity

addGeneAnnotation

public void addGeneAnnotation(GeneAnnotation ga)
Add a single annotation to the document.

Parameters:
ga -

setGeneAnnotations

public void setGeneAnnotations(List<GeneAnnotation> annotations)
Replace the current set of annotations with the given list. Also register all the bioentities from the annotations.

Parameters:
annotations -

getComments

public List<String> getComments()
Get the current set of comments.

Returns:
comments, never null

addComment

public void addComment(String c)
Add a comment line.

Parameters:
c -


Copyright © 2010-2014. All Rights Reserved.