- Version:
- 1.0 January 2010
- Author:
- pvtroshin
- See Also:
LimitsManager
Constructor Summary |
Limit(int seqNumber,
int seqLength,
java.lang.String preset)
Instantiate the limit |
Limit(int seqNumber,
int seqLength,
java.lang.String preset,
boolean isDefault)
|
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Limit
public Limit(int seqNumber,
int seqLength,
java.lang.String preset)
- Instantiate the limit
- Parameters:
seqNumber
- the maximum number of sequences allowed for calculation.
RequiredseqLength
- the average length of the sequence, optionalpreset
- the name of preset if any, optional
- Throws:
java.lang.IllegalArgumentException
- if the seqNumber is not supplied or the seqLength is negative
Limit
public Limit(int seqNumber,
int seqLength,
java.lang.String preset,
boolean isDefault)
getPreset
public java.lang.String getPreset()
getAvgSeqLength
public int getAvgSeqLength()
- Returns:
- the allowed average sequence length
getSeqNumber
public int getSeqNumber()
- Returns:
- the maximum number of sequences allowed
isDefault
public boolean isDefault()
- Returns:
- true is this is a default limit to be used, false otherwise
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
isExceeded
public boolean isExceeded(java.util.List<FastaSequence> data)
- Checks if the number of sequences or their average length in the dataset
exceeds this limit.
- Parameters:
data
- the dataset to measure
- Returns:
- true if a limit is exceeded (what is the dataset is larger then
the limit), false otherwise. First check the number of sequences
in the dataset and if it exceeds the limit return true
irrespective of the average length. If the number of sequences in
the dataset is less than the limit and average length is defined,
then check whether the total number of letters (number of
sequence multiplied by the average sequence length) is greater
then the total number of letters in the dataset. Returns true if
the total number of letters in the dataset is greater than the
limit, false otherwise.
getAvgSequenceLength
public static int getAvgSequenceLength(java.util.List<FastaSequence> data)
- Calculates an average sequence length of the dataset
- Parameters:
data
-
- Returns:
- an average sequence length in the input dataset