Package picard

Examples of picard.PicardException


            final File scriptFile = File.createTempFile("script", ".R");
            scriptFileStream = IOUtil.openFileForWriting(scriptFile);
            IOUtil.copyStream(scriptStream, scriptFileStream);
            return scriptFile;
        } catch (IOException e) {
            throw new PicardException("Unexpected exception creating R script file", e);
        } finally {
            if (scriptStream != null) {
                try {
                    scriptStream.close();
                } catch (IOException ignored) {
View Full Code Here


            readLength = rec.getReadLength();
        } else {
            if (rec.getReadLength() != readLength) {
                final String message=String.format("This program only works with uniform read lengths. First record had length %d. Current record %s, has length %d", readLength, rec.getReadName(), rec.getReadLength());
                log.error(message);
                throw new PicardException(message);
            }
        }

        // Not interested in counting unmapped, secondary or supplemental reads.
        if (rec.getReadUnmappedFlag() || rec.isSecondaryOrSupplementary()) {
View Full Code Here

        if (differentOutputSpecified) {
            IOUtil.assertFileIsWritable(OUTPUT);
        }
        else if (INPUT.size() != 1) {
            throw new PicardException("Must specify either an explicit OUTPUT file or a single INPUT file to be overridden.");
        }
        else {
            final File soleInput = INPUT.get(0).getAbsoluteFile();
            final File dir       = soleInput.getParentFile().getAbsoluteFile();
            try {
                IOUtil.assertFileIsWritable(soleInput);
                IOUtil.assertDirectoryIsWritable(dir);
                OUTPUT = File.createTempFile(soleInput.getName() + ".being_fixed.", BamFileIoUtils.BAM_FILE_EXTENSION, dir);
            }
            catch (final IOException ioe) {
                throw new RuntimeIOException("Could not create tmp file in " + dir.getAbsolutePath());
            }
        }

        // Get the input records merged and sorted by query name as needed
        final PeekableIterator<SAMRecord> iterator;
        final SAMFileHeader header;

        {
            // Deal with merging if necessary
            final Iterator<SAMRecord> tmp;
            if (INPUT.size() > 1) {
                final List<SAMFileHeader> headers = new ArrayList<SAMFileHeader>(readers.size());
                for (final SAMFileReader reader : readers) {
                    headers.add(reader.getFileHeader());
                }
                final SortOrder sortOrder = (allQueryNameSorted? SortOrder.queryname: SortOrder.unsorted);
                final SamFileHeaderMerger merger = new SamFileHeaderMerger(sortOrder, headers, false);
                tmp = new MergingSamRecordIterator(merger, readers, false);
                header = merger.getMergedHeader();
            }
            else {
                tmp = readers.get(0).iterator();
                header = readers.get(0).getFileHeader();
            }

            // And now deal with re-sorting if necessary
            if (ASSUME_SORTED || allQueryNameSorted) {
                iterator = new SamPairUtil.SetMateInfoIterator(new PeekableIterator<SAMRecord>(tmp), ADD_MATE_CIGAR);
            }
            else {
                log.info("Sorting input into queryname order.");
                final SortingCollection<SAMRecord> sorter = SortingCollection.newInstance(SAMRecord.class,
                                                                                          new BAMRecordCodec(header),
                                                                                          new SAMRecordQueryNameComparator(),
                                                                                          MAX_RECORDS_IN_RAM,
                                                                                          TMP_DIR);
                while (tmp.hasNext()) {
                    sorter.add(tmp.next());

                }

                iterator = new SamPairUtil.SetMateInfoIterator(new PeekableIterator<SAMRecord>(sorter.iterator()) {
                    @Override
                    public void close() {
                        super.close();
                        sorter.cleanup();
                    }
                }, ADD_MATE_CIGAR);
                log.info("Sorting by queryname complete.");
            }

            // Deal with the various sorting complications
            final SortOrder outputSortOrder = SORT_ORDER == null ? readers.get(0).getFileHeader().getSortOrder() : SORT_ORDER;
            log.info("Output will be sorted by " + outputSortOrder);
            header.setSortOrder(outputSortOrder);
        }

        if (CREATE_INDEX && header.getSortOrder() != SortOrder.coordinate){
            throw new PicardException("Can't CREATE_INDEX unless sort order is coordinate");
        }

        createSamFileWriter(header);

        log.info("Traversing query name sorted records and fixing up mate pair information.");
View Full Code Here

                    } else if (!bclFileUtil.filesAvailable() && gzBclFileUtil.filesAvailable()) {
                        parameterizedFileUtil = gzBclFileUtil;
                    } else if (!bclFileUtil.filesAvailable() && !gzBclFileUtil.filesAvailable()) {
                        parameterizedFileUtil = bclFileUtil;
                    } else {
                        throw new PicardException(
                                "Not all BCL files in " + basecallLaneDir.getAbsolutePath() + " have the same extension!");
                    }
                    utils.put(SupportedIlluminaFormat.Bcl, parameterizedFileUtil);
                    break;
                case Locs:
View Full Code Here

     * Get the available tiles for the given formats, if the formats have tile lists that differ then
     * throw an exception, if any of the format
     */
    public List<Integer> getActualTiles(final List<SupportedIlluminaFormat> formats) {
        if (formats == null) {
            throw new PicardException("Format list provided to getTiles was null!");
        }

        if (formats.size() == 0) {
            throw new PicardException(
                    "0 Formats were specified.  You need to specify at least SupportedIlluminaFormat to use getTiles");
        }

        final List<Integer> tiles = getUtil(formats.get(0)).getTiles();
        for (int i = 1; i < formats.size(); i++) {
            final List<Integer> fmTiles = getUtil(formats.get(i)).getTiles();
            if (tiles.size() != fmTiles.size() || !tiles.containsAll(fmTiles)) {
                throw new PicardException(
                        "Formats do not have the same number of tiles! " + summarizeTileCounts(formats));
            }
        }

        return tiles;
View Full Code Here

                    tiles = tiles.subList(i, tiles.size());
                    break;
                }
            }
            if (tiles.get(0).intValue() != firstTile.intValue()) {
                throw new PicardException("firstTile=" + firstTile + ", but that tile was not found.");
            }
        }
        if (tileLimit != null && tiles.size() > tileLimit) {
            tiles = tiles.subList(0, tileLimit);
        }
