Esempio n. 1
0
 def checkFileStructure(s):
     """Returns True if minimum required file structure is present."""
     if not core.ispath(s.protocolroot()):
         return False;
     if not core.ispath(s.experimentsPath()):
         return False;
     if not core.ispath(s.documentPath()):
         return False;
     return True;
Esempio n. 2
0
 def createFileStructure(s):
     """Creates minimum requried file structure at root if needed."""
     # protocol folder
     if not core.ispath(s.protocolroot()):
         core.makepath(s.protocolroot());
     if not core.ispath(s.experimentsPath()):
         core.makepath(s.experimentsPath());
     if not core.ispath(s.documentPath()):
         core.makepath(s.documentPath());
Esempio n. 3
0
    def initializeExperiment(s,eid,overwrite=False):
        """Initialize an experiment with id eid, may overwrite if it exists
        (overwrite=True), which will delete all existing repository files for
        the experiment before writing over with empty ones, otherwise raises.
        Initialization means creating the repository folders and writing empty
        set and sample spreadsheet files.  Returns None."""

        eid = s.testID(eid);
        if not s.checkFileStructure():
            raise Exception("File structure is not yet valid.");

        # experiment folder
        if core.ispath(s.experimentPath(eid)):
            if overwrite:
                s.deleteExperimentPath(eid);
            else:
                raise Exception("Path " + s.experimentPath(eid) + " already exists");
        s.createExperimentFolder(eid);
        # write empty set and sample files
        s.writeSets( s.getEmptySets(), eid );
        s.writeSams( s.getEmptySams(), eid );
Esempio n. 4
0
 def experimentPathExists(s,eid):
     """Does the folder for experiment eid exist? True or False."""
     eid = s.testID(eid);
     return core.ispath( s.experimentPath(eid) );
Esempio n. 5
0
 def deleteExperimentPath(s,eid):
     """Delete the repository folder for experiment eid."""
     eid = s.testID(eid);
     if not core.ispath( s.experimentPath(eid) ):
         raise Exception("Can't find " + s.experimentPath(eid));
     core.rmpath( s.experimentPath(eid), require_empty=False );
Esempio n. 6
0
 def createExperimentFolder(s,eid):
     """Create repository folder for experiment eid."""
     eid = s.testID(eid);
     if not core.ispath( s.experimentPath(eid) ):
         core.makepath( s.experimentPath(eid) );