Thank you very very much!!!!but how can I extract PE fragment length (R1+R2) , make it split to (0-50bp,50-150bp, >150bp)?
hi,I want to split paired end read as length distribution like (0-50,50-150, >150),How can I do it? when I using samtools extract reads
samtools view -h Epi2_input_rmdup.bam |\
awk 'length($10) > 100 && length($10) < 200|| $1 ~ /^@/' |\
samtools view -bS - > 100_200qc_rm/50_Epi2_input_rmdup.bam
I found all reads length no more than 100bp, but when I draw paired reads fragment size stastics using deeptools bamPEFragmentSize,it show length 0-500bp.
1 answer
you're confusing read-length length($10) and fragment-length (abs($9) the later is the distance between the read and the mate).
http://deeptools.readthedocs.io/en/develop/content/tools/bamPEFragmentSize.html
This tool calculates the fragment sizes for read pairs given a BAM file from paired-end sequencing.
I'm surprised you cannot find how to do this with column $9 while you've been able to write a awk expression for the read length (?)
Log in to answer this question.
