Thank you so much Pierre!
You are always there when we need help.
I will give a try to all of these commands
Dear all,
I am wondering if there is any tool or someone have a custom script to extract reads from sam/bam or fastq file that contain a specific pattern of repeats. Let s say we have 1000000 reads and we want to look how many of them contain the pattern (CCAATT)n.
Thank you in advance.
using samjs: http://lindenb.github.io/jvarkit/SamJavascript.html
java -jar dist/samjs.jar -e 'record.getReadString().contains("CCAATT") || record.getReadString().contains("GGTTAA")' input.bam
using awk:
samtools view -h input.bam | awk -F '\t' '($0 ~ /^@/ || $10 ~ /CCAATT/ || $10 ~ /AATTGG/ )'
from a fastq:
gunzip -c input.fastq.gz | paste - - - - | awk -F '\t' '($2 ~ /CCAATT/ || $2 ~ /AATTGG/ )' | tr "\t" "\n"
Thank you so much Pierre!
You are always there when we need help.
I will give a try to all of these commands
You've asked many questions on this forum without validation (green mark on the left) or comment. e.g: samtools flagstat only for exome coordinates . Please validate/close the answers.
Dear Pierre,
These commands are working nicely.
However, what about if we want to look for reads consisting of let s say more than 50% of this repeat (randomly distributed within the reads)?
many thanks
Log in to answer this question.