Average read length by position BAM file
1
0
Entering edit mode
2.4 years ago
mmarcell • 0

Hello everyone! Is there a tool which can be used to extract the average length of mapped reads in each position per chromosome? Thanks in advance!

BAM • 678 views
ADD COMMENT
1
Entering edit mode

May I ask what this would be useful for. No, probably no out-of-the-box tool. There are many posts on biostars on extracting read length from a BAM. It will be tedious as you describe it. Do you really need every genome position? For human that will be three billion "average read lengths".

ADD REPLY
2
Entering edit mode
2.4 years ago

it sounds like a XY problem. What's the point of this ?

Anyway, using bioalcidaejdk http://lindenb.github.io/jvarkit/BioAlcidaeJdk.html and datamash:

java -jar ${JVARKIT_DIST}/bioalcidaejdk.jar -e 'stream().forEach(R->println(R.getContig()+":"+R.getStart()+"\t"+R.getReadLength()));' coord.sorted.bam | datamash -g 1 mean 2


(...)
RF01:1  70
RF01:8  70
RF01:11 70
RF01:12 70
RF01:27 70
RF01:44 70
RF01:67 70
RF01:94 70
RF01:102    70
RF01:110    70
ADD COMMENT
1
Entering edit mode

No, probably no out-of-the-box tool

Is there anything that BioAlcidae cannot do? :-D

ADD REPLY

Login before adding your answer.

Traffic: 1647 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