public static int insertWMFromFile(String species, String wmname, String wmversion, String wmtype, String wmfile, String bgFreq) 
  throws SQLException, NotFoundException, UnknownRoleException, FileNotFoundException, ParseException, IOException {
    WeightMatrix matrix;
    if (wmtype.matches(".*TAMO.*")) {
      matrix = PWMParser.readTamoMatrix(wmfile);
    } else if (wmtype.matches(".*MEME.*")) {
      matrix = PWMParser.readMemeMatrix(wmfile);
    } else if (wmtype.matches(".*SEQ.*")) { 
      matrix = PWMParser.readAlignedSequenceMatrix(wmfile);
    } else if (wmtype.matches(".*TRANSFAC.*")) {
      //TODO add a method to read a single transfac matrix
      matrix = PWMParser.readTRANSFACFreqMatrices(wmfile, wmversion).get(0);
    } else if (wmtype.matches(".*PRIORITY.*")) {
      matrix = PWMParser.parsePriorityBestOutput(wmfile);
    } else if (wmtype.toUpperCase().matches(".*GIMME.*")) {
        matrix = PWMParser.readGimmeMotifsMatrices(wmfile,wmversion,wmtype).get(0);
    } else {
      System.err.println("Didn't see a program I recognize in the type.  defaulting to reading TAMO format");
      matrix = PWMParser.readTamoMatrix(wmfile);
    }
    matrix.name = wmname;
    matrix.version = wmversion;
    matrix.type = wmtype;
    matrix.speciesid = (new Species(species)).getDBID();
    return insertMatrixIntoDB(matrix);
 }
public static int insertWMFromFile(String species, String wmname, String wmversion, String wmtype, String wmfile, String bgFreq) 
  throws SQLException, NotFoundException, UnknownRoleException, FileNotFoundException, ParseException, IOException {
    WeightMatrix matrix;
    if (wmtype.matches(".*TAMO.*")) {
      matrix = PWMParser.readTamoMatrix(wmfile);
    } else if (wmtype.matches(".*MEME.*")) {
      matrix = PWMParser.readMemeMatrix(wmfile);
    } else if (wmtype.matches(".*SEQ.*")) { 
      matrix = PWMParser.readAlignedSequenceMatrix(wmfile);
    } else if (wmtype.matches(".*TRANSFAC.*")) {
     
      matrix = PWMParser.readTRANSFACFreqMatrices(wmfile, wmversion).get(0);
    } else if (wmtype.matches(".*PRIORITY.*")) {
      matrix = PWMParser.parsePriorityBestOutput(wmfile);
    } else if (wmtype.toUpperCase().matches(".*GIMME.*")) {
        matrix = PWMParser.readGimmeMotifsMatrices(wmfile,wmversion,wmtype).get(0);
    } else {
      System.err.println("Didn't see a program I recognize in the type.  defaulting to reading TAMO format");
      matrix = PWMParser.readTamoMatrix(wmfile);
    }
    matrix.name = wmname;
    matrix.version = wmversion;
    matrix.type = wmtype;
    matrix.speciesid = (new Species(species)).getDBID();
    return insertMatrixIntoDB(matrix);
 }
public static int insertwmfromfile(string species, string wmname, string wmversion, string wmtype, string wmfile, string bgfreq) throws sqlexception, notfoundexception, unknownroleexception, filenotfoundexception, parseexception, ioexception { weightmatrix matrix; if (wmtype.matches(".*tamo.*")) { matrix = pwmparser.readtamomatrix(wmfile); } else if (wmtype.matches(".*meme.*")) { matrix = pwmparser.readmemematrix(wmfile); } else if (wmtype.matches(".*seq.*")) { matrix = pwmparser.readalignedsequencematrix(wmfile); } else if (wmtype.matches(".*transfac.*")) { matrix = pwmparser.readtransfacfreqmatrices(wmfile, wmversion).get(0); } else if (wmtype.matches(".*priority.*")) { matrix = pwmparser.parseprioritybestoutput(wmfile); } else if (wmtype.touppercase().matches(".*gimme.*")) { matrix = pwmparser.readgimmemotifsmatrices(wmfile,wmversion,wmtype).get(0); } else { system.err.println("didn't see a program i recognize in the type. defaulting to reading tamo format"); matrix = pwmparser.readtamomatrix(wmfile); } matrix.name = wmname; matrix.version = wmversion; matrix.type = wmtype; matrix.speciesid = (new species(species)).getdbid(); return insertmatrixintodb(matrix); }