util.classificationFeatures.implementations.test
Class SecStructSimpleClassificationFeature

java.lang.Object
  extended by util.classificationFeatures.implementations.test.SecStructSimpleClassificationFeature
All Implemented Interfaces:
java.lang.Cloneable, ClassificationFeature

public class SecStructSimpleClassificationFeature
extends java.lang.Object
implements ClassificationFeature


Field Summary
 
Fields inherited from interface util.classificationFeatures.ClassificationFeature
ERROR_STRING
 
Constructor Summary
SecStructSimpleClassificationFeature()
           
 
Method Summary
 java.util.List<java.lang.Double> extractFeatures(java.lang.String[] sequences, int splicesite, java.lang.String[] types, java.util.List<Conversion> conversions, java.lang.String[] conversion_sequences)
          This method extracts the features from a sequence (relative to the splicesite) and returns those features in a list of double-values (standardized on double values because of its generic but still small-sized nature).
 ClassificationFeatureDrawing getClassificationFeatureDrawing()
          Because all classificationfeatures need different algorithms to draw them, according to the specifications, these utilities are also moved to the implementations of the ClassificationFeatures.
 Conversion getConversion()
          This method asks the classificationfeature for its conversion-type.
 int getDownstream_range()
           
 int getLength()
          This method returns the length of the feature.
 AttributeDescription getLocationDescription(int loc)
          Returns a standardized description of the location that is indicated.
 int getNumberOfAttributes()
          Returns the number of attributes that are created by this classificationfeature, according to the internal parameters (e.g. up- and downstreamranges).
 int[] getUpDownRanges()
          This method asks for the up- and downstreamranges of the feature
 int getUpstream_range()
           
 ClassificationFeature make_copy()
          Makes a copy of this particular classificationfeature.
 boolean needCompositionalTypes()
          Asks whether the computer needs to precompute compositional types.
 void setParameters(java.lang.String[] args)
          This method sets the necessary parameters for the classificationfeature.
 void setUpDownRanges(int up, int down)
          This method sets the new upstream and downstream ranges
 java.lang.String toNoRangeString()
          String representation of the classificationFeature that contains the core elements, and discards the upstream/downstream range elements.
 java.lang.String toString()
          String representation of the classificationFeature
 java.lang.String toStringUnderscore()
          Returns the string representation of the classificationfeature, but with all possible spaces and tabs replaced by underscores.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecStructSimpleClassificationFeature

public SecStructSimpleClassificationFeature()
Method Detail

make_copy

public ClassificationFeature make_copy()
Description copied from interface: ClassificationFeature
Makes a copy of this particular classificationfeature. The cloneable interface cannot be used directly because it is only applicable on classes, not interfaces.

Specified by:
make_copy in interface ClassificationFeature
Returns:
A copy of the classificationfeature

getUpDownRanges

public int[] getUpDownRanges()
This method asks for the up- and downstreamranges of the feature

Specified by:
getUpDownRanges in interface ClassificationFeature
Returns:
The up/down ranges

getConversion

public Conversion getConversion()
This method asks the classificationfeature for its conversion-type.

Specified by:
getConversion in interface ClassificationFeature
Returns:
The used conversion type. Null of not appropriate.

setUpDownRanges

public void setUpDownRanges(int up,
                            int down)
This method sets the new upstream and downstream ranges

Specified by:
setUpDownRanges in interface ClassificationFeature
Parameters:
up - The new upstream range
down - The new downstream range

needCompositionalTypes

public boolean needCompositionalTypes()
Asks whether the computer needs to precompute compositional types. When a conversion is taken with a large alphabet and/or a large length, this computation can take WAAAY to long (and take too much memory as well). Therefore, prior to this operation, this flag should be checked.

Specified by:
needCompositionalTypes in interface ClassificationFeature
Returns:
Whether or not to supply compositional types of certain length.

extractFeatures

public java.util.List<java.lang.Double> extractFeatures(java.lang.String[] sequences,
                                                        int splicesite,
                                                        java.lang.String[] types,
                                                        java.util.List<Conversion> conversions,
                                                        java.lang.String[] conversion_sequences)
                                                 throws FeatureExtractionException
This method extracts the features from a sequence (relative to the splicesite) and returns those features in a list of double-values (standardized on double values because of its generic but still small-sized nature).

Specified by:
extractFeatures in interface ClassificationFeature
Parameters:
sequences - The sequence from which the features should be extracted.
splicesite - The location of the splicesite (pseudo or real)
types - The compositional types (if requested, otherwise null).
conversions - A list with all the conversion types
conversion_sequences - An array with all the converted sequences.
Returns:
A list with the features
Throws:
FeatureExtractionException - Thrown when something goes wrong when extracting the features.

toStringUnderscore

public java.lang.String toStringUnderscore()
Returns the string representation of the classificationfeature, but with all possible spaces and tabs replaced by underscores.

Specified by:
toStringUnderscore in interface ClassificationFeature
Returns:
Alternative string representation

toString

public java.lang.String toString()
String representation of the classificationFeature

Specified by:
toString in interface ClassificationFeature
Overrides:
toString in class java.lang.Object
Returns:
String representation of the classificationfeature

toNoRangeString

public java.lang.String toNoRangeString()
Description copied from interface: ClassificationFeature
String representation of the classificationFeature that contains the core elements, and discards the upstream/downstream range elements.

Specified by:
toNoRangeString in interface ClassificationFeature
Returns:
Shortened version of the string representation of the classificationfeature

getLocationDescription

public AttributeDescription getLocationDescription(int loc)
Returns a standardized description of the location that is indicated. e.g. 5 bp upstream of splicesite. In case the location is outside the range of the feature, an error string is returned.

Specified by:
getLocationDescription in interface ClassificationFeature
Parameters:
loc - The location
Returns:
The description

getNumberOfAttributes

public int getNumberOfAttributes()
Returns the number of attributes that are created by this classificationfeature, according to the internal parameters (e.g. up- and downstreamranges). When the internal parameters are not set, or they are in an incorrect state, this method will return -1 as value

Specified by:
getNumberOfAttributes in interface ClassificationFeature
Returns:
The number of attributes created by this classificationfeature

setParameters

public void setParameters(java.lang.String[] args)
                   throws IncorrectClassificationFeatureException
This method sets the necessary parameters for the classificationfeature. The parameters are all generically passed as an array of strings, which of course need to be decoded by the classificationfeature itself.

Specified by:
setParameters in interface ClassificationFeature
Parameters:
args - The array with the parameters in string format
Throws:
IncorrectClassificationFeatureException - Can be thrown when the parameters are incorrect (outside possible ranges) and/or the parameters could not be parsed.

getClassificationFeatureDrawing

public ClassificationFeatureDrawing getClassificationFeatureDrawing()
Because all classificationfeatures need different algorithms to draw them, according to the specifications, these utilities are also moved to the implementations of the ClassificationFeatures. However, as not to clutter them, we have chosen to place this data in a seperate interface. The programmer thus has a choice of using one or two classes to implement both interfaces.

Specified by:
getClassificationFeatureDrawing in interface ClassificationFeature
Returns:
The object which can draw the classification features.

getDownstream_range

public int getDownstream_range()

getUpstream_range

public int getUpstream_range()

getLength

public int getLength()
Description copied from interface: ClassificationFeature
This method returns the length of the feature. If not applicable, (such as in case of branchpointfeatures), return 0;

Specified by:
getLength in interface ClassificationFeature
Returns:
length of the feature