View Full Code Here

            tileReadAggregator.submit();
            try {
                tileReadAggregator.awaitWorkComplete();
            } catch (final InterruptedException e) {
                log.error(e, "Failure encountered in worker thread; attempting to shut down remaining worker threads and terminate ...");
                throw new PicardException("Failure encountered in worker thread; see log for details.");
            } finally {
                tileReadAggregator.shutdown();
            }

            for (final Map.Entry<Byte, Integer> entry : bclQualityEvaluationStrategy.getPoorQualityFrequencies().entrySet()) {
View Full Code Here

        if(printCommon) {
            final Field fileField;
            try {
                fileField = getClass().getField("IGNORE_THIS_PROPERTY");
            } catch (final NoSuchFieldException e) {
                throw new PicardException("Should never happen", e);
            }
            final OptionDefinition optionsFileOptionDefinition =
              new OptionDefinition(fileField, OPTIONS_FILE, "",
                "File of OPTION_NAME=value pairs.  No positional parameters allowed.  Unlike command-line options, " +
                "unrecognized options are ignored.  " + "A single-valued option set in an options file may be overridden " +
View Full Code Here

            }
            reader.close();
            return true;

        } catch (final IOException e) {
            throw new PicardException("I/O error loading OPTIONS_FILE=" + optionsFile, e);
        } finally {
            CloserUtil.close(reader);
        }
    }
View Full Code Here

            sb.append(" Cannot be used in conjuction with option(s)");
            for (final String option : optionDefinition.mutuallyExclusive) {
                final OptionDefinition mutextOptionDefinition = optionMap.get(option);

                if(mutextOptionDefinition == null) {
                    throw new PicardException("Invalid option definition in source code.  " + option +
                            " doesn't match any known option.");
                }

                sb.append(" ").append(mutextOptionDefinition.name);
                if (mutextOptionDefinition.shortName.length() > 0) {
View Full Code Here

TOP

Related Classes of picard.PicardException

Copyright © 2018 www.massapicom. 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.