Class RichSequence.Tools

    • 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 string
        alpha - The Alphabet for the sequence
        Returns:
        A new RichSequence. All versions are 1 or 1.0
        Throws:
        BioException - If the symbols in seqString are not valid in alpha
      • 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 singleton Namespace will be created or retrieved as appropriate.
        name - The name for the sequence. Will also be used for the accession.
        seqString - The sequence string
        alpha - The Alphabet for the sequence
        Returns:
        A new RichSequence. All versions are 1 or 1.0
        Throws:
        BioException - If the symbols in seqString are not valid in alpha
      • 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 string
        alpha - The Alphabet for the sequence
        Returns:
        A new RichSequence. All versions are 1 or 1.0
        Throws:
        BioException - If the symbols in seqString are not valid in alpha
      • 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 a Sequence into a RichSequence. Sequences 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. Features are converted to RichFeatures. The old Annotation bundle is converted to a RichAnnotation
        Parameters:
        s - The Sequence to enrich
        Returns:
        a new RichSequence
        Throws:
        ChangeVetoException - if s 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 number
        seqVersion - the new sequence version
        s - the original RichSequence.
        from - the 1st subsequence coordinate (inclusive)
        to - the last subsequence coordinate (inclusive)
        newNamespace - the new Namespace
        newName - the new name
        newAccession - the new accession number
        newIdentifier - the new identifier
        Returns:
        A new RichSequence
        Throws:
        IndexOutOfBoundsException - if from or to lie outside of the bounds of s.