Bedtools – converting multiple bam files to bed
I have previous experience in R, but since some months ago I am trying new things in Python (JupyterLab).
I have a a directory with different files. Some of them are ‘.bam’ files. My objective is to obtain ‘.bed’ files from them. Therefore, I start as follows:
from pybedtools import BedTool
import os, fnmatch
bam_files = fnmatch.filter(os.listdir(‘.’), ‘*.BAM’) #To filter only ‘.bam’ files in working directory file
After this, I try to work with the expression
bedtools bamtobed -i reads.bam > reads.bed
But I think, as I have multiple files, I am doing something wrong. Any help about how to proceed to convert my multiple files??
Thank you very much!!
• 18 views
Read more here: Source link