public final class Seq
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
This class is used to contain all sequence related functions.
Please see a description of each of these fields before making any major edits to this class. Additionally, please note that the toString method should not be edited lightly (because it is relied upon by other classes).
WHY PACKAGE ACCESS FOR MANY VARIABLES?
Because the access is restricted to only the package level, there should not be any major issues with regard to code bugs.
In addition, because these variables do not have to be validated (they can be any value, including null), and the variables are only changed by classes and methods within the package there is no reason for accessor methods because it would only cause a slow-down (i.e. additional overhead). In addition, the variables are only given package access to minimize the amount of code that can change them.
Please note that any variable defined in the scope of a class without the word 'public' or 'private' preceding it, is defined as package scope. Package scope means that only classes and methods in the same package can alter or read the value directly.
WHY TRANSIENT?
Certain parts of the object, such as the protection status and groupID, are not necessary to store when serializing this object. To indicate this to Java, we add the word 'transient' before each variable declaration.Modifier and Type | Class and Description |
---|---|
static class |
Seq.Direction
Used for typing/storing sequence direction.
|
static class |
Seq.Strandedness
Used for typing/storing sequence strandedness.
|
static class |
Seq.Topology
Used for typing/storing sequence topology.
|
static class |
Seq.Type
This enum is used for typing/storing sequence types.
|
Constructor and Description |
---|
Seq()
Constructs new instances of a sequence object.
|
Seq(Seq.Type type,
java.lang.String name,
java.lang.StringBuffer sequence)
Constructs new instances of a sequence object.
|
Seq(Seq.Type type,
java.lang.String name,
java.lang.StringBuffer sequence,
Seq.Direction direction,
Seq.Topology topology,
Seq.Strandedness strandedness)
Constructs new instances of a sequence object.
|
Seq(Seq.Type type,
java.lang.String name,
java.lang.StringBuffer sequence,
Seq.Direction direction,
Seq.Topology topology,
Seq.Strandedness strandedness,
java.lang.CharSequence original)
Constructs new instances of a sequence object.
|
Seq(Seq.Type type,
java.lang.String name,
java.lang.StringBuffer sequence,
Seq.Direction direction,
Seq.Topology topology,
Seq.Strandedness strandedness,
int groupID,
java.lang.String description)
Constructs new instances of a sequence object.
|
Seq(Seq.Type type,
java.lang.String name,
java.lang.StringBuffer sequence,
java.lang.String description)
Constructs new instances of a sequence object.
|
Seq(Seq data)
Constructs new instance of a sequence object by copying data from
another, pre-existing sequence object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Clones the current sequence object.
|
static Seq.Type |
detectType(java.lang.StringBuffer data)
This function detects the type of a sequence (RNA, DNA, or protein).
|
java.lang.String |
toString()
Creates a string representation of the Seq and its fields
This representation is limited to '[GROUP#|_] NAME' because the toString
method will be called when the sequence is displayed in any JList.
|
public Seq()
Constructs new instances of a sequence object. The names of the constructor parameters passed correspond directly with the class fields of the same names (i.e. the parameter 'name' corresponds directly to the sequence object field 'name').
In this case, the sequence object will be a nameless empty DNA sequence.
public Seq(Seq.Type type, java.lang.String name, java.lang.StringBuffer sequence)
Constructs new instances of a sequence object. The names of the constructor parameters passed correspond directly with the class fields of the same names (i.e. the parameter 'name' corresponds directly to the sequence object field 'name').
The only thing really noteworthy is that if the sequence provided is empty, the character protection settings will all be set to false. This functionality is handled by this specific constructor method (hence why all other constructor methods, except the clone/copy Seq constructor method, interface with this constructor).
This constructor is called directly by BioLegato's GDE flat-file parser, and also unifies all of the other Seq object constructors (except the copy/clone Seq constructor).
type
- the type of data to store in the sequence object.name
- the name of the sequence object.sequence
- the text sequence to store in the sequence object.type
,
name
,
sequence
,
Seq()
,
Seq(org.biolegato.sequence.data.Seq.Type, java.lang.String, java.lang.StringBuffer, java.lang.String)
,
Seq(org.biolegato.sequence.data.Seq.Type, java.lang.String, java.lang.StringBuffer, org.biolegato.sequence.data.Seq.Direction, org.biolegato.sequence.data.Seq.Topology, org.biolegato.sequence.data.Seq.Strandedness)
,
Seq(org.biolegato.sequence.data.Seq.Type, java.lang.String, java.lang.StringBuffer, org.biolegato.sequence.data.Seq.Direction, org.biolegato.sequence.data.Seq.Topology, org.biolegato.sequence.data.Seq.Strandedness, java.lang.CharSequence)
,
Seq(org.biolegato.sequence.data.Seq.Type, java.lang.String, java.lang.StringBuffer, org.biolegato.sequence.data.Seq.Direction, org.biolegato.sequence.data.Seq.Topology, org.biolegato.sequence.data.Seq.Strandedness, int, java.lang.String)
public Seq(Seq.Type type, java.lang.String name, java.lang.StringBuffer sequence, java.lang.String description)
Constructs new instances of a sequence object. The names of the constructor parameters passed correspond directly with the class fields of the same names (i.e. the parameter 'name' corresponds directly to the sequence object field 'name').
The only thing really noteworthy is that if the sequence provided is empty, the character protection settings will all be set to false.
This constructor is called by BioLegato's FastA file parser.
type
- the type of data to store in the sequence object.name
- the name of the sequence object.sequence
- the text sequence to store in the sequence object.description
- the description of the sequence object.type
,
name
,
sequence
,
description
,
FastAFile
public Seq(Seq.Type type, java.lang.String name, java.lang.StringBuffer sequence, Seq.Direction direction, Seq.Topology topology, Seq.Strandedness strandedness)
Constructs new instances of a sequence object. The names of the constructor parameters passed correspond directly with the class fields of the same names (i.e. the parameter 'name' corresponds directly to the sequence object field 'name').
The only thing really noteworthy is that if the sequence provided is empty, the character protection settings will all be set to false.
This method unifies the Seq constructors called by the GenBANK and GDE parsers.
type
- the type of data to store in the sequence object.name
- the name of the sequence object.sequence
- the text sequence to store in the sequence object.direction
- the direction of the sequence (if nucleotide).topology
- the topology of the sequence (if nucleotide).strandedness
- the strandedness of the sequence (if nucleotide).type
,
name
,
sequence
,
direction
,
topology
,
strandedness
,
Seq(org.biolegato.sequence.data.Seq.Type, java.lang.String, java.lang.StringBuffer, org.biolegato.sequence.data.Seq.Direction, org.biolegato.sequence.data.Seq.Topology, org.biolegato.sequence.data.Seq.Strandedness, java.lang.CharSequence)
,
Seq(org.biolegato.sequence.data.Seq.Type, java.lang.String, java.lang.StringBuffer, org.biolegato.sequence.data.Seq.Direction, org.biolegato.sequence.data.Seq.Topology, org.biolegato.sequence.data.Seq.Strandedness, int, java.lang.String)
public Seq(Seq.Type type, java.lang.String name, java.lang.StringBuffer sequence, Seq.Direction direction, Seq.Topology topology, Seq.Strandedness strandedness, java.lang.CharSequence original)
Constructs new instances of a sequence object. The names of the constructor parameters passed correspond directly with the class fields of the same names (i.e. the parameter 'name' corresponds directly to the sequence object field 'name').
The only thing really noteworthy is that if the sequence provided is empty, the character protection settings will all be set to false.
This constructor is called by BioLegato's GenBANK parser.
type
- the type of data to store in the sequence object.name
- the name of the sequence object.sequence
- the text sequence to store in the sequence object.direction
- the direction of the sequence (if nucleotide).topology
- the topology of the sequence (if nucleotide).strandedness
- the strandedness of the sequence (if nucleotide).original
- the original GenBANK header for the sequence data.type
,
name
,
sequence
,
direction
,
topology
,
strandedness
,
original
,
GenBankFile2008
public Seq(Seq.Type type, java.lang.String name, java.lang.StringBuffer sequence, Seq.Direction direction, Seq.Topology topology, Seq.Strandedness strandedness, int groupID, java.lang.String description)
Constructs new instances of a sequence object. The names of the constructor parameters passed correspond directly with the class fields of the same names (i.e. the parameter 'name' corresponds directly to the sequence object field 'name').
The only thing really noteworthy is that if the sequence provided is empty, the character protection settings will all be set to false.
This constructor is called by BioLegato's GDE parser.
type
- the type of data to store in the sequence object.name
- the name of the sequence object.sequence
- the text sequence to store in the sequence object.direction
- the direction of the sequence (if nucleotide).topology
- the topology of the sequence (if nucleotide).strandedness
- the strandedness of the sequence (if nucleotide).groupID
- the group ID for the sequence object.description
- the description of the sequence object.type
,
name
,
sequence
,
direction
,
topology
,
strandedness
,
groupID
,
description
,
GDEFile
public java.lang.String toString()
Creates a string representation of the Seq and its fields This representation is limited to '[GROUP#|_] NAME' because the toString method will be called when the sequence is displayed in any JList.
A couple of examples are as follows:
1 HEXOKINASE 1 PYRUVATE KINASE 1 ENOLASE 2 ACONITASE _ OTC
Where the glycolysis enzymes (HEXOKINASE, PYRUVATE KINASE, and ENOLASE) are in group 1, the citric acid enzyme (ACONITASE) is in group 2, and the urea cycle enzyme (OTC -- ornithine transcarbamylase) is not grouped.
Reliability and performance are the reasons why the string format limitation of '[GROUP#|_] NAME' was imposed:
toString
in class java.lang.Object
groupID
,
name
,
Dataset.getElementAt(int)
public java.lang.Object clone()
clone
in class java.lang.Object
public static Seq.Type detectType(java.lang.StringBuffer data)
This function detects the type of a sequence (RNA, DNA, or protein).
Please note that this function's implementation is very simple and may not be accurate in all cases. This function reads sequence data and looks for the characters F, E, J, L, O, Q, X, Z, or U. If the characters F, E, J, L, O, Q, X, or Z are encountered, the sequence is determined to be an amino acid/protein sequence; however, if the character U is found, the sequence is determined to be RNA. If both the character U and any character from the protein set (F, E, J, L, O, Q, X, or Z) are found, then the first of those characters found will be used to determine the sequence type. Note that if none of those characters (F, E, J, L, O, Q, X, Z, or U) are detected, then the sequence type will default to DNA.
data
- the sequence object to detect the type for.Copyright © 2008-2022 University of Manitoba.