de.jstacs.data.sequences.annotation
Class LocatedSequenceAnnotationWithLength

java.lang.Object
  extended by de.jstacs.results.ResultSet
      extended by de.jstacs.data.sequences.annotation.SequenceAnnotation
          extended by de.jstacs.data.sequences.annotation.LocatedSequenceAnnotation
              extended by de.jstacs.data.sequences.annotation.LocatedSequenceAnnotationWithLength
All Implemented Interfaces:
Storable
Direct Known Subclasses:
IntronAnnotation, StrandedLocatedSequenceAnnotationWithLength

public class LocatedSequenceAnnotationWithLength
extends LocatedSequenceAnnotation

Class for a SequenceAnnotation that has a position on the sequence and a length, e.g. for donor splice sites, exons or genes.

Author:
Jan Grau

Field Summary
 
Fields inherited from class de.jstacs.results.ResultSet
results
 
Constructor Summary
LocatedSequenceAnnotationWithLength(int position, int length, String type, String identifier, Collection<Result> results)
          Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier and additional annotation (that does not fit the SequenceAnnotation definitions) given as a Collection of Results result.
LocatedSequenceAnnotationWithLength(int position, int length, String type, String identifier, Result... results)
          Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier and additional annotation (that does not fit the SequenceAnnotation definitions) given as an array of Results result.
LocatedSequenceAnnotationWithLength(int position, int length, String type, String identifier, SequenceAnnotation[] annotations, Result... additionalAnnotations)
          Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier, additional annotation (that does not fit the SequenceAnnotation definitions) given as an array of Results additionalAnnotations and sub-annotations annotations.
LocatedSequenceAnnotationWithLength(StringBuffer representation)
          The standard constructor for the interface Storable.
LocatedSequenceAnnotationWithLength(String type, String identifier, LocatedSequenceAnnotation[] annotations, Result... additionalAnnotations)
          Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier, additional annotation (that does not fit the SequenceAnnotation definitions) given as an array of Results additionalAnnotations and sub-annotations annotations.
 
Method Summary
protected  void fromXML(StringBuffer representation)
          Parses the contents of a ResultSet from its XML representation as returned by ResultSet.toXML().
 int getEnd()
          Returns the end of this LocatedSequenceAnnotationWithLength, i.e.
 int getLength()
          Returns the length of this LocatedSequenceAnnotationWithLength as given in the constructor.
 boolean overlaps(LocatedSequenceAnnotationWithLength second)
          Returns true if this LocatedSequenceAnnotationWithLength overlaps with the location of second.
 String toString()
           
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class de.jstacs.data.sequences.annotation.LocatedSequenceAnnotation
getPosition
 
Methods inherited from class de.jstacs.data.sequences.annotation.SequenceAnnotation
getAnnotations, getIdentifier, getSubAnnotations, getType
 
Methods inherited from class de.jstacs.results.ResultSet
findColumn, getNumberOfResults, getResultAt, getResultForName, getResults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocatedSequenceAnnotationWithLength

public LocatedSequenceAnnotationWithLength(int position,
                                           int length,
                                           String type,
                                           String identifier,
                                           Result... results)
Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier and additional annotation (that does not fit the SequenceAnnotation definitions) given as an array of Results result.

Parameters:
position - the position of the LocatedSequenceAnnotationWithLength on the sequence
length - the length of the LocatedSequenceAnnotationWithLength
type - the type of the annotation
identifier - the identifier of the annotation
results - the additional annotation
See Also:
LocatedSequenceAnnotation.LocatedSequenceAnnotation(int, String, String, Result...)

LocatedSequenceAnnotationWithLength

public LocatedSequenceAnnotationWithLength(int position,
                                           int length,
                                           String type,
                                           String identifier,
                                           Collection<Result> results)
Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier and additional annotation (that does not fit the SequenceAnnotation definitions) given as a Collection of Results result.

