private String readLineConditionallySkippingBlanks() throws IOException { String line; do { line = reader.readLine(); if (line == null) return line; } while(skipBlankLines && StringUtil.isBlank(line)); return line; }
private String readLineConditionallySkippingBlanks() throws IOException { String line; do { line = reader.readLine(); if (line == null) return line; } while(skipBlankLines && StringUtil.isBlank(line)); return line; }
private String readLineConditionallySkippingBlanks() throws IOException { String line; do { line = reader.readLine(); if (line == null) return line; } while(skipBlankLines && StringUtil.isBlank(line)); return line; }
try { for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) { if (StringUtil.isBlank(line)) { continue; final String altName = line.substring(tab + 1); if (StringUtil.isBlank(contigName)) { throw new IOException("empty contig in " + line); if (StringUtil.isBlank(altName)) { throw new IOException("empty alternative name in " + line);
try { for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) { if (StringUtil.isBlank(line)) { continue; final String altName = line.substring(tab + 1); if (StringUtil.isBlank(contigName)) { throw new IOException("empty contig in " + line); if (StringUtil.isBlank(altName)) { throw new IOException("empty alternative name in " + line);
/** Checks that the line is neither null (representing EOF) or empty (blank line in file). */ protected void checkLine(final String line, final LineType kind) { if (line == null) { throw new SAMException(error("File is too short - missing " + kind)); } if (StringUtil.isBlank(line)) { throw new SAMException(error("Missing " + kind)); } }
/** Checks that the line is neither null (representing EOF) or empty (blank line in file). */ protected void checkLine(final String line, final LineType kind) { if (line == null) { throw new SAMException(error("File is too short - missing " + kind)); } if (StringUtil.isBlank(line)) { throw new SAMException(error("Missing " + kind)); } }
private void checkLine(final String line, final String kind) { if (line == null) { throw new SAMException(error("File is too short - missing "+kind+" line")); } if (StringUtil.isBlank(line)) { throw new SAMException(error("Missing "+kind)); } }
/** Returns read baseName and asserts correct pair read name format: * <ul> * <li> Paired reads must either have the exact same read names or they must contain at least one "/" * <li> and the First pair read name must end with "/1" and second pair read name ends with "/2" * <li> The baseName (read name part before the /) must be the same for both read names * <li> If the read names are exactly the same but end in "/2" or "/1" then an exception will be thrown * </ul> */ String getBaseName(final String readName1, final String readName2, final FastqReader freader1, final FastqReader freader2) { String [] toks = getReadNameTokens(readName1, 1, freader1); final String baseName1 = toks[0] ; final String num1 = toks[1] ; toks = getReadNameTokens(readName2, 2, freader2); final String baseName2 = toks[0] ; final String num2 = toks[1]; if (!baseName1.equals(baseName2)) { throw new PicardException(String.format("In paired mode, read name 1 (%s) does not match read name 2 (%s)", baseName1,baseName2)); } final boolean num1Blank = StringUtil.isBlank(num1); final boolean num2Blank = StringUtil.isBlank(num2); if (num1Blank || num2Blank) { if(!num1Blank) throw new PicardException(error(freader1,"Pair 1 number is missing (" +readName1+ "). Both pair numbers must be present or neither.")); //num1 != blank and num2 == blank else if(!num2Blank) throw new PicardException(error(freader2, "Pair 2 number is missing (" +readName2+ "). Both pair numbers must be present or neither.")); //num1 == blank and num =2 != blank } else { if (!num1.equals("1")) throw new PicardException(error(freader1,"Pair 1 number must be 1 ("+readName1+")")); if (!num2.equals("2")) throw new PicardException(error(freader2,"Pair 2 number must be 2 ("+readName2+")")); } return baseName1 ; }
/** Returns read baseName and asserts correct pair read name format: * <ul> * <li> Paired reads must either have the exact same read names or they must contain at least one "/" * <li> and the First pair read name must end with "/1" and second pair read name ends with "/2" * <li> The baseName (read name part before the /) must be the same for both read names * <li> If the read names are exactly the same but end in "/2" or "/1" then an exception will be thrown * </ul> */ String getBaseName(final String readName1, final String readName2, final FastqReader freader1, final FastqReader freader2) { String [] toks = getReadNameTokens(readName1, 1, freader1); final String baseName1 = toks[0] ; final String num1 = toks[1] ; toks = getReadNameTokens(readName2, 2, freader2); final String baseName2 = toks[0] ; final String num2 = toks[1]; if (!baseName1.equals(baseName2)) { throw new PicardException(String.format("In paired mode, read name 1 (%s) does not match read name 2 (%s)", baseName1,baseName2)); } final boolean num1Blank = StringUtil.isBlank(num1); final boolean num2Blank = StringUtil.isBlank(num2); if (num1Blank || num2Blank) { if(!num1Blank) throw new PicardException(error(freader1,"Pair 1 number is missing (" +readName1+ "). Both pair numbers must be present or neither.")); //num1 != blank and num2 == blank else if(!num2Blank) throw new PicardException(error(freader2, "Pair 2 number is missing (" +readName2+ "). Both pair numbers must be present or neither.")); //num1 == blank and num =2 != blank } else { if (!num1.equals("1")) throw new PicardException(error(freader1,"Pair 1 number must be 1 ("+readName1+")")); if (!num2.equals("2")) throw new PicardException(error(freader2,"Pair 2 number must be 2 ("+readName2+")")); } return baseName1 ; }
if (StringUtil.isBlank(seqHeader)) { throw new SAMException(error("Missing sequence header"));
if (StringUtil.isBlank(seqHeader)) { throw new SAMException(error("Missing sequence header"));
if (StringUtil.isBlank(seqHeader)) { throw new SAMException(error("Missing sequence header"));
/** * Determines whether any read alignments overlaps the original alignment (if any). * @param r * @return */ public static boolean overlapsOriginalAlignment(SAMRecord r) { String oa = r.getStringAttribute("OA"); if (StringUtil.isBlank(oa)) return false; SAMSequenceDictionary dict = r.getHeader().getSequenceDictionary(); ChimericAlignment originalAlignment = new ChimericAlignment(oa); ChimericAlignment thisAlignment = new ChimericAlignment(r); int overlapCount = originalAlignment.overlappingBases(dict, thisAlignment); for (ChimericAlignment ca : ChimericAlignment.getChimericAlignments(r)) { overlapCount += originalAlignment.overlappingBases(dict, ca); } return overlapCount > 0; } public static int getReadLengthIncludingHardClipping(SAMRecord r) {