001package org.gbif.api.util;
002
003import java.util.regex.Pattern;
004import org.apache.commons.codec.digest.DigestUtils;
005
006public class DnaUtils {
007
008  private static final Pattern NON_IUPAC = Pattern.compile("[^ACGTURYSWKMBDHVN]");
009
010  public static String convertDnaSequenceToID(String dnaSequence) {
011    if (dnaSequence != null && !dnaSequence.isEmpty()) {
012      return DigestUtils.md5Hex(NON_IUPAC.matcher(dnaSequence.toUpperCase()).replaceAll(""));
013    }
014    return dnaSequence;
015  }
016}