I am trying to convert a bam file to a bed file using R software however, I am currently unsuccessful. The below is what I have inputted so far in R-software can anyone help me please?
#load library library(Rsamtools) library(RNAseqData.HNRNPC.bam.chr14) library(GenomicAlignments) bamfile <- file.path("C:","Users","azzop","Desktop","I16-1144-01-esd_m1_CGCTCATT-AGGCGAAG_tophat2","accepted_hits.bam") system(paste("bedtools bamtobed -i", bamfile, "> myBed.bed")) library(data.table) myData <- fread("myBed.bed")
Does anyone know how I can use the package
bedtools in R? What am I doing is it correct?
Also, my goal is to combine more than 1 bam file together as I have 9 bam files and I would need to analyze the data holistically? Any suggestions?