# Path: seqenv/common/cache.py
# def property_cached(f):
#     """Decorator for properties evaluated only once.
#     It can be used to created a cached property like this:
# 
#         class Employee(object):
#             @property_cached
#             def salary(self):
#                 print "Evaluating..."
#                 return time.time()
#         bob = Employee()
#         print bob.salary
#         bob.salary = "10000$"
#         print bob.salary
#     """
#     def retrieve_from_cache(self):
#         if '__cache__' not in self.__dict__: self.__cache__ = {}
#         if f.__name__ not in self.__cache__:
#             # Add result to the property cache #
#             if inspect.isgeneratorfunction(f): result = tuple(f(self))
#             else: result = f(self)
#             self.__cache__[f.__name__] = result
#         return self.__cache__[f.__name__]
#     def overwrite_cache(self, value):
#         if '__cache__' not in self.__dict__: self.__cache__ = {}
#         self.__cache__[f.__name__] = value
#     retrieve_from_cache.__doc__ = f.__doc__
#     return property(retrieve_from_cache, overwrite_cache)
# 
# Path: seqenv/common/autopaths.py
# class DirectoryPath(str):
# 
#     def __repr__(self): return '<%s object "%s">' % (self.__class__.__name__, self.path)
# 
#     @classmethod
#     def clean_path(cls, path):
#         """Given a path, return a cleaned up version for initialization."""
#         # Conserve 'None' object style #
#         if path is None: return None
#         # Don't nest DirectoryPaths or the like #
#         if hasattr(path, 'path'): path = path.path
#         # Expand the tilda #
#         if "~" in path: path = os.path.expanduser(path)
#         # Our standard is to end with a slash for directories #
#         if not path.endswith('/'): path += '/'
#         # Return the result #
#         return path
# 
#     def __new__(cls, path, *args, **kwargs):
#         """A DirectoryPath is in fact a string"""
#         return str.__new__(cls, cls.clean_path(path))
# 
#     def __init__(self, path):
#         self.path = self.clean_path(path)
# 
#     @property
#     def name(self):
#         """Just the directory name"""
#         return os.path.basename(os.path.dirname(self.path))
# 
#     @property
#     def exists(self):
#         """Does it exist in the file system?"""
#         return os.path.lexists(self.path) # Include broken symlinks
# 
#     @property
#     def absolute_path(self):
#         """The absolute path starting with a `/`"""
#         return os.path.abspath(self.path) + '/'
# 
#     @property
#     def is_symlink(self):
#         """Is this directory a symbolic link to an other directory?"""
#         return os.path.islink(self.path.rstrip('/'))
# 
#     @property
#     def directory(self):
#         """The full path of directory containing this one"""
#         return DirectoryPath(os.path.dirname(os.path.dirname(self.path)))
# 
#     @property
#     def permissions(self):
#         """Convenience object for dealing with permissions."""
#         return FilePermissions(self.path)
# 
#     def remove(self):
#         if not self.exists: return False
#         if self.is_symlink: return self.remove_when_symlink()
#         shutil.rmtree(self.path, ignore_errors=True)
#         return True
# 
#     def remove_when_symlink(self):
#         if not self.exists: return False
#         os.remove(self.path.rstrip('/'))
#         return True
# 
#     def create(self, safe=False, inherit=True):
#         # Create it #
#         if not safe:
#             os.makedirs(self.path)
#             if inherit: os.chmod(self.path, self.directory.permissions.number)
#         if safe:
#             try:
#                 os.makedirs(self.path)
#                 if inherit: os.chmod(self.path, self.directory.permissions.number)
#             except OSError: pass
# 
#     def create_if_not_exists(self):
#         if not self.exists: self.create()


import warnings, marshal, re
import seqenv
import pandas
    import biom
from seqenv.common.cache     import property_cached
from seqenv.common.autopaths import DirectoryPath
# Built-in modules #

# Internal modules #

# Third party modules #

# We don't want the annoying h5py warning #
with warnings.catch_warnings():
    warnings.simplefilter("ignore")

################################################################################
class OutputGenerator(object):
    """Once the Analysis is done running and all the data is in memory in the
    form of python objects, this object will take care of generating
    all the output files the user could possibly want. You pass it the Analysis
    object obviously."""


