Hi Alex,
I tried the above command and it gives me 0 with each file. Do you have an idea what might goes wrong?
Thanks
• 0 views
•
link
Hi,
I'm working with Cut&Run data and I would like to get the percentage of the fragment length that is less than 120bp. I used bampefragmest size from deep tools to get a plot of all the fragment length that is present in my sample. And now I would like to get the proportion of fragment length that is less than 120bp in the whole sample in order to assess my data.
Can anyone suggest a way to get this, maybe with awk?
Thanks
You could collect the fragment lengths from the ninth column of the BAM file, and then accumulate them in awk:
$ bam2bed --do-not-sort < reads.bam | awk -v FS="\t" -v THRESHOLD=120 'BEGIN { s = 0; a = 0; } { s += 1; if (($9 < THRESHOLD) && ($9 > -THRESHOLD)) { a += 1 } } END { print a / s; }'
Hi Alex,
I tried the above command and it gives me 0 with each file. Do you have an idea what might goes wrong?
Thanks
Log in to answer this question.
You asked multiple questions but seem to have neither upvoted nor followed up on most of them. Please upvote helpful comments, consider accepting answers that solved the problem.
I wil do that for the coming question. Thanks