# Path: q2_types/plugin_setup.py



import ijson
import h5py
import biom
import qiime2.plugin.model as model
from ..plugin_setup import plugin, citations

    def sniff(self):
        try:
            # Always sniff in read-only mode. If opened in 'w' mode,
            # h5py will truncate the file, effectively destroying
            # the table's contents
            with h5py.File(str(self), mode='r') as fh:
                for grp in self.groups:
                    if grp not in fh:
                        return False
                for ds in self.datasets:
                    if ds not in fh:
                        return False
                for attr in self.attrs:
                    if attr not in fh.attrs:
                        return False
                return True
        except Exception:
            return False


BIOMV100DirFmt = model.SingleFileDirectoryFormat('BIOMV100DirFmt',
                                                 'feature-table.biom',
                                                 BIOMV100Format)
BIOMV210DirFmt = model.SingleFileDirectoryFormat('BIOMV210DirFmt',
                                                 'feature-table.biom',
                                                 BIOMV210Format)

plugin.register_views(BIOMV100Format, BIOMV210Format, BIOMV100DirFmt,
                      BIOMV210DirFmt, biom.Table,

# Path: q2_types/plugin_setup.py



# Path: q2_types/feature_table/_format.py
import ijson
import h5py
import biom
import qiime2.plugin.model as model
from ..plugin_setup import plugin, citations


    def sniff(self):
        try:
            # Always sniff in read-only mode. If opened in 'w' mode,
            # h5py will truncate the file, effectively destroying
            # the table's contents
            with h5py.File(str(self), mode='r') as fh:
                for grp in self.groups:
                    if grp not in fh:
                        return False
                for ds in self.datasets:
                    if ds not in fh:
                        return False
                for attr in self.attrs:
                    if attr not in fh.attrs:
                        return False
                return True
        except Exception:
            return False


BIOMV100DirFmt = model.SingleFileDirectoryFormat('BIOMV100DirFmt',
                                                 'feature-table.biom',
                                                 BIOMV100Format)
BIOMV210DirFmt = model.SingleFileDirectoryFormat('BIOMV210DirFmt',
                                                 'feature-table.biom',
                                                 BIOMV210Format)

plugin.register_views(BIOMV100Format, BIOMV210Format, BIOMV100DirFmt,
                      BIOMV210DirFmt, biom.Table,

                      citations=[citations['mcdonald2012biological']])