bamtools filtering syntax - reads containing more than X mismatches and soft-clipped reads
1
0
Entering edit mode
4.1 years ago
joelepaul • 0

Hi @ll!

I'm extremely new to the field of bioinformatics, though I have some programming knowledge. A lot of tools have quite nice manuals out there, which helps me learning about how to use them properly. However, when it came to bamtools, I have been stuck.

My aims are twofold - starting from nice *.bam datasets

1) to remove reads containing more than 4 mismatches. However, I can only find the syntax to filter reads that contain 0 mismatches.

bamtools filter -tag XM:0 -in reads.bam -out reads.noMismatch.bam

However, I cannot find any documentation about the syntax of the BWA-specific flags such as XM, so I do not know how to adapt this code correctly to include a "more than" function.

2) to remove soft-clipped reads. My supervisor told me to use bamtools for that, but all guides like these Remove Soft Clipped Bases refer to other software/scripts. The bamtools manuals also do not say anything about how to do that. Does anyone know how to use specifically bamtools for that purpose?

Thank you for your time!

Cheers Joe

bwa bamtools • 2.1k views
ADD COMMENT
1
Entering edit mode
4.1 years ago

not bamstools, using samjdk http://lindenb.github.io/jvarkit/SamJdk.html

java -jar dist/samjdk.jar -e 'Integer xm = record.getIntegerAttribute("XM"); if(xm!=null && xm > 4) return false; return record.getCigar()==null   || !record.getCigar().isClipped();' input.bam
ADD COMMENT
0
Entering edit mode

hello Pierre, I tried to install jvarkit, but got errors like below, could you please help me? Thanks!

$ git clone "https://github.com/lindenb/jvarkit.git"
$ cd ~/jvarkit/
~/jvarkit$ ~/jvarkit/gradlew samjdk

FAILURE: Build failed with an exception.

* Where:
Settings file '/home/hyjforesight/jvarkit/settings.gradle'

* What went wrong:
Could not compile settings file '/home/hyjforesight/jvarkit/settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 61

  java.lang.IllegalArgumentException: Unsupported class file major version 61
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
        at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
        at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
        at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)
        at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:169)
        at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:125)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:57)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:44)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:79)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:70)
        at org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:57)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode$2.get(DecompiledClassNode.java:234)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode$2.get(DecompiledClassNode.java:231)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.createMethodNode(DecompiledClassNode.java:242)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:199)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getDeclaredMethods(DecompiledClassNode.java:122)


  1 error


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
ADD REPLY
0
Entering edit mode

your default java is version 60 and refers to Java 16, as specified in the manual, you need to use the 'old' java jdk 8 or a jdk 11 . (= set your PATH )

ADD REPLY

Login before adding your answer.

Traffic: 2457 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6