Exemplo n.º 1
0
  /** @param args the command line arguments */
  public static void main(String[] args) {
    //        args=tests();

    try {
      setOptions(args);
    } catch (Exception e) {
      help();
    }
    String os = System.getProperty("os.name").toLowerCase();
    if (!os.contains("win") && rnafoldlinux.isEmpty()) {
      System.out.println(
          "You must submit the RNAfold program path (option -r). See help with -help option");
    } else {
      // check Vienna tools
      if (!Vienna.checkViennaTools()) {
        System.err.println("Vienna tools cannot be executed");
      } else if (predictMiRNAFromPrec) {
        mirdupExecutionPredictor();
      } else {
        miRdupExecutionEMBL();
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Get probabilities for each pairs stored in the ps file
   *
   * @param aBdot5ps
   */
  private void getBasePairsProbabilities(String aBdot5ps) {

    boolean finalProbs = false;
    int nucleotide5p = 0;

    try {
      BufferedReader br = new BufferedReader(new FileReader(aBdot5ps));
      String line = br.readLine();
      while (!line.startsWith("%data")) {
        line = br.readLine();
      }
      line = br.readLine();
      while (!line.startsWith("showpage")) {
        String tab[] = line.split(" ");
        int actual5pnt = Integer.valueOf(tab[0]) - 1;
        int nucleotide3p = Integer.valueOf(tab[1]) - 1;
        double score = Double.valueOf(tab[2]);
        Double content[] = {Double.valueOf(actual5pnt), Double.valueOf(nucleotide3p), score};

        if (actual5pnt < nucleotide5p) {
          finalProbs = true;
        }
        nucleotide5p = actual5pnt;
        //                System.out.println(line);
        assignBasePairsProbability(
            bothmirnas.charAt(actual5pnt), bothmirnas.charAt(nucleotide3p), score);

        BPprobGlobal += score;
        if (finalProbs) {
          BPprobFinalStructure += score;
          alBPprobFinalStructure.add(content);
        } else {
          BPprobTmpStructure += score;
          hmBPprobTmpStructure.put(actual5pnt, content);
          ComplexBoltzmannProbability += -Math.exp(-score / (8.3144621 * 37));
        }

        line = br.readLine();
      }
      br.close();

      // ensemblized bulges at +4 and -4
      int numberOfUnpairedBases = 0;
      double SumUnpairedBasesAroundBulges = 0;
      for (int i = 0; i < alBPprobFinalStructure.size(); i++) {
        if (alBPprobFinalStructure.get(i)[0] != i) {
          numberOfUnpairedBases++;
          for (int j = i - 4; j <= i + 4; j++) {
            try {

              SumUnpairedBasesAroundBulges += hmBPprobTmpStructure.get(j)[2];
            } catch (Exception e) {
            }
          }
        }
      }
      BPprobEnsemblizedBulges = SumUnpairedBasesAroundBulges / numberOfUnpairedBases;

      // ComplexBoltzmannProbability
      if (calculateConstraint) {
        String constraint = "";
        if (mirna5p.length() == mirna3p.length()) {
          for (int i = 0; i < mirna5p.length(); i++) {
            constraint += "(";
          }
          constraint += "&";
          for (int i = 0; i < mirna3p.length(); i++) {
            constraint += ")";
          }
        } else if (mirna5p.length() < mirna3p.length()) {
          for (int i = 0; i < mirna5p.length(); i++) {
            constraint += "(";
          }
          constraint += "&";
          for (int i = 0; i < mirna5p.length(); i++) {
            constraint += ")";
          }
          for (int i = 0; i < mirna5p.length() - mirna5p.length(); i++) {
            constraint += ".";
          }
        } else {
          for (int i = 0; i < mirna5p.length() - mirna3p.length(); i++) {
            constraint += ".";
          }
          for (int i = 0; i < mirna3p.length(); i++) {
            constraint += "(";
          }
          constraint += "&";
          for (int i = 0; i < mirna3p.length(); i++) {
            constraint += ")";
          }
        }

        double Q =
            Vienna.GetInfosDuplexRNAcofoldConstraint(mirna5p, mirna3p, constraint)
                .ComplexBoltzmannProbability;
        ComplexBoltzmannProbability = ComplexBoltzmannProbability / Q;
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }