Coder Social home page Coder Social logo

methylresolver's Introduction

MethylResolver

Build Status HitCount License: GPL v3

Contents

Overview

MethylResolver is an R package to conduct robust deconvolution of bulk tissue methylation profiles using a reference signature. A reference signature of 11 leukocyte cell types is provided. Additionally, tumor purity and tumor purity-adjusted cell type fractions can be estimated without a reference of the tumor using a Random Forest regression model trained on concensus tumor purity estimates (CPE) of TCGA samples.

MethylResolver was developed and is maintained by Douglas Arneson at UCLA.

Repo Contents

  • R: R package code.
  • man: package manual for help in R session.
  • data: data used in the tutorial, the RF model, and the signature matrix.

System Requirements

Hardware Requirements

The MethylResolver package requires only a standard computer with Rstudio installed.

Software Requirements

OS Requirements

The package has tested on Mac OSX operating systems. The package has been tested on the following systems:

Linux:
Mac OSX: macOS Mojave 10.14.6
Windows:

The R package should be compatible with Windows, Mac, and Linux operating systems.

Before setting up the MethylResolver package, users should have R version 3.4.0 or higher.

Installation Guide

Stable Release

MethylResolver is available from github:

install.packages('devtools')
devtools::install_github(repo = 'darneson/MethylResolver')
library(MethylResolver)

Typical install times are 1-2 minutes.

Demo

Examples

For demos of the functions, please check out the examples built into the package. They can be accessed as follows:

require(MethylResolver)

# Deconvolution with default signature and calculating absolute fractions with default RF model:
MethylResolver(methylMix = MethylMix)

# Deconvolution with default signature and calculating absolute fractions with default RF model while 
# specifying a particular alpha value:
MethylResolver(methylMix = MethylMix, alpha = 0.5)

# Deconvolution with default signature and only calculating relative fractions:
MethylResolver(methylMix = MethylMix, absolute = FALSE)

# Specify your own signature matrix and RF model for calculating absolute fractions:
MethylResolver(methylMix = MethylMix, methylSig = MethylSig, purityModel = RFmodel)

Typical run times for the examples are ~10 seconds.

Also, please look at the built in help for descriptions of the parameters using: ?MethylResolver.

Version History

February 20, 2019:

  • Version 0.1.0 released (initial release)

methylresolver's People

Contributors

darneson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

methylresolver's Issues

