commit 6e0010bc3dfaab1d9549e5b0096d8c9612dde4b4
Author: Florent Chuffart <florent.chuffart@ens-lyon.fr>
Date:   Tue Apr 29 10:09:45 2014 +0200

    Some change for the visualization of chains

diff --git a/build/nucleominer_2.3.40.tar.gz b/build/nucleominer_2.3.40.tar.gz
new file mode 100644
index 0000000..6359164
Binary files /dev/null and b/build/nucleominer_2.3.40.tar.gz differ
diff --git a/doc/sphinx_doc/build/latex/NucleoMiner2.pdf b/doc/sphinx_doc/build/latex/NucleoMiner2.pdf
index 9615611..1ee49a2 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/ref.txt b/doc/sphinx_doc/build/text/ref.txt
index d423398..26fdb4b 100644
--- a/doc/sphinx_doc/build/text/ref.txt
+++ b/doc/sphinx_doc/build/text/ref.txt
@@ -6,191 +6,6 @@ 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.
-
-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
 ===========
@@ -450,21 +265,21 @@ Florent Chuffart
 Examples
 ~~~~~~~~
 
-       # Define new translate_roi function...
-       translate_roi = function(roi, strain2, big_roi=NULL, config=NULL) {
+       # 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_roi", as.environment("package:nucleominer"))
-       unlockBinding("translate_roi", getNamespace("nucleominer"))
-       assign("translate_roi", translate_roi, "package:nucleominer")
-       assign("translate_roi", translate_roi, getNamespace("nucleominer"))
-       lockBinding("translate_roi", getNamespace("nucleominer"))
-       lockBinding("translate_roi", as.environment("package:nucleominer"))
+       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_roi(roi, roi$strain_ref1)
+   roi2 = translate_cur(roi, roi$strain_ref1)
    replicates = list()
    for (j in 1:2) {
        samples = list()
@@ -615,6 +430,61 @@ Examples
    #       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
 
 
@@ -662,8 +532,8 @@ CURs are regions that can be aligned between the genomes
 Usage
 ~~~~~
 
-   compute_inter_all_strain_curs(diff_allowed = 10, min_cur_width = 200,
-       config = NULL, plot = FALSE)
+   compute_inter_all_strain_curs(diff_allowed = 30, min_cur_width = 4000,
+       config = NULL)
 
 
 Arguments
@@ -681,10 +551,6 @@ The minimum width of a CUR
 
 GLOBAL config variable
 
-"plot"
-
-Plot CURs or not
-
 
 Author(s)
 ~~~~~~~~~
@@ -701,8 +567,8 @@ Crop bound of regions according to region of interest bound
 Description
 ~~~~~~~~~~~
 
-The fucntion is no more necessary since we remove "big_roi" bug in
-translate_roi function.
+The fucntion is no more necessary since we remove "big_cur" bug in
+translate_cur function.
 
 
 Usage
@@ -795,50 +661,6 @@ Examples
    df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
    print(df)
 
-R: Extract wp nucs from nuc map.
-
-
-Extract wp nucs from nuc map.
------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-Function based on common wp nuc index and roi_index.
-
-
-Usage
-~~~~~
-
-   extract_wp(strain_maps, roi_index, strain, tmp_common_nucs)
-
-
-Arguments
-~~~~~~~~~
-
-"strain_maps"
-
-Nuc maps.
-
-"roi_index"
-
-The region of interest index.
-
-"strain"
-
-The strain to consider.
-
-"tmp_common_nucs"
-
-the list of wp nucs.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
 R: Prefetch data
 
 
@@ -1050,7 +872,7 @@ aggregate_intra_strain_nucs function.
 Usage
 ~~~~~
 
-   flat_aggregated_intra_strain_nucs(partial_strain_maps, roi_index)
+   flat_aggregated_intra_strain_nucs(partial_strain_maps, cur_index)
 
 
 Arguments
@@ -1060,7 +882,7 @@ Arguments
 
 the output of aggregate_intra_strain_nucs function
 
-"roi_index"
+"cur_index"
 
 the index of the roi involved
 
@@ -1241,55 +1063,44 @@ Author(s)
 
 Florent Chuffart
 
-R: Compute the fuzzy nucs.
+R: Compute the fuzzy list for a given strain.
 
 
-Compute the fuzzy nucs.
------------------------
+Compute the fuzzy list for a given strain.
+------------------------------------------
 
 
 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 fuzzy regions. It will be take into account in the count
-read part og the pipeline.
+This function grabs the nucleosomes detxted by template_filter that
+have been rejected bt aggregate_intra_strain_nucs as well positions.
 
 
 Usage
 ~~~~~
 
-   get_fuzzy(combi, roi, roi_index, strain_maps, common_nuc_results,
-       config = NULL)
+   get_intra_strain_fuzzy(wp_map, roi, strain, config = NULL)
 
 
 Arguments
 ~~~~~~~~~
 
-"combi"
+"wp_map"
 
-The strain combination to consider.
+Well positionned nucleosomes map.
 
 "roi"
 
 The region of interest.
 
-"roi_index"
-
-The region of interest index.
-
-"strain_maps"
-
-Nuc maps.
+"strain"
 
-"common_nuc_results"
-
-Common wp nuc maps
+The strain we want to extracvt the fuzzy map.
 
 "config"
 
-GLOBAL config variable
+GLOBAL config variable.
 
 
 Author(s)
@@ -1351,10 +1162,106 @@ Examples
 
    marker = "H3K4me1"
    combi = c("BY", "YJM")
-   form = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy"
+   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
 
 
@@ -1439,7 +1346,7 @@ Details
 +-----------------+-----------------------------------------------------+
 | Author:         | Florent Chuffart                                    |
 +-----------------+-----------------------------------------------------+
-| Version:        | 2.3.29                                              |
+| Version:        | 2.3.40                                              |
 +-----------------+-----------------------------------------------------+
 | License:        | CeCILL                                              |
 +-----------------+-----------------------------------------------------+
@@ -1454,62 +1361,6 @@ Author(s)
 
 Florent Chuffart
 
-R: Performaing ANOVAs
-
-
-Performaing ANOVAs
-------------------
-
-
-Description
-~~~~~~~~~~~
-
-Counts reads and Performs ANOVAS for each common nucleosomes involved.
-
-
-Usage
-~~~~~
-
-   perform_anovas(replicates, aligned_inter_strain_nucs, inputs_name = "Mnase_Seq",
-       plot_anova_boxes = FALSE)
-
-
-Arguments
-~~~~~~~~~
-
-"replicates"
-
-Set of replicates, each replicate is a list of samples (ideally 3).
-Each sample is a list like *sample = list(id=..., marker=...,
-strain=..., roi=..., inputs=..., outputs=...)* with *roi =
-list(name=..., begin=..., end=..., chr=..., genome=...)*. In the
-*perform_anovas* contexte, we need 4 replicates (4 * (3 samples)): 2
-strains * (1 marker + 1 input (Mnase_Seq)).
-
-"aligned_inter_strain_nucs"
-
-List of common nucleosomes.
-
-"inputs_name"
-
-Name of the input.
-
-"plot_anova_boxes"
-
-Plot (or not) boxplot for each nuc.
-
-
-Value
-~~~~~
-
-Returns ANOVA results and comunted reads.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
 R: Plot the distribution of reads.
 
 
@@ -1559,50 +1410,6 @@ Author(s)
 
 Florent Chuffart
 
-R: Remove wp nucs from common nucs list.
-
-
-Remove wp nucs from common nucs list.
--------------------------------------
-
-
-Description
-~~~~~~~~~~~
-
-It is based on common wp nucs index on nucs and region.
-
-
-Usage
-~~~~~
-
-   remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, strain)
-
-
-Arguments
-~~~~~~~~~
-
-"strain_maps"
-
-Nuc maps.
-
-"roi_index"
-
-The region of interest index.
-
-"tmp_common_nucs"
-
-the list of wp nucs.
-
-"strain"
-
-The strain to consider.
-
-
-Author(s)
-~~~~~~~~~
-
-Florent Chuffart
-
 R: sign from strand
 
 
@@ -1722,47 +1529,45 @@ Examples
    l = list(key1 = "value1", key2 = "value2")
    print(switch_pairlist(l))
 
-R: Translate a list of regions from a strain ref to another.
+R: Translate coords of a genome region.
 
 
-Translate a list of regions from a strain ref to another.
----------------------------------------------------------
+Translate coords of a genome region.
+------------------------------------
 
 
 Description
 ~~~~~~~~~~~
 
-This function is an eloborated call to translate_roi.
+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_regions(regions, combi, roi_index, config = NULL, roi)
+   translate_cur(roi, strain2, config = NULL, big_cur = NULL)
 
 
 Arguments
 ~~~~~~~~~
 
-"regions"
-
-Regions to be translated.
-
-"combi"
+"roi"
 
-Combination of strains.
+Original genome region of interest.
 
-"roi_index"
+"strain2"
 
-The region of interest index.
+The strain in wich you want the genome region of interest.
 
 "config"
 
 GLOBAL config variable
 
-"roi"
+"big_cur"
 
-The region of interest.
+A largest region than roi use to filter c2c if it is needed.
 
 
 Author(s)
@@ -1770,45 +1575,68 @@ Author(s)
 
 Florent Chuffart
 
-R: Translate coords of a genome region.
 
+Examples
+~~~~~~~~
 
-Translate coords of a genome region.
-------------------------------------
+   # 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 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.
+This function is an eloborated call to translate_cur.
 
 
 Usage
 ~~~~~
 
-   translate_roi(roi, strain2, config = NULL, big_roi = NULL)
+   translate_regions(regions, combi, cur_index, config = NULL, roi)
 
 
 Arguments
 ~~~~~~~~~
 
-"roi"
+"regions"
 
-Original genome region of interest.
+Regions to be translated.
 
-"strain2"
+"combi"
 
-The strain in wich you want the genome region of interest.
+Combination of strains.
+
+"cur_index"
+
+The region of interest index.
 
 "config"
 
 GLOBAL config variable
 
-"big_roi"
+"roi"
 
-A largest region than roi use to filter c2c if it is needed.
+The region of interest.
 
 
 Author(s)
@@ -1816,27 +1644,6 @@ Author(s)
 
 Florent Chuffart
 
-
-Examples
-~~~~~~~~
-
-   # Define new translate_roi function...
-   translate_roi = function(roi, strain2, config) {
-       strain1 = roi$strain_ref
-       if (strain1 == strain2) {
-           return(roi)
-       } else {
-         stop("Here is my new translate_roi function...")
-       }
-   }
-   # Binding it by uncomment follwing lines.
-   # unlockBinding("translate_roi", as.environment("package:nm"))
-   # unlockBinding("translate_roi", getNamespace("nm"))
-   # assign("translate_roi", translate_roi, "package:nm")
-   # assign("translate_roi", translate_roi, getNamespace("nm"))
-   # lockBinding("translate_roi", getNamespace("nm"))
-   # lockBinding("translate_roi", as.environment("package:nm"))
-
 R: Aggregate regions that intersect themnselves.
 
 
@@ -1893,10 +1700,12 @@ Usage
        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_wp_nuc_model = TRUE,
-       plot_common_nucs = TRUE, plot_anovas = FALSE, plot_anova_boxes = FALSE,
-       plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, aggregated_intra_strain_nucs = NULL,
-       aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
+       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
@@ -1950,6 +1759,10 @@ Change the color of each nucleosome.
 
 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
@@ -1958,13 +1771,9 @@ Plot (or not) gaussian model for a cluster of nucs
 
 Plot (or not) aligned reads.
 
-"plot_anovas"
-
-Plot (or not) scatter for each nuc.
+"plot_common_unrs"
 
-"plot_anova_boxes"
-
-Plot (or not) boxplot for each nuc.
+Plot (or not) unaligned nucleosomal refgions (UNRs).
 
 "plot_wp_nucs_4_nonmnase"
 
@@ -1974,6 +1783,10 @@ Plot (or not) clusters for non inputs samples.
 
 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.
@@ -1987,6 +1800,18 @@ list of aligned inter strain nucs. If NULL, it will be computed.
 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
diff --git a/doc/sphinx_doc/build/text/tuto.txt b/doc/sphinx_doc/build/text/tuto.txt
index 68f359e..85c37e2 100644
--- a/doc/sphinx_doc/build/text/tuto.txt
+++ b/doc/sphinx_doc/build/text/tuto.txt
@@ -44,52 +44,28 @@ 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.
@@ -98,10 +74,6 @@ 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*.
 
diff --git a/doc/sphinx_doc/conf.py b/doc/sphinx_doc/conf.py
index 3d8f352..6f8985f 100644
--- a/doc/sphinx_doc/conf.py
+++ b/doc/sphinx_doc/conf.py
@@ -50,9 +50,9 @@ copyright = u'2012, Florent CHUFFART, Jean-Baptiste VEYRIERAS, Gael YVERT'
 # built documents.
 #
 # The short X.Y version.
-version = '2.3.39'
+version = '2.3.40'
 # The full version, including alpha/beta/rc tags.
-release = '2.3.39'
+release = '2.3.40'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/sphinx_doc/rref.rst b/doc/sphinx_doc/rref.rst
index c4c0399..541040c 100644
--- a/doc/sphinx_doc/rref.rst
+++ b/doc/sphinx_doc/rref.rst
@@ -1252,7 +1252,7 @@ Details
 +---------------+---------------------------------------------------+
 | Author:       | Florent Chuffart                                  |
 +---------------+---------------------------------------------------+
-| Version:      | 2.3.39                                            |
+| Version:      | 2.3.40                                            |
 +---------------+---------------------------------------------------+
 | License:      | CeCILL                                            |
 +---------------+---------------------------------------------------+
@@ -1586,8 +1586,10 @@ Usage
         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, aggregated_intra_strain_nucs = NULL, 
-        aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
+        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
 ~~~~~~~~~
@@ -1664,6 +1666,10 @@ Plot (or not) clusters for non inputs samples.
 
 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.
@@ -1677,6 +1683,18 @@ list of aligned inter strain nucs. If NULL, it will be computed.
 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
diff --git a/src/DESCRIPTION b/src/DESCRIPTION
index 9d4a761..9a5c6f0 100644
--- a/src/DESCRIPTION
+++ b/src/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: nucleominer
 Maintainer: Florent Chuffart <florent.chuffart@ens-lyon.fr>
 Author: Florent Chuffart
-Version: 2.3.39
+Version: 2.3.40
 License: CeCILL 
 Title: nm
 Depends: seqinr, plotrix, DESeq, cachecache
diff --git a/src/R/nucleominer.R b/src/R/nucleominer.R
index 290254c..22313e1 100644
--- a/src/R/nucleominer.R
+++ b/src/R/nucleominer.R
@@ -1835,9 +1835,13 @@ plot_common_nucs = FALSE,  ##<< Plot (or not) aligned reads.
 plot_common_unrs = FALSE,  ##<< Plot (or not) unaligned nucleosomal refgions (UNRs).
 plot_wp_nucs_4_nonmnase = FALSE,  ##<< Plot (or not) clusters for non inputs samples.
 plot_chain = FALSE,  ##<< Plot (or not) clusterised nuceosomes between mnase samples.
+plot_sample_id = FALSE, ##<<  Plot (or not) the sample id for each sample.
 aggregated_intra_strain_nucs = NULL, ##<< list of aggregated intra strain nucs. If NULL, it will be computed.
 aligned_inter_strain_nucs = NULL, ##<< list of aligned inter strain nucs. If NULL, it will be computed.
 height = 10, ##<< Number of reads in per million read for each sample, graphical parametre for the y axis.
+main=NULL, ##<< main title of the produced plot
+xlab=NULL, ##<< xlab of the produced plot
+ylab="#reads (per million reads)", ##<< ylab of the produced plot
 config=NULL ##<< GLOBAL config variable
 ){
   returned_list = list()
@@ -1859,7 +1863,10 @@ config=NULL ##<< GLOBAL config variable
 	y_max_glo = max(ylim_glo)
   delta_y_glo = y_max_glo - y_min_glo
   # Plot main frame
-  plot(c(x_min_glo,x_max_glo), c(0,0), ylim=ylim_glo, col=0, yaxt="n", ylab="#reads (per million reads)", xlab=paste("Ref strain:", replicates[[1]][[1]]$strain, "chr: ", replicates[[1]][[1]]$roi$chr), main="NucleoMiner2" )
+  if (is.null(xlab)) {
+    xlab = paste("Ref strain:", replicates[[1]][[1]]$strain, "chr: ", replicates[[1]][[1]]$roi$chr)
+  }
+  plot(c(x_min_glo,x_max_glo), c(0,0), ylim=ylim_glo, col=0, yaxt="n", ylab=ylab, xlab=xlab, main=main )
   axis(2, at=0:(nb_rank_glo*2) * delta_y_glo / (nb_rank_glo*2), labels=c(rep(c(height/2,0),nb_rank_glo),height/2))
   # Go
 	replicates_wp_nucs = list()
@@ -1878,7 +1885,9 @@ config=NULL ##<< GLOBAL config variable
 			# computing sample parameters
 			sample = samples[[sample_rank]]
 			y_lev = y_min + (sample_rank - 0.5) * delta_y/nb_rank
-			text(x_min_glo, y_lev + height/2 - delta_y_glo/100, labels=paste("(",sample$id,") ",sample$strain, " ", sample$marker, sep=""))
+      if (plot_sample_id) {
+  			text(x_min_glo, y_lev + height/2 - delta_y_glo/100, labels=paste("(",sample$id,") ",sample$strain, " ", sample$marker, sep=""))
+      }
 
 		  if (sample$roi[["begin"]] < sample$roi[["end"]]) {
 			  x_min = sample$roi[["begin"]]
@@ -1940,9 +1949,12 @@ config=NULL ##<< GLOBAL config variable
 				if (length(nucs$center) > 0) {
 					col = 1
 		      for (i in 1:length(nucs$center)) {
+            foo<<-nucs
             if (change_col) {
   						col = col + 1
-            }
+              } else {
+                col = "blue"
+              }
 		        nuc = nucs[i,]
 						involved_reads = filter_tf_inputs(reads, sample$roi$chr, nuc$lower_bound, nuc$upper_bound, nuc_width = nuc$width)
 				  	involved_signs = apply(t(involved_reads[,3]), 2, function(strand) {	if (strand == "F") return(1) else return(-1)})
@@ -1962,7 +1974,7 @@ config=NULL ##<< GLOBAL config variable
 							lines(sign(x_min) * delta_x + shift, dnorm(delta_x, mean(flatted_reads[[2]]), sd(flatted_reads[[2]])) * length(flatted_reads[[2]]) * -1 * sign(x_min) * height/5 + y_lev, col=col)
 	          }
 	          if (plot_gaussian_unified_reads ) {
-							lines(sign(x_min) * delta_x + shift, dnorm(delta_x, mean(flatted_reads[[3]]), sd(flatted_reads[[3]])) * length(flatted_reads[[3]]) * height/5 + y_lev, col=col, lty=2)
+							lines(sign(x_min) * delta_x + shift, dnorm(delta_x, mean(flatted_reads[[3]]), sd(flatted_reads[[3]])) * length(flatted_reads[[3]]) * height/5 + y_lev, col=col, lty=1)
 	          }
 	          if (plot_ellipse_nucs) {
 				      # require(plotrix)
@@ -2007,7 +2019,11 @@ config=NULL ##<< GLOBAL config variable
         tmp_track = unlist(tf_nucs$track)
         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
+        # 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
+        }
+        tmp_track_inter = signif(tmp_track_prev - tmp_track_next) + config$TRACK_LOD_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})
@@ -2025,7 +2041,12 @@ config=NULL ##<< GLOBAL config variable
         points(tmp_x, tmp_y, cex=4, pch=16, col="white")
         points(tmp_x, tmp_y, cex=4, lw=2)
         text(tmp_x, tmp_y, 1:nrow(tf_nucs))
-        text(tmp_x_inter, tmp_y_inter, tmp_lod_inter, srt=90, cex=0.9, bg = "yellow")#, col=(tmp_lod_inter < 20) + 2)
+        if (is.null(config$LEGEND_LOD_POS)) {
+          pos = 2
+        } else {
+          pos = config$LEGEND_LOD_POS
+        }
+        text(tmp_x_inter, tmp_y_inter, tmp_lod_inter, cex=1.5, pos=pos) 
       }
 
       if (plot_wp_nucs | plot_fuzzy_nucs | plot_common_nucs ) {
@@ -2117,7 +2138,7 @@ config=NULL ##<< GLOBAL config variable
       common_nuc_results = list()
       common_nuc_results[[paste(combi[1], combi[2], sep="_")]] = aligned_inter_strain_nucs
       unrs = get_unrs(combi, roi, cur_index, wp_maps, fuzzy_maps, common_nuc_results, config = config) 
-      rect(sign(x_min[[1]]) * unrs$lower_bound + shift[[1]], y_min[[1]], sign(x_min[[1]]) * unrs$upper_bound + shift[[1]], y_max[[2]], col=adjustcolor(4, alpha.f = 0.3), border=1)        
+      rect(sign(x_min[[1]]) * unrs$lower_bound + shift[[1]], y_min[[1]], sign(x_min[[1]]) * unrs$upper_bound + shift[[1]], y_max[[2]], border=4, lw=3, col=adjustcolor(4, alpha.f = 0.05))        
     }
 
 	}
