There could be several ways you could this. one way is that you could use biomaRt to extract the TSS regions of organism of your interest and GenomicRanges to resize the TSS to plus minus 1000bp and then intersect your peaks file of histone mark using bedtools intersect.
you can use below R code for this purpose .
mart = useMart('ensembl')
ensembl = useMart( "ensembl", dataset = "mmusculus_gene_ensembl" )
tss <- getBM( attributes = c("chromosome_name","transcript_start","transcript_end","external_gene_name"),mart = ensembl )
tss <- tss[which(tss$chromosome_name != "MT"),]
tss$chromosome_name <- paste0("Chr",tss$chromosome_name)
gr <- GRanges(seqnames=Rle(tss$chromosome_name),
ranges = IRanges(tss$transcript_start, end=tss$transcript_end),
resizeRanges <- resize(gr, width = 1000,fix = 'start')
write.table(resizeRanges, file="tss.bed", quote=F, sep="\t", row.names=F, col.names=F)
modified 6 weeks ago
6 weeks ago by
Prakash • 1.1k