<jupyter_start><jupyter_text>DSS for Lister-Mukamel Neuron and Glia Author: <NAME> Date: 31 October 2018 (Happy Halloween!)This is my first attempt at using DSS to find DMRs. The idea is to try to find DMRS usingread-level methylation data before and after imputing values using CpG Net. I'm comparing Neuron and Glia tissue samples from chromosome 19 since it's usually a pretty interesting chromosome, and I'm only looking at 100bp bins with 2 CpGs. No imputation has been performed so far, and I've set no coverage requirements (since DSS does this for us).  Step 1) get some R packages<jupyter_code>source("https://bioconductor.org/biocLite.R")
biocLite("DSS")<jupyter_output>Bioconductor version 3.4 (BiocInstaller 1.24.0), ?biocLite for help
A new version of Bioconductor is available after installing the most recent
  version of R; see http://bioconductor.org/install
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.2 (2016-10-31).
Installing package(s) ‘DSS’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Old packages: 'assertthat', 'backports', 'BH', 'bindr', 'bindrcpp', 'boot',
  'broom', 'car', 'caret', 'caTools', 'cluster', 'colorspace', 'crayon',
  'curl', 'data.table', 'DBI', 'digest', 'dplyr', 'evaluate', 'forcats',
  'foreach', 'foreign', 'formatR', 'ggplot2', 'gistr', 'glmnet', 'glue',
  'haven', 'hexbin', 'highr', 'hms', 'htmltools', 'htmlwidgets', 'httpuv',
  'httr', 'IRdisplay', 'iterators', 'jsonlite', 'knitr', 'lattice', 'lazyeval',
  'lme4', 'lubridate', 'maps', 'markdown', 'MASS', 'Matrix', 'mgcv', 'mime',
  'ModelMetrics', 'modelr', 'munsell', 'nloptr', 'openssl', 'pac[...]<jupyter_text>Step 2) More R requirements<jupyter_code>library(DSS)
require(bsseq)<jupyter_output><empty_output><jupyter_text>Step 3) Inspect our data to ensure proper format<jupyter_code>glia = read.table("lm_glia_2cpgs_dss_data_chr19.txt",header=TRUE)
head(glia)
# neuron
neurons = read.table("lm_neuron_2cpgs_dss_data_chr19.txt",header=TRUE)
head(neurons)<jupyter_output><empty_output><jupyter_text>Step 4) Load data into a BSobj<jupyter_code># Note: I'm only using 1000 CpGs for now
dat1.1 = glia
dat1.2 = neurons
BSobj <- makeBSseqData( list(dat1.1, dat1.2),  c("C1","C2") )#[1:1000,]
BSobj<jupyter_output><empty_output><jupyter_text>Step 5) Run the test<jupyter_code>dmlTest <- DMLtest(BSobj, group1=c("C1"), group2=c("C2"), smoothing=TRUE)<jupyter_output>Smoothing ...
Estimating dispersion for each CpG site, this will take a while ...<jupyter_text>Step 6) Find DM loci<jupyter_code>dmls <- callDML(dmlTest, p.threshold=0.001)
head(dmls)<jupyter_output><empty_output><jupyter_text>Step 7) Find DMRs<jupyter_code>dmrs <- callDMR(dmlTest, p.threshold=0.01)
head(dmrs)
nrow(dmrs)
# Step 8) Visualize DMRS
showOneDMR(dmrs[2,], BSobj)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1476157082748948, 'fraction_numerical': 0.028751753155680224, 'mean_word_length': 6.628342245989304, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 28, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '634450', 'license': 'MIT', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1050, 'n_words': 284, 'path': 'DSS/DSS_Playground.ipynb', 'repo_name': 'waterlandlab/PReLIM', 'size': '2857'}