Parameters:
position - the position of the LocatedSequenceAnnotationWithLength on the sequence
length - the length of the LocatedSequenceAnnotationWithLength
type - the type of the annotation
identifier - the identifier of the annotation
results - the additional annotation
See Also:
LocatedSequenceAnnotation.LocatedSequenceAnnotation(int, String, String, Collection)

LocatedSequenceAnnotationWithLength

public LocatedSequenceAnnotationWithLength(int position,
                                           int length,
                                           String type,
                                           String identifier,
                                           SequenceAnnotation[] annotations,
                                           Result... additionalAnnotations)
Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier, additional annotation (that does not fit the SequenceAnnotation definitions) given as an array of Results additionalAnnotations and sub-annotations annotations.

Parameters:
position - the position of the LocatedSequenceAnnotationWithLength on the sequence
length - the length of the LocatedSequenceAnnotationWithLength
type - the type of the annotation
identifier - the identifier of the annotation
annotations - the sub-annotations
additionalAnnotations - the additional annotation
See Also:
LocatedSequenceAnnotation.LocatedSequenceAnnotation(int, String, String, SequenceAnnotation[], Result...)

LocatedSequenceAnnotationWithLength

public LocatedSequenceAnnotationWithLength(String type,
                                           String identifier,
                                           LocatedSequenceAnnotation[] annotations,
                                           Result... additionalAnnotations)
Creates a new LocatedSequenceAnnotationWithLength of type type with identifier identifier, additional annotation (that does not fit the SequenceAnnotation definitions) given as an array of Results additionalAnnotations and sub-annotations annotations. The position of the new LocatedSequenceAnnotationWithLength is the minimal position of all positions of annotations and the length is determined so that it is the maximum of these positions and (if applicable) the corresponding values of getEnd().

Parameters:
type - the type of the annotation
identifier - the identifier of the annotation
annotations - the sub-annotations
additionalAnnotations - the additional annotation
See Also:
LocatedSequenceAnnotation.LocatedSequenceAnnotation(String, String, LocatedSequenceAnnotation[], Result...), getEnd()

LocatedSequenceAnnotationWithLength

public LocatedSequenceAnnotationWithLength(StringBuffer representation)
                                    throws NonParsableException
The standard constructor for the interface Storable. Creates a new LocatedSequenceAnnotationWithLength out of its XML representation.

Parameters:
representation - the XML representation as StringBuffer
Throws:
NonParsableException - if the LocatedSequenceAnnotationWithLength could not be reconstructed out of the XML representation (the StringBuffer representation could not be parsed)
See Also:
LocatedSequenceAnnotation.LocatedSequenceAnnotation(StringBuffer), Storable
Method Detail

fromXML

protected void fromXML(StringBuffer representation)
                throws NonParsableException
Description copied from class: ResultSet
Parses the contents of a ResultSet from its XML representation as returned by ResultSet.toXML().

Overrides:
fromXML in class LocatedSequenceAnnotation
Parameters:
representation - the XML representation as StringBuffer
Throws:
NonParsableException - if the XML code could not be parsed

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML representation as StringBuffer of an instance of the implementing class.

Specified by:
toXML in interface Storable
Overrides:
toXML in class LocatedSequenceAnnotation
Returns:
the XML representation

getLength

public int getLength()
Returns the length of this LocatedSequenceAnnotationWithLength as given in the constructor.

Returns:
the length of this LocatedSequenceAnnotationWithLength

getEnd

public int getEnd()
Returns the end of this LocatedSequenceAnnotationWithLength, i.e. LocatedSequenceAnnotation.getPosition() + getLength().

Returns:
the end of this LocatedSequenceAnnotationWithLength
See Also:
LocatedSequenceAnnotation.getPosition(), getLength()

toString

public String toString()
Overrides:
toString in class LocatedSequenceAnnotation

overlaps

public boolean overlaps(LocatedSequenceAnnotationWithLength second)
Returns true if this LocatedSequenceAnnotationWithLength overlaps with the location of second.

Parameters:
second - the other LocatedSequenceAnnotationWithLength
Returns:
if both annotations overlap