/** * Creates the output stream. * @param os output stream to create a BlockCompressedOutputStream from * @param file file to which to write the output or null if not available * @param compressionLevel the compression level (0-9) * @param deflaterFactory custom factory to create deflaters (overrides the default) */ public BlockCompressedOutputStream(final OutputStream os, final File file, final int compressionLevel, final DeflaterFactory deflaterFactory) { this(os, IOUtil.toPath(file), compressionLevel, deflaterFactory); }
/** * Finds and loads the sequence file dictionary. * @param file Fasta file to read. Also acts as a prefix for supporting files. */ AbstractFastaSequenceFile(final File file) { this(IOUtil.toPath(file)); }
/** * Prepare to compress at the given compression level * @param compressionLevel 1 <= compressionLevel <= 9 * @param deflaterFactory custom factory to create deflaters (overrides the default) */ public BlockCompressedOutputStream(final File file, final int compressionLevel, final DeflaterFactory deflaterFactory) { this(IOUtil.toPath(file), compressionLevel, deflaterFactory); }
/** * Prepare to compress at the given compression level * @param compressionLevel 1 <= compressionLevel <= 9 * @param deflaterFactory custom factory to create deflaters (overrides the default) */ public BlockCompressedOutputStream(final File file, final int compressionLevel, final DeflaterFactory deflaterFactory) { this(IOUtil.toPath(file), compressionLevel, deflaterFactory); }
/** * Constructs BinaryCodec from a file and set its mode to writing or not * * @param file file to be written to or read from * @param writing whether the file is being written to */ public BinaryCodec(final File file, final boolean writing) { this(IOUtil.toPath(file), writing); }
public BCF2Writer(final File location, final OutputStream output, final SAMSequenceDictionary refDict, final IndexCreator indexCreator, final boolean enableOnTheFlyIndexing, final boolean doNotWriteGenotypes) { this(IOUtil.toPath(location), output, refDict, indexCreator, enableOnTheFlyIndexing, doNotWriteGenotypes); }
public VCFWriter(final File location, final OutputStream output, final SAMSequenceDictionary refDict, final IndexCreator indexCreator, final boolean enableOnTheFlyIndexing, final boolean doNotWriteGenotypes, final boolean allowMissingFieldsInHeader, final boolean writeFullFormatField) { this(IOUtil.toPath(location), output, refDict, indexCreator, enableOnTheFlyIndexing, doNotWriteGenotypes, allowMissingFieldsInHeader, writeFullFormatField); }
/** * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. * @param file The file to open. * @param index Pre-built FastaSequenceIndex, for the case in which one does not exist on disk. * @throws FileNotFoundException If the fasta or any of its supporting files cannot be found. */ public IndexedFastaSequenceFile(final File file, final FastaSequenceIndex index) { this(IOUtil.toPath(file), index); }
/** * Constructs BinaryCodec from a file and set its mode to writing or not * * @param file file to be written to or read from * @param writing whether the file is being written to */ public BinaryCodec(final File file, final boolean writing) { this(IOUtil.toPath(file), writing); }
protected static File findSequenceDictionary(final File file) { final Path dictionary = findSequenceDictionary(IOUtil.toPath(file)); if (dictionary == null) { return null; } return dictionary.toFile(); }
/** * Opens a GZIP-encoded file for reading, decompressing it if necessary * * @param file The file to open * @return the input stream to read from */ public static InputStream openGzipFileForReading(final File file) { return openGzipFileForReading(toPath(file)); }
/** * Returns a reasonable "name" for this writer, to display to the user if something goes wrong * * @param location * @param stream * @return */ protected static final String writerName(final File location, final OutputStream stream) { return writerName(IOUtil.toPath(location), stream); }
/** * Write an appropriately named and located Index file based on the name and location of the featureFile. * * Default implementation delegates to {@link #writeBasedOnFeaturePath(Path)} * * @param featureFile * @throws IOException if featureFile is not a normal file. */ public default void writeBasedOnFeatureFile(File featureFile) throws IOException { writeBasedOnFeaturePath(IOUtil.toPath(featureFile)); }
/** * Returns the default dictionary name for a FASTA file. * * @param file the reference sequence file on disk. */ public static File getDefaultDictionaryForReferenceSequence(final File file) { return getDefaultDictionaryForReferenceSequence(IOUtil.toPath(file)).toFile(); }
/** * Parses an interval list from a file. * * @param file the file containing the intervals * @return an IntervalList object that contains the headers and intervals from the file */ public static IntervalList fromFile(final File file) { return fromPath(IOUtil.toPath(file)); }
/** * Returns the default dictionary name for a FASTA file. * * @param file the reference sequence file on disk. */ public static File getDefaultDictionaryForReferenceSequence(final File file) { return getDefaultDictionaryForReferenceSequence(IOUtil.toPath(file)).toFile(); }
/** * Returns a reasonable "name" for this writer, to display to the user if something goes wrong * * @param location * @param stream * @return */ protected static final String writerName(final File location, final OutputStream stream) { return writerName(IOUtil.toPath(location), stream); }
/** * Parses an interval list from a file. * * @param file the file containing the intervals * @return an IntervalList object that contains the headers and intervals from the file */ public static IntervalList fromFile(final File file) { return fromPath(IOUtil.toPath(file)); }
/** * Checks that a directory is non-null, extent, writable and a directory * otherwise a runtime exception is thrown. * * @param dir the dir to check for writability */ public static void assertDirectoryIsWritable(final File dir) { final Path asPath = IOUtil.toPath(dir); assertDirectoryIsWritable(asPath); }
@Test(dataProvider ="filesAndIndicies") public void testIndexSymlinking(File bam, File expected_index) { Assert.assertEquals(SamFiles.findIndex(bam), expected_index); Assert.assertEquals(SamFiles.findIndex(bam.toPath()), IOUtil.toPath(expected_index)); } }