I have 2 files - bed file (chromosome, start and end) and second file is mapped reads which are in sam file. I want to plot reads against coordinates from my bed file. Example my bed file contains-
chr4 50 100 chr4 100 150 chr4 150 200 chr4 200 250
With this bed file, I can extract reads from sam file which are mapped between chr4: 50 and 250 positions. In the end, I want a plot like this (image taken from internet but I modified it little bit). Each read is shown according to its start position and length of the bar represents read length. I found this image and about python and matlab here. But I want to do this in R. The thing is, I have about 40 bed files and with the help of par(mfrow) in R, I will make 40 plots on same sheet. Any suggestions how would you do it or any R package will be great. I would really appreciate your help.
Thanks and Best regards,