/** * Read only header info * * @return */ public VcfHeader readHeader() { // No more header to read? if ((nextLine != null) && !nextLine.startsWith("#")) return header; try { while (ready()) { line = readLine(); if (line == null) return null; // End of file? if (!line.startsWith("#")) { nextLine = line; return header; // End of header? } header.addLine(line); } } catch (IOException e) { throw new RuntimeException( "Error reading file '" + fileName + "'. Line ignored:\n\tLine (" + lineNum + "):\t'" + line + "'"); } return header; }
/** * Parse a line from a VCF file * * @param line * @return */ protected VcfEntry parseVcfLine(String line) { try { if (line.startsWith("#")) { header.addLine(line); // Header? } else if ((line.length() > 0) && (!line.startsWith("#"))) return new VcfEntry(this, line, lineNum, parseNow); // Vcf entry? } catch (Throwable t) { Gpr.debug("Fatal error reading file '" + fileName + "' (line: " + lineNum + "):\n" + line); throw new RuntimeException(t); } // Could not create a VcfEntry from this line (e.g. header line) return null; }