예제 #1
0
파일: Main.java 프로젝트: JeGoi/mirdup
 public static void AttributeSelection() {
   // search sequences from mirbase based on a keyword
   System.out.println("Attribute selection");
   Mirbase m = new Mirbase();
   ArrayList altrain =
       m.getSequencesFromFiles(matures, hairpins, organisms, structures, keyword, "tmp");
   // train model
   File arff = new File(keyword + ".arff");
   AdaptDataForWeka.createFileFromList(altrain, arff, bestFeatures);
   System.out.println("Attribute selection for " + keyword);
   WekaModule.attributeSelection(arff, keyword + ".AttribSel.txt");
 }
예제 #2
0
파일: Main.java 프로젝트: JeGoi/mirdup
  /** Use miRbase fastas source */
  public static void miRdupExecutionFastas() {
    String filename = matures.substring(0, matures.lastIndexOf("."));
    // Normal execution. We get sequences on mirbase using keyword ("all" if empty),
    // then we train the model on it, and if the test dataset is present we submit it to the model
    if (!classifier.isEmpty()) {
      if (predictionsFile.isEmpty()) {
        System.out.println("You must submit a file with data you want to validate");
      } else {
        System.out.println("Validation of " + predictionsFile + " with classifier " + classifier);
        // test model
        File arff = null;
        if (arffFileForValidate.isEmpty()) {
          arff = new File(predictionsFile + ".arff");
          AdaptDataForWeka.createPredictionDataset(predictionsFile, false);
        } else {
          System.out.println("Using arff file " + arffFileForValidate + " to validate");
          arff = new File(arffFileForValidate);
        }
        WekaModule.testModel(arff, predictionsFile, classifier, predictMirnaPosition);
      }
    } else if (trainFromOnlineMiRbase == true) {
      // search sequences from mirbase based on a keyword
      Mirbase m = new Mirbase();
      ArrayList altrain = m.getSequencesFromMirbase(keyword);
      // train model
      File arff = new File(keyword + ".arff");
      AdaptDataForWeka.createFileFromList(altrain, arff, false);
      WekaModule.trainModel(arff, keyword);

      // submit a file with predicted mirnas and their hairpins to the model
      if (!predictionsFile.isEmpty()) {
        // test model
        arff = null;
        if (arffFileForValidate.isEmpty()) {
          arff = new File(predictionsFile + ".arff");
          AdaptDataForWeka.createPredictionDataset(predictionsFile, false);
        } else {
          arff = new File(arffFileForValidate);
        }
        WekaModule.testModel(arff, predictionsFile, keyword + modelExtension, predictMirnaPosition);
      }
      // Case offline mirbase, and local sequences are submitted
    } else {
      // search sequences from mirbase based on a keyword
      File arff = null;
      if (arffFileForTrain.isEmpty()) {
        Mirbase m = new Mirbase();
        ArrayList altrain =
            m.getSequencesFromFiles(matures, hairpins, organisms, structures, keyword, filename);
        arff = new File(keyword + "" + filename + ".arff");
        AdaptDataForWeka.createFileFromList(altrain, arff, false);
      } else {
        arff = new File(arffFileForTrain);
      }
      // train model
      WekaModule.trainModel(arff, keyword + "" + filename);
      // submit a file with predicted mirnas and their hairpins to the model
      if (!predictionsFile.isEmpty()) {
        // test model
        arff = null;
        if (arffFileForValidate.isEmpty()) {
          arff = new File(predictionsFile + ".arff");
          AdaptDataForWeka.createPredictionDataset(predictionsFile, false);
        } else {
          arff = new File(arffFileForValidate);
        }
        WekaModule.testModel(
            arff, predictionsFile, keyword + filename + modelExtension, predictMirnaPosition);
      }
    }
  }