Entering edit mode
5.6 years ago
kspata
▴
90
Hi All,
I want to extract all reads containing a variant from a co-ordinate sorted bam file. The variant is an 11 bp long insertion starting at base position 39. I am running samjdk.jar
script as per instructions in the post here: How to extract reads with a known variant form a bam file
I modified the input file Scripts.js like this:
final String contig= "ref";
final int mutpos = 39;
***final String mutbase="GCCCGGGCAAA";***
if(record.getReadUnmappedFlag()) return false;
if(!record.getContig().equals(contig)) return false;
if(record.getEnd() < mutpos) return false;
if(record.getStart() > mutpos) return false;
int readpos = record.getReadPositionAtReferencePosition(mutpos);
if(readpos<1) return false;
readpos--;
final byte[] bases= record.getReadBases();
if(bases[readpos]==mutbase) return true;
return false;
I am getting the following error.
/
tmp/jvarkit4226389813265542455.tmp/SamJdkCustom61691149.java:25: error: bad operand types for binary operator '=='
if(bases[readpos]==mutbase) return true;
^
first type: byte
second type: String
1 error
[SEVERE][SamJdk]java.lang.RuntimeException: Cannot compile
java.lang.RuntimeException: java.lang.RuntimeException: Cannot compile
at com.github.lindenb.jvarkit.lang.OpenJdkCompiler$DefaultOpenJdkCompiler.compileClass(OpenJdkCompiler.java:255)
at com.github.lindenb.jvarkit.tools.samjs.SamJdk.doWork(SamJdk.java:568)
at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMain(Launcher.java:736)
at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMainWithExit(Launcher.java:894)
at com.github.lindenb.jvarkit.tools.samjs.SamJdk.main(SamJdk.java:785)
Caused by: java.lang.RuntimeException: Cannot compile
at com.github.lindenb.jvarkit.lang.OpenJdkCompiler$DefaultOpenJdkCompiler.exec(OpenJdkCompiler.java:180)
at com.github.lindenb.jvarkit.lang.OpenJdkCompiler$DefaultOpenJdkCompiler.compileClass(OpenJdkCompiler.java:232)
... 4 more
[INFO][Launcher]samjdk Exited with failure (-1)
How can I resolve this error? This is occurring due to difference in character and string operators in java. Can Samjdk be used for indels?
Thanks in advance !!