Package pal.datatype

Class Nucleotides

    • Constructor Detail

      • Nucleotides

        public Nucleotides()
      • Nucleotides

        public Nucleotides​(boolean isRNA)
        If isRNA is true than getChar(state) will return a U instead of a T
    • Method Detail

      • getNumStates

        public int getNumStates()
        Description copied from interface: DataType
        get number of unique states
        Specified by:
        getNumStates in interface DataType
        Returns:
        number of unique states
      • isUnknownStateImpl

        protected final boolean isUnknownStateImpl​(int state)
        Description copied from class: SimpleDataType
        For subclasses to handle, without regard for gaps
        Specified by:
        isUnknownStateImpl in class SimpleDataType
        Returns:
        true if this state is an unknown state
      • getStateImpl

        protected int getStateImpl​(char c)
        Get state corresponding to character c
        NOTE: IF YOU CHANGE THIS IT MAY STOP THE NUCLEOTIDE TRANSLATOR FROM WORKING! - It relies on the fact that all the states for 'ACGTU' are between [0, 3]
        Specified by:
        getStateImpl in class SimpleDataType
      • getCharImpl

        protected char getCharImpl​(int state)
        Get character corresponding to a given state
        Specified by:
        getCharImpl in class SimpleDataType
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: DataType
        description of data type
        Specified by:
        getDescription in interface DataType
        Returns:
        a string describing the data type
      • getTypeID

        public int getTypeID()
        Description copied from interface: DataType
        get numerical code describing the data type
        Specified by:
        getTypeID in interface DataType
        Returns:
        the unique numerical code describing the data type
      • isTransitionByState

        public final boolean isTransitionByState​(int firstState,
                                                 int secondState)
        Returns:
        true if A->G, G->A, C->T, or T->C if firstState equals secondState returns FALSE!
      • isTransitionByChar

        public final boolean isTransitionByChar​(char firstChar,
                                                char secondChar)
        Returns:
        true if A->G, G->A, C->T, or T->C if firstState equals secondState returns FALSE! (I've renamed things to avoid confusion between java typing of ints and chars)
      • getNucleotideStates

        public int[] getNucleotideStates​(int[] residueStates)
        Specified by:
        getNucleotideStates in interface MolecularDataType
        Parameters:
        residueStates - an array of states corresponding to states of this datatype
        Returns:
        a copy of the input
      • getRelavantLength

        public int getRelavantLength​(int numberOfStates)
        Returns:
        the input
      • getComplementState

        public static final int getComplementState​(int baseState)
        Obtain the complement state
        Parameters:
        baseState - the base state to complement (may be IUPAC but IUPACness is lost)
        Returns:
        the complement state
      • getSequenceComplement

        public static final int[] getSequenceComplement​(int[] sequence)
        Obtain the complement of a sequence of nucleotides (or IUPACNucleotides - but IUPAC ness is lost)
        Parameters:
        sequence - the sequence (of nucleotide states)
        Returns:
        the complement
      • complementSequence

        public static final void complementSequence​(int[] sequence)
        Complement of a sequence of nucleotides (or IUPACNucleotides - but IUPAC ness is lost)
        Parameters:
        sequence - the sequence (of nucleotide states) (is modified)