示例#1
0
  public static void main(String[] args) throws Exception {

    NativeLibraryLoader l = new NativeLibraryLoader();
    l.load("/home/lmose/code/abra/target");

    NativeAssembler assem = new NativeAssembler();
    assem.setTruncateOutputOnRepeat(true);
    assem.setMaxContigs(5000);
    assem.setMaxPathsFromRoot(5000);
    assem.setKmer(new int[] {43});
    assem.setReadLength(100);
    assem.setMinKmerFrequency(2);
    assem.setMaxAverageDepth(400);
    assem.setShouldSearchForSv(true);

    //		String bam1 = args[0];
    String bam1 = "/home/lmose/dev/abra/sv/test.bam";
    List<String> inputFiles = new ArrayList<String>();
    inputFiles.add(bam1);

    // String output = args[2];
    String output = "/home/lmose/dev/abra/sv/output.txt";
    // chr18:60,793,358-60,793,758
    Feature region = new Feature("chr18", 60793358, 60793758);
    String prefix = "pre";
    boolean checkForDupes = true;
    ReAligner realigner = new ReAligner();
    CompareToReference2 c2r = new CompareToReference2();
    // c2r.init(args[3]);
    c2r.init("/home/lmose/reference/chr18/chr18.fa");

    List<Feature> regions = new ArrayList<Feature>();
    regions.add(region);
    String contigs =
        assem.assembleContigs(
            inputFiles, output, "asm_temp", regions, prefix, checkForDupes, realigner, c2r);
    System.err.println(contigs);

    System.err.println("-------------------------");

    List<BreakpointCandidate> svCandidates = assem.getSvCandidateRegions();
    for (BreakpointCandidate svCandidate : svCandidates) {
      System.err.println(
          "SV: " + region.getDescriptor() + "-->" + svCandidate.getRegion().getDescriptor());
    }

    //		assem.assembleContigs(args[0], args[1], "contig");

    //		for (int i=0; i<10; i++) {
    //			run(args[0], args[1] + "_" + i);
    //		}

    //		run(args[0], args[1]);

    //		assem.assembleContigs("/home/lmose/code/abra/src/main/c/1810_reads.txt",
    //				"/home/lmose/code/abra/src/main/c/1810.fa", "bar");
  }
示例#2
0
  private void evalRegion(Feature region, String regionBases) {
    boolean shouldInclude = false;
    NativeAssembler assembler = new NativeAssembler();
    StringBuffer readBuf =
        new StringBuffer((ReAligner.MAX_REGION_LENGTH + 2 * readLength) * readLength);
    for (int j = 0; j <= regionBases.length() - readLength; j++) {
      readBuf.append("0"); // forward strand only
      String read = regionBases.substring(j, j + readLength);
      readBuf.append(read);
      readBuf.append(qualities);
    }

    String contig =
        assembler.nativeAssemble(
            readBuf.toString(),
            region.getDescriptor(),
            "eval",
            0,
            1,
            (ReAligner.MAX_REGION_LENGTH + 2 * readLength) * 2,
            readLength,
            kmers,
            1,
            0,
            .01,
            1,
            MAX_NODES);
    int basesIdx = contig.indexOf('\n') + 1;
    if (basesIdx < contig.length()) {
      String contigBases = contig.substring(basesIdx, contig.length() - 1);
      if (regionBases.equals(contigBases)) {
        shouldInclude = true;
      }
    }

    if (shouldInclude) {
      includeRegions.add(region);
    } else {
      excludeRegions.add(region);
    }
  }