Package org.broadinstitute.gatk.utils.exceptions

Examples of org.broadinstitute.gatk.utils.exceptions.GATKException


    @Override
    public RecalibrationArgumentCollection clone() {
        try {
            return (RecalibrationArgumentCollection) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new GATKException("Unreachable code clone not supported thrown when the class "
                    + this.getClass().getName() + " is cloneable ",e);
        }
    }
View Full Code Here


                    datum.atTruthSite = datum.isKnown;
                    vd.add(datum);
                }
            }
        } catch (FileNotFoundException e) {
            throw new GATKException("foo", e);
        }

        return vd;
    }
View Full Code Here

                     throw new UserException.BadInput("Input-output map file maps multiple entries onto single output name "+fields[1]);

                 fname_map.put(fields[0],fields[1]);
             }
        } catch (IOException e) {
            throw new GATKException("I/O Error while reading input-output map file "+N_WAY_OUT+": "+e.getMessage());
        }
       return fname_map;
    }
View Full Code Here

     * @param toolkit
     * @param in2out
     */
    public void setupByReader(GenomeAnalysisEngine toolkit, Map<String,String> in2out, SAMFileHeader.SortOrder order,
                              boolean presorted, boolean indexOnTheFly, boolean generateMD5, SAMProgramRecord pRecord) {
        if ( in2out==null ) throw new GATKException("input-output bam filename map for n-way-out writing is NULL");
        for ( SAMReaderID rid : toolkit.getReadsDataSource().getReaderIDs() ) {

            String fName = toolkit.getReadsDataSource().getSAMFile(rid).getName();

            String outName;
            if ( ! in2out.containsKey(fName) )
                    throw new UserException.BadInput("Input-output bam filename map does not contain an entry for the input file "+fName);
            outName = in2out.get(fName);

            if ( writerMap.containsKey( rid ) )
                throw new GATKException("nWayOut mode: Reader id for input sam file "+fName+" is already registered; "+
                        "map file likely contains multiple entries for this input file");

            addWriter(rid,outName, order, presorted, indexOnTheFly, generateMD5, pRecord);
        }

View Full Code Here

            }
            String prefix = fName.substring(0,pos);
            outName = prefix+ext;

            if ( writerMap.containsKey( rid ) )
                throw new GATKException("nWayOut mode: Reader id for input sam file "+fName+" is already registered");
            addWriter(rid,outName, order, presorted, indexOnTheFly, generateMD5, pRecord);
        }

    }
View Full Code Here

    private static File replacePath(File file, String path) {
        if (file instanceof FileExtension)
            return ((FileExtension)file).withPath(path);
        if (!File.class.equals(file.getClass()))
            throw new GATKException("Sub classes of java.io.File must also implement FileExtension");
        return new File(path);
    }
View Full Code Here

        OutputStream outputStream = null;
        try {
            outputStream = FileUtils.openOutputStream(file);
            org.apache.commons.io.IOUtils.copy(inputStream, outputStream);
        } catch (IOException e) {
            throw new GATKException(String.format("Unable to copy resource '%s' to '%s'", path, file), e);
        } finally {
            org.apache.commons.io.IOUtils.closeQuietly(inputStream);
            org.apache.commons.io.IOUtils.closeQuietly(outputStream);
        }
    }
View Full Code Here

            for (Type lowerType: wildcardType.getLowerBounds())
                addGenericTypes(classes, lowerType);
        } else if (type instanceof Class<?>) {
            classes.add((Class<?>) type);
        } else {
            throw new GATKException("Unknown type: " + type + " (" + type.getClass().getName() + ")");
        }
    }
View Full Code Here

     * @return the probability under the hypothesis that all sequences are equally likely of finding a set-two entry preceding a set-one entry "u" times.
     */
    @Requires({"m > 0","n > 0","u >= 0"})
    @Ensures({"result != null","! Double.isInfinite(result.getFirst())", "! Double.isInfinite(result.getSecond())"})
    public static Pair<Double,Double> calculatePRecursively(int n, int m, long u, boolean twoSided, ExactMode mode) {
        if ( m > 8 && n > 5 ) { throw new GATKException(String.format("Please use the appropriate (normal or sum of uniform) approximation. Values n: %d, m: %d",n,m)); }
        double p = mode == ExactMode.POINT ? cpr(n,m,u) : cumulativeCPR(n,m,u);
        //p *= twoSided ? 2.0 : 1.0;
        double z;
        try {

            if ( mode == ExactMode.CUMULATIVE ) {
                z = APACHE_NORMAL.inverseCumulativeProbability(p);
            } else {
                double sd = Math.sqrt((1.0+1.0/(1+n+m))*(n*m)*(1.0+n+m)/12); // biased variance empirically better fit to distribution then asymptotic variance
                //System.out.printf("SD is %f and Max is %f and prob is %f%n",sd,1.0/Math.sqrt(sd*sd*2.0*Math.PI),p);
                if ( p > 1.0/Math.sqrt(sd*sd*2.0*Math.PI) ) { // possible for p-value to be outside the range of the normal. Happens at the mean, so z is 0.
                    z = 0.0;
                } else {
                    if ( u >= n*m/2 ) {
                        z = Math.sqrt(-2.0*(Math.log(sd)+Math.log(p)+LNSQRT2PI));
                    } else {
                        z = -Math.sqrt(-2.0*(Math.log(sd)+Math.log(p)+LNSQRT2PI));
                    }
                }
            }

        } catch (MathException me) {
            throw new GATKException("A math exception occurred in inverting the probability",me);
        }

        return new Pair<Double,Double>(z,(twoSided ? 2.0*p : p));
    }
View Full Code Here

    private FileInputStream openInputStream(final SAMReaderID reader) {
        try {
            return new FileInputStream(reader.getSamFilePath());
        }
        catch(IOException ex) {
            throw new GATKException("Unable to open input file");
        }
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.exceptions.GATKException

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.