commit e5603c3f87f71891f0bbf9f3e8892f9e67ffaf48
Author: Florent Chuffart <florent.chuffart@ens-lyon.fr>
Date:   Fri Jul 18 15:27:59 2014 +0200

    Adding workdir deps

diff --git a/README b/README
index 6a29558..7a83826 100644
--- a/README
+++ b/README
@@ -3,9 +3,9 @@ Readme / Documentation for *NucleoMiner2*
 *****************************************
 
 *NucleoMiner2* offers Python API and R package allowing to perform
-quantitative analysis of nucleosomal epigenome. It is especially well
-suited for scripting to extract natural Single-Nucleosome Epi-
-Polymorphisms (SNEP) from ChIP-Seq data.
+quantitative analysis of epigenetic marks on individual nucleosomes.
+It was developed to detect natural Single-Nucleosome Epi-Polymorphisms
+(SNEP) from MNase-seq and ChIP-seq data.
 
 
 License
@@ -35,16 +35,20 @@ only with a limited warranty  and the software's author,  the holder
 of the economic rights,  and the successive licensors  have only
 limited liability.
 
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards
-their requirements in conditions enabling the security of their
-systems and/or data to be ensured and,  more generally, to use and
-operate it in the same conditions as regards security.
+This software is provided with absolutely NO WARRANTY. The authors can
+not be held responsible, even partially, for any damage, loss,
+financial loss or any other undesired facts resulting from the use of
+the software. In this respect, the user's attention is drawn to the
+risks associated with loading,  using,  modifying and/or developing or
+reproducing the software by the user in light of its specific status
+of free software, that may mean  that it is complicated to manipulate,
+and  that  also therefore means  that it is reserved for developers
+and  experienced professionals having in-depth computer knowledge.
+Users are therefore encouraged to load and test the software's
+suitability as regards their requirements in conditions enabling the
+security of their systems and/or data to be ensured and,  more
+generally, to use and operate it in the same conditions as regards
+security.
 
 The fact that you are presently reading this means that you have had
 knowledge of the CeCILL license and that you accept its terms.
@@ -57,27 +61,36 @@ Installation Instructions
 Links
 -----
 
-*NucleoMiner2* home page and documentation: https://forge.cbp.ens-
-lyon.fr/redmine/projects/nucleominer
+*NucleoMiner2* home page and documentation are available here:
 
-Gael Yvert lab page: http://www.ens-lyon.fr/LBMC/gisv/
+   * https://forge.cbp.ens-lyon.fr/redmine/projects/nucleominer
+
+The Yvert lab web page is accessible here:
+
+   * http://www.ens-lyon.fr/LBMC/gisv/
 
 
 Installation
 ------------
 
-   * Download archive
 
-   * Compile bowtie2
+Prerequisites
+~~~~~~~~~~~~~
+
+To work properly, NucleoMiner2 needs that the following free software
+are installed and made available on your system:
+
+   * Bowtie2 http://bowtie-bio.sourceforge.net/bowtie2
 
-   * Compile samtools
+   * SAMtools http://samtools.sourceforge.net
 
-   * Compile bedtools
+   * bedtools http://code.google.com/p/bedtools/
 
-   * Compile TemplateFilter
+   * TemplateFilter
+     http://compbio.cs.huji.ac.il/NucPosition/TemplateFiltering
 
-Required R packages:
-   * bot
+It also requires the following R packages to be installed on your
+system:
 
    * fork
 
@@ -85,28 +98,10 @@ Required R packages:
 
    * seqinr
 
-   * cachecache
-
-   cd src/r_packages/
-         tar xfvz R-latest.tar.gz
-         cd R-patched
-         ./configure --with-x=no PDFLATEX="ls"
-         make
-   cd ../../..
-   R_BIN=src/r_packages/R-patched/bin/R
-         $R_BIN CMD INSTALL src/r_packages/rjson_0.2.12.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/seqinr_3.0-7.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/plotrix_3.4-5.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/nm_2.0.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/fork_1.2.4.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/bot_0.9.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/DESeq_1.14.0.tar.gz
-
-...
-
+   * cachecache https://forge.cbp.ens-
+     lyon.fr/redmine/projects/cachecache
 
-usage
-=====
+   * bot https://forge.cbp.ens-lyon.fr/redmine/projects/bot
 
