/** * Checks that each path is non-null, exists, is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param paths the list of paths to check for readability */ public static void assertPathsAreReadable(final List<Path> paths) { for (final Path path: paths) assertFileIsReadable(path); }
/** * Checks that each file is non-null, exists, is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param files the list of files to check for readability */ public static void assertFilesAreReadable(final List<File> files) { for (final File file : files) assertFileIsReadable(file); }
/** * Checks that each path is non-null, exists, is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param paths the list of paths to check for readability */ public static void assertPathsAreReadable(final List<Path> paths) { for (final Path path: paths) assertFileIsReadable(path); }
@Override protected IntervalList getProbeIntervals() { for (final File file : BAIT_INTERVALS) IOUtil.assertFileIsReadable(file); return IntervalList.fromFiles(BAIT_INTERVALS); }
public static Reader openFileForReader(File file) throws IOException { IOUtil.assertFileIsReadable(file); if(file.getName().endsWith(".gz") || file.getName().endsWith(".bgz")) // DB added .bgz { return new InputStreamReader(openFileForReading(file)); } return new FileReader(file); }
/** * Checks that a file is non-null, exists, is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param file the file to check for readability */ public static void assertFileIsReadable(final File file) { assertFileIsReadable(toPath(file)); }
public static InputStream openFileForReading(final File file) throws IOException { IOUtil.assertFileIsReadable(file); InputStream in= Files.newInputStream(file.toPath()); if(file.getName().endsWith(".gz") || file.getName().endsWith(".bgz")) // DB added .bgz { in = tryBGZIP(in); } return in; }
/** * Checks that a file is non-null, exists, is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param file the file to check for readability */ public static void assertFileIsReadable(final File file) { assertFileIsReadable(toPath(file)); }
private static void checkFactoryVars(final int headerSize, final File binaryFile) { IOUtil.assertFileIsReadable(binaryFile); if(headerSize < 0) { throw new PicardException("Header size cannot be negative. HeaderSize(" + headerSize + ") for file " + binaryFile.getAbsolutePath()); } if(headerSize > binaryFile.length()) { throw new PicardException("Header size(" + headerSize + ") is greater than file size(" + binaryFile.length() + ") for file " + binaryFile.getAbsolutePath()); } }
private static void checkFactoryVars(final int headerSize, final File binaryFile) { IOUtil.assertFileIsReadable(binaryFile); if(headerSize < 0) { throw new PicardException("Header size cannot be negative. HeaderSize(" + headerSize + ") for file " + binaryFile.getAbsolutePath()); } if(headerSize > binaryFile.length()) { throw new PicardException("Header size(" + headerSize + ") is greater than file size(" + binaryFile.length() + ") for file " + binaryFile.getAbsolutePath()); } }
/** * Main method for the program. Checks that input file is present and * readable, then iterates through the index printing meta data to stdout. */ protected int doWork() { if (INPUT.getName().endsWith(BAMIndex.BAMIndexSuffix)) log.warn("INPUT should be the BAM file name, not its index file"); IOUtil.assertFileIsReadable(INPUT); BAMIndexMetaData.printIndexStats(INPUT); return 0; } }
private void assertIoFiles(final File summaryFile, final File detailsFile, final File plotsFile) { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsReadable(REFERENCE_SEQUENCE); IOUtil.assertFileIsWritable(summaryFile); IOUtil.assertFileIsWritable(detailsFile); IOUtil.assertFileIsWritable(plotsFile); }
protected AbstractIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path); if (index == null) { throw new IllegalArgumentException("Null index for fasta " + path); } this.index = index; IOUtil.assertFileIsReadable(path); reset(); if(getSequenceDictionary() != null) { sanityCheckDictionaryAgainstIndex(path.toAbsolutePath().toString(),sequenceDictionary,index); } }
protected AbstractIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path); if (index == null) { throw new IllegalArgumentException("Null index for fasta " + path); } this.index = index; IOUtil.assertFileIsReadable(path); reset(); if(getSequenceDictionary() != null) { sanityCheckDictionaryAgainstIndex(path.toAbsolutePath().toString(),sequenceDictionary,index); } }
/** * Convenience method that constructs a downsampling iterator for all the reads in a SAM file. * See {@link DownsamplingIteratorFactory#make(Iterator, Strategy, double, double, int)} for detailed parameter information. */ public static DownsamplingIterator make(final File samFile, final Strategy strategy, final double proportion, final double accuracy, final int seed) { IOUtil.assertFileIsReadable(samFile); return make(SamReaderFactory.makeDefault().open(samFile), strategy, proportion, accuracy, seed); }
/** * Convenience method that constructs a downsampling iterator for all the reads in a SAM file. * See {@link DownsamplingIteratorFactory#make(Iterator, Strategy, double, double, int)} for detailed parameter information. */ public static DownsamplingIterator make(final File samFile, final Strategy strategy, final double proportion, final double accuracy, final int seed) { IOUtil.assertFileIsReadable(samFile); return make(SamReaderFactory.makeDefault().open(samFile), strategy, proportion, accuracy, seed); }
@Override protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); final IntervalList intervalList = VCFFileReader.fromVcf(INPUT, INCLUDE_FILTERED); // Sort and write the output intervalList.uniqued().write(OUTPUT); return 0; } }
@Override protected void setup(final SAMFileHeader header, final File samFile) { IOUtil.assertFileIsWritable(CHART_OUTPUT); IOUtil.assertFileIsWritable(SUMMARY_OUTPUT); IOUtil.assertFileIsReadable(REFERENCE_SEQUENCE); //Calculate windowsByGc for the reference sequence final int[] windowsByGc = GcBiasUtils.calculateRefWindowsByGc(BINS, REFERENCE_SEQUENCE, SCAN_WINDOW_SIZE); //Delegate actual collection to GcBiasMetricCollector multiCollector = new GcBiasMetricsCollector(METRIC_ACCUMULATION_LEVEL, windowsByGc, header.getReadGroups(), SCAN_WINDOW_SIZE, IS_BISULFITE_SEQUENCED, ALSO_IGNORE_DUPLICATES); }
@Override protected int doWork() { final List<File> inputs = IOUtil.unrollFiles(INPUT, BamFileIoUtils.BAM_FILE_EXTENSION, ".sam"); for (final File f : inputs) IOUtil.assertFileIsReadable(f); IOUtil.assertFileIsWritable(OUTPUT); if (determineBlockCopyingStatus(inputs)) { BamFileIoUtils.gatherWithBlockCopying(inputs, OUTPUT, CREATE_INDEX, CREATE_MD5_FILE); } else { gatherNormally(inputs, OUTPUT, CREATE_INDEX, CREATE_MD5_FILE, REFERENCE_SEQUENCE); } return 0; }
@Override protected void setup(final SAMFileHeader header, final File samFile) { IOUtil.assertFileIsWritable(CHART_OUTPUT); IOUtil.assertFileIsWritable(SUMMARY_OUTPUT); IOUtil.assertFileIsReadable(REFERENCE_SEQUENCE); //Calculate windowsByGc for the reference sequence final int[] windowsByGc = GcBiasUtils.calculateRefWindowsByGc(BINS, REFERENCE_SEQUENCE, SCAN_WINDOW_SIZE); //Delegate actual collection to GcBiasMetricCollector multiCollector = new GcBiasMetricsCollector(METRIC_ACCUMULATION_LEVEL, windowsByGc, header.getReadGroups(), SCAN_WINDOW_SIZE, IS_BISULFITE_SEQUENCED, ALSO_IGNORE_DUPLICATES); }