private byte[] loadReference( File inputFile ) { // Read in the first sequence in the input file ReferenceSequenceFile reference = ReferenceSequenceFileFactory.getReferenceSequenceFile(inputFile); ReferenceSequence sequence = reference.nextSequence(); return sequence.getBases(); }
/** * Retrieves the complete sequence described by this contig. * @param contig contig whose data should be returned. * @return The full sequence associated with this contig. */ @Override public ReferenceSequence getSequence( String contig ) { return getSubsequenceAt( contig, 1, (int)index.getIndexEntry(contig).getSize() ); }
/** * Retrieves the complete sequence described by this contig. * @param contig contig whose data should be returned. * @return The full sequence associated with this contig. */ public ReferenceSequence getSequence( String contig ) { return getSubsequenceAt( contig, 1, (int)index.getIndexEntry(contig).getSize() ); }
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; }
/** * Attempts to determine the type of the reference file and return an instance * of ReferenceSequenceFile that is appropriate to read it. Sequence names * will be truncated at first whitespace, if any. * * @param file the reference sequence file on disk */ public static ReferenceSequenceFile getReferenceSequenceFile(File file) { return getReferenceSequenceFile(file, true); }
/** * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. * @param path The file to open. * @throws FileNotFoundException If the fasta or any of its supporting files cannot be found. */ public IndexedFastaSequenceFile(final Path path) throws FileNotFoundException { this(path, new FastaSequenceIndex((findRequiredFastaIndexFile(path)))); }
public BlockCompressedIndexedFastaSequenceFile(final Path path) throws FileNotFoundException { this(path,new FastaSequenceIndex((findRequiredFastaIndexFile(path)))); }
protected AbstractIndexedFastaSequenceFile(final Path path) throws FileNotFoundException { this(path, new FastaSequenceIndex(findRequiredFastaIndexFile(path))); }
@Override public void close() throws IOException { referenceSequenceFile.close(); } }
/** * Build a sequence index from the specified input stream. * @param in InputStream to read from. */ public FastaSequenceIndex(InputStream in) { parseIndexFile(in); }
private byte[] loadReverseReference( File inputFile ) { ReferenceSequenceFile reference = ReferenceSequenceFileFactory.getReferenceSequenceFile(inputFile); ReferenceSequence sequence = reference.nextSequence(); PackUtils.reverse(sequence.getBases()); return sequence.getBases(); }
/** * Return an instance of ReferenceSequenceFile using the given fasta sequence file stream, optional index stream, * and no sequence dictionary * * @param source The named source of the reference file (used in error messages). * @param in The input stream to read the fasta file from. * @param index The index, or null to return a non-indexed reader. */ public static ReferenceSequenceFile getReferenceSequenceFile(final String source, final SeekableStream in, final FastaSequenceIndex index) { return getReferenceSequenceFile(source, in, index, null, true); }
/** * Retrieves the complete sequence described by this contig. * @param contig contig whose data should be returned. * @return The full sequence associated with this contig. */ @Override public ReferenceSequence getSequence( String contig ) { return getSubsequenceAt( contig, 1, (int)index.getIndexEntry(contig).getSize() ); }
/** * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. * @param path The file to open. * @throws FileNotFoundException If the fasta or any of its supporting files cannot be found. */ public IndexedFastaSequenceFile(final Path path) throws FileNotFoundException { this(path, new FastaSequenceIndex((findRequiredFastaIndexFile(path)))); }
public BlockCompressedIndexedFastaSequenceFile(final Path path) throws FileNotFoundException { this(path,new FastaSequenceIndex((findRequiredFastaIndexFile(path)))); }
protected AbstractIndexedFastaSequenceFile(final Path path) throws FileNotFoundException { this(path, new FastaSequenceIndex(findRequiredFastaIndexFile(path))); }
/** * Attempts to determine the type of the reference file and return an instance * of ReferenceSequenceFile that is appropriate to read it. * * @param path the reference sequence file on disk * @param truncateNamesAtWhitespace if true, only include the first word of the sequence name */ public static ReferenceSequenceFile getReferenceSequenceFile(final Path path, final boolean truncateNamesAtWhitespace) { return getReferenceSequenceFile(path, truncateNamesAtWhitespace, true); }
/** * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. * @param file The file to open. * @throws FileNotFoundException If the fasta or any of its supporting files cannot be found. */ public IndexedFastaSequenceFile(final File file) throws FileNotFoundException { this(file, new FastaSequenceIndex((findRequiredFastaIndexFile(file)))); }
/** * Attempts to determine the type of the reference file and return an instance * of ReferenceSequenceFile that is appropriate to read it. * * @param file the reference sequence file on disk * @param truncateNamesAtWhitespace if true, only include the first word of the sequence name */ public static ReferenceSequenceFile getReferenceSequenceFile(final File file, final boolean truncateNamesAtWhitespace) { return getReferenceSequenceFile(file, truncateNamesAtWhitespace, true); }
/** * Attempts to determine the type of the reference file and return an instance * of ReferenceSequenceFile that is appropriate to read it. * * @param file the reference sequence file on disk * @param truncateNamesAtWhitespace if true, only include the first word of the sequence name */ public static ReferenceSequenceFile getReferenceSequenceFile(final File file, final boolean truncateNamesAtWhitespace) { return getReferenceSequenceFile(file, truncateNamesAtWhitespace, true); }