Git Product home page Git Product logo

Comments (4)

PeteHaitch avatar PeteHaitch commented on July 18, 2024

Hi @sahuno,

It's not well-documented, but you can only combine 2 BSseq objects that have been smoothed if they have the exact same set of loci (i.e. having the same set of chromosomes isn't enough).
That's what the warning message Combining BSseq objects with different loci. You will need to re-smooth using 'BSmooth()' on the returned object. is telling you.

The reason for this is that downstream functionality assumes that all samples have the same been smoothed over the same set of loci.

So the solution is to first combine and then smooth.
The only way you can smooth and then combine is if all objects have the same loci.

from bsseq.

kasperdanielhansen avatar kasperdanielhansen commented on July 18, 2024

from bsseq.

sahuno avatar sahuno commented on July 18, 2024

Hi @PeteHaitch @kasperdanielhansen thanks for the feedback!
@kasperdanielhansen i think i already did your suggestion in another approach.
a. Read both files with read.bismark()
b. then split and save individual samples as rds file
c. smooth separately
d. combine smoothed files

#read bisnark coverage files from disk and set annotations
bismark_bsseq <- read.bismark(files = sample_metadata$File,
                    colData = DataFrame(row.names = sample_metadata$Sample, Type = sample_metadata$Group, Pair = c("Pair1", "Pair1")),
                      rmZeroCov = FALSE,
                      strandCollapse = FALSE,
                      verbose = TRUE)

#split for parallelzation
## Split data and run bs
BS1 <- bismark_bsseq[, 1]
saveRDS(BS1, file =paste0(wrkDir,"/SA123T.rds"))

BS2 <- bismark_bsseq[, 2]
saveRDS(BS2, file =paste0(wrkDir,"/SA123N.rds"))

##run bsmooth separate on cluster using snakemake
bs_unsmoothed <- readRDS(opt$input_file)
bismark_bsseq.fit <- BSmooth(
    BSseq = bs_unsmoothed, 
    BPPARAM = MulticoreParam(workers = 12), 
    verbose = TRUE)

## load and combine; in a new R session
SA123N.fitted <- readRDS("/dir/scripts/bsmooth_snakemake/results/bsmooth_fit/SA123N/SA123N.fitted.rds")
SA123T.fitted <- readRDS("/dir/scripts/bsmooth_snakemake/results/bsmooth_fit/SA123T/SA123T.fitted.rds")
BS.cancer.ex.fit <- combine(SA123N.fitted, SA123T.fitted)

So my confusion is that does splitting bsseq object automatically remove CpGs with zero coverage in the result file or maybe the bsmoothing does?

from bsseq.

kasperdanielhansen avatar kasperdanielhansen commented on July 18, 2024

from bsseq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.