Error in { : task 14 failed - "invalid 'length' argument"

Hello,

I am getting this error with my data.

> res = MethylResolver(methylMix = beta_vals, betaPrime = FALSE, doPar = TRUE, numCores = 6, absolute = FALSE)
Beginning LTS Deconvolution For This Mixture...
  |=====================================================================================================================================| 100%
Error in { : task 14 failed - "invalid 'length' argument"

Please help.

Thanks,
Ahwan

Memory problem and R crash

Hi,

On top of issue #6 which is still unaddressed I think I found some fun new way MR can fail and possibly take down your computer in the process.

Tried running MethylResolver on TCGA BRCA 450K samples (N=630). Ran with full matrix as input and using 6 cores but otherwise standard parameters. After some 30s or something my screens started blinking and my machine froze up. Turned out the R-session running MR was consuming ungodly amounts of RAM and the usage was up at 100% on a 64Gb machine and likely rising. OS is Win.

In between freezes I managed to kill the R-process and things went back to normal. Any idea what happened?

Should MR only be fed the probes used for deconv from a larger matrix or is there another explanation? Usually I guess you would just do a row-intersect to get rid of superfluous data included in the call. What happened?!

using own dataset

Hello,

Could you please help me resolve an issue I have using this package. I tried it on my methylation mixture dataset, however, every time it loads to 100% it breaks at task two and doesn't finish the deconvolution. It only happens if I allow it to use a grid search for the best alpha value. Although, oddly enough, if I specify a specific value of alpha it works. Here is the whole error message:

Error in {: task 2 failed - "invalid 'length' argument"
Traceback:

  1. MethylResolver_costum(methylMix = x, methylSig = MethylSig, betaPrime = FALSE,
    . outputPath = "~/Documents/", doPar = FALSE, numCores = 1,
    . outputName = "MethylResolver")
  2. foreach::foreach(i = 1:ncol(methylMix), .combine = "rbind", .options.snow = opts,
    . .packages = c("robustbase", "Metrics")) %dopar% {
    . regressionFormula = as.formula(paste0("methylMix[,i] ~ ",
    . paste(colnames(methylSig), sep = "", collapse = " + ")))
    . if (length(alpha) > 1) {
    . alphaRMSEs = c()
    . for (alphaVal in alpha) {
    . print(paste0("alphaVal:", alphaVal))
    . deconvoluteSample <- robustbase::ltsReg(regressionFormula,
    . data = methylSig, alpha = alphaVal)
    . bestCpGs = deconvoluteSample$best
    . print(paste0("bestCpGs:", bestCpGs, "\n"))
    . deconvoluteSample <- deconvoluteSample$coefficients[2:length(deconvoluteSample$coefficients)]
    . deconvoluteSample[which(deconvoluteSample < 0)] <- 0
    . if (sum(deconvoluteSample) == 0) {
    . deconvoluteSample[1:length(deconvoluteSample)] = rep((1/length(deconvoluteSample)),
    . length(deconvoluteSample))
    . }
    . deconvoluteSample <- deconvoluteSample/sum(deconvoluteSample)
    . mHat = deconvoluteSample %% t(data.matrix(methylSig))
    . rmse2 <- Metrics::rmse(methylMix[, i], mHat)
    . print(paste0(rmse2, "\n"))
    . alphaRMSEs = c(alphaRMSEs, rmse2)
    . }
    . alphaBest = alpha[which(alphaRMSEs == min(alphaRMSEs))]
    . }
    . else {
    . alphaBest = alpha
    . }
    . print(paste0("alphaBest:", alphaBest, "\n"))
    . regressionFormula = as.formula(paste0("methylMix[,i] ~ ",
    . paste(colnames(methylSig), sep = "", collapse = " + ")))
    . deconvoluteSample <- robustbase::ltsReg(regressionFormula,
    . data = methylSig, alpha = alphaBest)
    . bestCpGs = deconvoluteSample$best
    . deconvoluteSample <- deconvoluteSample$coefficients[2:length(deconvoluteSample$coefficients)]
    . deconvoluteSample[which(deconvoluteSample < 0)] <- 0
    . if (sum(deconvoluteSample) == 0) {
    . deconvoluteSample[1:length(deconvoluteSample)] = rep((1/length(deconvoluteSample)),
    . length(deconvoluteSample))
    . }
    . deconvoluteSample <- deconvoluteSample/sum(deconvoluteSample)
    . mHat = deconvoluteSample %
    % t(data.matrix(methylSig))
    . mHat2 = mHat[bestCpGs]
    . pearson1 = cor(methylMix[bestCpGs, i], as.vector(mHat2))
    . rmse1 <- Metrics::rmse(methylMix[bestCpGs, i], mHat2)
    . pearson2 = cor(methylMix[, i], as.vector(mHat))
    . rmse2 <- Metrics::rmse(methylMix[, i], mHat)
    . deconvoluteOne = data.frame(matrix(c(rmse1, pearson1, rmse2,
    . pearson2, deconvoluteSample), nrow = 1))
    . deconvoluteOne
    . } # at line 62-123 of file
  3. e$fun(obj, substitute(ex), parent.frame(), e$data)

Thank you in advance for your assistance!

invalid 'length' argument

Good morning,

I'm a PhD student working on a benchmarking project and I came across your tool after using MethylCIBERSORT.
I sounded more apeling than the previous one since I wouldn't be required to upload data to a web server.

When I was running the code it outputted this error

MethylResolver(methylMix = samples_filtered_5M.clean, methylSig = ref_matrix_filtered_house.clean, betaPrime = FALSE, outputName = "MethylResolver_5M", absolute = FALSE)
Beginning LTS Deconvolution For This Mixture...
|===============================================================================================================================| 100%Error in { : task 6 failed - "invalid 'length' argument"

I saw a similar one already closed but the solution of splitting it didn't work for me since some of the slices would have a task 1 failed.

I also tried using a different signature matrix more complete with different subtypes and got the following

MethylResolver(methylMix = samples_filtered_5M.clean, methylSig = ref_matrix_filtered_house_subt.clean, betaPrime = FALSE, outputName = "MethylResolver_5M_totmatrix", alpha = 0.5, absolute = FALSE)
Beginning LTS Deconvolution For This Mixture...
|===============================================================================================================================| 100%Error in { :
task 1 failed - "system is computationally singular: reciprocal condition number = 5.17026e-21"

Thank you in advance for the attention

normalized input beta values

Dear MethylResolver team,

I want to apply cell-type deconvolution on some Illumina EPIC methylation data from whole blood. To run MethylResolver (with betaPrime=FALSE), I understand I need to use normalized beta values (background corrected, log-transformed, quantile-adjusted etc) instead of raw beta values, is this correct?

Thank you very much for your help,

Isabel

MethylResolver error and questions

Hi, I'm trying to use your method together with some others to generate a consensus estimate of the TME in various cancers.

A couple of questions.

1: sometimes when I run MethylResolver it fails to give an output. Start with the message "Beginning LTS Deconvolution For This Mixture..." runs the bar to 100% but does not output the finished run message. These times no output file is generated. About 1/3 to 1/2 of runs. Running it also breaks a loop if I don't wrap the MethylResolver-function with try(). Some bug?

2: I've noticed that the output is not strictly deterministic. Depending on sample you can get fairly large differences in the individual cell type estimates. Purity is somewhat stabile though. Would it be ok to average the output of e.g. 50 runs by cell type and normalize to average purity of same runs to get a consensus "absolute" estimate? Any other way of stabilizing the output?

3: Should MethylResolver be run on data normalized in a specific way e.g. "preprocessFunnorm" in minfi or other package. Does normalization affect performance? To what extent?

EDIT: scaled up from a test using 10 samples to full set with 342 samples. With 342 samples MethylResolver just does not generate an output. With 10 samples fail rate is about same as stated above..

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.