MethMAGE - Methylation Modeling Analysis using Generalized Estimating Equations
=========
Contributors: David E Frankhouser
Contact for questions: 
    Ralf Bundschuh - bundschuh@mps.ohio-state.edu
    David E Frankhouser - david.frankhouser@osumc.edu

-----------
Publication
-----------

PrEMeR-CG: Inferring Nucleotide Level DNA Methylation Values from MethylCap-Seq Data

-----------
Authors
-----------

David E. Frankhouser, Mark Murphy, James S Blachly, Jincheol Park, John Curfman, John C Byrd, Shili Lin, Guido Marcucci, Pearlly Yan, Ralf Bundschuh

-----------
Description
-----------

A complementary statistical method which utilizes the nucleotide-resolution meththylation data in the detection of differentially methylated regions (DMRs), genomic regions in which the methylation profile differs between different groups.

This method is a domain-specific use of the Generalized Estimating Equation (GEE), as an analysis tool for ascertaining methylation differences in a way that utilizes the methylation value of individual CpG sites fully without resorting to averaging across a genomic feature of interest.

-------
Scripts
-------

### generate_mmroi.py ###

    - Takes a cgb file (see README in PrEMeR-CG), and a bed file providing genomic regions of interest.
    - Requires
        -Python Modules: os, sys, gzip, pickle, argparse, datetime, csv
    - Generates an mmroi file for the input cgb, which provides the methylation signal for each CpG that falls within the regions specified by the bed file
    

    usage: generate_mmroi.py [-h] [--out OUT] [--cgb CGB [CGB ...]]
                             [--bed BED [BED ...]]

    Generate mmroi files

    optional arguments:
      -h, --help           show this help message and exit
      --out OUT            Output mmroi-output file name.
      --cgb CGB [CGB ...]  input - cgb sample file name .
      --bed BED [BED ...]  input - bed feature file name.


### main.MethMAGE.py ###

	- Takes two files, each containing a list of the paths to the samples for a group of ssnrois. The two groups will be compared.
	- Requires 
        -MethMAGE.py (Included. See NOTE 2 below)
        -Python Modules: rpy2, sys, marshal, os, gzip, string, matplotlib, numpy, 
	- Output:
        -Generates two tables: 1) Output of every region from the bam file with all methylation statistics able to be tested for that region 2) identify differentially methylated regions.
        -Plots of every region that was able to be tested
        -Plots that summarize the standard error of the methylation signal vs the non-zero fraction of the CpGs contained within testable regions

	usage: main.MethMAGE.py [-h] [--plots_out PLOTS_OUT] [--Alabel ALABEL]
                        [--Blabel BLABEL] [--out OUT]
                        [--ssnroisA SSNROISA [SSNROISA ...]]
                        [--ssnroisB SSNROISB [SSNROISB ...]] [--filter FILTER]
                        [--logname LOGNAME] [--debug]

	Generate MethMAGE

	optional arguments:
	  -h, --help            show this help message and exit
	  --plots_out PLOTS_OUT
        	                Output location for plots
	  --Alabel ALABEL       Optional Label for groupA
	  --Blabel BLABEL       Optional Label for groupB
	  --out OUT             Output file name.
	  --ssnroisA SSNROISA [SSNROISA ...]
	                        Group A of ssnrois.
	  --ssnroisB SSNROISB [SSNROISB ...]
	                        Group B of ssnrois.
	  --filter FILTER       List of IDs to use.
	  --logname LOGNAME     File name to use for log output.
	  --debug               Enable debug logging.


### MethMAGE.py ###
	- Main worker program for plot and file generation
	
-----
NOTES
-----

NOTE 1: main.MethMAGE.py is more or less a wrapper for MethMAGE.py. Importing the binner as a compiled file increases performance.

NOTE 2: MethMAGE.py module should be located in the same directory as main.cgbinner_readnorm.py. See 'docs.python.org/2/tutorial/modules.html#the-module-search-path' for alternatives.
