commit c68acc424884f52e8fb8d2069ea34b5c107498e6
Author: Florent Chuffart <florent.chuffart@ens-lyon.fr>
Date:   Wed Jul 16 18:28:33 2014 +0200

    initialize project

diff --git a/README b/README
new file mode 100644
index 0000000..2a41fb9
--- /dev/null
+++ b/README
@@ -0,0 +1,56 @@
+***************************************
+Readme / Documentation for `cachecache`
+***************************************
+
+`cachecache` offers Python API and R package allowing to perform 
+direct qtl detection from raw sequence reads of yeast populations under selection.
+
+License
+=======
+
+Copyright CNRS 2012-2013                                                 
+                                                                          
+- Florent CHUFFART                                                         
+- Gael YVERT                                                               
+                                                                          
+This software is a computer program which purpose is to perform direct qtl 
+detection from raw sequence reads of yeast populations under selection.
+                                                                          
+The Software is provided "as is" without warranty of any kind, either express or 
+implied, including without limitation any implied warranties of condition, 
+uninterrupted use, merchantability, fitness for a particular purpose, or 
+non-infringement. You use this software at your own risk.
+								                                                           
+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
+-----
+
+`cachecache` home page: https://forge.cbp.ens-lyon.fr/redmine/projects/cachecache
\ No newline at end of file
diff --git a/build/cachecache_0.1.tar.gz b/build/cachecache_0.1.tar.gz
new file mode 100644
index 0000000..64c13bb
Binary files /dev/null and b/build/cachecache_0.1.tar.gz differ
diff --git a/build/cachecache_0.2.tar.gz b/build/cachecache_0.2.tar.gz
new file mode 100644
index 0000000..951054f
Binary files /dev/null and b/build/cachecache_0.2.tar.gz differ
diff --git a/build/cachecache_0.3.tar.gz b/build/cachecache_0.3.tar.gz
new file mode 100644
index 0000000..9005289
Binary files /dev/null and b/build/cachecache_0.3.tar.gz differ
diff --git a/src/DESCRIPTION b/src/DESCRIPTION
new file mode 100644
index 0000000..46cf1d9
--- /dev/null
+++ b/src/DESCRIPTION
@@ -0,0 +1,13 @@
+Package: cachecache
+Maintainer: Florent Chuffart <florent.chuffart@ens-lyon.fr>
+Author: Florent Chuffart
+Version: 0.2
+License: CeCILL 
+Title: cachecache
+Depends: 
+Description: cachecache is an R package allowing to reduce disk access by managing a cache. Data on the disk is identified by a path that is also an index in the cache (an R list). this index provide an access to the same data in RAM space. cachecache is used to compute NGS data in the SiGHT project context (ERC-StG2011-281359). For more information on how to use bot, have a look on the examples of the help ?cahecache::get_content.
+URL: http://forge.cbp.ens-lyon.fr/redmine/projects/cachecache http://www.ens-lyon.fr/LBMC/gisv/index.php/en/protocols/bioinformatics  http://www.ens-lyon.fr/LBMC/gisv
+
+ 
+
+  
diff --git a/src/NAMESPACE b/src/NAMESPACE
new file mode 100644
index 0000000..d65fd31
--- /dev/null
+++ b/src/NAMESPACE
@@ -0,0 +1 @@
+export(get_content)
\ No newline at end of file
diff --git a/src/R/cachecache.R b/src/R/cachecache.R
new file mode 100644
index 0000000..9bf2fec
--- /dev/null
+++ b/src/R/cachecache.R
@@ -0,0 +1,61 @@
+get_content = structure( function(## Get content from cached 
+### Access to the cached content of a file via the global variable CACHE_CACHE. Load content in CACHE_CACHE if needed.
+filename, ##<< The path to the file that contain dataset.
+class=NULL, ##<< The class of dataset.
+... ##<< Parameters that will be passed to my_read
+) {
+  if (inherits(try(CACHE_CACHE,TRUE), "try-error") || is.null(CACHE_CACHE)) {
+    CACHE_CACHE <<- list()
+  }
+  obj = list(filename=filename)
+  class(obj) = class
+  if (is.null(CACHE_CACHE[[obj$filename]])) {
+    print(paste("Loading file ",obj$filename, sep=""))
+		tmp_content = my_read(obj, ...)
+    print("affect it...")
+    CACHE_CACHE[[obj$filename]] <<- tmp_content
+    print("done.")
+  }  
+  return(CACHE_CACHE[[obj$filename]])
+### Returns the cached content of the current object. 
+}, ex=function(){
+	# Create a dataframe
+	df = data.frame(list(key1 = "value1", key2 = "value2"), stringsAsFactors=FALSE)
+	df = rbind(df, list(key1 = "value1'", key2 = "value3'"))
+	# Dump it into tmp file
+	write.table(df, file="/tmp/tmp.dump.table.tmp")
+	# Load it into cache using feature.
+	# First time it will be load into cache
+	print(get_content("/tmp/tmp.dump.table.tmp", "table", stringsAsFactors=FALSE))
+	# Second time not
+	print(get_content("/tmp/tmp.dump.table.tmp", "table", stringsAsFactors=FALSE))
+	
+})
+	
+my_read = function(
+### Abstract my_read function.	
+	obj, ...) {
+  UseMethod("my_read", obj)
+}
+	
+my_read.default = function(
+### Default my_read function.	
+	obj, ...){
+  stop(paste("ERROR, my_read is not defined for any Objects (file ", obj$filename," )", sep=""))			
+}
+
+my_read.table = function(
+### my_read function for table files.	
+	obj, ...){
+	if (rev(unlist(strsplit(obj$filename, ".", fixed=TRUE)))[1] == "gz") {
+	  return(read.table(file=gzfile(obj$filename), ...))			
+	} else { 
+	  return(read.table(file=obj$filename, ...))
+	}
+}	
+
+my_read.cvs = function(
+### my_read function for cvs files.	
+	obj, ...){
+  return(read.csv(file=obj$filename, ...))
+}	
