Skip to content

Commit

Permalink
getNotPrimaryAlignmentFlag deprecated; tests for bamstats04
Browse files Browse the repository at this point in the history
  • Loading branch information
lindenb committed Nov 19, 2017
1 parent d407ea6 commit 203b9b0
Show file tree
Hide file tree
Showing 10 changed files with 766 additions and 762 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void writeBamSection(
{
SAMRecord rec=iter.next();
if(rec.getReadUnmappedFlag()) continue;
if(rec.getNotPrimaryAlignmentFlag()) continue;
if(rec.isSecondaryAlignment()) continue;
if(rec.getDuplicateReadFlag()) continue;
if(rec.getReadFailsVendorQualityCheckFlag()) continue;
for(int i1= Math.max(interval.start+1,rec.getAlignmentStart());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void watch(SAMRecord rec)
}


if(!rec.getNotPrimaryAlignmentFlag())
if(!rec.isSecondaryAlignment())
{
this.increment(Category.PRIMARY_ALIGNMENT);
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/github/lindenb/jvarkit/tools/tests/TestNg01.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ of this software and associated documentation files (the "Software"), to deal
import com.github.lindenb.jvarkit.tools.bam2graphics.Bam2Raster;
import com.github.lindenb.jvarkit.tools.bam2graphics.LowResBam2Raster;
import com.github.lindenb.jvarkit.tools.bam2wig.Bam2Wig;
import com.github.lindenb.jvarkit.tools.bamstats04.BamStats04;
import com.github.lindenb.jvarkit.tools.bioalcidae.BioAlcidaeJdk;
import com.github.lindenb.jvarkit.tools.biostar.Biostar59647;
import com.github.lindenb.jvarkit.tools.biostar.Biostar86480;
Expand Down Expand Up @@ -121,6 +122,7 @@ class TestNg01 {
static final File TEST_RESULTS_DIR= new File("test-results");
static final File JETER_VCF = new File(TEST_RESULTS_DIR,"jeter.vcf");
static final String TOY_FA="src/test/resources/toy.fa";
static final String TOY_BED_GZ="src/test/resources/toy.bed.gz";
static final String TOY_VCF_GZ="src/test/resources/toy.vcf.gz";
static final String TOY_BAM="src/test/resources/toy.bam";
static final String TOY_DICT="src/test/resources/toy.dict";
Expand Down Expand Up @@ -1060,4 +1062,17 @@ public void testVcfToSql(final String path) throws IOException {
}));
Assert.assertTrue(outvcf.delete());
}

@Test
public void testBamStats04() throws IOException {
final File output =new File(TEST_RESULTS_DIR,"jeter.tsv");
Assert.assertEquals(0,new BamStats04().instanceMain(new String[]{
"-o",output.getPath(),
"-R",TOY_FA,
"-B",TOY_BED_GZ,
TOY_BAM
}));
Assert.assertTrue(output.delete());
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
/* JavaCCOptions:KEEP_LINE_COL=null */
/*
The MIT License (MIT)
Expand Down Expand Up @@ -44,11 +44,6 @@ public class ParseException extends Exception {
*/
private static final long serialVersionUID = 1L;

/**
* The end of line string for this machine.
*/
protected static String EOL = System.getProperty("line.separator", "\n");

/**
* This constructor is used by the method "generateParseException"
* in the generated parser. Calling this constructor generates
Expand Down Expand Up @@ -117,7 +112,7 @@ public ParseException(String message) {
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {

String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
Expand All @@ -130,7 +125,7 @@ private static String initialise(Token currentToken,
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
expected.append("...");
}
expected.append(EOL).append(" ");
expected.append(eol).append(" ");
}
String retval = "Encountered \"";
Token tok = currentToken.next;
Expand All @@ -147,23 +142,20 @@ private static String initialise(Token currentToken,
tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + EOL;


if (expectedTokenSequences.length == 0) {
// Nothing to add here
retval += "." + eol;
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + eol + " ";
} else {
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + EOL + " ";
} else {
retval += "Was expecting one of:" + EOL + " ";
}
retval += expected.toString();
retval += "Was expecting one of:" + eol + " ";
}

retval += expected.toString();
return retval;
}

/**
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");

/**
* Used to convert raw characters to their escaped version
Expand All @@ -176,6 +168,8 @@ static String add_escapes(String str) {
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
{
case 0 :
continue;
case '\b':
retval.append("\\b");
continue;
Expand Down Expand Up @@ -214,4 +208,4 @@ static String add_escapes(String str) {
}

}
/* JavaCC - OriginalChecksum=8f1e51aa4b916bc256163d0c1bebb8ed (do not edit this line) */
/* JavaCC - OriginalChecksum=2478e7e15dfcd9937c47bf4e1260ae77 (do not edit this line) */
Loading

0 comments on commit 203b9b0

Please sign in to comment.