Package org.broad.igv.exceptions

Examples of org.broad.igv.exceptions.ParserException


                    try {
                        location = ParsingUtils.parseInt(tokens[startColumn]) - startBase;

                    } catch (NumberFormatException numberFormatException) {
                        log.error("Column " + tokens[startColumn] + " is not a number");
                        throw new ParserException("Column " + (startColumn + 1) +
                                " must contain an integer value." + " Found: " + tokens[startColumn],
                                count + headerRows, nextLine);
                    }

                    int length = 1;
                    if (hasEndLocations) {
                        try {
                            length = ParsingUtils.parseInt(tokens[endColumn].trim()) - location + 1;

                        } catch (NumberFormatException numberFormatException) {
                            log.error("Column " + tokens[endColumn] + " is not a number");
                            throw new ParserException("Column " + (endColumn + 1) +
                                    " must contain an integer value." + " Found: " + tokens[endColumn],
                                    count + headerRows, nextLine);
                        }
                    }

                    updateLongestFeature(longestFeatureMap, thisChr, length);

                    if (wgData.locations.size() > 0 && wgData.locations.get(wgData.locations.size() - 1) > location) {
                        throw new ParserException("File is not sorted, .igv and .cn files must be sorted by start position." +
                                " Use igvtools (File > Run igvtools..) to sort the file.", count + headerRows);
                    }

                    wgData.locations.add(location);

                    for (int idx = 0; idx < headings.length; idx++) {
                        int i = firstDataColumn + idx * skipColumns;

                        float copyNo = i < tokens.length ? readFloat(tokens[i]) : Float.NaN;

                        if (!Float.isNaN(copyNo)) {
                            dataMin = Math.min(dataMin, copyNo);
                            dataMax = Math.max(dataMax, copyNo);
                        }
                        if (copyNo < 0) {
                            logNormalized = true;
                        }
                        String heading = headings[idx];
                        wgData.data.get(heading).add(copyNo);
                    }

                    nRows++;

                }
                chrRowCount++;
            }

            dataset.setLongestFeatureMap(longestFeatureMap);

        } catch (ParserException pe) {
            throw pe;
        } catch (FileNotFoundException e) {
            // DialogUtils.showError("SNP file not found: " + dataSource.getCopyNoFile());
            log.error("File not found: " + dataResourceLocator);
            throw new RuntimeException(e);
        } catch (Exception e) {
            log.error("Exception when loading: " + dataResourceLocator.getPath(), e);
            if (nextLine != null && (count + headerRows != 0)) {
                throw new ParserException(e.getMessage(), e, count + headerRows, nextLine);
            } else {
                throw new RuntimeException(e);
            }
        } finally {
            if (is != null) {
View Full Code Here


    @Override
    public final byte getByte(ResultSet rs, String label) throws ParserException {
        try {
            return rs.getByte(label);
        } catch (SQLException e) {
            throw new ParserException(e.getMessage(), -1);
        }
    }
View Full Code Here

    @Override
    public final short getShort(ResultSet rs, String label) throws ParserException {
        try {
            return rs.getShort(label);
        } catch (SQLException e) {
            throw new ParserException(e.getMessage(), -1);
        }
    }
View Full Code Here

    @Override
    public final int getInt(ResultSet rs, String label) throws ParserException {
        try {
            return rs.getInt(label);
        } catch (SQLException e) {
            throw new ParserException(e.getMessage(), -1);
        }
    }
View Full Code Here

    @Override
    public final double getDouble(ResultSet rs, String label) throws ParserException {
        try {
            return rs.getDouble(label);
        } catch (SQLException e) {
            throw new ParserException(e.getMessage(), -1);
        }
    }
View Full Code Here

                throw new RuntimeException("Data not loaded. Number of columns is less than " + nTokens + ".");
            }

        } catch (Exception ex) {
            if (lineCount != 0) {
                throw new ParserException(ex.getMessage(), lineCount, nextLine);
            } else {
                throw new RuntimeException(ex);
            }
        } finally {
            if (reader != null) {
View Full Code Here

                parseLine(parser, tokens);
            }

        } catch (IOException e) {
            if (nextLine != null && lineNumber != 0) {
                throw new ParserException(e.getMessage(), e, lineNumber, nextLine);
            } else {
                throw new RuntimeException(e);
            }
        } finally {
            if (reader != null) {
View Full Code Here

            // in general a real error, and nothing we can do about it in any
            // event.
            return features;
        } catch (Exception e) {
            if (nextLine != null && nLines != 0) {
                throw new ParserException(e.getMessage(), e, nLines, nextLine);
            } else {
                throw new RuntimeException(e);
            }
        }
View Full Code Here


        } catch (IOException ex) {
            log.error("Error reading GFF file", ex);
            if (line != null && lineNumber != 0) {
                throw new ParserException(ex.getMessage(), ex, lineNumber, line);
            } else {
                throw new RuntimeException(ex);
            }
        }
View Full Code Here

TOP

Related Classes of org.broad.igv.exceptions.ParserException

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.