Exemplo n.º 1
0
  public static void main(String[] args) {

    BackgroundEstimation estimation = new BolstadEMBackgroundEstimation();
    // BackgroundEstimation estimation = new UniformBackgroundEstimation();

    String key = args[0];

    WorkflowProperties props = new WorkflowProperties();
    File fplus = new File(props.getDirectory(), String.format("%s_plus.raw", key));
    File fminus = new File(props.getDirectory(), String.format("%s_negative.raw", key));

    // LogTransform transform = LogTransform.NONE;
    LogTransform transform = LogTransform.LOG_TO_EXP;

    BackgroundRemoval norm = new BackgroundRemoval(estimation, transform);

    try {
      System.out.println(String.format("Loading: %s", fplus.getName()));
      norm.load(new WorkflowDataLoader(fplus));
      System.out.println(String.format("Loading: %s", fminus.getName()));
      norm.load(new WorkflowDataLoader(fminus));

      WorkflowIndexing indexing = props.getIndexing(key);

      System.out.println(String.format("Removing background..."));
      norm.removeBackground();

      Filter<ProbeLine, ProbeLine> plus =
          new Filter<ProbeLine, ProbeLine>() {
            public ProbeLine execute(ProbeLine p) {
              return p.strand.equals("+") ? p : null;
            }
          };
      Filter<ProbeLine, ProbeLine> minus =
          new Filter<ProbeLine, ProbeLine>() {
            public ProbeLine execute(ProbeLine p) {
              return p.strand.equals("-") ? p : null;
            }
          };

      System.out.println(String.format("Outputting background-removed results..."));
      File plusOut = new File(props.getDirectory(), String.format("%s_plus.corrected", key));
      File minusOut = new File(props.getDirectory(), String.format("%s_negative.corrected", key));

      outputProbes(new FilterIterator<ProbeLine, ProbeLine>(plus, norm.iterator()), plusOut);
      System.out.println(String.format("\t%s", plusOut.getAbsolutePath()));

      outputProbes(new FilterIterator<ProbeLine, ProbeLine>(minus, norm.iterator()), minusOut);
      System.out.println(String.format("\t%s", minusOut.getAbsolutePath()));

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) {

    WorkflowProperties props = new WorkflowProperties();
    File inputFile =
        args.length > 0
            ? new File(args[0])
            : new File(props.getDirectory(), "s288c_mata_1_plus.segments");

    try {
      DifferentialSegments dsegs = new DifferentialSegments(inputFile);

      Collection<DifferentialKey> keys = dsegs.differentialRegions(0, 1);
      System.out.println(DifferentialKey.header());
      for (DifferentialKey key : keys) {
        System.out.println(key.toString());
      }

      System.out.println(String.format("# Regions: " + keys.size()));

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