Examples of ReferenceSequenceFile


Examples of net.sf.picard.reference.ReferenceSequenceFile

    Collections.reverse(record.getReadFeatures());
  }

  public static byte[] getBasesFromReferenceFile(String referenceFilePath,
      String seqName, int from, int length) {
    ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
        .getReferenceSequenceFile(new File(referenceFilePath));
    ReferenceSequence sequence = referenceSequenceFile.getSequence(seqName);
    byte[] bases = referenceSequenceFile.getSubsequenceAt(
        sequence.getName(), from, from + length).getBases();
    return bases;
  }
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

      System.exit(1);
    }

    Log.setGlobalLogLevel(LogLevel.INFO);

    ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
        .getReferenceSequenceFile(params.reference);

    FileInputStream fis = new FileInputStream(params.cramFile);
    BufferedInputStream bis = new BufferedInputStream(fis);
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

      if (System.console() == null)
        throw new RuntimeException("Cannot access console.");
      pass = System.console().readPassword();
    }

    ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
        .getReferenceSequenceFile(params.reference);

    InputStream is;
    if (params.cramFile != null) {
      FileInputStream fis = new FileInputStream(params.cramFile);
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

      log.warn("No input file, reading from input...");
      samFileReader = new SAMFileReader(System.in);
    } else
      samFileReader = new SAMFileReader(bamFile);

    ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
        .getReferenceSequenceFile(params.referenceFasta);

    BLOCK_PROTO.recordsPerSlice = params.maxSliceSize;
    ReferenceSequence sequence = null;
    List<SAMRecord> samRecords = new ArrayList<SAMRecord>(
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

    if (params.files == null || params.files.isEmpty()) {
      System.out.println("At least one CRAM or BAM file is required.");
      System.exit(1);
    }

    ReferenceSequenceFile refFile = null;
    if (params.reference != null) {
      System.setProperty("reference", params.reference.getAbsolutePath());
      refFile = ReferenceSequenceFileFactory
          .getReferenceSequenceFile(params.reference);
    } else {
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

      throws IllegalArgumentException, IllegalAccessException,
      IOException {
    File bamFile = new File(
        "c:/temp/HG00096.mapped.illumina.mosaik.GBR.exome.20110411.chr20.bam");
    SAMFileReader samFileReader = new SAMFileReader(bamFile);
    ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
        .getReferenceSequenceFile(new File(
            "c:/temp/human_g1k_v37.fasta"));

    ReferenceSequence sequence = null;
    {
      String seqName = null;
      SAMRecordIterator iterator = samFileReader.iterator();
      SAMRecord samRecord = iterator.next();
      seqName = samRecord.getReferenceName();
      iterator.close();
      sequence = referenceSequenceFile.getSequence(seqName);
    }

    int maxRecords = 100000;
    List<SAMRecord> samRecords = new ArrayList<SAMRecord>(maxRecords);
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

  public static void main(String[] args) {
    File bamFile = new File(args[0]);
    SAMFileReader reader = new SAMFileReader(bamFile);

    ReferenceSequenceFile ref = ReferenceSequenceFileFactory.getReferenceSequenceFile(new File(args[1]));
    SAMRecordIterator iterator = reader.iterator();
    String refName = iterator.next().getReferenceName();
    iterator.close();
    ReferenceSequence sequence = ref.getSequence(refName);

    iterator = reader.iterator();
    Sam2CramRecordFactory factory = new Sam2CramRecordFactory(sequence.getBases());
    factory.preserveReadNames = false;
    factory.captureAllTags = false;
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

      recordsPerSlice = 1000;
    }
   
    System.out.println(SAMTagUtil.getSingleton().makeBinaryTag("OQ"));

    ReferenceSequenceFile refSeqFile = ReferenceSequenceFileFactory.getReferenceSequenceFile(refFile);

    byte[] refBytes = refSeqFile.getSequence(seqName).getBases();
    Sam2CramRecordFactory scFactory = new Sam2CramRecordFactory(refBytes);
    scFactory.captureAllTags = true;
    scFactory.captureUnmappedBases = true;
    scFactory.captureUnmappedScores = true;
    scFactory.losslessQS = true;
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

public class ReferenceDiscovery {
  public static Map<Object, ReferenceSequenceFile> referenceFactory = new HashMap<Object, ReferenceSequenceFile>();

  public static ReferenceSequenceFile probeLocation(String location) {
    ReferenceSequenceFile referenceSequenceFile = referenceFactory.get(location);
    if (referenceSequenceFile != null)
      return referenceSequenceFile;

    String baseName = location.replaceFirst(".cram$", "");
View Full Code Here

Examples of net.sf.picard.reference.ReferenceSequenceFile

    }
    return null;
  }

  public static ReferenceSequenceFile findReferenceSequenceFileOrFail(Object... sources) {
    ReferenceSequenceFile referenceSequenceFile = null;

    if (sources != null)
      for (Object source : sources) {
        if (source == null)
          continue;
        ReferenceSequenceFile foundFile = referenceFactory.get(source);
        if (foundFile != null)
          return foundFile;

        // last resort, using a blind-walk method in a black room to
        // find a
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.