Package org.biojavax.bio.seq
Class RichSequence.Tools
- java.lang.Object
-
- org.biojavax.bio.seq.RichSequence.Tools
-
- Enclosing interface:
- RichSequence
public static class RichSequence.Tools extends Object
Some useful tools for working with RichSequence objects.- Since:
- 1.5
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RichSequence
createRichSequence(String namespace, String name, String seqString, Alphabet alpha)
Create a new RichSequence in the specified namespace.static RichSequence
createRichSequence(String name, String seqString, Alphabet alpha)
Create a new RichSequence in the default namespace.static RichSequence
createRichSequence(String name, SymbolList syms)
Create a new RichSequence in the default namespace.static RichSequence
createRichSequence(Namespace ns, String name, String seqString, Alphabet alpha)
Create a new RichSequence in the specified namespace.static RichSequence
createRichSequence(Namespace ns, String name, SymbolList syms)
Create a new RichSequence in the specified namespace.static RichSequence
enrich(Sequence s)
Boldly attempts to convert aSequence
into aRichSequence
.static RichSequence
subSequence(RichSequence s, int from, int to, Namespace newNamespace, String newName, String newAccession, String newIdentifier, int newVersion, Double seqVersion)
Creates a new sequence from a subregion of another sequence.
-
-
-
Method Detail
-
createRichSequence
public static RichSequence createRichSequence(String name, String seqString, Alphabet alpha) throws BioException
Create a new RichSequence in the default namespace.- Parameters:
name
- The name for the sequence. Will also be used for the accession.seqString
- The sequence stringalpha
- TheAlphabet
for the sequence- Returns:
- A new
RichSequence
. All versions are 1 or 1.0 - Throws:
BioException
- If the symbols inseqString
are not valid inalpha
-
createRichSequence
public static RichSequence createRichSequence(String namespace, String name, String seqString, Alphabet alpha) throws BioException
Create a new RichSequence in the specified namespace.- Parameters:
namespace
- the namespace to create the sequence in. A singletonNamespace
will be created or retrieved as appropriate.name
- The name for the sequence. Will also be used for the accession.seqString
- The sequence stringalpha
- TheAlphabet
for the sequence- Returns:
- A new
RichSequence
. All versions are 1 or 1.0 - Throws:
BioException
- If the symbols inseqString
are not valid inalpha
-
createRichSequence
public static RichSequence createRichSequence(Namespace ns, String name, String seqString, Alphabet alpha) throws BioException
Create a new RichSequence in the specified namespace.- Parameters:
ns
- The namespace to create the sequence in.name
- The name for the sequence. Will also be used for the accession.seqString
- The sequence stringalpha
- TheAlphabet
for the sequence- Returns:
- A new
RichSequence
. All versions are 1 or 1.0 - Throws:
BioException
- If the symbols inseqString
are not valid inalpha
-
createRichSequence
public static RichSequence createRichSequence(String name, SymbolList syms)
Create a new RichSequence in the default namespace.- Parameters:
syms
- The symbols to add to the sequence.name
- The name for the sequence. Will also be used for the accession.- Returns:
- A new
RichSequence
. All versions are 1 or 1.0
-
createRichSequence
public static RichSequence createRichSequence(Namespace ns, String name, SymbolList syms)
Create a new RichSequence in the specified namespace.- Parameters:
ns
- the namespace to create the sequence in.syms
- The symbols to add to the sequence.name
- The name for the sequence. Will also be used for the accession.- Returns:
- A new
RichSequence
. All versions are 1 or 1.0
-
enrich
public static RichSequence enrich(Sequence s) throws ChangeVetoException
Boldly attempts to convert aSequence
into aRichSequence
.Sequence
s will be assigned to the default namespace. The accession will be assumed to be the name of the old sequence. The version of the sequence will be set to 0 and the seqversion set to 0.0.Feature
s are converted toRichFeature
s. The oldAnnotation
bundle is converted to aRichAnnotation
- Parameters:
s
- TheSequence
to enrich- Returns:
- a new
RichSequence
- Throws:
ChangeVetoException
- ifs
is locked or the conversion fails.
-
subSequence
public static RichSequence subSequence(RichSequence s, int from, int to, Namespace newNamespace, String newName, String newAccession, String newIdentifier, int newVersion, Double seqVersion) throws IndexOutOfBoundsException
Creates a new sequence from a subregion of another sequence. The sequence is not a view. The sequence can be given a new Namespace, Accession, Name, Identifier etc. or you can copy over the old values. For unique identification in databases we recommend you change at least the name and identifier.
The new sequence will retain all features that are fully contained by the new subsequence, the note set (annotation), Taxon, and description, modified to reflect the subsequence as follows:
seq.setDescription("subsequence (" + from + ":" + to + ") of " + s.getDescription());
No other properties are copied.- Parameters:
newVersion
- the new version numberseqVersion
- the new sequence versions
- the originalRichSequence
.from
- the 1st subsequence coordinate (inclusive)to
- the last subsequence coordinate (inclusive)newNamespace
- the newNamespace
newName
- the new namenewAccession
- the new accession numbernewIdentifier
- the new identifier- Returns:
- A new
RichSequence
- Throws:
IndexOutOfBoundsException
- iffrom
orto
lie outside of the bounds ofs
.
-
-