Package ru.autosome.commons.motifModel.di

Examples of ru.autosome.commons.motifModel.di.DiPWM


    return new DiWordwiseBackground();
  }

  @Override
  protected DiPWM createMotif(double[][] matrix, String name) {
    return new DiPWM(matrix, name);
  }
View Full Code Here


      System.out.println(similarityInfo.alignment);
      System.out.println(similarityInfo.recognizedByBoth);
      //System.out.println("\n----------\n" + new PairAligned(firstPWMCounting, secondPWMCounting, similarityInfo.alignment).firstModelAligned);
      //System.out.println("\n----------\n" + new PairAligned(firstPWMCounting, secondPWMCounting, similarityInfo.alignment).secondModelAligned);

      DiPWM firstDiPWM = DiPWM.fromPWM(firstPWM);
      DiPWM secondDiPWM = DiPWM.fromPWM(secondPWM);
      DiBackgroundModel dibackground = new DiWordwiseBackground();
//      DiBackgroundModel dibackground = new DiBackground(new double[]{ 0.0625,0.0625,0.0625,0.0625,
//                                                                      0.0625,0.0625,0.0625,0.0625,
//                                                                      0.0625,0.0625,0.0625,0.0625,
//                                                                      0.0625,0.0625,0.0625,0.0625});
View Full Code Here

  }

  // constructs DiPWM from any source: pwm/pcm/ppm matrix
  @Override
  public DiPWM createMotif(double matrix[][], String name) {
    DiPWM dipwm;
    switch (dataModel) {
      case PCM:
        dipwm = new DiPCM(matrix, name).to_pwm(background);
        break;
      case PPM:
        dipwm = new DiPPM(matrix, name).to_pwm(background, effectiveCount);
        break;
      case PWM:
        dipwm = new DiPWM(matrix, name);
        break;
      default:
        throw new Error("This code never reached");
    }
    return dipwm;
View Full Code Here

                         "pvalue: " + info.pvalue + "\n" +
                         "number of recognized words: " + info.numberOfRecognizedWords(background, pwmLength) + "\n------------\n");
  }

  static void run_mono_and_di(PWM mono_pwm, BackgroundModel mono_background, Discretizer discretizer, Integer max_hash_size, double threshold) {
    DiPWM di_pwm = DiPWM.fromPWM(mono_pwm);
    DiBackgroundModel di_background = DiBackground.fromMonoBackground(mono_background);

    FindPvalueAPE calculator = new FindPvalueAPE<PWM, BackgroundModel>(mono_pwm,
                                                                       mono_background,
                                                                       discretizer, max_hash_size);
    FindPvalueAPE dicalculator = new FindPvalueAPE<DiPWM, DiBackgroundModel>(di_pwm,
                                                                             di_background,
                                                                             discretizer, max_hash_size);

    // Single threshold
    try {
      System.out.println( "================");
      CanFindPvalue.PvalueInfo info = calculator.pvalueByThreshold(threshold);
      print_result(info, mono_background, mono_pwm.length());

      CanFindPvalue.PvalueInfo di_info = dicalculator.pvalueByThreshold(threshold);
      print_result(di_info, di_background, di_pwm.length());
      System.out.println( "================");
    } catch (HashOverflowException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    Integer max_hash_size = null;
    double threshold = 7;
//    double[] thresholds = {3,5,7};

    Sequence word = new Sequence("ACAGTGACAA");
    DiPWM dipwm = DiPWM.fromPWM(pwm); // A way to transform mono-nucleotide to di matrix

    System.out.println(pwm.score(word));
    System.out.println(dipwm.score(word));

    //DiPWM dipwm_2 = new DiPWMImporter().loadMotif("test_data/dipwm/AP2A.di"));

    run_mono_and_di(pwm, new WordwiseBackground(), discretizer, max_hash_size, threshold);
    run_mono_and_di(pwm, new Background(new double[] {0.1, 0.4, 0.4, 0.1}), discretizer, max_hash_size, threshold);
View Full Code Here

TOP

Related Classes of ru.autosome.commons.motifModel.di.DiPWM

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.