Class SequenceUtil


  • public final class SequenceUtil
    extends Object
    Utility class for operations on sequences
    Since:
    3.0.2
    Version:
    1.0
    Author:
    Peter Troshin
    • Method Detail

      • isNonAmbNucleotideSequence

        public static boolean isNonAmbNucleotideSequence​(String sequence)
        Ambiguous DNA chars : AGTCRYMKSWHBVDN // differs from protein in only one (!) - B char
      • cleanSequence

        public static String cleanSequence​(String sequence)
        Removes all whitespace chars in the sequence string
        Parameters:
        sequence -
        Returns:
        cleaned up sequence
      • deepCleanSequence

        public static String deepCleanSequence​(String sequence)
        Removes all special characters and digits as well as whitespace chars from the sequence
        Parameters:
        sequence -
        Returns:
        cleaned up sequence
      • isProteinSequence

        public static boolean isProteinSequence​(String sequence)
        Parameters:
        sequence -
        Returns:
        true is the sequence is a protein sequence, false overwise
      • isAmbiguosProtein

        public static boolean isAmbiguosProtein​(String sequence)
        Check whether the sequence confirms to amboguous protein sequence
        Parameters:
        sequence -
        Returns:
        return true only if the sequence if ambiguous protein sequence Return false otherwise. e.g. if the sequence is non-ambiguous protein or DNA
      • writeFasta

        public static void writeFasta​(OutputStream outstream,
                                      List<FastaSequence> sequences,
                                      int width)
                               throws IOException
        Writes list of FastaSequeces into the outstream formatting the sequence so that it contains width chars on each line
        Parameters:
        outstream -
        sequences -
        width - - the maximum number of characters to write in one line
        Throws:
        IOException