-See html documentation for *NucleoMiner2*: http://www.ens-
-lyon.fr/LBMC/gisv/
+   * nucleominer https://forge.cbp.ens-
+     lyon.fr/redmine/projects/nucleominer
diff --git a/build/nucleominer_2.3.45.tar.gz b/build/nucleominer_2.3.45.tar.gz
index b4f9281..63c2ac0 100644
Binary files a/build/nucleominer_2.3.45.tar.gz and b/build/nucleominer_2.3.45.tar.gz differ
diff --git a/doc/Chuffart_NM2_sweave/src/.DS_Store b/doc/Chuffart_NM2_sweave/src/.DS_Store
deleted file mode 100644
index 5008ddf..0000000
Binary files a/doc/Chuffart_NM2_sweave/src/.DS_Store and /dev/null differ
diff --git a/doc/Chuffart_NM2_workdir/deps/bot_0.14.tar.gz b/doc/Chuffart_NM2_workdir/deps/bot_0.14.tar.gz
new file mode 100644
index 0000000..0741906
Binary files /dev/null and b/doc/Chuffart_NM2_workdir/deps/bot_0.14.tar.gz differ
diff --git a/doc/Chuffart_NM2_workdir/deps/cachecache_0.1.tar.gz b/doc/Chuffart_NM2_workdir/deps/cachecache_0.1.tar.gz
new file mode 100644
index 0000000..64c13bb
Binary files /dev/null and b/doc/Chuffart_NM2_workdir/deps/cachecache_0.1.tar.gz differ
diff --git a/doc/Chuffart_NM2_workdir/deps/gdl-1.0.tar.gz b/doc/Chuffart_NM2_workdir/deps/gdl-1.0.tar.gz
new file mode 100644
index 0000000..3d7a584
Binary files /dev/null and b/doc/Chuffart_NM2_workdir/deps/gdl-1.0.tar.gz differ
diff --git a/doc/Chuffart_NM2_workdir/deps/nucleominer-1.0.tar.gz b/doc/Chuffart_NM2_workdir/deps/nucleominer-1.0.tar.gz
new file mode 100644
index 0000000..dae12d6
Binary files /dev/null and b/doc/Chuffart_NM2_workdir/deps/nucleominer-1.0.tar.gz differ
diff --git a/doc/sphinx_doc/build/latex/NucleoMiner2.pdf b/doc/sphinx_doc/build/latex/NucleoMiner2.pdf
index 2ef96b1..44fa6d3 100644
Binary files a/doc/sphinx_doc/build/latex/NucleoMiner2.pdf and b/doc/sphinx_doc/build/latex/NucleoMiner2.pdf differ
diff --git a/doc/sphinx_doc/build/text/index.txt b/doc/sphinx_doc/build/text/index.txt
deleted file mode 100644
index b172a76..0000000
--- a/doc/sphinx_doc/build/text/index.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-
-Welcome to *NucleoMiner2*
-*************************
-
-* Readme / Documentation for *NucleoMiner2*
-
-  * License
-
-  * Installation Instructions
-
-  * usage
-
-* Tutorial
-
-  * Python and R Common Configuration File
-
-  * Dataset and Configuration Variables
-
-  * Preprocessing Illumina Fastq Reads for Each Sample
-
-  * Inferring Nucleosome Position and Extracting Read Counts
-
-  * Results
-
-* References
-
-  * Python Reference
-
-  * R Reference
-
-
-Indices and tables
-******************
-
-* *Index*
-
-* *Search Page*
diff --git a/doc/sphinx_doc/build/text/readme.txt b/doc/sphinx_doc/build/text/readme.txt
deleted file mode 100644
index 6a29558..0000000
--- a/doc/sphinx_doc/build/text/readme.txt
+++ /dev/null
@@ -1,112 +0,0 @@
-
-Readme / Documentation for *NucleoMiner2*
-*****************************************
-
-*NucleoMiner2* offers Python API and R package allowing to perform
-quantitative analysis of nucleosomal epigenome. It is especially well
-suited for scripting to extract natural Single-Nucleosome Epi-
-Polymorphisms (SNEP) from ChIP-Seq data.
-
-
-License
-=======
-
-Copyright CNRS 2012-2013
-
-* Florent CHUFFART
-
-* Jean-Baptiste VEYRIERAS
-
-* Gael YVERT
-
-This software is a computer program which purpose is to perform
-quanti- tative analysis of epigenetic marks at single nucleosome
-resolution.
-
-This software is governed by the CeCILL license under French law and
-abiding by the rules of distribution of free software.  You can  use,
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info".
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided
-only with a limited warranty  and the software's author,  the holder
-of the economic rights,  and the successive licensors  have only
-limited liability.
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards
-their requirements in conditions enabling the security of their
-systems and/or data to be ensured and,  more generally, to use and
-operate it in the same conditions as regards security.
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-
-
-Installation Instructions
-=========================
-
-
-Links
------
-
-*NucleoMiner2* home page and documentation: https://forge.cbp.ens-
-lyon.fr/redmine/projects/nucleominer
-
-Gael Yvert lab page: http://www.ens-lyon.fr/LBMC/gisv/
-
-
-Installation
-------------
-
-   * Download archive
-
-   * Compile bowtie2
-
-   * Compile samtools
-
-   * Compile bedtools
-
-   * Compile TemplateFilter
-
-Required R packages:
-   * bot
-
-   * fork
-
-   * rjson
-
-   * seqinr
-
-   * cachecache
-
-   cd src/r_packages/
-         tar xfvz R-latest.tar.gz
-         cd R-patched
-         ./configure --with-x=no PDFLATEX="ls"
-         make
-   cd ../../..
-   R_BIN=src/r_packages/R-patched/bin/R
-         $R_BIN CMD INSTALL src/r_packages/rjson_0.2.12.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/seqinr_3.0-7.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/plotrix_3.4-5.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/nm_2.0.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/fork_1.2.4.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/bot_0.9.tar.gz
-         $R_BIN CMD INSTALL src/r_packages/DESeq_1.14.0.tar.gz
-
-...
-
-
-usage
-=====
-
-See html documentation for *NucleoMiner2*: http://www.ens-
-lyon.fr/LBMC/gisv/
diff --git a/doc/sphinx_doc/build/text/ref.txt b/doc/sphinx_doc/build/text/ref.txt
deleted file mode 100644
index 6ab7ff9..0000000
--- a/doc/sphinx_doc/build/text/ref.txt
+++ /dev/null
@@ -1,2020 +0,0 @@
-
-References
-**********
-
-
-Python Reference
-================
-
-configurator.CSV_SAMPLE_FILE = None
-
-   Path to cvs file that contains sample information.
-
-configurator.BOWTIE_BUILD_BIN = None
-
-   Path for bowtie2 build bin.
-
-configurator.BOWTIE2_BIN = None
-
-   Path for bowtie2 bin.
-
-configurator.SAMTOOLS_BIN = None
-
-   Path for samtools bin.
-
-configurator.BEDTOOLS_BIN = None
-
-   Path for bedtools bin.
-
-configurator.TF_BIN = None
-
-   Path for TemplateFilter bin.
-
-configurator.TF_TEMPLATES_FILE = None
-
-   Path for TemplateFilter templates file.
-
-configurator.ILLUMINA_OUTPUTFILE_PREFIX = None
-
-   Prefix for Illumina fastq output files.
-
-configurator.INDEX_DIR = None
-
-   Path for index dir.
-
-configurator.ALIGN_DIR = None
-
-   Path for align dir.
-
-configurator.LOG_DIR = None
-
-   Path for log dir
-
-configurator.CACHE_DIR = None
-
-   Path for cache dir.
-
-configurator.RESULTS_DIR = None
-
-   Path for results dir
-
-configurator.FASTA_REFERENCE_GENOME_FILES = None
-
-   Dictionary where each fasta reference genomes is indexed by
-   reference strain that it corresponds.
-
-configurator.AREA_BLACK_LIST = None
-
-   Dictionary where keys are strain and values are black listed of
-   geneome region.
-
-configurator.FASTA_INDEXES = None
-
-   Dictionary of strain that indexes dictionaries where keys are
-   chromosome reference from Fastq file and value are its
-   correspondance for Templatefilter.
-
-configurator.C2C_FILES = None
-
-   Dictionary where each strain combination indexes genome aligment.
-
-configurator.READ_LENGTH = None
-
-   Length of Illumina reads.
-
-configurator.MAPQ_THRES = None
-
-   Aligment quality thresold.
-
-configurator.TF_CORR = None
-
-   TemplateFilter Template correlation threshold.
-
-configurator.TF_MINW = None
-
-   TemplateFilter minimum width of a nucleosome.
-
-configurator.TF_MAXW = None
-
-   TemplateFilter maximum  width of a nucleosome.
-
-configurator.TF_OL = None
-
-   TemplateFilter maximum allowed overlap for two nucleosomes.
-
-wf.json_conf_file = 'src/current/nucleominer_config.json'
-
-   Path to the json configuration file.
-
-wf.samples = []
-
-   List of samples where a sample is identify by an id (key: *id*) and
-   a strain name (key *strain*).
-
-wf.samples_mnase = []
-
-   List of Mnase samples.
-
-wf.strains = []
-
-   List of reference strains.
-
-libcoverage.create_bowtie_index(strain, strain_fasta_ref, index_dir, bowtie_build_bin)
-
-   Creates bowtie index for a strain *strain*.
-
-   Parameters:
-      * **strain** -- the strain reference.
-
-      * **strain_fasta_ref** -- fasta reference genome.
-
-      * **index_dir** -- directories where to put bowtie index.
-
-      * **bowtie_build_bin** -- bowtie2 build binary.
-
-libcoverage.align_reads(sample, align_dir, log_dir, index_dir, illumina_outputfile_prefix, bowtie2_bin, samtools_bin, bedtools_bin)
-
-   Aligns reads to reference genomes. It produces .sam files, that are
-   converted to .bam, that are converted to .bed.
-
-   Parameters:
-      * **sample** -- a dict that describe a sample.
-
-      * **align_dir** -- directory where aligned reads will be
-        stored.
-
-      * **log_dir** -- directory where logs will be stored.
-
-      * **illumina_outputfile_prefix** -- prefix of Illumina
-        sequencer fastq.gz output files.
-
-      * **bowtie2_bin** -- bowtie2 binary.
-
-      * **samtools_bin** -- samtools binary.
-
-      * **bedtools_bin** -- bedtools binary.
-
-      * **index_dir** -- bowtie index directory.
-
-libcoverage.split_fr_4_TF(sample, align_dir, fasta_indexes, area_black_list, read_length, mapq_thres)
-
-   Create TempleFilter input files form bed files. This function
-   appends in two times. First, it collects reads from bed files and
-   feeds a datastructure
-
-   Parameters:
-      * **sample** -- a dict that describe a sample.
-
-      * **align_dir** -- directory where aligned reads will be
-        stored.
-
-      * **fasta_index** -- the chr reference from the illumina
-        output file.
-
-      * **area_black_list** -- the description of genome that will
-        be omit.
-
-      * **read_length** -- Length of Illumina reads.
-
-      * **mapq_thres** -- mapping quality criterion threshold, see
-        MAPQ in BED/BAM file format.
-
-libcoverage.template_filter(sample, align_dir, log_dir, tf_bin, tf_templates_file, corr, minw, maxw, ol)
-
-   Run TemplateFilter on a specifi sample. It produces .tab file.
-
-   Parameters:
-      * **sample** -- a dict that describe a sample.
-
-      * **align_dir** -- directory where aligned reads will be
-        stored.
-
-      * **log_dir** -- directory where logs will be stored.
-
-      * **tf_bin** -- path to the TemplateFilter binary.
-
-      * **tf_templates_file** -- path to the TemplateFilter
-        templates file.
-
-      * **corr** -- correlation threshold transmits to
-        TemplateFilter.
-
-      * **minw** -- minimum width of a nuc, transmits to
-        TemplateFilter.
-
-      * **maxw** -- maximum width of a nuc, transmits to
-        TemplateFilter.
-
-      * **ol** -- maximum overlaps for 2 nuc, transmits to
-        TemplateFilter.
-
-
-R Reference
-===========
-
-
-Arabic to Roman pair list.
---------------------------
-
-
-Description
-~~~~~~~~~~~
-
-Util to convert Arabicto Roman
-
-
-Usage
-~~~~~
-
-   ARAB2ROM()
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: False Discovery Rate
-
-
-False Discovery Rate
---------------------
-
-
-Description
-~~~~~~~~~~~
-
-From a vector x of independent p-values, extract the cutoff
-corresponding to the specified FDR. See Benjamini & Hochberg 1995
-paper
-
-
-Usage
-~~~~~
-
-   FDR(x, FDR)
-
-
-Arguments
-~~~~~~~~~
-
-"x"
-
-A vector x of independent p-values.
-
-"FDR"
-
-The specified FDR.
-
-
-Value
-~~~~~
-
-Return the the corresponding cutoff.
-
-
-Author(s)
-~~~~~~~~~
-
-Gael Yvert, Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   print("example")
-
-R: Roman to Arabic pair list.
-
-
-Roman to Arabic pair list.
---------------------------
-
-
-Description
-~~~~~~~~~~~
-
-Util to convert Roman to Arabic
-
-
-Usage
-~~~~~
-
-   ROM2ARAB()
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Aggregate replicated sample's nucleosomes.
-
-
-Aggregate replicated sample's nucleosomes.
-------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function aggregates nucleosome for replicated samples. It uses
-TemplateFilter ouput of each sample as replicate. Each sample owns a
-set of nucleosomes computed using TemplateFilter and ordered by the
-position of their center. Adajacent nucleosomes are compared two by
-two. Comparison is based on a log likelihood ratio score. The issue of
-comparison is adjacents nucleosomes merge or separation. Finally the
-function returns a list of clusters and all computed *llr_scores*.
-Each cluster ows an attribute *wp* for "well positionned". This
-attribute is set as *TRUE* if the cluster is composed of exactly one
-nucleosomes of each sample.
-
-
-Usage
-~~~~~
-
-   aggregate_intra_strain_nucs(samples, llr_thres = 20, coord_max = 2e+07)
-
-
-Arguments
-~~~~~~~~~
-
-"samples"
-
-A list of samples. Each sample is a list like *sample = list(id=...,
-marker=..., strain=..., roi=..., inputs=..., outputs=...)* with *roi =
-list(name=..., begin=..., end=..., chr=..., genome=...)*.
-
-"llr_thres"
-
-Log likelihood ration threshold.
-
-"coord_max"
-
-A too big value to be a coord for a nucleosome lower bound.
-
-
-Value
-~~~~~
-
-Returns a list of clusterized nucleosomes, and all computed llr
-scores.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   # Dealing with a region of interest
-   roi =list(name="example", begin=1000,  end=1300, chr="1", genome=rep("A",301))
-   samples = list()
-   for (i in 1:3) {
-       # Create TF output
-       tf_nuc = list("chr"=paste("chr", roi$chr, sep=""), "center"=(roi$end + roi$begin)/2, "width"= 150, "correlation.score"= 0.9)
-       outputs = dfadd(NULL,tf_nuc)
-       outputs = filter_tf_outputs(outputs, roi$chr, roi$begin, roi$end)
-       # Generate corresponding reads
-       nb_reads = round(runif(1,170,230))
-       reads = round(rnorm(nb_reads, tf_nuc$center,20))
-       u_reads = sort(unique(reads))
-       strands = sample(c(rep("R",ceiling(length(u_reads)/2)),rep("F",floor(length(u_reads)/2))))
-       counts = apply(t(u_reads), 2, function(r) { sum(reads == r)})
-       shifts = apply(t(strands), 2, function(s) { if (s == "F") return(-tf_nuc$width/2) else return(tf_nuc$width/2)})
-       u_reads = u_reads + shifts
-       inputs = data.frame(list("V1" = rep(roi$chr, length(u_reads)),
-                                "V2" = u_reads,
-                                                        "V3" = strands,
-                                                        "V4" = counts), stringsAsFactors=FALSE)
-       samples[[length(samples) + 1]] = list(id=1, marker="Mnase_Seq", strain="strain_ex", total_reads = 10000000, roi=roi, inputs=inputs, outputs=outputs)
-   }
-   print(aggregate_intra_strain_nucs(samples))
-
-R: Aligns nucleosomes between 2 strains.
-
-
-Aligns nucleosomes between 2 strains.
--------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function aligns nucs between two strains for a given genome
-region.
-
-
-Usage
-~~~~~
-
-   align_inter_strain_nucs(replicates, wp_nucs_strain_ref1 = NULL,
-       wp_nucs_strain_ref2 = NULL, corr_thres = 0.5, llr_thres = 100,
-       config = NULL, ...)
-
-
-Arguments
-~~~~~~~~~
-
-"replicates"
-
-Set of replicates, ideally 3 per strain.
-
-"wp_nucs_strain_ref1"
-
-List of aggregates nucleosome for strain 1. If it's null this list
-will be computed.
-
-"wp_nucs_strain_ref2"
-
-List of aggregates nucleosome for strain 2. If it's null this list
-will be computed.
-
-"corr_thres"
-
-Correlation threshold.
-
-"llr_thres"
-
-LOD cut off.
-
-"config"
-
-GLOBAL config variable
-
-"..."
-
-A list of parameters that will be passed to
-*aggregate_intra_strain_nucs* if needed.
-
-
-Value
-~~~~~
-
-Returns a list of clusterized nucleosomes, and all computed llr
-scores.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-       # Define new translate_cur function...
-       translate_cur = function(roi, strain2, big_cur=NULL, config=NULL) {
-         return(roi)
-       }
-       # Binding it by uncomment follwing lines.
-       unlockBinding("translate_cur", as.environment("package:nucleominer"))
-       unlockBinding("translate_cur", getNamespace("nucleominer"))
-       assign("translate_cur", translate_cur, "package:nucleominer")
-       assign("translate_cur", translate_cur, getNamespace("nucleominer"))
-       lockBinding("translate_cur", getNamespace("nucleominer"))
-       lockBinding("translate_cur", as.environment("package:nucleominer"))
-
-   # Dealing with a region of interest
-   roi =list(name="example", begin=1000,  end=1300, chr="1", genome=rep("A",301), strain_ref1 = "STRAINREF1")
-   roi2 = translate_cur(roi, roi$strain_ref1)
-   replicates = list()
-   for (j in 1:2) {
-       samples = list()
-       for (i in 1:3) {
-           # Create TF output
-           tf_nuc = list("chr"=paste("chr", roi$chr, sep=""), "center"=(roi$end + roi$begin)/2, "width"= 150, "correlation.score"= 0.9)
-           outputs = dfadd(NULL,tf_nuc)
-           outputs = filter_tf_outputs(outputs, roi$chr, roi$begin, roi$end)
-           # Generate corresponding reads
-           nb_reads = round(runif(1,170,230))
-           reads = round(rnorm(nb_reads, tf_nuc$center,20))
-           u_reads = sort(unique(reads))
-           strands = sample(c(rep("R",ceiling(length(u_reads)/2)),rep("F",floor(length(u_reads)/2))))
-           counts = apply(t(u_reads), 2, function(r) { sum(reads == r)})
-           shifts = apply(t(strands), 2, function(s) { if (s == "F") return(-tf_nuc$width/2) else return(tf_nuc$width/2)})
-           u_reads = u_reads + shifts
-           inputs = data.frame(list("V1" = rep(roi$chr, length(u_reads)),
-                                    "V2" = u_reads,
-                                                            "V3" = strands,
-                                                            "V4" = counts), stringsAsFactors=FALSE)
-           samples[[length(samples) + 1]] = list(id=1, marker="Mnase_Seq", strain=paste("strain_ex",j,sep=""), total_reads = 10000000, roi=roi, inputs=inputs, outputs=outputs)
-       }
-       replicates[[length(replicates) + 1]] = samples
-   }
-   print(align_inter_strain_nucs(replicates))
-
-R: Launch deseq methods.
-
-
-Launch deseq methods.
----------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function is based on deseq example. It mormalizes data, fit data
-to GLM model with and without interaction term and compare the two
-l;=models.
-
-
-Usage
-~~~~~
-
-   analyse_design(snep_design, reads)
-
-
-Arguments
-~~~~~~~~~
-
-"snep_design"
-
-The design to considere.
-
-"reads"
-
-The data to considere.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Stage replicates data
-
-
-Stage replicates data
----------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function loads in memory data corresponding to the given
-experiments.
-
-
-Usage
-~~~~~
-
-   build_replicates(expe, roi, only_fetch = FALSE, get_genome = FALSE,
-       all_samples, config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"expe"
-
-a list of vector corresponding to vector of replicates.
-
-"roi"
-
-the region that we are interested in.
-
-"only_fetch"
-
-filter or not inputs.
-
-"get_genome"
-
-Load or not corresponding genome.
-
-"all_samples"
-
-Global list of samples.
-
-"config"
-
-GLOBAL config variable.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   # library(rjson)
-   # library(nucleominer)
-   #
-   # # Read config file
-   # json_conf_file = "nucleo_miner_config.json"
-   # config = fromJSON(paste(readLines(json_conf_file), collapse=""))
-   # # Read sample file
-   # all_samples = get_content(config$CSV_SAMPLE_FILE, "cvs", sep=";", head=TRUE, stringsAsFactors=FALSE)
-   # # here are the sample ids in a list
-   # expes = list(c(1))
-   # # here is the region that we wnt to see the coverage
-   # cur = list(chr="8", begin=472000, end=474000, strain_ref="BY")
-   # # it displays the corverage
-   # replicates = build_replicates(expes, cur, all_samples=all_samples, config=config)
-   # out = watch_samples(replicates, config$READ_LENGTH,
-   #       plot_coverage = TRUE,
-   #       plot_squared_reads = FALSE,
-   #       plot_ref_genome = FALSE,
-   #       plot_arrow_raw_reads = FALSE,
-   #       plot_arrow_nuc_reads = FALSE,
-   #       plot_gaussian_reads = FALSE,
-   #       plot_gaussian_unified_reads = FALSE,
-   #       plot_ellipse_nucs = FALSE,
-   #       plot_wp_nucs = FALSE,
-   #       plot_wp_nuc_model = FALSE,
-   #       plot_common_nucs = FALSE,
-   #       height = 50)
-
-R: Extract a sub part of the corresponding c2c file
-
-
-Extract a sub part of the corresponding c2c file
-------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This fonction allow to acces to a specific part of the c2c file.
-
-
-Usage
-~~~~~
-
-   c2c_extraction(strain1, strain2, chr = NULL, lower_bound = NULL,
-       upper_bound = NULL, config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"strain1"
-
-the key strain
-
-"strain2"
-
-the target strain
-
-"chr"
-
-if defined, the c2c will filtered according to the chromosome value
-
-"lower_bound"
-
-if defined, the c2c will filtered for part of the genome upper than
-lower_bound
-
-"upper_bound"
-
-if defined, the c2c will filtered for part of the genome lower than
-upper_bound
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: reformat an "apply manipulated" list of regions
-
-
-reformat an "apply manipulated" list of regions
------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-Utils to reformat an "apply manipulated" list of regions
-
-
-Usage
-~~~~~
-
-   collapse_regions(regions)
-
-
-Arguments
-~~~~~~~~~
-
-+-----------------+------+
-+-----------------+------+
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Compute Common Uninterrupted Regions (CUR)
-
-
-Compute Common Uninterrupted Regions (CUR)
-------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-CURs are regions that can be aligned between the genomes
-
-
-Usage
-~~~~~
-
-   compute_inter_all_strain_curs(diff_allowed = 30, min_cur_width = 4000,
-       config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"diff_allowed"
-
-the maximum indel width allowe din a CUR
-
-"min_cur_width"
-
-The minimum width of a CUR
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Crop bound of regions according to region of interest bound
-
-
-Crop bound of regions according to region of interest bound
------------------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-The fucntion is no more necessary since we remove "big_cur" bug in
-translate_cur function.
-
-
-Usage
-~~~~~
-
-   crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"tmp_fuzzy_nucs"
-
-the regiuons to be croped.
-
-"roi"
-
-The region of interest.
-
-"strain"
-
-The strain to consider.
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Adding list to a dataframe.
-
-
-Adding list to a dataframe.
----------------------------
-
-
-Description
-~~~~~~~~~~~
-
-Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*.
-Return the dataframe *df*.
-
-
-Usage
-~~~~~
-
-   dfadd(df, l)
-
-
-Arguments
-~~~~~~~~~
-
-"df"
-
-A dataframe
-
-"l"
-
-A list
-
-
-Value
-~~~~~
-
-Return the dataframe *df*.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   ## Here dataframe is NULL
-   print(df)
-   df = NULL
-
-   # Initialize df
-   df = dfadd(df, list(key1 = "value1", key2 = "value2"))
-   print(df)
-
-   # Adding elements to df
-   df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
-   print(df)
-
-R: Prefetch data
-
-
-Prefetch data
--------------
-
-
-Description
-~~~~~~~~~~~
-
-Fetch and filter inputs and outpouts per region of interest. Organize
-it per replicates.
-
-
-Usage
-~~~~~
-
-   fetch_mnase_replicates(strain, roi, all_samples, config = NULL,
-       only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE)
-
-
-Arguments
-~~~~~~~~~
-
-"strain"
-
-The strain we want mnase replicatesList of replicates. Each replicates
-is a vector of sample ids.
-
-"roi"
-
-Region of interest.
-
-"all_samples"
-
-Global list of samples.
-
-"config"
-
-GLOBAL config variable
-
-"only_fetch"
-
-If TRUE, only fetch and not filtering. It is used tio load sample
-files into memory before forking.
-
-"get_genome"
-
-If TRUE, load corresponding genome sequence.
-
-"get_ouputs"
-
-If TRUE, get also ouput corresponding TF output files.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Filter TemplateFilter inputs
-
-
-Filter TemplateFilter inputs
-----------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function filters TemplateFilter inputs according genome area
-observed properties. It takes into account reads that are at the
-frontier of this area and the strand of these reads.
-
-
-Usage
-~~~~~
-
-   filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160,
-       only_f = FALSE, only_r = FALSE, filter_for_coverage = FALSE)
-
-
-Arguments
-~~~~~~~~~
-
-"inputs"
-
-TF inputs to be filtered.
-
-"chr"
-
-Chromosome observed, here chr is an integer.
-
-"x_min"
-
-Coordinate of the first bp observed.
-
-"x_max"
-
-Coordinate of the last bp observed.
-
-"nuc_width"
-
-Nucleosome width.
-
-"only_f"
-
-Filter only F reads.
-
-"only_r"
-
-Filter only R reads.
-
-"filter_for_coverage"
-
-Does it filter for plot coverage?
-
-
-Value
-~~~~~
-
-Returns filtred inputs.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Filter TemplateFilter outputs
-
-
-Filter TemplateFilter outputs
------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function filters TemplateFilter outputs according, not only
-genome area observerved properties, but also correlation and
-overlapping threshold.
-
-
-Usage
-~~~~~
-
-   filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160,
-       ol_bp = 59, corr_thres = 0.5)
-
-
-Arguments
-~~~~~~~~~
-
-"tf_outputs"
-
-TemplateFilter outputs.
-
-"chr"
-
-Chromosome observed, here chr is an integer.
-
-"x_min"
-
-Coordinate of the first bp observed.
-
-"x_max"
-
-Coordinate of the last bp observed.
-
-"nuc_width"
-
-Nucleosome width.
-
-"ol_bp"
-
-Overlap Threshold.
-
-"corr_thres"
-
-Correlation threshold.
-
-
-Value
-~~~~~
-
-Returns filtered TemplateFilter Outputs
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: to flat aggregate_intra_strain_nucs function output
-
-
-to flat aggregate_intra_strain_nucs function output
----------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function builds a dataframe of all clusters obtain from
-aggregate_intra_strain_nucs function.
-
-
-Usage
-~~~~~
-
-   flat_aggregated_intra_strain_nucs(partial_strain_maps, cur_index)
-
-
-Arguments
-~~~~~~~~~
-
-"partial_strain_maps"
-
-the output of aggregate_intra_strain_nucs function
-
-"cur_index"
-
-the index of the roi involved
-
-
-Value
-~~~~~
-
-Returns a dataframe of all clusters obtain from
-aggregate_intra_strain_nucs function.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: flat reads
-
-
-flat reads
-----------
-
-
-Description
-~~~~~~~~~~~
-
-Extract reads coordinates from TempleteFilter input sequence
-
-
-Usage
-~~~~~
-
-   flat_reads(reads, nuc_width)
-
-
-Arguments
-~~~~~~~~~
-
-"reads"
-
-TemplateFilter input reads
-
-"nuc_width"
-
-Width used to shift F and R reads.
-
-
-Value
-~~~~~
-
-Returns a list of F reads, R reads and joint/shifted F and R reads.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Retrieve Reads
-
-
-Retrieve Reads
---------------
-
-
-Description
-~~~~~~~~~~~
-
-Retrieve reads for a given marker, combi, form.
-
-
-Usage
-~~~~~
-
-   get_all_reads(marker, combi, form = "wp", config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"marker"
-
-The marker to considere.
-
-"combi"
-
-The starin combination to considere.
-
-"form"
-
-The nuc form to considere.
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: get comp strand
-
-
-get comp strand
----------------
-
-
-Description
-~~~~~~~~~~~
-
-Compute the complementatry strand.
-
-
-Usage
-~~~~~
-
-   get_comp_strand(strand)
-
-
-Arguments
-~~~~~~~~~
-
-"strand"
-
-The original strand.
-
-
-Value
-~~~~~
-
-Returns the complementatry strand.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Build the design for deseq
-
-
-Build the design for deseq
---------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function build the design according sample properties.
-
-
-Usage
-~~~~~
-
-   get_design(marker, combi, all_samples)
-
-
-Arguments
-~~~~~~~~~
-
-"marker"
-
-The marker to considere.
-
-"combi"
-
-The starin combination to considere.
-
-"all_samples"
-
-Global list of samples.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Compute the fuzzy list for a given strain.
-
-
-Compute the fuzzy list for a given strain.
-------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function grabs the nucleosomes detxted by template_filter that
-have been rejected bt aggregate_intra_strain_nucs as well positions.
-
-
-Usage
-~~~~~
-
-   get_intra_strain_fuzzy(wp_map, roi, strain, config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"wp_map"
-
-Well positionned nucleosomes map.
-
-"roi"
-
-The region of interest.
-
-"strain"
-
-The strain we want to extracvt the fuzzy map.
-
-"config"
-
-GLOBAL config variable.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Compute the list of SNEPs for a given set of marker, strain...
-
-
-Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
--------------------------------------------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function uses
-
-
-Usage
-~~~~~
-
-   get_sneps(marker, combi, form, all_samples, config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"marker"
-
-The marker involved.
-
-"combi"
-
-The strain combination involved.
-
-"form"
-
-the nuc form involved.
-
-"all_samples"
-
-Global list of samples.
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   marker = "H3K4me1"
-   combi = c("BY", "YJM")
-   form = "wpunr" # "wp" | "unr" | "wpunr"
-   # foo = get_sneps(marker, combi, form)
-   # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
-
-R: Compute the unaligned nucleosomal regions (UNRs).
-
-
-Compute the unaligned nucleosomal regions (UNRs).
--------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function aggregate non common wp nucs for each strain and
-substract common wp nucs. It does not take care about the size of the
-resulting UNR. It will be take into account in the count read part og
-the pipeline.
-
-
-Usage
-~~~~~
-
-   get_unrs(combi, roi, cur_index, wp_maps, fuzzy_maps, common_nuc_results,
-       config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"combi"
-
-The strain combination to consider.
-
-"roi"
-
-The region of interest.
-
-"cur_index"
-
-The region of interest index.
-
-"wp_maps"
-
-Well positionned nucleosomes maps.
-
-"fuzzy_maps"
-
-Fuzzy nucleosomes maps.
-
-"common_nuc_results"
-
-Common wp nuc maps
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Returns the intersection of 2 list on regions.
-
-
-Returns the intersection of 2 list on regions.
-----------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function...
-
-
-Usage
-~~~~~
-
-   intersect_region(region1, region2)
-
-
-Arguments
-~~~~~~~~~
-
-"region1"
-
-Original regions.
-
-"region2"
-
-Regions to intersect.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Likelihood ratio
-
-
-Likelihood ratio
-----------------
-
-
-Description
-~~~~~~~~~~~
-
-Compute the log likelihood ratio of two or more set of value.
-
-
-Usage
-~~~~~
-
-   llr_score_nvecs(xs)
-
-
-Arguments
-~~~~~~~~~
-
-"xs"
-
-list of vectors.
-
-
-Value
-~~~~~
-
-Returns the log likelihood ratio.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   # LOD score for 2 set of values
-   mean1=5; sd1=2; card2 = 250
-   mean2=6; sd2=3; card1 = 200
-   x1 = rnorm(card1, mean1, sd1)
-   x2 = rnorm(card2, mean2, sd2)
-   min = floor(min(c(x1,x2)))
-   max = ceiling(max(c(x1,x2)))
-   hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
-   lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
-   lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
-   lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
-   llr_score_nvecs(list(x1,x2))
-
-R: nm
-
-
-nm
---
-
-
-Description
-~~~~~~~~~~~
-
-It provides a set of useful functions allowing to perform quantitative
-analysis of nucleosomal epigenome.
-
-
-Details
-~~~~~~~
-
-+-----------------+-----------------------------------------------------+
-| Package:        | nucleominer                                         |
-+-----------------+-----------------------------------------------------+
-| Maintainer:     | Florent Chuffart <florent.chuffart@ens-lyon.fr>     |
-+-----------------+-----------------------------------------------------+
-| Author:         | Florent Chuffart                                    |
-+-----------------+-----------------------------------------------------+
-| Version:        | 2.3.45                                              |
-+-----------------+-----------------------------------------------------+
-| License:        | CeCILL                                              |
-+-----------------+-----------------------------------------------------+
-| Title:          | nm                                                  |
-+-----------------+-----------------------------------------------------+
-| Depends:        | seqinr, plotrix, DESeq, cachecache                  |
-+-----------------+-----------------------------------------------------+
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Plot the distribution of reads.
-
-
-Plot the distribution of reads.
--------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This fuxntion use the deseq nomalization feature to compare
-qualitatively the distribution.
-
-
-Usage
-~~~~~
-
-   plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
-
-
-Arguments
-~~~~~~~~~
-
-"strain"
-
-The strain to considere.
-
-"marker"
-
-The marker to considere.
-
-"res"
-
-Data
-
-"all_samples"
-
-Global list of samples.
-
-"NEWPLOT"
-
-If FALSE the curve will be add to the current plot.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: sign from strand
-
-
-sign from strand
-----------------
-
-
-Description
-~~~~~~~~~~~
-
-Get the sign of strand
-
-
-Usage
-~~~~~
-
-   sign_from_strand(strands)
-
-
-Arguments
-~~~~~~~~~
-
-+-----------------+------+
-+-----------------+------+
-
-
-Value
-~~~~~
-
-If strand in forward then returns 1 else returns -1
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Substract to a list of regions an other list of regions that...
-
-
-Substract to a list of regions an other list of regions that intersect it.
---------------------------------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This fucntion embed a recursive part. It occurs when a substracted
-region split an original region on two.
-
-
-Usage
-~~~~~
-
-   substract_region(region1, region2)
-
-
-Arguments
-~~~~~~~~~
-
-"region1"
-
-Original regions.
-
-"region2"
-
-Regions to substract.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Switch a pairlist
-
-
-Switch a pairlist
------------------
-
-
-Description
-~~~~~~~~~~~
-
-Take a pairlist key:value and return the switched pairlist value:key.
-
-
-Usage
-~~~~~
-
-   switch_pairlist(l)
-
-
-Arguments
-~~~~~~~~~
-
-"l"
-
-The pairlist to switch.
-
-
-Value
-~~~~~
-
-The switched pairlist.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   l = list(key1 = "value1", key2 = "value2")
-   print(switch_pairlist(l))
-
-R: Translate coords of a genome region.
-
-
-Translate coords of a genome region.
-------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function is used in the examples, usualy you have to define your
-own translation function and overwrite this one using *unlockBinding*
-features. Please, refer to the example.
-
-
-Usage
-~~~~~
-
-   translate_cur(roi, strain2, config = NULL, big_cur = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"roi"
-
-Original genome region of interest.
-
-"strain2"
-
-The strain in wich you want the genome region of interest.
-
-"config"
-
-GLOBAL config variable
-
-"big_cur"
-
-A largest region than roi use to filter c2c if it is needed.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-
-Examples
-~~~~~~~~
-
-   # Define new translate_cur function...
-   translate_cur = function(roi, strain2, config) {
-       strain1 = roi$strain_ref
-       if (strain1 == strain2) {
-           return(roi)
-       } else {
-         stop("Here is my new translate_cur function...")
-       }
-   }
-   # Binding it by uncomment follwing lines.
-   # unlockBinding("translate_cur", as.environment("package:nm"))
-   # unlockBinding("translate_cur", getNamespace("nm"))
-   # assign("translate_cur", translate_cur, "package:nm")
-   # assign("translate_cur", translate_cur, getNamespace("nm"))
-   # lockBinding("translate_cur", getNamespace("nm"))
-   # lockBinding("translate_cur", as.environment("package:nm"))
-
-R: Translate a list of regions from a strain ref to another.
-
-
-Translate a list of regions from a strain ref to another.
----------------------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function is an eloborated call to translate_cur.
-
-
-Usage
-~~~~~
-
-   translate_regions(regions, combi, cur_index, config = NULL, roi)
-
-
-Arguments
-~~~~~~~~~
-
-"regions"
-
-Regions to be translated.
-
-"combi"
-
-Combination of strains.
-
-"cur_index"
-
-The region of interest index.
-
-"config"
-
-GLOBAL config variable
-
-"roi"
-
-The region of interest.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Aggregate regions that intersect themnselves.
-
-
-Aggregate regions that intersect themnselves.
----------------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function is based on sort of lower bounds to detect regions that
-intersect. We compare lower bound and upper bound of the porevious
-item. This function embed a while loop and break break regions list
-become stable.
-
-
-Usage
-~~~~~
-
-   union_regions(regions)
-
-
-Arguments
-~~~~~~~~~
-
-"regions"
-
-The Regions to be aggregated
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
-R: Watching analysis of samples
-
-
-Watching analysis of samples
-----------------------------
-
-
-Description
-~~~~~~~~~~~
-
-This function allows to view analysis for a particuler region of the
-genome.
-
-
-Usage
-~~~~~
-
-   watch_samples(replicates, read_length, plot_ref_genome = TRUE,
-       plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE,
-       plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE,
-       plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE,
-       change_col = TRUE, plot_wp_nucs = TRUE, plot_fuzzy_nucs = TRUE,
-       plot_wp_nuc_model = TRUE, plot_common_nucs = FALSE, plot_common_unrs = FALSE,
-       plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, plot_sample_id = FALSE,
-       aggregated_intra_strain_nucs = NULL, aligned_inter_strain_nucs = NULL,
-       height = 10, main = NULL, xlab = NULL, ylab = "#reads (per million reads)",
-       config = NULL)
-
-
-Arguments
-~~~~~~~~~
-
-"replicates"
-
-replicates under the form...
-
-"read_length"
-
-length of the reads
-
-"plot_ref_genome"
-
-Plot (or not) reference genome.
-
-"plot_arrow_raw_reads"
-
-Plot (or not) arrows for raw reads.
-
-"plot_arrow_nuc_reads"
-
-Plot (or not) arrows for reads aasiocied to a nucleosome.
-
-"plot_squared_reads"
-
-Plot (or not) reads in the square fashion.
-
-"plot_coverage"
-
-Plot (or not) reads in the covergae fashion. fashion.
-
-"plot_gaussian_reads"
-
-Plot (or not) gaussian model of a F anf R reads.
-
-"plot_gaussian_unified_reads"
-
-Plot (or not) gaussian model of a nuc.
-
-"plot_ellipse_nucs"
-
-Plot (or not) ellipse for a nuc.
-
-"change_col"
-
-Change the color of each nucleosome.
-
-"plot_wp_nucs"
-
-Plot (or not) cluster of nucs
-
-"plot_fuzzy_nucs"
-
-Plot (or not) cluster of fuzzy
-
-"plot_wp_nuc_model"
-
-Plot (or not) gaussian model for a cluster of nucs
-
-"plot_common_nucs"
-
-Plot (or not) aligned reads.
-
-"plot_common_unrs"
-
-Plot (or not) unaligned nucleosomal refgions (UNRs).
-
-"plot_wp_nucs_4_nonmnase"
-
-Plot (or not) clusters for non inputs samples.
-
-"plot_chain"
-
-Plot (or not) clusterised nuceosomes between mnase samples.
-
-"plot_sample_id"
-
-Plot (or not) the sample id for each sample.
-
-"aggregated_intra_strain_nucs"
-
-list of aggregated intra strain nucs. If NULL, it will be computed.
-
-"aligned_inter_strain_nucs"
-
-list of aligned inter strain nucs. If NULL, it will be computed.
-
-"height"
-
-Number of reads in per million read for each sample, graphical
-parametre for the y axis.
-
-"main"
-
-main title of the produced plot
-
-"xlab"
-
-xlab of the produced plot
-
-"ylab"
-
-ylab of the produced plot
-
-"config"
-
-GLOBAL config variable
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
diff --git a/doc/sphinx_doc/build/text/tuto.txt b/doc/sphinx_doc/build/text/tuto.txt
deleted file mode 100644
index 3fb8c7e..0000000
--- a/doc/sphinx_doc/build/text/tuto.txt
+++ /dev/null
@@ -1,696 +0,0 @@
-
-Tutorial
-********
-
-This tutorial describes steps allowing to perform quantitave analysis
-of nucleosomal epigenome. We assume that files are organised around a
-given hierarchie and that all command lines are launched from
-project's root.
-
-This tutorial is divided into t=wo main parts. First one consists in
-the python script *wf.py* that aligns and convert Illumina reads.
-Second one is the R script *main.r* that extracts information
-(nucleosome position and indicators) from the dataset.
-
-
-Python and R Common Configuration File
-======================================
-
-First of all we define in one place some configuration variables that
-will be launch by python and R scripts. This file is
-**configurator.py**. The execution of this python script dumps
-variables into the **nucleo_miner_config.json** that will be launch by
-both kind of scriopts (R and puython).
-
-To do this launch at the root of your project the following command
-line:
-
-   python src/current/configurator.py
-
-$$$ other python script to describe: - libcoverage.py - wf.py
-
-
-Dataset and Configuration Variables
-===================================
-
-We want to compare nucleosomes of 3 yeast strains:
-
-* BY
-
-* RM
-
-* YJM
-
-For each strain we perform Mnase-Seq and ChIP-Seq using the 5
-following markers:
-
-* H3K4me1
-
-* H3K4me3
-
-* H3K9ac
-
-* H3K14ac
-
-* H4K12ac
-
-In order to simplify the design of experiment, we considere Mnase as a
-marker. For each couple *(strain, marker)* we perform 3 replicates.
-So, theoritically we should have *3 * (1 + 5) * 3 = 54* samples. In
-practice we only obtain 2 replicates for *(YJM, H3K4me1)*. Each one of
-the 53 samples is indentify by a uniq identifier. The file
-*CSV_SAMPLE_FILE* sums up this information.
-
-configurator.CSV_SAMPLE_FILE = None
-
-   Path to cvs file that contains sample information.
-
-We use a convention to link sample and Illumina fastq outputs.
-Illumina output files of the sample *ID* will be stored in the
-directory *ILLUMINA_OUTPUTFILE_PREFIX* + *ID*. For example, sample 41
-outputs will be stored in the directory
-*data/2012-09-05/FASTQ/Sample_Yvert_Bq41/*.
-
-configurator.ILLUMINA_OUTPUTFILE_PREFIX = None
-
-   Prefix for Illumina fastq output files.
-
-For BY (resp. RM and YJM) we use following reference genome
-*saccharomyces_cerevisiae_BY_S288c_chromosomes.fasta* (resp.
-*saccharomyces_cerevisiae_rm11-1a_1_supercontigs.fasta* and
-*saccharomyces_cerevisiae_YJM_789_screencontig.fasta*). The index
-*FASTA_REFERENCE_GENOME_FILES* stores this information.
-
-configurator.FASTA_REFERENCE_GENOME_FILES = None
-
-   Dictionary where each fasta reference genomes is indexed by
-   reference strain that it corresponds.
-
-Each chromosome/contig is identify in the fasta file by an obscure
-identifier. For example, BY chromosome I is identify by
-*gi|144228165|ref|NC_001133.7|* when TemplateFilter is waiting for an
-integer. So, we translate it. The index *FASTA_INDEXES* stores this
-translation.
-
-configurator.FASTA_INDEXES = None
-
-   Dictionary of strain that indexes dictionaries where keys are
-   chromosome reference from Fastq file and value are its
-   correspondance for Templatefilter.
-
-From a pragamatical point of view we discard some part of the genome
-(repeated sequence etc...). The list of the black listed area is
-explicitely detailled in *AREA_BLACK_LIST*.
-
-configurator.AREA_BLACK_LIST = None
-
-   Dictionary where keys are strain and values are black listed of
-   geneome region.
-
-For BY-RM (resp. BY-YJM and RM-YJM) genome sequence alignment we use
-previously compute .c2c file
-*data/2012-03_primarydata/BY_RM_gxcomp.c2c* (resp.
-*BY_YJM_GComp_All.c2c* and *RM_YJM_gxcomp.c2c*). For more information
-about .c2c files, please read section 5 of the manual of
-*NucleoMiner*, the old version of *NucleoMiner2* (http://www.ens-
-lyon.fr/LBMC/gisv/NucleoMiner_Manual/manual.pdf).
-
-configurator.C2C_FILES = None
-
-   Dictionary where each strain combination indexes genome aligment.
-
-*nucleominer* uses specific directory to work in, these are described
-in *INDEX_DIR*, *ALIGN_DIR* and *LOG_DIR*.
-
-Finally, *nucleominer* use external ressources, the path to these
-resspources are describe in *BOWTIE_BUILD_BIN*, *BOWTIE2_BIN*,
-*SAMTOOLS_BIN*, *BEDTOOLS_BIN* and *TF_BIN* and *TF_TEMPLATES_FILE*.
-
-All paths, prefixes and indexes could be change in the
-*src/current/nucleominer_config.json* file.
-
-wf.json_conf_file = 'src/current/nucleominer_config.json'
-
-   Path to the json configuration file.
-
-
-Preprocessing Illumina Fastq Reads for Each Sample
-==================================================
-
-This preprocessing step consists in the 4 main steps embed in the
-*wf.py* and described bellow. As a preamble, this script computes
-*samples* *samples_mnase* and *strains* that will be used along the 4
-steps.
-
-wf.samples = []
-
-   List of samples where a sample is identify by an id (key: *id*) and
-   a strain name (key *strain*).
-
-wf.samples_mnase = []
-
-   List of Mnase samples.
-
-wf.strains = []
-
-   List of reference strains.
-
-
-Creating Bowtie Index from each Reference Genome
-------------------------------------------------
-
-For each strain, we need to create bowtie index. Bowtie index of a
-strain is a tree view of the genemoe reference for this strain. It
-will be used by bowtie to align reads. This step is performed by the
-following part of the *wf.py* script:
-
-     for strain in strains:
-       per_strain_stats[strain] = create_bowtie_index(strain, 
-         config["FASTA_REFERENCE_GENOME_FILES"][strain], config["INDEX_DIR"], 
-         config["BOWTIE_BUILD_BIN"])
-
-The following table sum up involved file sizes and process durations
-concerning this step.
-
-+--------+------------------------+------------------------+------------------+
-| strain | fasta genome file size | bowtie index file size | process duration |
-+========+========================+========================+==================+
-| BY     | 12 Mo                  | 25 Mo                  | 11 s.            |
-+--------+------------------------+------------------------+------------------+
-| RM     | 12 Mo                  | 24 Mo                  | 9 s.             |
-+--------+------------------------+------------------------+------------------+
-| YJM    | 12 Mo                  | 25 Mo                  | 11 s.            |
-+--------+------------------------+------------------------+------------------+
-
-
-Aligning Reads to Reference Genome
-----------------------------------
-
-Next, we launch bowtie to align reads to the reference genome. It
-produces a *.sam* file that we convert into a *.bed* file. Binaries
-for *bowtie*, *samtools* and *bedtools* are wrapped using python
-*subprocess* class. This step is performed by the followinw part of
-the *wf.py* script:
-
-     for sample in samples:
-       per_sample_align_stats["sample_%s" % sample["id"]] = align_reads(sample, 
-         config["ALIGN_DIR"], config["LOG_DIR"], config["INDEX_DIR"], 
-         config["ILLUMINA_OUTPUTFILE_PREFIX"], config["BOWTIE2_BIN"], 
-         config["SAMTOOLS_BIN"], config["BEDTOOLS_BIN"])
-
-
-Convert Aligned Reads for TemplateFilter
-----------------------------------------
-
-TemplateFilter use particular input format for reads, so we convert
-*.bed* file. TemplateFilter expect reads as following: *chr coord
-strand #read* where:
-
-* chr is the number of the chromosome;
-
-* coord is the coordinate of the reads;
-
-* strand is *F* for forward and *R* for reverse;
-
-* #reads the number of reads for this position.
-
-Each entry is *tab*-separated.
-
-**WARNING** for reverse strand bowtie returns the position of left
-first nucleotid when TemplateFilter is waiting for right one. So this
-step takes it into account and add lenght of reads (in our case 50) to
-reverse reads coordinate.
-
-This step is performed by the followinw part of the *wf.py* script:
-
-     for sample in samples:
-       per_sample_convert_stats["sample_%s" % sample["id"]] = split_fr_4_TF(sample, 
-         config["ALIGN_DIR"], config["FASTA_INDEXES"], config["AREA_BLACK_LIST"], 
-         config["READ_LENGTH"],config["MAPQ_THRES"])
-
-The following table sum up number of reads, involved file sizes and
-process durations concerning the two last steps. In our case, aligment
-process have been multuthreaded over over 3 cores.
-
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| id | Illumina reads | aligned and filtred reads | ratio  | *.bed* file size | TF input file size | process duration |
-+====+================+===========================+========+==================+====================+==================+
-| 1  | 16436138       | 10199695                  | 62,06% | 1064 Mo          | 60  Mo             | 383   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 2  | 16911132       | 12512727                  | 73,99% | 1298 Mo          | 64  Mo             | 437   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 3  | 15946902       | 12340426                  | 77,38% | 1280 Mo          | 65  Mo             | 423   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 4  | 13765584       | 10381903                  | 75,42% | 931  Mo          | 59  Mo             | 352   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 5  | 15168268       | 11502855                  | 75,83% | 1031 Mo          | 64  Mo             | 386   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 6  | 18850820       | 14024905                  | 74,40% | 1254 Mo          | 69  Mo             | 482   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 7  | 15591124       | 12126623                  | 77,78% | 1163 Mo          | 72  Mo             | 405   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 8  | 15659905       | 12475664                  | 79,67% | 1194 Mo          | 71  Mo             | 416   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 9  | 14668641       | 10960565                  | 74,72% | 1052 Mo          | 70  Mo             | 375   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 10 | 14339179       | 10454451                  | 72,91% | 1049 Mo          | 51  Mo             | 363   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 11 | 18019895       | 13688774                  | 75,96% | 1378 Mo          | 59  Mo             | 474   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 12 | 13746796       | 10810022                  | 78,64% | 1084 Mo          | 54  Mo             | 360   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 13 | 15205065       | 11766016                  | 77,38% | 990  Mo          | 54  Mo             | 381   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 14 | 17803097       | 13838883                  | 77,73% | 1154 Mo          | 60  Mo             | 452   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 15 | 15434564       | 12307878                  | 79,74% | 1032 Mo          | 57  Mo             | 394   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 16 | 16802587       | 12725665                  | 75,74% | 1221 Mo          | 48  Mo             | 438   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 17 | 16058417       | 12513734                  | 77,93% | 1192 Mo          | 63  Mo             | 422   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 18 | 16154482       | 13204331                  | 81,74% | 1277 Mo          | 52  Mo             | 430   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 19 | 21013924       | 17102120                  | 81,38% | 1646 Mo          | 59  Mo             | 555   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 20 | 17213114       | 14433357                  | 83,85% | 1389 Mo          | 53  Mo             | 459   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 21 | 17360907       | 14733001                  | 84,86% | 1203 Mo          | 55  Mo             | 450   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 22 | 18136816       | 15389581                  | 84,85% | 1257 Mo          | 53  Mo             | 469   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 23 | 14763678       | 12173025                  | 82,45% | 1140 Mo          | 56  Mo             | 393   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 24 | 15541709       | 12890345                  | 82,94% | 1057 Mo          | 48  Mo             | 398   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 25 | 16433215       | 13094314                  | 79,68% | 1241 Mo          | 57  Mo             | 433   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 26 | 17370850       | 14264136                  | 82,12% | 1347 Mo          | 51  Mo             | 466   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 27 | 14613512       | 8654495                   | 59,22% | 887  Mo          | 56  Mo             | 339   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 28 | 15248545       | 11367589                  | 74,55% | 1166 Mo          | 67  Mo             | 405   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 29 | 14316809       | 10767926                  | 75,21% | 1103 Mo          | 63  Mo             | 379   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 30 | 15178058       | 12265794                  | 80,81% | 1030 Mo          | 66  Mo             | 390   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 31 | 14968579       | 11876186                  | 79,34% | 1009 Mo          | 63  Mo             | 387   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 32 | 16912705       | 13550508                  | 80,12% | 1143 Mo          | 70  Mo             | 442   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 33 | 16782154       | 12755111                  | 76,00% | 1227 Mo          | 65  Mo             | 438   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 34 | 16741443       | 13168071                  | 78,66% | 1260 Mo          | 71  Mo             | 442   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 35 | 13096171       | 10367041                  | 79,16% | 992  Mo          | 62  Mo             | 350   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 36 | 17715118       | 14092985                  | 79,55% | 1404 Mo          | 68  Mo             | 483   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 37 | 17288466       | 7402082                   | 42,82% | 741  Mo          | 48  Mo             | 339   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 38 | 16116394       | 13178457                  | 81,77% | 1101 Mo          | 63  Mo             | 420   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 39 | 14241106       | 10537228                  | 73,99% | 880  Mo          | 57  Mo             | 348   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 40 | 13784738       | 10598464                  | 76,89% | 1005 Mo          | 64  Mo             | 358   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 41 | 12438007       | 9620975                   | 77,35% | 911  Mo          | 60  Mo             | 326   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 42 | 13853959       | 11031238                  | 79,63% | 1045 Mo          | 64  Mo             | 365   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 43 | 12036162       | 6654780                   | 55,29% | 684  Mo          | 46  Mo             | 268   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 44 | 13873129       | 10251074                  | 73,89% | 1048 Mo          | 61  Mo             | 365   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 45 | 19817751       | 14904502                  | 75,21% | 1520 Mo          | 72  Mo             | 528   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 46 | 13368959       | 10818619                  | 80,92% | 912  Mo          | 63  Mo             | 350   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 47 | 7566467        | 6139001                   | 81,13% | 520  Mo          | 44  Mo             | 201   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 48 | 32586928       | 21191363                  | 65,03% | 1816 Mo          | 82  Mo             | 766   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 49 | 30733184       | 18791373                  | 61,14% | 1801 Mo          | 89  Mo             | 721   s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 50 | 41287616       | 30383875                  | 73,59% | 2911 Mo          | 112 Mo             | 1065  s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 51 | 40439965       | 31177914                  | 77,10% | 2981 Mo          | 117 Mo             | 1070  s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 53 | 40876476       | 33780065                  | 82,64% | 3316 Mo          | 103 Mo             | 1165  s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-| 55 | 52424414       | 47117107                  | 89,88% | 3811 Mo          | 119 Mo             | 1477  s.         |
-+----+----------------+---------------------------+--------+------------------+--------------------+------------------+
-
-For some reasons (manipulation efficiency, e.g. PCR...), we remove
-samples 33, 45, 48 and 55.
-
-
-Run TemplateFilter on Mnase Samples
------------------------------------
-
-Finally, for each sample we perfome TemplateFilter analysis.
-
-**WARNING** TemplateFilter returns a list of nucleosomes. Each
-nucleosome is define by its center and its width. An odd width leads
-us to considere non interger lower and upper bound.
-
-**WARNING** TemplateFilter is not design to deal with replicate. So we
-choose to keep a maximum of nucleosome and filter in a second time
-using the benefit of replicate. To do that we set a low correlation
-threshold parameter (*0.5*) and a particularly high value of
-overlaping (*300%*).
-
-This step is performed by the followinw part of the *wf.py* script:
-
-     for sample in samples_mnase:
-       per_mnase_sample_stats["sample_%s" % sample["id"]] = template_filter(sample, 
-         config["ALIGN_DIR"], config["LOG_DIR"], config["TF_BIN"], 
-         config["TF_TEMPLATES_FILE"], config["TF_CORR"], config["TF_MINW"], 
-         config["TF_MAXW"], config["TF_OL"])  
-
-+----+--------+------------+---------------+------------------+
-| id | strain | found nucs | nuc file size | process duration |
-+====+========+============+===============+==================+
-| 1  | BY     | 96214      | 68 Mo         | 1022 s.          |
-+----+--------+------------+---------------+------------------+
-| 2  | BY     | 91694      | 65 Mo         | 1038 s.          |
-+----+--------+------------+---------------+------------------+
-| 3  | BY     | 91205      | 65 Mo         | 1036 s.          |
-+----+--------+------------+---------------+------------------+
-| 4  | RM     | 88076      | 62 Mo         | 984 s.           |
-+----+--------+------------+---------------+------------------+
-| 5  | RM     | 90141      | 64 Mo         | 967 s.           |
-+----+--------+------------+---------------+------------------+
-| 6  | RM     | 87517      | 62 Mo         | 980 s.           |
-+----+--------+------------+---------------+------------------+
-| 7  | YJM    | 88945      | 64 Mo         | 566 s.           |
-+----+--------+------------+---------------+------------------+
-| 8  | YJM    | 88689      | 64 Mo         | 570 s.           |
-+----+--------+------------+---------------+------------------+
-| 9  | YJM    | 88128      | 63 Mo         | 565 s.           |
-+----+--------+------------+---------------+------------------+
-
-
-Inferring Nucleosome Position and Extracting Read Counts
-========================================================
-
-The second part of the tutorial uses *R*
-(http://http://www.r-project.org). It consists in a set of R scripts
-taht will be sourced in an R console launched at the root of your
-project. the R srcipts are:
-
-   * headers.R
-
-   * extract_maps.R
-
-   * compare_common_wp.R
-
-   * split_samples.R
-
-   * count_reads.R
-
-   * get_size_factors
-
-   * launch_deseq.R
-
-
-The Script headers.R
---------------------
-
-The script header.R is included in each other scripts. It is in charge
-of:
-
-   * launching libraries used in thes scripts
-
-   * launching configuration (design, strain, marker...)
-
-   * computing and caching CURs
-
-In your R console, run the following command line:
-
-   R CMD BATCH src/current/header.R
-
-
-The Script extract_maps.R
--------------------------
-
-This script is in charge of extracting Maps for well positioned and
-fuzzy nucleosomes. First of all, this script computed intra and inter
-strain nucleosome maps for each CUR. This step is executed in parallel
-on many cores using the BoT library. Next, it collects results and
-produces well positioned, fuzzy and UNR maps.
-
-The well-positioned map for BY is collected in the result directory
-and is called **BY_wp.tab**. It is composed of following columns:
-
-   * chr, the number of the chromosome
-
-   * lower_bound, the lower bound of the nucleosome
-
-   * upper_bound, the upper bound of the nucleosome
-
-   * cur_index, index of the CUR
-
-   * index_nuc, the index of the nucleosome in the CUR
-
-   * wp, 1 if it is a well positioned nucleosome, 0 else
-
-   * nb_reads, the number of reads that supports this nucleosome
-
-   * nb_nucs, the number of TemplateFilter nucleosome across
-     replicates (= the number of replicates if it is a well-positioned
-     nucleosome)
-
-   * llr_1, for a well-positioned nucleosome, it is the LLR1 between
-     the first and the second TemplateFilter nucleosome.
-
-   * llr_2, for a well-positioned nucleosome, it is the LLR1 between
-     the second and the first TemplateFilter nucleosome.
-
-   * wp_llr, for a well-positioned nucleosome, it is the LLR2
-     overall TemplateFilter nucleosomes.
-
-   * wp_pval, for a well-positioned nucleosome, it is the p-value
-     chi square test obtained with the LLR2 (**1-pchisq(2.LLR2,
-     df=4)**)
-
-   * dyad_shift, for a well-positioned nucleosome, it is shift
-     between the two extreme TemplateFilter nucleosome dyad positions.
-
-The fuzzy map for BY is collected in the result directory and is
-called **BY_fuzzy.tab**. It is composed of following columns:
-
-   * chr, the number of the chromosome
-
-   * lower_bound, the lower bound of the nucleosome
-
-   * upper_bound, the upper bound of the nucleosome
-
-   * cur_index, index of the CUR
-
-The common well-position map for BY and RM strains is collected in the
-result directory and is called **BY_RM_common_wp.tab**. It is composed
-of following columns:
-
-   * cur_index, the index of the CUR
-
-   * index_nuc_BY, the index of the BY nucleosome in the CUR
-
-   * index_nuc_RM,the index of the RM nucleosome in the CUR
-
-   * llr_score, the LLR3 score between th eBy and RM nucleosomes
-
-   * common_wp_pval,  the p-value chi square test obtained with the
-     LLR3 (**1-pchisq(2.LLR3, df=2)**)
-
-The common UNR map for BY and RM strains is collected in the result
-directory and is called **BY_RM_common_unr.tab**. It is composed of
-following columns:
-
-   * cur_index, the index of the CUR
-
-   * index_nuc_BY, the index of the BY nucleosome in the CUR
-
-   * index_nuc_RM,the index of the RM nucleosome in the CUR
-
-To execute this script, run the following command line in your R
-console:
-
-   source("src/current/extract_maps.R")
-
-
-The Script compare_common_wp.R
-------------------------------
-
-This script is used to compare inter strain distances between common
-well-positioned nucleosomes.
-
-For example, it compute the file **BY_RM_common_wp_diff.tab** that
-contains dyad shifts between two well-positioned nucleosomes. It is
-composed of following columns:
-   * cur_index, the index of the CUR
-
-   * index_nuc_BY, the index of the BY nucleosome in the CUR
-
-   * index_nuc_RM,the index of the RM nucleosome in the CUR
-
-   * llr_score, the LLR3 score between th eBy and RM nucleosomes
-
-   * common_wp_pval,  the p-value chi square test obtained with the
-     LLR3 (**1-pchisq(2.LLR3, df=2)**)
-
-   * diff, the dyad shifts between two well-positioned nucleosomes
-
-It also translates well-positioned nucleosome maps from a strain to an
-other strain and stores it into a table.
-
-For example, the file **results/2014-04/RM_wp_tr_2_BY.tab** contains
-RM well-positioned nucleosome translated into the BY genome
-referential. It is composed of following columns:
-
-   * strain_ref, the reference genome (in which positioned are
-     defined)
-
-   * begin, the translated lower bound of the nucleosome
-
-   * end, the translated upper bound of the nucleosome
-
-   * chr, the number of chromosome for the reference genome (in
-     which positioned are defined)
-
-   * length, the length of the nucleosome (could be negative)
-
-   * cur_index, the index of the CUR
-
-   * index_nuc, the index of the nucleosome in the CUR
-
-To execute this script, run the following command line in your R
-console:
-
-   R CMD BATCH src/current/compare_common_wp.R
-
-
-Split and Compress Samples According CURs
------------------------------------------
-
-   R CMD BATCH src/current/split_samples.R
-
-
-Count Reads for Each Nucleosome
--------------------------------
-
-   R CMD BATCH src/current/count_reads.R
-
-
-Get Size Factors Using DESeq
-----------------------------
-
-   R CMD BATCH src/current/get_size_factors.R
-
-
-Performing DESeq Analysis
--------------------------
-
-   R CMD BATCH src/current/launch_deseq.R
-
-
-Results
-=======
-
-
-Output Files Organisation
--------------------------
-
-Previous steps produce following 45 files. Each filename is under the
-form
-
-   results/current/[combi]_[marker]_[form]_snep.tab
-
-Where combi is in {BY_RM, BY_YJM, RM_YJM} for each strain combination,
-marker is in {H3K4me1, H3K4me3, H3K9ac, H3K14ac, H4K12ac} for each
-post translational histone modification and form is in {wp, fuzzy,
-wpfuzzy} considering well positioned nucleosomes, fuzzy nucleosomes or
-both for SNEP computation.
-
-chr_BY lower_bound_BY upper_bound_BY index_nuc_BY chr_RM
-lower_bound_RM upper_bound_RM index_nuc_RM roi_index form
-BY_Mnase_Seq_1 BY_Mnase_Seq_2 BY_Mnase_Seq_3 RM_Mnase_Seq_4
-RM_Mnase_Seq_5 RM_Mnase_Seq_6 BY_H3K14ac_36 BY_H3K14ac_37
-BY_H3K14ac_53 RM_H3K14ac_38 RM_H3K14ac_39 pvalsGLM
-
-For each file, there is 1 line per nucleosome and each line is
-composed of many columns divided into 3 main topics:
-   * nuc information
-
-   * number opf reads for each sample
-
-   * DESeq analysis results.
-
-For exemple for the file *BY_RM_H3K14ac_wp_snep.tab* informations are:
-   * chr_BY, the BY chr involved
-
-   * lower_bound_BY, the lower bound of the BY nuc
-
-   * upper_bound_BY, the upper_bound of the BY nuc
-
-   * index_nuc_BY, the index of the nuc in the entire list of BY
-     nucs
-
-   * chr_RM, lower_bound_RM, upper_bound_RM, index_nuc_RM
-
-        are the same information for the RM strain
-
-   * roi_index, the index of the region of interrest involved.
-
-Next cols concern indicators for each sample. They are labeled
-[strain]_[marker]_[sample_id] and each value represents the number of
-reads for the current nuc for the sample *sample_id*.
-
-The 5 final columns concern DESeq analysis:
-   * manip[a_manip] strain[a_strain]
-     manip[a_strain]:strain[a_strain], the manip (marker) effect, the
-     strain effect and the snep effect.
-
-   * pvalsGLM, the pvalue resulting of the comparison of the GLM
-     model considering or the interaction term *marker:strain*
-
-   * snep_index, a boolean set to TRUE if the *pvalueGLM* value is
-     under the threshold computed with FDR function with a rate set to
-     0.01%.
-
-It also produces the file that explicts size factor for each involved
-sample in differents strain combination and nucleosomal region type:
-
-TODO: include this file...
-/home/filleton/analyses/snepcatalog/data/2013-10-09/current/README.txt
-
-   results/current/size_factors.tab
-
-
-Number of SNEPs
----------------
-
-Here are the number of computed for each forms.
-
-   [1] "wp"
-          #nucs H3K4me1 H3K4me3 H3K9ac H3K14ac H4K12ac
-   BY-RM  30234     520     798     83    3566      26
-   BY-YJM 31298     303     619    102     103     128
-   RM-YJM 29863     129     340     46    3177      18
-   [1] "fuzzy"
-          #nucs H3K4me1 H3K4me3 H3K9ac H3K14ac H4K12ac
-   BY-RM  10748     294     308    101    1681      42
-   BY-YJM 10669     122     176    124      93      87
-   RM-YJM 11478      54     112     41    1389      20
-   [1] "wpfuzzy"
-          #nucs H3K4me1 H3K4me3 H3K9ac H3K14ac H4K12ac
-   BY-RM  40982     770    1136    183    5404      73
-   BY-YJM 41967     439     804    214     198     199
-   RM-YJM 41341     184     468     87    4687      37
-
-TODO:
-   * Print/study intra/inter strain LODs.
-
-   * Check the normality of sample using Shapiro–Wilk (Hypothesis
-     for computing LODs)
diff --git a/doc/sphinx_doc/conf.py b/doc/sphinx_doc/conf.py
index e4c39c1..28af47b 100644
--- a/doc/sphinx_doc/conf.py
+++ b/doc/sphinx_doc/conf.py
@@ -17,7 +17,7 @@ import sys, os
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #sys.path.insert(0, os.path.abspath('.'))
-sys.path.insert(0, os.path.abspath('../../../snep/src/current'))
+sys.path.insert(0, os.path.abspath('../Chuffart_NM2_workdir/src/current'))
 
 # -- General configuration -----------------------------------------------------
 
@@ -185,7 +185,7 @@ latex_elements = {
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, documentclass [howto/manual]).
 latex_documents = [
-  ('index', 'NucleoMiner2.tex', u'nucleo\\_miner Documentation',
+  ('index', 'NucleoMiner2.tex', u'NucleoMiner2 Documentation',
    u'Florent CHUFFART, Jean-Baptiste VEYRIERAS, Gael YVERT', 'manual'),
 ]
 
diff --git a/doc/sphinx_doc/index.rst b/doc/sphinx_doc/index.rst
index 08476d2..4c0d76f 100644
--- a/doc/sphinx_doc/index.rst
+++ b/doc/sphinx_doc/index.rst
@@ -23,14 +23,14 @@ Welcome to `NucleoMiner2`
 
 
 
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`search`
-
-
-
+.. Indices and tables
+.. ==================
+..
+.. * :ref:`genindex`
+.. * :ref:`search`
+..
+..
+..
 
 
 
diff --git a/doc/sphinx_doc/readme.rst b/doc/sphinx_doc/readme.rst
index 5297955..c16a59b 100644
--- a/doc/sphinx_doc/readme.rst
+++ b/doc/sphinx_doc/readme.rst
@@ -2,48 +2,46 @@
 Readme / Documentation for `NucleoMiner2`
 *****************************************
 
-`NucleoMiner2` offers Python API and R package allowing to perform 
-quantitative analysis of nucleosomal epigenome. It is especially well 
-suited for scripting to extract natural Single-Nucleosome Epi-
-Polymorphisms (SNEP) from ChIP-Seq data.
+`NucleoMiner2` offers Python API and R package allowing to perform quantitative analysis of epigenetic marks on individual nucleosomes. It was developed to detect natural Single-Nucleosome Epi-Polymorphisms (SNEP) from MNase-seq and ChIP-seq data.
 
 License
 =======
 
-Copyright CNRS 2012-2013                                                 
-                                                                          
-- Florent CHUFFART                                                         
-- Jean-Baptiste VEYRIERAS                                                  
-- Gael YVERT                                                               
-                                                                          
+Copyright CNRS 2012-2013
+
+- Florent CHUFFART
+- Jean-Baptiste VEYRIERAS
+- Gael YVERT
+
 This software is a computer program which purpose is to perform quanti-
-tative analysis of epigenetic marks at single nucleosome resolution.     
-                                                                          
-This software is governed by the CeCILL license under French law and     
-abiding by the rules of distribution of free software.  You can  use,    
-modify and/ or redistribute the software under the terms of the CeCILL   
-license as circulated by CEA, CNRS and INRIA at the following URL        
-"http://www.cecill.info".                                                
-                                                                          
-As a counterpart to the access to the source code and  rights to copy,   
-modify and redistribute granted by the license, users are provided only  
-with a limited warranty  and the software's author,  the holder of the   
-economic rights,  and the successive licensors  have only  limited       
-liability.                                                               
-                                                                          
-In this respect, the user's attention is drawn to the risks associated   
-with loading,  using,  modifying and/or developing or reproducing the    
-software by the user in light of its specific status of free software,   
-that may mean  that it is complicated to manipulate,  and  that  also    
-therefore means  that it is reserved for developers  and  experienced    
-professionals having in-depth computer knowledge. Users are therefore    
-encouraged to load and test the software's suitability as regards their  
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the    
-same conditions as regards security.                                     
-                                                                          
-The fact that you are presently reading this means that you have had     
-knowledge of the CeCILL license and that you accept its terms.           
+tative analysis of epigenetic marks at single nucleosome resolution.
+
+This software is governed by the CeCILL license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+This software is provided with absolutely NO WARRANTY. The authors can not be held responsible, even partially, for any damage, loss, financial loss or any other undesired facts resulting from the use of the software.
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
 
 Installation Instructions
 =========================
@@ -51,48 +49,56 @@ Installation Instructions
 Links
 -----
 
-`NucleoMiner2` home page and documentation: https://forge.cbp.ens-lyon.fr/redmine/projects/nucleominer
+`NucleoMiner2` home page and documentation are available here:
+
+  - https://forge.cbp.ens-lyon.fr/redmine/projects/nucleominer
+
+The Yvert lab web page is accessible here:
 
-Gael Yvert lab page: http://www.ens-lyon.fr/LBMC/gisv/
+  - http://www.ens-lyon.fr/LBMC/gisv/
 
 
 Installation
 ------------
 
- - Download archive
- - Compile bowtie2
- - Compile samtools
- - Compile bedtools
- - Compile TemplateFilter
+The first installation step is to retrieve the source code of MyLabStocks. You can do this by typing the following command in a terminal.
+
+.. code:: bash
+
+  git clone http://forge.cbp.ens-lyon.fr/git/nucleominer
+..
+
+
+Prerequisites
+^^^^^^^^^^^^^
+
+To work properly, NucleoMiner2 needs that the following free software are installed and made available on your system:
+
+ - Bowtie2 http://bowtie-bio.sourceforge.net/bowtie2
+ - SAMtools http://samtools.sourceforge.net
+ - bedtools http://code.google.com/p/bedtools/
+ - TemplateFilter http://compbio.cs.huji.ac.il/NucPosition/TemplateFiltering
+
+It also requires the following R packages to be installed on your system:
 
-Required R packages:
- - bot
  - fork
  - rjson
  - seqinr
- - cachecache
+ - cachecache https://forge.cbp.ens-lyon.fr/redmine/projects/cachecache
+ - bot https://forge.cbp.ens-lyon.fr/redmine/projects/bot
+ - nucleominer https://forge.cbp.ens-lyon.fr/redmine/projects/nucleominer
+ 
+The first packages could be installed by typing the following command in an R console:
+
+
+ 
+The last packages are available in the git repository they could be install by typing the following command in your terminal:
 
 .. code:: bash
 
-  cd src/r_packages/
-	tar xfvz R-latest.tar.gz 
-	cd R-patched 
-	./configure --with-x=no PDFLATEX="ls"
-	make
-  cd ../../..	
-  R_BIN=src/r_packages/R-patched/bin/R 
-	$R_BIN CMD INSTALL src/r_packages/rjson_0.2.12.tar.gz 
-	$R_BIN CMD INSTALL src/r_packages/seqinr_3.0-7.tar.gz 
-	$R_BIN CMD INSTALL src/r_packages/plotrix_3.4-5.tar.gz 
-	$R_BIN CMD INSTALL src/r_packages/nm_2.0.tar.gz 
-	$R_BIN CMD INSTALL src/r_packages/fork_1.2.4.tar.gz 
-	$R_BIN CMD INSTALL src/r_packages/bot_0.9.tar.gz 
-	$R_BIN CMD INSTALL src/r_packages/DESeq_1.14.0.tar.gz 
-		 
-
-...
-
-usage
-=====
-
-See html documentation for `NucleoMiner2`: http://www.ens-lyon.fr/LBMC/gisv/
+  cd nucleominer
+   R CMD INSTALL doc/Chuffart_NM2_workdir/deps/bot_0.14.tar.gz\
+      doc/Chuffart_NM2_workdir/deps/cachecache_0.1.tar.gz\
+      build/nucleominer_2.XXX.tar.gz 
+      
+      
\ No newline at end of file
diff --git a/doc/sphinx_doc/rref.rst b/doc/sphinx_doc/rref.rst
index 73afad1..724e329 100644
--- a/doc/sphinx_doc/rref.rst
+++ b/doc/sphinx_doc/rref.rst
@@ -4,7 +4,7 @@ Arabic to Roman pair list.
 Description
 ~~~~~~~~~~~
 
-Util to convert Arabicto Roman
+Utility to convert Arabic numbers to Roman numbers
 
 Usage
 ~~~~~
@@ -72,7 +72,7 @@ Roman to Arabic pair list.
 Description
 ~~~~~~~~~~~
 
-Util to convert Roman to Arabic
+Utility to convert Roman numbers into Arabic numbers
 
 Usage
 ~~~~~
@@ -94,16 +94,17 @@ Aggregate replicated sample's nucleosomes.
 Description
 ~~~~~~~~~~~
 
-This function aggregates nucleosome for replicated samples. It uses
+This function aggregates nucleosomes from replicated samples. It uses
 TemplateFilter ouput of each sample as replicate. Each sample owns a set
 of nucleosomes computed using TemplateFilter and ordered by the position
-of their center. Adajacent nucleosomes are compared two by two.
-Comparison is based on a log likelihood ratio score. The issue of
-comparison is adjacents nucleosomes merge or separation. Finally the
-function returns a list of clusters and all computed *llr\_scores*. Each
-cluster ows an attribute *wp* for "well positionned". This attribute is
-set as *TRUE* if the cluster is composed of exactly one nucleosomes of
-each sample.
+of their center (dyad). A chain of nucleosomes is builts across all
+replicates. Adjacent nucleosomes of the chain are compared two by two.
+Comparison is based on a log likelihood ratio (LLR1). depending on the
+LLR1 value nucleosomes are merged (low LLR) or separated (high LLR).
+Finally the function returns a list of clusters and all computed
+llr\_scores. Each cluster ows an attribute wp for “well positioned”.
+This attribute is set to TRUE if the cluster is composed of exactly one
+nucleosome of each sample.
 
 Usage
 ~~~~~
@@ -123,7 +124,7 @@ list(name=..., begin=..., end=..., chr=..., genome=...)*.
 
 ``llr_thres``
 
-Log likelihood ration threshold.
+Log likelihood ratio threshold to decide between merging and separating
 
 ``coord_max``
 
@@ -176,7 +177,8 @@ Aligns nucleosomes between 2 strains.
 Description
 ~~~~~~~~~~~
 
-This function aligns nucs between two strains for a given genome region.
+This function aligns nucleosomes between two strains for a given genome
+region.
 
 Usage
 ~~~~~
@@ -196,12 +198,12 @@ Set of replicates, ideally 3 per strain.
 
 ``wp_nucs_strain_ref1``
 
-List of aggregates nucleosome for strain 1. If it's null this list will
+List of aggregates nucleosome for strain 1. If it's NULL this list will
 be computed.
 
 ``wp_nucs_strain_ref2``
 
-List of aggregates nucleosome for strain 2. If it's null this list will
+List of aggregates nucleosome for strain 2. If it's NULL this list will
 be computed.
 
 ``corr_thres``
@@ -210,7 +212,7 @@ Correlation threshold.
 
 ``llr_thres``
 
-LOD cut off.
+Log likelihood ratio threshold to decide between merging and separating
 
 ``config``
 
@@ -278,17 +280,16 @@ Examples
     }
     print(align_inter_strain_nucs(replicates))
 
-R: Launch deseq methods.
+R: Launch DESeq methods.
 
-Launch deseq methods.
+Launch DESeq methods.
 ---------------------
 
 Description
 ~~~~~~~~~~~
 
-This function is based on deseq example. It mormalizes data, fit data to
-GLM model with and without interaction term and compare the two
-l;=models.
+This function is based on DESeq example. It normalizes data, fit data to
+GLM model with and without interaction term and compares the two models.
 
 Usage
 ~~~~~
@@ -302,11 +303,11 @@ Arguments
 
 ``snep_design``
 
-The design to considere.
+The design to consider.
 
 ``reads``
 
-The data to considere.
+The data to consider.
 
 Author(s)
 ~~~~~~~~~
@@ -321,7 +322,7 @@ Stage replicates data
 Description
 ~~~~~~~~~~~
 
-This function loads in memory data corresponding to the given
+This function loads in memory the data corresponding to the given
 experiments.
 
 Usage
@@ -337,7 +338,7 @@ Arguments
 
 ``expe``
 
-a list of vector corresponding to vector of replicates.
+a list of vectors corresponding to replicates.
 
 ``roi``
 
@@ -373,7 +374,7 @@ Examples
     # library(nucleominer)
     #
     # # Read config file
-    # json_conf_file = "nucleo_miner_config.json"
+    # json_conf_file = "nucleominer_config.json"
     # config = fromJSON(paste(readLines(json_conf_file), collapse=""))
     # # Read sample file
     # all_samples = get_content(config$CSV_SAMPLE_FILE, "cvs", sep=";", head=TRUE, stringsAsFactors=FALSE)
@@ -405,7 +406,7 @@ Extract a sub part of the corresponding c2c file
 Description
 ~~~~~~~~~~~
 
-This fonction allow to acces to a specific part of the c2c file.
+This fonction allows to access to a specific part of the c2c file.
 
 Usage
 ~~~~~
@@ -428,16 +429,16 @@ the target strain
 
 ``chr``
 
-if defined, the c2c will filtered according to the chromosome value
+if defined, the c2c will be filtered according to the chromosome value
 
 ``lower_bound``
 
-if defined, the c2c will filtered for part of the genome upper than
+if defined, the c2c will be filtered for part of the genome upper than
 lower\_bound
 
 ``upper_bound``
 
-if defined, the c2c will filtered for part of the genome lower than
+if defined, the c2c will be filtered for part of the genome lower than
 upper\_bound
 
 ``config``
@@ -950,9 +951,9 @@ Author(s)
 
 Florent Chuffart
 
-R: Build the design for deseq
+R: Build the design for DESeq
 
-Build the design for deseq
+Build the design for DESeq
 --------------------------
 
 Description
@@ -1044,7 +1045,7 @@ Usage
 
 ::
 
-    get_sneps(marker, combi, form, all_samples, config = NULL)
+    get_sneps(marker, combi, form, all_samples, FDR = 1e-04, config = NULL)
 
 Arguments
 ~~~~~~~~~
@@ -1065,6 +1066,8 @@ the nuc form involved.
 
 Global list of samples.
 
+``FDR``
+
 ``config``
 
 GLOBAL config variable
@@ -1214,7 +1217,7 @@ Examples
 
 ::
 
-    # LOD score for 2 set of values
+    # LLR score for 2 set of values
     mean1=5; sd1=2; card2 = 250
     mean2=6; sd2=3; card1 = 200
     x1 = rnorm(card1, mean1, sd1)
@@ -1270,7 +1273,7 @@ Plot the distribution of reads.
 Description
 ~~~~~~~~~~~
 
-This fuxntion use the deseq nomalization feature to compare
+This fuxntion use the DESeq nomalization feature to compare
 qualitatively the distribution.
 
 Usage
@@ -1491,7 +1494,7 @@ Translate a list of regions from a strain ref to another.
 Description
 ~~~~~~~~~~~
 
-This function is an eloborated call to translate\_cur.
+This function is an elaborated call to translate\_cur.
 
 Usage
 ~~~~~
@@ -1528,10 +1531,10 @@ Author(s)
 
 Florent Chuffart
 
-R: Aggregate regions that intersect themnselves.
+R: Aggregate regions that intersect themselves.
 
-Aggregate regions that intersect themnselves.
----------------------------------------------
+Aggregate regions that intersect themselves.
+--------------------------------------------
 
 Description
 ~~~~~~~~~~~
diff --git a/doc/sphinx_doc/tuto.rst b/doc/sphinx_doc/tuto.rst
index 4201ca8..f1ee89b 100644
--- a/doc/sphinx_doc/tuto.rst
+++ b/doc/sphinx_doc/tuto.rst
@@ -1,125 +1,85 @@
 Tutorial
 ========
 
-This tutorial describes steps allowing to perform quantitave analysis of 
-nucleosomal epigenome. We assume that files are organised around a given 
-hierarchie and that all command lines are launched from project's root.
+This tutorial describes steps allowing performing quantitative analysis of epigenetic marks on individual nucleosomes. We assume that files are organised according to a given hierarchy and that all command lines are launched from the project’s root directory.
 
-This tutorial is divided into t=wo main parts. First one consists in the python 
-script `wf.py` that aligns and convert Illumina reads. Second one is the R 
-script `main.r` that extracts information (nucleosome position and indicators) 
-from the dataset.
+This tutorial is divided into two main parts. The first part covers the python script `wf.py` that aligns and converts short sequence reads. The second part covers the R scripts that extracts information (nucleosome position and indicators) from the dataset.
 
 
-Python and R Common Configuration File
---------------------------------------
-
-First of all we define in one place some configuration variables that will be launch by python and R scripts. This file is **configurator.py**. The execution of this python script dumps variables into the **nucleo_miner_config.json** that will be launch by both kind of scriopts (R and puython).
-
-To do this launch at the root of your project the following command line:
 
-.. code:: bash
 
-  python src/current/configurator.py
-  
+Experimental Dataset, Working Directory and Configuration File 
+--------------------------------------------------------------
 
-$$$ other python script to describe:
-- libcoverage.py
-- wf.py
+Working Directory Organisation
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+The working directory... 
 
+$$$ TODO: Explain how and where retrieve the workdir
 
 
 
-Dataset and Configuration Variables
------------------------------------
+Retrieving Experimental Dataset
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-We want to compare nucleosomes of 3 yeast strains: 
+The MNase-seq and MN-ChIP-seq raw data are available at ArrayExpress (http://www.ebi.ac.uk/arrayexpress/) under accession number E-MTAB-2671.
 
-- BY
-- RM
-- YJM
+$$$ TODO explain how organise Experimental Dataset into the `data` directory of the working directory.
 
-For each strain we perform Mnase-Seq and ChIP-Seq using the 5 following 
-markers: 
 
-- H3K4me1
-- H3K4me3
-- H3K9ac
-- H3K14ac
-- H4K12ac
+We want to compare nucleosomes of 2 yeast strains: BY and RM. For each strain we performed Mnase-Seq and ChIP-Seq using an antibody recognizing the H3K14ac epigenetic mark.
 
-In order to simplify the design of experiment, we considere Mnase as a marker. 
-For each couple `(strain, marker)` we perform 3 replicates. So, theoritically 
-we should have `3 * (1 + 5) * 3 = 54` samples. In practice we only obtain 2 
-replicates for `(YJM, H3K4me1)`. Each one of the 53 samples is indentify by a 
-uniq identifier. The file `CSV_SAMPLE_FILE` sums up this information.
+The dataset is composed of 55 files organised as follows: 
 
-.. autodata:: configurator.CSV_SAMPLE_FILE
-    :noindex: 
-		
-We use a convention to link sample and Illumina fastq outputs. Illumina output 
-files of the sample `ID` will be stored in the directory 
-`ILLUMINA_OUTPUTFILE_PREFIX` + `ID`. For example, sample 41 outputs will be 
-stored in the directory `data/2012-09-05/FASTQ/Sample_Yvert_Bq41/`.
-
-.. autodata:: configurator.ILLUMINA_OUTPUTFILE_PREFIX
-    :noindex: 
-
-For BY (resp. RM and YJM) we use following reference genome 
-`saccharomyces_cerevisiae_BY_S288c_chromosomes.fasta`
-(resp. `saccharomyces_cerevisiae_rm11-1a_1_supercontigs.fasta` and 
-`saccharomyces_cerevisiae_YJM_789_screencontig.fasta`).
-The index `FASTA_REFERENCE_GENOME_FILES` stores this information.
+  - 3 replicates for BY MNase Seq
+  
+    - sample 1 (5 fastq.gz files)
+    - sample 2 (5 fastq.gz files)
+    - sample 3 (4 fastq.gz files)
+    
+  - 3 replicates for RM MNase Seq
+  
+    - sample 4 (4 fastq.gz files)
+    - sample 5 (4 fastq.gz files)
+    - sample 6 (5 fastq.gz files)
+    
+  - 3 replicates for BY ChIP Seq H3K14ac
+  
+    - sample 36 (5 fastq.gz files)
+    - sample 37 (5 fastq.gz files)
+    - sample 53 (9 fastq.gz files)
+    
+  - 2 replicates for RM ChIP Seq H3K14ac
+  
+    - sample 38 (5 fastq.gz files)
+    - sample 39 (4 fastq.gz files)
+    
 
-.. autodata:: configurator.FASTA_REFERENCE_GENOME_FILES
-    :noindex: 
 
-Each chromosome/contig is identify in the fasta file by an obscure identifier. 
-For example, BY chromosome I is identify by `gi|144228165|ref|NC_001133.7|` when 
-TemplateFilter is waiting for an integer. So, we translate it. The index 
-`FASTA_INDEXES` stores this translation.
 
-.. autodata:: configurator.FASTA_INDEXES
-    :noindex: 
+Python and R Common Configuration File
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-From a pragamatical point of view we discard some part of the genome (repeated 
-sequence etc...). The list of the black listed area is explicitely detailled in 
-`AREA_BLACK_LIST`.
+First of all we define in one place some configuration variables that will be launched by python and R scripts. These variables are contained in file `configurator.py`. The execution of this python script dumps variables into the `nucleominer_config.json` file that will then be used by both R and python scripts.
 
-.. autodata:: configurator.AREA_BLACK_LIST
-    :noindex: 
+To do this, go to the root directory of your project and run the following command:
 
-For BY-RM (resp. BY-YJM and RM-YJM) genome sequence alignment we use previously 
-compute .c2c file `data/2012-03_primarydata/BY_RM_gxcomp.c2c` (resp. 
-`BY_YJM_GComp_All.c2c` and `RM_YJM_gxcomp.c2c`). For more information about 
-.c2c files, please read section 5 of the manual of `NucleoMiner`, the old 
-version of `NucleoMiner2` 
-(http://www.ens-lyon.fr/LBMC/gisv/NucleoMiner_Manual/manual.pdf).
+.. code:: bash
 
-.. autodata:: configurator.C2C_FILES
-    :noindex: 
+  python src/current/configurator.py
+  
 
-`nucleominer` uses specific directory to work in, these are described in 
-`INDEX_DIR`, `ALIGN_DIR` and `LOG_DIR`.
 
-Finally, `nucleominer` use external ressources, the path to these resspources 
-are describe in `BOWTIE_BUILD_BIN`, `BOWTIE2_BIN`, `SAMTOOLS_BIN`, 
-`BEDTOOLS_BIN` and `TF_BIN` and `TF_TEMPLATES_FILE`.
 
-All paths, prefixes and indexes could be change in the 
-`src/current/nucleominer_config.json` file.
 
-.. autodata:: wf.json_conf_file
-    :noindex: 
 
 
 Preprocessing Illumina Fastq Reads for Each Sample
 --------------------------------------------------
 
-This preprocessing step consists in the 4 main steps embed in the `wf.py` and 
-described bellow. As a preamble, this script computes `samples` `samples_mnase` 
-and `strains` that will be used along the 4 steps.
+This preprocessing step consists of 4 main steps embedded in the `wf.py` script. They are described bellow. As a preamble, this script computes `samples`, `samples_mnase` and `strains` that will be used along the 4 steps.
+
 
 .. autodata:: wf.samples
     :noindex: 
@@ -134,25 +94,20 @@ and `strains` that will be used along the 4 steps.
 Creating Bowtie Index from each Reference Genome
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-For each strain, we need to create bowtie index. Bowtie index of a strain is a 
-tree view of the genemoe reference for this strain. It will be used by 
-bowtie to align reads. This step is performed by the following part of the 
-`wf.py` script:
+For each strain, we need to create bowtie index. Bowtie index of a strain is a tree view of the genome of this strain. It will be used by bowtie to align reads. This step is performed by the following part of the `wf.py` script:
 
 .. literalinclude:: ../../../snep/src/current/wf.py
    :start-after: # _STARTOF_ step_1
    :end-before: # _ENDOF_ step_1
    :language: python
 
-The following table sum up involved file sizes and process durations concerning 
-this step.
+The following table summarizes the file sizes and process durations concerning this step.
 
 ======  ======================  ======================  ================
 strain  fasta genome file size  bowtie index file size  process duration
 ======  ======================  ======================  ================
 BY      12 Mo                          25 Mo                    11 s.
 RM      12 Mo                          24 Mo                    9 s.
-YJM     12 Mo                          25 Mo                    11 s.
 ======  ======================  ======================  ================
 
 
@@ -162,41 +117,35 @@ Aligning Reads to Reference Genome
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Next, we launch bowtie to align reads to the reference genome. It produces a 
-`.sam` file that we convert into a `.bed` file. Binaries for `bowtie`, `samtools` 
-and `bedtools` are wrapped using python `subprocess` class. This step is 
-performed by the followinw part of the `wf.py` script:
+`.sam` file that we convert into a `.bed` file. Binaries for `bowtie`, `samtools` and `bedtools` are wrapped using python `subprocess` class. This step is performed by the following part of the `wf.py` script:
 
 .. literalinclude:: ../../../snep/src/current/wf.py
    :start-after: # _STARTOF_ step_2
    :end-before: # _ENDOF_ step_2
    :language: python
 
-Convert Aligned Reads for TemplateFilter
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-TemplateFilter use particular input format for reads, so we convert `.bed` file. 
-TemplateFilter expect reads as following: `chr coord strand #read` where:
+Convert Aligned Reads into TemplateFilter Format
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+TemplateFilter uses particular input formats for reads, so it is necessary to convert the `.bed` files. TemplateFilter expect reads as follows: `chr`, `coord`, `strand` and `#read` where:
 
-- chr is the number of the chromosome;
-- coord is the coordinate of the reads;
-- strand is `F` for forward and `R` for reverse;
-- #reads the number of reads for this position.
+- `chr` is the number of the chromosome;
+- `coord` is the coordinate of the reads;
+- `strand` is `F` for forward and `R` for reverse;
+- `#reads` the number of reads covering this position.
 
 Each entry is *tab*-separated.
 
-**WARNING** for reverse strand bowtie returns the position of left first 
-nucleotid when TemplateFilter is waiting for right one. So this step takes it 
-into account and add lenght of reads (in our case 50) to reverse reads 
-coordinate.
+**WARNING** for reverse strands, bowtie returns the position of the first nucleotide on the left hand side, whereas TemplateFilter expects the first one on the right hand side.  This step takes this into account by adding the read length (in our case 50) to the reverse reads coordinates.
 
-This step is performed by the followinw part of the `wf.py` script:
+This step is performed by the following part of the `wf.py` script:
 
 .. literalinclude:: ../../../snep/src/current/wf.py
    :start-after: # _STARTOF_ step_3
    :end-before: # _ENDOF_ step_3
    :language: python
 
-The following table sum up number of reads, involved file sizes and process durations concerning 
-the two last steps. In our case, aligment process have been multuthreaded over over 3 cores.
+The following table summarises the number of reads, the involved file sizes and process durations concerning the two last steps. In our case, alignment process have been multithreaded over 3 cores.
 
 ==  ==============  =========================  ======  ================  ==================  ================  
 id  Illumina reads  aligned and filtred reads  ratio   `.bed` file size  TF input file size  process duration
@@ -207,73 +156,25 @@ id  Illumina reads  aligned and filtred reads  ratio   `.bed` file size  TF inpu
 4   13765584        10381903                   75,42%  931  Mo           59  Mo              352   s.
 5   15168268        11502855                   75,83%  1031 Mo           64  Mo              386   s.
 6   18850820        14024905                   74,40%  1254 Mo           69  Mo              482   s.
-7   15591124        12126623                   77,78%  1163 Mo           72  Mo              405   s.
-8   15659905        12475664                   79,67%  1194 Mo           71  Mo              416   s.
-9   14668641        10960565                   74,72%  1052 Mo           70  Mo              375   s.
-10  14339179        10454451                   72,91%  1049 Mo           51  Mo              363   s.
-11  18019895        13688774                   75,96%  1378 Mo           59  Mo              474   s.
-12  13746796        10810022                   78,64%  1084 Mo           54  Mo              360   s.
-13  15205065        11766016                   77,38%  990  Mo           54  Mo              381   s.
-14  17803097        13838883                   77,73%  1154 Mo           60  Mo              452   s.
-15  15434564        12307878                   79,74%  1032 Mo           57  Mo              394   s.
-16  16802587        12725665                   75,74%  1221 Mo           48  Mo              438   s.
-17  16058417        12513734                   77,93%  1192 Mo           63  Mo              422   s.
-18  16154482        13204331                   81,74%  1277 Mo           52  Mo              430   s.
-19  21013924        17102120                   81,38%  1646 Mo           59  Mo              555   s.
-20  17213114        14433357                   83,85%  1389 Mo           53  Mo              459   s.
-21  17360907        14733001                   84,86%  1203 Mo           55  Mo              450   s.
-22  18136816        15389581                   84,85%  1257 Mo           53  Mo              469   s.
-23  14763678        12173025                   82,45%  1140 Mo           56  Mo              393   s.
-24  15541709        12890345                   82,94%  1057 Mo           48  Mo              398   s.
-25  16433215        13094314                   79,68%  1241 Mo           57  Mo              433   s.
-26  17370850        14264136                   82,12%  1347 Mo           51  Mo              466   s.
-27  14613512        8654495                    59,22%  887  Mo           56  Mo              339   s.
-28  15248545        11367589                   74,55%  1166 Mo           67  Mo              405   s.
-29  14316809        10767926                   75,21%  1103 Mo           63  Mo              379   s.
-30  15178058        12265794                   80,81%  1030 Mo           66  Mo              390   s.
-31  14968579        11876186                   79,34%  1009 Mo           63  Mo              387   s.
-32  16912705        13550508                   80,12%  1143 Mo           70  Mo              442   s.
-33  16782154        12755111                   76,00%  1227 Mo           65  Mo              438   s.
-34  16741443        13168071                   78,66%  1260 Mo           71  Mo              442   s.
-35  13096171        10367041                   79,16%  992  Mo           62  Mo              350   s.
 36  17715118        14092985                   79,55%  1404 Mo           68  Mo              483   s.
 37  17288466        7402082                    42,82%  741  Mo           48  Mo              339   s.
 38  16116394        13178457                   81,77%  1101 Mo           63  Mo              420   s.
 39  14241106        10537228                   73,99%  880  Mo           57  Mo              348   s.
-40  13784738        10598464                   76,89%  1005 Mo           64  Mo              358   s.
-41  12438007        9620975                    77,35%  911  Mo           60  Mo              326   s.
-42  13853959        11031238                   79,63%  1045 Mo           64  Mo              365   s.
-43  12036162        6654780                    55,29%  684  Mo           46  Mo              268   s.
-44  13873129        10251074                   73,89%  1048 Mo           61  Mo              365   s.
-45  19817751        14904502                   75,21%  1520 Mo           72  Mo              528   s.
-46  13368959        10818619                   80,92%  912  Mo           63  Mo              350   s.
-47  7566467         6139001                    81,13%  520  Mo           44  Mo              201   s.
-48  32586928        21191363                   65,03%  1816 Mo           82  Mo              766   s.
-49  30733184        18791373                   61,14%  1801 Mo           89  Mo              721   s.
-50  41287616        30383875                   73,59%  2911 Mo           112 Mo              1065  s.
-51  40439965        31177914                   77,10%  2981 Mo           117 Mo              1070  s.
 53  40876476        33780065                   82,64%  3316 Mo           103 Mo              1165  s.
-55  52424414        47117107                   89,88%  3811 Mo           119 Mo              1477  s.
 ==  ==============  =========================  ======  ================  ==================  ================  
 
-For some reasons (manipulation efficiency, e.g. PCR...), we remove samples 33, 45, 48 and 55.
-
-
 Run TemplateFilter on Mnase Samples
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Finally, for each sample we perfome TemplateFilter analysis. 
+Finally, for each sample we perform TemplateFilter analysis. 
 
 **WARNING** TemplateFilter returns a list of nucleosomes. Each nucleosome is 
-define by its center and its width. An odd width leads us to considere non 
-interger lower and upper bound.
+define by its center and its width. An odd width leads us to consider non-
+integer lower and upper bound.
 
-**WARNING** TemplateFilter is not design to deal with replicate. So we choose to 
-keep a maximum of nucleosome and filter in a second time using the benefit of 
-replicate. To do that we set a low correlation threshold parameter (`0.5`) and a 
-particularly high value of overlaping (`300%`).
+**WARNING** TemplateFilter is not designed to deal with replicates. So we recommend to keep a maximum of nucleosomes and filter the aberrant ones afterwards using the benefits of having replicates. To do this, we set a low correlation threshold parameter (0.5) and a particularly high value of overlap (300%).
 
-This step is performed by the followinw part of the `wf.py` script:
+This step is performed by the following part of the `wf.py` script:
 
 .. literalinclude:: ../../../snep/src/current/wf.py
    :start-after: # _STARTOF_ step_4
@@ -289,9 +190,6 @@ id  strain  found nucs  nuc file size  process duration
 4    RM     88076       62 Mo          984 s.                      
 5    RM     90141       64 Mo          967 s.                      
 6    RM     87517       62 Mo          980 s.                      
-7    YJM    88945       64 Mo          566 s.                      
-8    YJM    88689       64 Mo          570 s.                      
-9    YJM    88128       63 Mo          565 s.                    
 ==  ======  ==========  =============  ================
 
 
@@ -306,16 +204,174 @@ id  strain  found nucs  nuc file size  process duration
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+..
+..
+.. $$$ other python script to describe:
+.. - libcoverage.py
+.. - wf.py
+..
+..
+..
+..
+..
+..
+.. In order to simplify the design of experiment, we consider Mnase as a marker.
+.. For each couple `(strain, marker)` we perform 3 replicates. So, theoritically
+.. we should have `3 * (1 + 5) * 3 = 54` samples. In practice we only obtain 2
+.. replicates for `(YJM, H3K4me1)`. Each one of the 53 samples is indentify by a
+.. uniq identifier. The file `CSV_SAMPLE_FILE` sums up this information.
+..
+.. .. autodata:: configurator.CSV_SAMPLE_FILE
+..     :noindex:
+..
+.. We use a convention to link sample and Illumina fastq outputs. Illumina output
+.. files of the sample `ID` will be stored in the directory
+.. `ILLUMINA_OUTPUTFILE_PREFIX` + `ID`. For example, sample 41 outputs will be
+.. stored in the directory `data/2012-09-05/FASTQ/Sample_Yvert_Bq41/`.
+..
+.. .. autodata:: configurator.ILLUMINA_OUTPUTFILE_PREFIX
+..     :noindex:
+..
+.. For BY (resp. RM and YJM) we use following reference genome
+.. `saccharomyces_cerevisiae_BY_S288c_chromosomes.fasta`
+.. (resp. `saccharomyces_cerevisiae_rm11-1a_1_supercontigs.fasta` and
+.. `saccharomyces_cerevisiae_YJM_789_screencontig.fasta`).
+.. The index `FASTA_REFERENCE_GENOME_FILES` stores this information.
+..
+.. .. autodata:: configurator.FASTA_REFERENCE_GENOME_FILES
+..     :noindex:
+..
+.. Each chromosome/contig is identify in the fasta file by an obscure identifier.
+.. For example, BY chromosome I is identify by `gi|144228165|ref|NC_001133.7|` when
+.. TemplateFilter is waiting for an integer. So, we translate it. The index
+.. `FASTA_INDEXES` stores this translation.
+..
+.. .. autodata:: configurator.FASTA_INDEXES
+..     :noindex:
+..
+.. From a pragamatical point of view we discard some part of the genome (repeated
+.. sequence etc...). The list of the black listed area is explicitely detailled in
+.. `AREA_BLACK_LIST`.
+..
+.. .. autodata:: configurator.AREA_BLACK_LIST
+..     :noindex:
+..
+.. For BY-RM (resp. BY-YJM and RM-YJM) genome sequence alignment we use previously
+.. compute .c2c file `data/2012-03_primarydata/BY_RM_gxcomp.c2c` (resp.
+.. `BY_YJM_GComp_All.c2c` and `RM_YJM_gxcomp.c2c`). For more information about
+.. .c2c files, please read section 5 of the manual of `NucleoMiner`, the old
+.. version of `NucleoMiner2`
+.. (http://www.ens-lyon.fr/LBMC/gisv/NucleoMiner_Manual/manual.pdf).
+..
+.. .. autodata:: configurator.C2C_FILES
+..     :noindex:
+..
+.. `nucleominer` uses specific directory to work in, these are described in
+.. `INDEX_DIR`, `ALIGN_DIR` and `LOG_DIR`.
+..
+.. Finally, `nucleominer` use external ressources, the path to these resspources
+.. are describe in `BOWTIE_BUILD_BIN`, `BOWTIE2_BIN`, `SAMTOOLS_BIN`,
+.. `BEDTOOLS_BIN` and `TF_BIN` and `TF_TEMPLATES_FILE`.
+..
+.. All paths, prefixes and indexes could be change in the
+.. `src/current/nucleominer_config.json` file.
+..
+.. .. autodata:: wf.json_conf_file
+..     :noindex:
+..
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 Inferring Nucleosome Position and Extracting Read Counts
 --------------------------------------------------------
 
 
 
-The second part of the tutorial uses `R` (http://http://www.r-project.org). It consists in a set of R scripts taht will be sourced in an R console launched at the root of your project. the R srcipts are:
+The second part of the tutorial uses R (http://http://www.r-project.org). It consists of a set of R scripts that will be sourced in an R from a console launched at the root of your project. These scripts are:
 
   - headers.R
   - extract_maps.R
-  - compare_common_wp.R
+  - translate_common_wp.R
   - split_samples.R
   - count_reads.R
   - get_size_factors  
@@ -324,214 +380,317 @@ The second part of the tutorial uses `R` (http://http://www.r-project.org). It c
 The Script headers.R
 ^^^^^^^^^^^^^^^^^^^^
 
-The script header.R is included in each other scripts. It is in charge of: 
+The script headers.R is included in each other scripts. It is in charge of: 
 
-  - launching libraries used in thes scripts
+  - launching libraries used in the scripts
   - launching configuration (design, strain, marker...)
-  - computing and caching CURs
+  - computing and caching CURs (caching means storing the information in the computer's memory)
+
+Note that you can customize the function “translate”. This function allows you to use the alignments between genomes when performing various tasks. You may be using NucleoMiner2 to analyse data of a single strain, or of several strains. 
+
+  - All the data corresponds to the same strain (e.g. treatment/control, or only few mutations): Then in step 1), the  regions to use are entire chromosomes. Instep 2) simply use the default translate function which is neutral.
+
+  - The data come from two or more strains: In this case, edit a list of regions and customize the translate function which performs the correspondence between the different genomes. How we did it: a .c2c file is obtained with NucleoMiner 1.0 (refer to the Appendice "Generate .c2c Files"), then use it to produce the list of regions and customise “translate”.
+
+
+
 
 In your R console, run the following command line:
 
 .. code:: bash
 
-  R CMD BATCH src/current/header.R
+  source("src/current/headers.R")
 
 
 The Script extract_maps.R
 ^^^^^^^^^^^^^^^^^^^^^^^^^
-This script is in charge of extracting Maps for well positioned and fuzzy nucleosomes. First of all, this script computed intra and inter strain nucleosome maps for each CUR. This step is executed in parallel on many cores using the BoT library. Next, it collects results and produces well positioned, fuzzy and UNR maps.
+This script is in charge of extracting Maps for well-positioned and fuzzy nucleosomes. First of all, this script computes intra and inter-strain nucleosome maps for each CUR. This step is executed in parallel on many cores using the BoT library. Next, it collects results and produces well-positioned, fuzzy and UNR maps.
 
-The well-positioned map for BY is collected in the result directory and is called **BY_wp.tab**. It is composed of following columns:
+The well-positioned map for BY is collected in the result directory and is called `BY_wp.tab`. It is composed of following columns:
 
  - chr, the number of the chromosome 
  - lower_bound, the lower bound of the nucleosome
  - upper_bound, the upper bound of the nucleosome 
  - cur_index, index of the CUR
  - index_nuc, the index of the nucleosome in the CUR
- - wp, 1 if it is a well positioned nucleosome, 0 else
- - nb_reads, the number of reads that supports this nucleosome
- - nb_nucs, the number of TemplateFilter nucleosome across replicates (= the number of replicates if it is a well-positioned nucleosome)
- - llr_1, for a well-positioned nucleosome, it is the LLR1 between the first and the second TemplateFilter nucleosome.
- - llr_2, for a well-positioned nucleosome, it is the LLR1 between the second and the first TemplateFilter nucleosome.
- - wp_llr, for a well-positioned nucleosome, it is the LLR2 overall TemplateFilter nucleosomes.
- - wp_pval, for a well-positioned nucleosome, it is the p-value chi square test obtained with the LLR2 (**1-pchisq(2.LLR2, df=4)**)
- - dyad_shift, for a well-positioned nucleosome, it is shift between the two extreme TemplateFilter nucleosome dyad positions. 
+ - wp, 1 if it is a well positioned nucleosome, 0 otherwise
+ - nb_reads, the number of reads that support this nucleosome
+ - nb_nucs, the number of TemplateFilter nucleosome across replicates (= the number of replicates in which it is a well-positioned nucleosome)
+ - llr_1, for a well-positioned nucleosome, it is the LLR1 (log-likelihood ratio) between the first and the second TemplateFilter nucleosome on the chain.
+ - llr_2, for a well-positioned nucleosome, it is the LLR1 between the second and the third TemplateFilter nucleosome on the chain.
+ - wp_llr, for a well-positioned nucleosome, it is the LLR2 that compares consistency of the positioning over all TemplateFilter nucleosomes.
+ - wp_pval, for a well-positioned nucleosome, it is the p-value chi square test obtained with the LLR2 (`1-pchisq(2.LLR2, df=4)`)
+ - dyad_shift, for a well-positioned nucleosome, it is the shift between the two extreme TemplateFilter nucleosome dyad positions. 
 
-The fuzzy map for BY is collected in the result directory and is called **BY_fuzzy.tab**. It is composed of following columns:
+The fuzzy map for BY is collected in the result directory and is called `BY_fuzzy.tab`. It is composed of following columns:
 
  - chr, the number of the chromosome 
  - lower_bound, the lower bound of the nucleosome
  - upper_bound, the upper bound of the nucleosome 
  - cur_index, index of the CUR
 
-The common well-position map for BY and RM strains is collected in the result directory and is called **BY_RM_common_wp.tab**. It is composed of following columns:
+The map of common well-positioned nucleosomes aligned between the BY and RM strains is collected in the result directory and is called `BY_RM_common_wp.tab`. It is composed of following columns:
 
  - cur_index, the index of the CUR
  - index_nuc_BY, the index of the BY nucleosome in the CUR
- - index_nuc_RM,the index of the RM nucleosome in the CUR
- - llr_score, the LLR3 score between th eBy and RM nucleosomes
- - common_wp_pval,  the p-value chi square test obtained with the LLR3 (**1-pchisq(2.LLR3, df=2)**)
+ - index_nuc_RM, the index of the RM nucleosome in the CUR
+ - llr_score, , the LLR3 score that estimates conservation between the positions in BY and RM 
+ - common_wp_pval,  the p-value chi square test obtained from LLR3 (`1-pchisq(2.LLR3, df=2)`)
+ - diff, the dyads shift between the positions in the two strains
 
-The common UNR map for BY and RM strains is collected in the result directory and is called **BY_RM_common_unr.tab**. It is composed of following columns:
+The common UNR map for BY and RM strains is collected in the result directory and is called `BY_RM_common_unr.tab`. It is composed of the following columns:
 
  - cur_index, the index of the CUR
  - index_nuc_BY, the index of the BY nucleosome in the CUR
  - index_nuc_RM,the index of the RM nucleosome in the CUR
 
-To execute this script, run the following command line in your R console:
+To execute this script, run the following command in your R console:
 
 .. code:: bash
 
   source("src/current/extract_maps.R")
 
 
-The Script compare_common_wp.R
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This script is used to compare inter strain distances between common well-positioned nucleosomes. 
-
-For example, it compute the file **BY_RM_common_wp_diff.tab** that contains dyad shifts between two well-positioned nucleosomes. It is composed of following columns:
- - cur_index, the index of the CUR
- - index_nuc_BY, the index of the BY nucleosome in the CUR
- - index_nuc_RM,the index of the RM nucleosome in the CUR
- - llr_score, the LLR3 score between th eBy and RM nucleosomes
- - common_wp_pval,  the p-value chi square test obtained with the LLR3 (**1-pchisq(2.LLR3, df=2)**)
- - diff, the dyad shifts between two well-positioned nucleosomes
+The Script translate_common_wp.R
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-It also translates well-positioned nucleosome maps from a strain to an other strain and stores it into a table. 
+This script is used to translate common well-positioned nucleosome maps from a strain to another strain and stores it into a table. 
 
-For example, the file **results/2014-04/RM_wp_tr_2_BY.tab** contains RM well-positioned nucleosome translated into the BY genome referential. It is composed of following columns:
+For example, the file `results/2014-04/RM_wp_tr_2_BY.tab` contains RM well-positioned nucleosome translated into the BY genome coordinates. It is composed of following columns:
 
  - strain_ref, the reference genome (in which positioned are defined)
  - begin, the translated lower bound of the nucleosome
  - end, the translated upper bound of the nucleosome
- - chr, the number of chromosome for the reference genome (in which positioned are defined)
+ - chr, the number of chromosomes for the reference genome (in which positioned are defined)
  - length, the length of the nucleosome (could be negative)
  - cur_index, the index of the CUR
  - index_nuc, the index of the nucleosome in the CUR
 
+To execute this script, run the following command in your R console:
 
+.. code:: bash
 
-To execute this script, run the following command line in your R console:
+  source("src/current/translate_common_wp.R")
 
-.. code:: bash
 
-  R CMD BATCH src/current/compare_common_wp.R
+The Script split_samples.R
+^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+For memory space usage reasons, we split and compress TemplateFilter input files according to their corresponding  chromosome. for example, `sample_1_TF.tab` will be split into :
 
-Split and Compress Samples According CURs
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+  - sample_1_chr_1_splited_sample.tab.gz
+  - sample_1_chr_2_splited_sample.tab.gz
+  - ...
+  - sample_1_chr_17_splited_sample.tab.gz
+  
+
+To execute this script, run the following command in your R console:
 
 .. code:: bash
 
-  R CMD BATCH src/current/split_samples.R
+  source("src/current/split_samples.R")
 
 
-Count Reads for Each Nucleosome
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The Script count_reads.R
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+To associate a number of observations (read) to each nucleosome we run the script `count_reads.R`. It produces the files `BY_RM_H3K14ac_wp_and_nbreads.tab`, `BY_RM_H3K14ac_unr_and_nbreads.tab` `BY_RM_Mnase_Seq_wp_and_nbreads.tab` and `BY_RM_Mnase_Seq_unr_and_nbreads.tab`  
+for H3K14ac common well-positioned nucleosomes, H3K14ac UNRs, Mnase common well-positioned nucleosomes and Mnase UNRs respectively. 
+
+For example, the file `BY_RM_H3K14ac_unr_and_nbreads.tab` contains counted reads for well-positioned nucleosomes with the experimental condition ChIP H3K14ac. It is composed of the following columns:
+
+  - chr_BY, the number of the chromosome for BY
+  - lower_bound_BY, the lower bound of the nucleosome for BY
+  - upper_bound_BY, the upper bound of the nucleosome  for BY
+  - index_nuc_BY, the index of the BY nucleosome in the CUR for BY
+  - chr_RM, the number of the chromosome for RM
+  - lower_bound_RM, the lower bound of the nucleosome for RM
+  - upper_bound_RM, the upper bound of the nucleosome  for RM
+  - index_nuc_RM,the index of the RM nucleosome in the CUR for RM
+  - cur_index, index of the CUR
+  - BY_H3K14ac_36, the number of reads for the current nucleosome for the sample 36
+  - BY_H3K14ac_37, #reads for sample 37
+  - BY_H3K14ac_53, #reads for sample 53
+  - RM_H3K14ac_38, #reads for sample 38
+  - RM_H3K14ac_39, #reads for sample 39
+
+To execute this script, run the following command in your R console:
 
 .. code:: bash
 
-  R CMD BATCH src/current/count_reads.R
+  source("src/current/count_reads.R")
+
+
+The Script get_size_factors.R
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+
+This script uses the DESeq function `estimateSizeFactors` to compute the size factor of each sample. It corresponds to normalisation of read counts from sample to sample, as determined by DESeq. When a sample has n reads for a nucleosome or a UNR,
+the normalised count is n/f where f is the factor contained in this file.
+The script dumps computed size factors into the file `size_factors.tab`. This file has the form:
+
+========= ======= ======= =======
+sample_id      wp     unr   wpunr
+========= ======= ======= =======
+        1 0.87396 0.88097 0.87584
+        2 1.07890 1.07440 1.07760
+        3 1.06400 1.05890 1.06250
+        4 0.85782 0.87948 0.86305
+        5 0.97577 0.96590 0.97307
+        6 1.19630 1.18120 1.19190
+       36 0.93318 0.92762 0.93166
+       37 0.48315 0.48453 0.48350
+       38 1.11240 1.11210 1.11230
+       39 0.89897 0.89917 0.89903
+       53 2.22650 2.22700 2.22660
+========= ======= ======= =======
+
+sample_id are given in file samples.csv
 
+If you don't know which column to use, we recommend using wpunr.
 
-Get Size Factors Using DESeq
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+If you want the very detailed factors produced by DESeq, here are the information:
+
+  - unr: factor computed from data of UNR regions. These regions are defined for every pairs of aligned genomes (e.g. BY_RM)
+  - wp: same, but for well-positioned nucleosomes.
+  - wpunr: both types of regions.
+
+To execute this script, run the following command in your R console:
 
 .. code:: bash
 
-  R CMD BATCH src/current/get_size_factors.R
+  source("src/current/get_size_factors.R")
 
 
-Performing DESeq Analysis
+The Script launch_deseq.R
 ^^^^^^^^^^^^^^^^^^^^^^^^^
 
+Finally, the script `launch_deseq.R` perform statistical analysis on each nucleosome using `DESeq`. It produces files:
+ 
+  - results/current/BY_RM_H3K14ac_wp_snep.tab
+  - results/current/BY_RM_H3K14ac_unr_snep.tab
+  - results/current/BY_RM_H3K14ac_wpunr_snep.tab
+  - results/current/BY_RM_H3K14ac_wp_mnase.tab
+  - results/current/BY_RM_H3K14ac_unr_mnase.tab
+  - results/current/BY_RM_H3K14ac_wpunr_mnase.tab
+
+These files are organised with the following columns (see file `BY_RM_H3K14ac_wp_snep.tab` for an example):
+
+  - chr_BY, the number of the chromosome for BY
+  - lower_bound_BY, the lower bound of the nucleosome for BY
+  - upper_bound_BY, the upper bound of the nucleosome  for BY
+  - index_nuc_BY, the index of the BY nucleosome in the CUR for BY
+  - chr_RM, the number of the chromosome for RM
+  - lower_bound_RM, the lower bound of the nucleosome for RM
+  - upper_bound_RM, the upper bound of the nucleosome  for RM
+  - index_nuc_RM,the index of the RM nucleosome in the CUR for RM
+  - cur_index, index of the CUR
+  - form 
+  - BY_Mnase_Seq_1, the number of reads for the current nucleosome for the sample 1  
+
+Next columns concern indicators for each sample:
+
+  - BY_Mnase_Seq_2, #reads for sample 2
+  - BY_Mnase_Seq_3, #reads for sample 3  
+  - RM_Mnase_Seq_4, #reads for sample 4  
+  - RM_Mnase_Seq_5, #reads for sample 5
+  - RM_Mnase_Seq_6, #reads for sample 6
+  - BY_H3K14ac_36, #reads for sample 36
+  - BY_H3K14ac_37, #reads for sample 37
+  - BY_H3K14ac_53, #reads for sample 53
+  - RM_H3K14ac_38, #reads for sample 38
+  - RM_H3K14ac_39, #reads for sample 39
+  
+The 5 last columns concern DESeq analysis:
+
+  - manip[a_manip] strain[a_strain] manip[a_strain]:strain[a_strain], the manip (marker) effect, the strain effect and the snep effect. These are the coefficients of the fitted generalized linear model.
+  - pvalsGLM, the pvalue resulting of the comparison of the GLM model considering or not the interaction term marker:strain. This is the statsitcial significance of the interaction term and therefore the statistical significance of the SNEP.
+  - snep_index, a boolean set to TRUE if the pvalueGLM value is under the threshold computed with FDR function with a rate set to 0.0001.
+To execute this script, run the following command 
+
+To execute this script, run the following command in your R console:
+
 .. code:: bash
 
-  R CMD BATCH src/current/launch_deseq.R
+  source("src/current/launch_deseq.R")
 
 
-Results
--------
+Results: Number of SNEPs
+------------------------
 
-Output Files Organisation
-^^^^^^^^^^^^^^^^^^^^^^^^^
-Previous steps produce following 45 files. 
-Each filename is under the form 
+Here are the number of computed SNEPs for each forms.
 
-.. code:: bash
+===== ======= ===== =======
+ form strains #nucs H3K14ac
+===== ======= ===== =======
+   wp   BY-RM 30464    3549
+  unr   BY-RM  9497    1559
+wpunr   BY-RM 39961    5240
+===== ======= ===== =======
+  
 
-  results/current/[combi]_[marker]_[form]_snep.tab 
 
-Where combi is in {BY_RM, BY_YJM, RM_YJM} for each strain combination, marker is 
-in {H3K4me1, H3K4me3, H3K9ac, H3K14ac, H4K12ac} for each post translational 
-histone modification and form is in {wp, fuzzy, wpfuzzy} considering well 
-positioned nucleosomes, fuzzy nucleosomes or both for SNEP computation.
 
 
 
-chr_BY lower_bound_BY upper_bound_BY index_nuc_BY chr_RM lower_bound_RM upper_bound_RM index_nuc_RM roi_index form BY_Mnase_Seq_1 BY_Mnase_Seq_2 BY_Mnase_Seq_3 RM_Mnase_Seq_4 RM_Mnase_Seq_5 RM_Mnase_Seq_6 BY_H3K14ac_36 
-BY_H3K14ac_37 BY_H3K14ac_53 RM_H3K14ac_38 RM_H3K14ac_39 pvalsGLM 
+APPENDICE: Generate .c2c Files
+------------------------------
 
-For each file, there is 1 line per nucleosome and each line is composed of many columns divided into 3 main topics:
-  - nuc information
-  - number opf reads for each sample
-  - DESeq analysis results.
+The `.c2c` files is a simple table that describes how the genome sequence can be aligned. We generate it using NucleoMiner 1.0.
 
-For exemple for the file *BY_RM_H3K14ac_wp_snep.tab* informations are: 
-  - chr_BY, the BY chr involved
-  - lower_bound_BY, the lower bound of the BY nuc
-  - upper_bound_BY, the upper_bound of the BY nuc
-  - index_nuc_BY, the index of the nuc in the entire list of BY nucs
-  - chr_RM, lower_bound_RM, upper_bound_RM, index_nuc_RM 
-	are the same information for the RM strain
-  - roi_index, the index of the region of interrest involved.
-  
-Next cols concern indicators for each sample. They are labeled [strain]_[marker]_[sample_id] and each value represents the number of reads for the current nuc for the sample *sample_id*. 
+To install NucleoMiner 1.0 on your UNIX/LINUX computer you need first to install the Genetic Data analysis Library (GDL), which is a dynamic library of useful C functions derived from the GNU Scientific Library.
 
-The 5 final columns concern DESeq analysis:
-  - manip[a_manip] strain[a_strain] manip[a_strain]:strain[a_strain], the manip (marker) effect, the strain effect and the snep effect.  
-  - pvalsGLM, the pvalue resulting of the comparison of the GLM model considering or the interaction term *marker:strain* 
-  - snep_index, a boolean set to TRUE if the *pvalueGLM* value is under the threshold computed with FDR function with a rate set to 0.01%. 
+Installing the GDL library
+^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-It also produces the file that explicts size factor for each involved sample in differents strain combination and nucleosomal region type:
+Get the gdl-1.0.tar.gz archive on your computer (in the directory deps of your working directory). Copy it in a dedicated directory. Go into this directory using the cd command, and then unfold the archive by typing:
 
-TODO: include this file... /home/filleton/analyses/snepcatalog/data/2013-10-09/current/README.txt
+tar -xvzf gdl-1.0.tar.gz
 
+This creates a directory called gdl-1.0. You now need to go into this directory and compile the library, by typing:
 
 .. code:: bash
 
-  results/current/size_factors.tab
+  cd gdl-1.0
+  ./configure
+  make
 
+Now you need to install the library on your system. This needs root priviledges:
 
+.. code:: bash
+
+  sudo make install
+
+Installing NucleoMiner
+^^^^^^^^^^^^^^^^^^^^^^
+
+Get the nucleominer-1.0.tar.gz archive on your computer. Copy it in a dedicated directory. Go into this directory using the cd command, and then unfold the archive by typing:
+
+tar -xvzf nucleominer-1.0.tar.gz
+This creates a directory called nucleominer-1.0. You now need to go into this directory and compile the library, by typing:
 
+.. code:: bash
 
-Number of SNEPs
-^^^^^^^^^^^^^^^
+  cd nucleominer-1.0
+  ./configure
+  make
 
-Here are the number of computed for each forms.
+You can then use the binaries dircetly from this folder (best then is to add the path to this folder in your PATH environment variable). If you want to install nucleominer at the system's level (useful if mutiple users will need it) then type, with root priviledges:
 
 .. code:: bash
 
-  [1] "wp"
-         #nucs H3K4me1 H3K4me3 H3K9ac H3K14ac H4K12ac
-  BY-RM  30234     520     798     83    3566      26
-  BY-YJM 31298     303     619    102     103     128
-  RM-YJM 29863     129     340     46    3177      18
-  [1] "fuzzy"
-         #nucs H3K4me1 H3K4me3 H3K9ac H3K14ac H4K12ac
-  BY-RM  10748     294     308    101    1681      42
-  BY-YJM 10669     122     176    124      93      87
-  RM-YJM 11478      54     112     41    1389      20
-  [1] "wpfuzzy"
-         #nucs H3K4me1 H3K4me3 H3K9ac H3K14ac H4K12ac
-  BY-RM  40982     770    1136    183    5404      73
-  BY-YJM 41967     439     804    214     198     199
-  RM-YJM 41341     184     468     87    4687      37
-
-
-TODO: 
-  - Print/study intra/inter strain LODs.
-  - Check the normality of sample using Shapiro–Wilk (Hypothesis for computing LODs)
-  	
+  sudo make install
+
+Generate .c2c Files
+^^^^^^^^^^^^^^^^^^^
+
+To generate .c2c files you need to type the following command in a terminal:
+
+.. code:: bash
 
+  mkdir dir_4_c2c
+  NMgxcomp Data/BY_S288c/Sequence/Genome.fasta \
+           Data/RM_11-1a/Sequence/Genome.fasta \
+           dir_4_c2c/BY_RM 2>dir_4_c2c/BY_RM.log
+            
+After execution, the directory dir_4_c2c will hold the .c2c files.
diff --git a/src/R/nucleominer.R b/src/R/nucleominer.R
index 7e42854..040eea0 100644
--- a/src/R/nucleominer.R
+++ b/src/R/nucleominer.R
@@ -136,7 +136,7 @@ llr_score_nvecs = structure(function # Likelihood ratio
   return(ratio)
 ### Returns the log likelihood ratio.
 }, ex=function(){
-  # LOD score for 2 set of values
+  # LLR score for 2 set of values
   mean1=5; sd1=2; card2 = 250
   mean2=6; sd2=3; card1 = 200
   x1 = rnorm(card1, mean1, sd1)
@@ -273,9 +273,9 @@ strand ##<< The original strand.
 
 
 aggregate_intra_strain_nucs = structure(function(# Aggregate replicated sample's nucleosomes.
-### This function aggregates nucleosome for replicated samples. It uses TemplateFilter ouput of each sample as replicate. Each sample owns a set of nucleosomes computed using TemplateFilter and ordered by the position of their center. Adajacent nucleosomes are compared two by two. Comparison is based on a log likelihood ratio score. The issue of comparison is adjacents nucleosomes merge or separation. Finally the function returns a list of clusters and all computed \emph{llr_scores}. Each cluster ows an attribute \emph{wp} for "well positionned". This attribute is set as \emph{TRUE} if the cluster is composed of exactly one nucleosomes of each sample.
+### This function aggregates nucleosomes from replicated samples. It uses TemplateFilter ouput of each sample as replicate. Each sample owns a set of nucleosomes computed using TemplateFilter and ordered by the position of their center (dyad). A chain of nucleosomes is builts across all replicates. Adjacent nucleosomes of the chain are compared two by two. Comparison is based on a log likelihood ratio (LLR1). depending on the LLR1 value nucleosomes are merged (low LLR) or separated (high LLR). Finally the function returns a list of clusters and all computed llr_scores. Each cluster ows an attribute wp for “well positioned”. This attribute is set to TRUE if the cluster is composed of exactly one nucleosome of each sample.
 samples, ##<< A list of samples. Each sample is a list like \emph{sample = list(id=..., marker=..., strain=..., roi=..., inputs=..., outputs=...)} with \emph{roi = list(name=..., begin=...,  end=..., chr=..., genome=...)}.
-llr_thres=20, ##<< Log likelihood ration threshold.
+llr_thres=20, ##<< Log likelihood ratio threshold to decide between merging and separating
 coord_max=20000000 ##<< A too big value to be a coord for a nucleosome lower bound.
 ){
 	end_of_tracks = function(tracks) {
@@ -487,12 +487,12 @@ cur_index ##<< the index of the roi involved
 }
 
 align_inter_strain_nucs = structure(function(# Aligns nucleosomes between 2 strains.
-### This function aligns nucs between two strains for a given genome region.
+### This function aligns nucleosomes between two strains for a given genome region.
 replicates, ##<< Set of replicates, ideally 3 per strain.
-wp_nucs_strain_ref1=NULL, ##<< List of aggregates nucleosome for strain 1. If it's null this list will be computed.
-wp_nucs_strain_ref2=NULL, ##<< List of aggregates nucleosome for strain 2. If it's null this list will be computed.
+wp_nucs_strain_ref1=NULL, ##<< List of aggregates nucleosome for strain 1. If it's NULL this list will be computed.
+wp_nucs_strain_ref2=NULL, ##<< List of aggregates nucleosome for strain 2. If it's NULL this list will be computed.
 corr_thres=0.5, ##<< Correlation threshold.
-llr_thres=100, ##<< LOD cut off.
+llr_thres=100, ##<< Log likelihood ratio threshold to decide between merging and separating
 config=NULL, ##<< GLOBAL config variable
 ... ##<< A list of parameters that will be passed to \emph{aggregate_intra_strain_nucs} if needed.
 ) {
@@ -575,7 +575,7 @@ config=NULL, ##<< GLOBAL config variable
 								reads_strain_ref1 = reads_strain_ref1 - rep(diff, length(reads_strain_ref1))
 								llr_score = llr_score_nvecs(list(reads_strain_ref1, reads_strain_ref2))
 								llr_scores = c(llr_scores, llr_score)
-								# Filtering on LOD Score
+								# Filtering on LLR Score
                 if (llr_score < llr_thres) {
 									tmp_nuc = list()
 									# strain_ref1
@@ -809,7 +809,7 @@ region2 ##<< Regions to substract.
   return(non_inter_fuzzy)
 }
 
-union_regions = function(# Aggregate regions that intersect themnselves.
+union_regions = function(# Aggregate regions that intersect themselves.
 ### This function is based on sort of lower bounds to detect regions that intersect. We compare lower bound and upper bound of the porevious item. This function embed a while loop and break break regions list become stable.
 regions ##<< The Regions to be aggregated
 ) {
@@ -862,7 +862,7 @@ regions ##<< The Regions to be aggregated
 # }
 
 translate_regions = function(# Translate a list of regions from a strain ref to another.
-### This function is an eloborated call to translate_cur.
+### This function is an elaborated call to translate_cur.
 regions, ##<< Regions to be translated.
 combi, ##<< Combination of strains.
 cur_index, ##<< The region of interest index.
@@ -964,7 +964,7 @@ config=NULL ##<< GLOBAL config variable
   return(all_reads)
 }
 
-get_design = function(# Build the design for deseq
+get_design = function(# Build the design for DESeq
 ### This function build the design according sample properties.
 marker, ##<< The marker to considere.
 combi, ##<< The starin combination to considere.
@@ -1006,7 +1006,7 @@ all_samples ##<< Global list of samples.
 }
 
 plot_dist_samples = function(# Plot the distribution of reads.
-### This fuxntion use the deseq nomalization feature to compare qualitatively the distribution.
+### This fuxntion use the DESeq nomalization feature to compare qualitatively the distribution.
 strain, ##<< The strain to considere.
 marker, ##<< The marker to considere.
 res, ##<< Data
@@ -1035,10 +1035,10 @@ NEWPLOT = TRUE ##<< If FALSE the curve will be add to the current plot.
   legend("topright", col=(1:length(sample_ids))+1, lty=1:length(sample_ids), legend=cols)
 }
 
-analyse_design = function(# Launch deseq methods.
-### This function is based on deseq example. It mormalizes data, fit data to GLM model with and without interaction term and compare the two l;=models.
-snep_design, ##<< The design to considere.
-reads ##<< The data to considere.
+analyse_design = function(# Launch DESeq methods.
+### This function is based on DESeq example. It normalizes data, fit data to GLM model with and without interaction term and compares the two models.
+snep_design, ##<< The design to consider.
+reads ##<< The data to consider.
 ) {
 	snep_count_table = reads[, rownames(snep_design)]
 	cdsFull = newCountDataSet(snep_count_table, snep_design)
@@ -1065,6 +1065,7 @@ marker, ##<< The marker involved.
 combi, ##<< The strain combination involved.
 form, ##<< the nuc form involved.
 all_samples, ##<< Global list of samples.
+FDR = 0.0001, ## the specific False Discover Rate
 config=NULL ##<< GLOBAL config variable
 ) {
   # PRETREAT
@@ -1082,8 +1083,7 @@ config=NULL ##<< GLOBAL config variable
 	reads$pvalsGLM = signif(tmp_analyse[[4]], 5)
 	snep_design = tmp_analyse[[3]]
   # print(snep_design)
-	fdr = 0.0001
-	thres = FDR(reads$pvalsGLM, fdr)
+	thres = FDR(reads$pvalsGLM, FDR)
 	reads$snep_index = reads$pvalsGLM < thres
 	print(paste(sum(reads$snep_index), " SNEPs found for ", length(reads[,1])," nucs and ", fdr*100,"% of FDR.", sep = ""))
   return(reads)
@@ -1119,7 +1119,7 @@ config=NULL ##<< GLOBAL config variable
 
 
 ROM2ARAB = function(# Roman to Arabic pair list.
-### Util to convert Roman to Arabic
+### Utility to convert Roman numbers into Arabic numbers
 ){list(
   "I" = 1,
   "II" = 2,
@@ -1159,19 +1159,19 @@ l ##<< The pairlist to switch.
 })
 
 ARAB2ROM = function(# Arabic to Roman pair list.
-### Util to convert Arabicto Roman
+### Utility to convert Arabic numbers to Roman numbers
 ){switch_pairlist(ROM2ARAB())}
 
 
 
 
 c2c_extraction = function(# Extract a sub part of the corresponding c2c file
-### This fonction allow to acces to a specific part of the c2c file.
+### This fonction allows to access to a specific part of the c2c file.
 strain1, ##<< the key strain
 strain2, ##<< the target strain
-chr=NULL, ##<< if defined, the c2c will filtered according to the chromosome value
-lower_bound=NULL, ##<< if defined, the c2c will filtered for part of the genome upper than lower_bound
-upper_bound=NULL, ##<< if defined, the c2c will filtered for part of the genome lower than upper_bound
+chr=NULL, ##<< if defined, the c2c will be filtered according to the chromosome value
+lower_bound=NULL, ##<< if defined, the c2c will be filtered for part of the genome upper than lower_bound
+upper_bound=NULL, ##<< if defined, the c2c will be filtered for part of the genome lower than upper_bound
 config=NULL##<<  GLOBAL config variable
 ) {
   reverse = (strain1=="RM" & strain2=="BY") | strain1=="YJM"
@@ -1656,8 +1656,8 @@ region2 ##<< Regions to intersect.
 }
 
 build_replicates = structure(function(# Stage replicates data
-### This function loads in memory data corresponding to the given experiments.
-expe, ##<< a list of vector corresponding to vector of replicates.
+### This function loads in memory the data corresponding to the given experiments.
+expe, ##<< a list of vectors corresponding to replicates.
 roi, ##<< the region that we are interested in.
 only_fetch=FALSE, ##<< filter or not inputs.
 get_genome=FALSE,##<< Load or not corresponding genome.
@@ -1705,7 +1705,7 @@ config=NULL ##<< GLOBAL config variable.
     # library(nucleominer)
     #
     # # Read config file
-    # json_conf_file = "nucleo_miner_config.json"
+    # json_conf_file = "nucleominer_config.json"
     # config = fromJSON(paste(readLines(json_conf_file), collapse=""))
     # # Read sample file
     # all_samples = get_content(config$CSV_SAMPLE_FILE, "cvs", sep=";", head=TRUE, stringsAsFactors=FALSE)
@@ -2017,10 +2017,10 @@ config=NULL ##<< GLOBAL config variable
         tmp_track_prev = tmp_track[-length(tmp_track)]
         tmp_track_next = tmp_track[-1]
         # tmp_track_inter = signif(tmp_track_prev - tmp_track_next) * (abs(tmp_track_prev - tmp_track_next) > 1) * 25
-        if (is.null(config$TRACK_LOD_OFFSET)) {
-          config$TRACK_LOD_OFFSET = 0
+        if (is.null(config$TRACK_LLR_OFFSET)) {
+          config$TRACK_LLR_OFFSET = 0
         }
-        tmp_track_inter = signif(tmp_track_prev - tmp_track_next) + config$TRACK_LOD_OFFSET * 25
+        tmp_track_inter = signif(tmp_track_prev - tmp_track_next) + config$TRACK_LLR_OFFSET * 25
         tmp_x_prev = tmp_x[-length(tmp_x)]
         tmp_x_next = tmp_x[-1]
         need_shift = apply(t(tmp_x_next - tmp_x_prev), 2, function(delta){ delta < 50})
@@ -2038,10 +2038,10 @@ config=NULL ##<< GLOBAL config variable
         points(tmp_x, tmp_y, cex=4, pch=16, col="white")
         points(tmp_x, tmp_y, cex=4, lwd=2)
         text(tmp_x, tmp_y, 1:nrow(tf_nucs))
-        if (is.null(config$LEGEND_LOD_POS)) {
+        if (is.null(config$LEGEND_LLR_POS)) {
           pos = 2
         } else {
-          pos = config$LEGEND_LOD_POS
+          pos = config$LEGEND_LLR_POS
         }
         col_llr = sapply(tmp_llr_inter, function(llr){if (llr < 20 ) return("green") else return("red")})
         text(tmp_x_inter, tmp_y_inter, tmp_llr_inter, cex=1.5, pos=pos, col=col_llr) 
