Esempio n. 1
0
 public static void main(String[] args) {
   String one =
       "MSVGELYSQCTRVWIPDPDEVWRSAELTKDYKEGDKSLQLRLEDETILEYPIDVQRNQLPFLRNPDILVGENDLTALSYLHEPAVLHNLKVRFLESNHIYTYCGIVLVAINPYEQLPIYGQDVIYTYSGQNMGDMDPHIFAVAEEAYKQMARDEKNQSIIVSGESGAGKTVSAKYAMRYFATVGGSASETNIEEKVLASSPIMEAIGNAKTTRNDNSSRFGKYIQIGFDKRYHIIGANMRTYLLEKSRVVFQADDERNYHIFYQLCAAAGLPEFKELALTSAEDFFYTSQGGDTSIEGVDDAEDFEKTRQAFTLLGVKESHQMSIFKIIASILHLGSVAIQAERDGDSCSISPQDVYLSNFCRLLGVEHSQMEHWLCHRKLVTTSETYVKTMSLQQVINARNALAKHIYAQLFGWIVEHINKALHTSLKQHSFIGVLDIYGFETFEVNSFEQFCINYANEKLQQQFNSHVFKLEQEEYMKEQIPWTLIDFYDNQPCIDLIEAKLGILDLLDEECKVPKGTDQNWAQKLYDRHSSSQHFQKPRMSNTAFIIVHFADKVEYLSDGFLEKNRDTVYEEQINILKASKFPLVADLFHDDKDPVPATTPGKGSSSKISVRSARPPMKVSNKEHKKTVGHQFRTSLHLLMETLNATTPHYVRCIKPNDEKLPFHFDPKRAVQQLRACGVLETIRISAAGYPSRWAYHDFFNRYRVLVKKRELANTDKKAICRSVLENLIKDPDKFQFGRTKIFFRAGQVAYLEKLRADKFRTATIMIQKTVRGWLQKVKYHRLKGATLTLQRYCRGHLARRLAEHLRRIRAAVVLQKHYRMQRARQAYQRVRRAAVVIQAFTRAMFVRRTYRQVLMEHKATTIQKHVRGWMARRHFQRLRDAAIVIQCAFRMLKARRELKALRIEARSAEHLKRLNVGMENKVVQLQRKIDEQNKEFKTLSEQLSVTTSTYTMEVERLKKELVHYQQSPGEDTSLRLQEEVESLRTELQRAHSERKILEDAHSREKDELRKRVADLEQENALLKDEKEQLNNQILCQSKDEFAQNSVKENLMKKELEEERSRYQNLVKEYSQLEQRYDNLRDEMTIIKQTPGHRRNPSNQSSLESDSNYPSISTSEIGDTEDALQQVEEIGLEKAAMDMTVFLKLQKRVRELEQERKKLQVQLEKREQQDSKKVQAEPPQTDIDLDPNADLAYNSLKRQELESENKKLKNDLNELRKAVADQATQNNSSHGSPDSYSLLLNQLKLAHEELEVRKEEVLILRTQIVSADQRRLAGRNAEPNINARSSWPNSEKHVDQEDAIEAYHGVCQTNSKTEDWGYLNEDGELGLAYQGLKQVARLLEAQLQAQSLEHEEEVEHLKAQLEALKEEMDKQQQTFCQTLLLSPEAQVEFGVQQEISRLTNENLDLKELVEKLEKNERKLKKQLKIYMKKAQDLEAAQALAQSERKRHELNRQVTVQRKEKDFQGMLEYHKEDEALLIRNLVTDLKPQMLSGTVPCLPAYILYMCIRHADYTNDDLKVHSLLTSTINGIKKVLKKHNDDFEMTSFWLSNTCRLLHCLKQYSGDEGFMTQNTAKQNEHCLKNFDLTEYRQVLSDLSIQIYQQLIKIAEGVLQPMIVSAMLENESIQGLSGVKPTGYRKRSSSMADGDNSYCLEAIIRQMNAFHTVMCDQGLDPEIILQVFKQLFYMINAVTLNNLLLRKDVCSWSTGMQLRYNISQLEEWLRGRNLHQSGAVQTMEPLIQAAQLLQLKKKTQEDAEAICSLCTSLSTQQIVKILNLYTPLNEFEERVTVAFIRTIQAQLQERNDPQQLLLDAKHMFPVLFPFNPSSLTMDSIHIPACLNLEFLNEV";
   System.out.println(">>> three==" + SequenceUtils.convAaSequence(one));
   String two = "erPheGluGlnPh";
   System.out.println(
       ">>> fulls=="
           + SequenceUtils.getNumFullAminoAcids(two)
           + ", parts=="
           + SequenceUtils.getNumPartAminoAcids(two));
 }
Esempio n. 2
0
 /**
  * Get the amino acid sequence (translate) for a spliced nucleotide sequence
  *
  * @param nuclSequence
  * @return amino acid sequence
  */
 public static String translate(String nuclSequence) {
   String aaSequence = "";
   for (int i = 0; i < nuclSequence.length() - 1; i = i + 3) {
     String codon = StringUtils.substring(nuclSequence, i, i + 3);
     aaSequence = aaSequence + SequenceUtils.getAminoAcid3(codon);
   }
   return aaSequence;
 }
Esempio n. 3
0
  /**
   * Convert a amino acid sequence in one-letter-notation to three-letter-notation
   *
   * @param one -letter-notation
   * @return three-letter-notation
   */
  public static String convAaSequence(String seq) {
    StringBuffer buf = new StringBuffer();

    for (char aminoAcid : seq.toCharArray())
      buf.append(SequenceUtils.toAminoAcid3(new Character(aminoAcid).toString()));

    return buf.toString();
  }
Esempio n. 4
0
  /**
   * Get index of first occurence of codon after given startCodonNum
   *
   * @param sequence
   * @param startCodonNum
   * @return codon number of first occurence, -1 if no match or null sequence input
   */
  public static int indexOfCodon(String sequence, String codon, int startCodonNum) {
    if (sequence == null || codon == null) return -1;

    int codonPos = StringUtils.indexOf(sequence, codon, startCodonNum * 3) + 1; // NT
    // pos
    // starts
    // at
    // 1
    // not
    // 0
    return SequenceUtils.getCodonNum(codonPos);
  }