Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample specific enhancer identificiation #105

Open
ferenckata opened this issue Sep 15, 2023 · 0 comments
Open

Sample specific enhancer identificiation #105

ferenckata opened this issue Sep 15, 2023 · 0 comments

Comments

@ferenckata
Copy link
Collaborator

Hei,

As far as I can see, the enhancer calling does not provide sample-specific enhancers, so I used a function from CAGEfightR to extract sample-specific enhancer bed files. See below. Let me know if there is a shorter way, or one that provides also the tpms per enhancer per sample.

brcage <- CAGEr::quickEnhancers(brcage)
supported_enhancers <- CAGEfightR::subsetBySupport(
        brcage[["enhancers"]],
        inputAssay="counts",
        unexpressed=0,
        minSamples=1)
sample_per_enhancer <- supported_enhancers@assays@data$counts
for (sample_name in colnames(sample_per_enhancer)){
        sample_bed <- lapply(
            names(
                sample_per_enhancer[
                    # filter for enhancers with non-zero tags per sample
                    sample_per_enhancer[,sample_name]>0,][,sample_name]
                ),
            # extract chr and coordinates into separate entities
            function(x){
                unlist(strsplit(x, ":|-"))
                }
        )
        # save list of coordinates to bedfile
        sink(file.path(
            cagerFolder,
            "enhancers",
            paste0(sample_name, "_enhancers.bed")))
        for (line in sample_bed){
            cat(paste0(line[1], "\t", line[2], "\t", line[3], "\n"))
            }
        sink()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants