commit b20637ed6504f7ef9d2cc4a38e4aed694d99aa6c
Author: Florent Chuffart <florent.chuffart@ens-lyon.fr>
Date:   Mon Jan 20 18:52:25 2014 +0100

    Fixing bug in substract_region fucntion

diff --git a/build/nucleominer_2.3.19.tar.gz b/build/nucleominer_2.3.19.tar.gz
new file mode 100644
index 0000000..9064535
Binary files /dev/null and b/build/nucleominer_2.3.19.tar.gz differ
diff --git a/doc/sphinx_doc/build/latex/NucleoMiner2.pdf b/doc/sphinx_doc/build/latex/NucleoMiner2.pdf
index 3a546f7..bed9a87 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/tuto.txt b/doc/sphinx_doc/build/text/tuto.txt
index f38d2d5..ccda2e9 100644
--- a/doc/sphinx_doc/build/text/tuto.txt
+++ b/doc/sphinx_doc/build/text/tuto.txt
@@ -384,13 +384,17 @@ This preprocessing step consists in the 4 main steps embed in the
 steps.
 
 The second part of the tutoriel use *R*
-(http://http://www.r-project.org). It consists in the 3 main steps
-corresponding to 4 R scripts:
+(http://http://www.r-project.org). It consists in the following main
+steps:
 
    * compute_rois.R
 
    * extract_maps.R
 
+   * compare_common_wp.R
+
+   * split_samples.R
+
    * count_reads.R
 
    * get_size_factors
@@ -410,6 +414,18 @@ Extracting Maps for Well Positionned and Fuzzy Nucleosomes
    R CMD BATCH src/current/extract_maps.R
 
 
+Compute Distance Between Well Positionned Nucleosomes
+-----------------------------------------------------
+
+   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
 -------------------------------
 
diff --git a/doc/sphinx_doc/conf.py b/doc/sphinx_doc/conf.py
index 0a8f682..6169499 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.18'
+version = '2.3.19'
 # The full version, including alpha/beta/rc tags.
-release = '2.3.18'
+release = '2.3.19'
 
 # 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 d59a2ff..b0b745b 100644
--- a/doc/sphinx_doc/rref.rst
+++ b/doc/sphinx_doc/rref.rst
@@ -1114,7 +1114,7 @@ Details
 +---------------+---------------------------------------------------+
 | Author:       | Florent Chuffart                                  |
 +---------------+---------------------------------------------------+
-| Version:      | 2.3.18                                            |
+| Version:      | 2.3.19                                            |
 +---------------+---------------------------------------------------+
 | License:      | CeCILL                                            |
 +---------------+---------------------------------------------------+
diff --git a/doc/sphinx_doc/tuto.rst b/doc/sphinx_doc/tuto.rst
index 081dc58..3d996fa 100644
--- a/doc/sphinx_doc/tuto.rst
+++ b/doc/sphinx_doc/tuto.rst
@@ -297,10 +297,12 @@ and `strains` that will be used along the 4 steps.
 
 
 The second part of the tutoriel use `R` (http://http://www.r-project.org). It 
-consists in the 3 main steps corresponding to 4 R scripts:
+consists in the following main steps:
 
   - compute_rois.R
   - extract_maps.R
+  - compare_common_wp.R
+  - split_samples.R
   - count_reads.R
   - get_size_factors  
   - launch_deseq.R
@@ -321,6 +323,22 @@ Extracting Maps for Well Positionned and Fuzzy Nucleosomes
   R CMD BATCH src/current/extract_maps.R
 
 
+Compute Distance Between Well Positionned Nucleosomes 
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. code:: bash
+
+  R CMD BATCH src/current/compare_common_wp.R
+
+
+Split and Compress Samples According CURs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. code:: bash
+
+  R CMD BATCH src/current/split_samples.R
+
+
 Count Reads for Each Nucleosome
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/src/DESCRIPTION b/src/DESCRIPTION
index 8451d90..7bbbec2 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.18
+Version: 2.3.19
 License: CeCILL 
 Title: nm
 Depends: seqinr, plotrix, DESeq, cachecache
diff --git a/src/R/nucleominer.R b/src/R/nucleominer.R
index 4c656e5..84327b3 100644
--- a/src/R/nucleominer.R
+++ b/src/R/nucleominer.R
@@ -767,7 +767,16 @@ region2 ##<< Regions to substract.
   }
   non_inter_fuzzy = rec_substract_region(region1, region2)
   if (is.null(non_inter_fuzzy)) {return(non_inter_fuzzy)}
-  return(collapse_regions(non_inter_fuzzy))
+  tmp_ulist = unlist(non_inter_fuzzy)
+  tmp_names = names(tmp_ulist)[1:4]
+  non_inter_fuzzy = data.frame(matrix(tmp_ulist, ncol=4, byrow=TRUE), stringsAsFactors=FALSE) 
+  names(non_inter_fuzzy) = tmp_names
+  non_inter_fuzzy$chr = as.character(non_inter_fuzzy$chr)     
+  non_inter_fuzzy$chr = as.numeric(non_inter_fuzzy$chr)     
+  non_inter_fuzzy$lower_bound = as.numeric(non_inter_fuzzy$lower_bound)
+  non_inter_fuzzy$upper_bound = as.numeric(non_inter_fuzzy$upper_bound)
+  non_inter_fuzzy = non_inter_fuzzy[order(non_inter_fuzzy$lower_bound),]      
+  return(non_inter_fuzzy)
 }
 
 union_regions = function(# Aggregate regions that intersect themnselves.
@@ -841,7 +850,7 @@ collapse_regions = function(# reformat an "apply  manipulated" list of regions
 ### Utils to reformat an "apply  manipulated" list of regions
 regions ##< a list of regions
 ) {
-  regions = do.call("rbind", regions)      
+  regions = do.call(rbind, regions)      
   regions$chr = as.character(regions$chr)     
   regions$chr = as.numeric(regions$chr)     
   regions$lower_bound = as.numeric(regions$lower_bound)