# Path: seqenv/common/cache.py
# def property_cached(f):
#     """Decorator for properties evaluated only once.
#     It can be used to created a cached property like this:
# 
#         class Employee(object):
#             @property_cached
#             def salary(self):
#                 print "Evaluating..."
#                 return time.time()
#         bob = Employee()
#         print bob.salary
#         bob.salary = "10000$"
#         print bob.salary
#     """
#     def retrieve_from_cache(self):
#         if '__cache__' not in self.__dict__: self.__cache__ = {}
#         if f.__name__ not in self.__cache__:
#             # Add result to the property cache #
#             if inspect.isgeneratorfunction(f): result = tuple(f(self))
#             else: result = f(self)
#             self.__cache__[f.__name__] = result
#         return self.__cache__[f.__name__]
#     def overwrite_cache(self, value):
#         if '__cache__' not in self.__dict__: self.__cache__ = {}
#         self.__cache__[f.__name__] = value
#     retrieve_from_cache.__doc__ = f.__doc__
#     return property(retrieve_from_cache, overwrite_cache)
# 
# Path: seqenv/common/autopaths.py
# class DirectoryPath(str):
# 
#     def __repr__(self): return '<%s object "%s">' % (self.__class__.__name__, self.path)
# 
#     @classmethod
#     def clean_path(cls, path):
#         """Given a path, return a cleaned up version for initialization."""
#         # Conserve 'None' object style #
#         if path is None: return None
#         # Don't nest DirectoryPaths or the like #
#         if hasattr(path, 'path'): path = path.path
#         # Expand the tilda #
#         if "~" in path: path = os.path.expanduser(path)
#         # Our standard is to end with a slash for directories #
#         if not path.endswith('/'): path += '/'
#         # Return the result #
#         return path
# 
#     def __new__(cls, path, *args, **kwargs):
#         """A DirectoryPath is in fact a string"""
#         return str.__new__(cls, cls.clean_path(path))
# 
#     def __init__(self, path):
#         self.path = self.clean_path(path)
# 
#     @property
#     def name(self):
#         """Just the directory name"""
#         return os.path.basename(os.path.dirname(self.path))
# 
#     @property
#     def exists(self):
#         """Does it exist in the file system?"""
#         return os.path.lexists(self.path) # Include broken symlinks
# 
#     @property
#     def absolute_path(self):
#         """The absolute path starting with a `/`"""
#         return os.path.abspath(self.path) + '/'
# 
#     @property
#     def is_symlink(self):
#         """Is this directory a symbolic link to an other directory?"""
#         return os.path.islink(self.path.rstrip('/'))
# 
#     @property
#     def directory(self):
#         """The full path of directory containing this one"""
#         return DirectoryPath(os.path.dirname(os.path.dirname(self.path)))
# 
#     @property
#     def permissions(self):
#         """Convenience object for dealing with permissions."""
#         return FilePermissions(self.path)
# 
#     def remove(self):
#         if not self.exists: return False
#         if self.is_symlink: return self.remove_when_symlink()
#         shutil.rmtree(self.path, ignore_errors=True)
#         return True
# 
#     def remove_when_symlink(self):
#         if not self.exists: return False
#         os.remove(self.path.rstrip('/'))
#         return True
# 
#     def create(self, safe=False, inherit=True):
#         # Create it #
#         if not safe:
#             os.makedirs(self.path)
#             if inherit: os.chmod(self.path, self.directory.permissions.number)
#         if safe:
#             try:
#                 os.makedirs(self.path)
#                 if inherit: os.chmod(self.path, self.directory.permissions.number)
#             except OSError: pass
# 
#     def create_if_not_exists(self):
#         if not self.exists: self.create()


# Path: seqenv/outputs.py
import warnings, marshal, re
import seqenv
import pandas
    import biom
from seqenv.common.cache     import property_cached
from seqenv.common.autopaths import DirectoryPath

# Built-in modules #

# Internal modules #

# Third party modules #

# We don't want the annoying h5py warning #
with warnings.catch_warnings():
    warnings.simplefilter("ignore")

################################################################################
class OutputGenerator(object):
    """Once the Analysis is done running and all the data is in memory in the
    form of python objects, this object will take care of generating
    all the output files the user could possibly want. You pass it the Analysis
    object obviously."""


    sep = '\t'