# Path: q2_types/plugin_setup.py

# 
# Path: q2_types/ordination/_format.py
# class OrdinationFormat(model.TextFileFormat):
#     def sniff(self):
#         sniffer = skbio.io.io_registry.get_sniffer('ordination')
#         return sniffer(str(self))[0]
# 
# class ProcrustesStatisticsFmt(model.TextFileFormat):
#     METADATA_COLUMNS = {
#         'true M^2 value',
#         'p-value for true M^2 value',
#         'number of Monte Carlo permutations',
#     }
# 
#     def validate(self, level):
#         try:
#             md = qiime2.Metadata.load(str(self))
#         except qiime2.metadata.MetadataFileError as md_exc:
#             raise ValidationError(md_exc) from md_exc
# 
#         for column in sorted(self.METADATA_COLUMNS):
#             try:
#                 md.get_column(column)
#             except ValueError as md_exc:
#                 raise ValidationError(md_exc) from md_exc


import pandas as pd
import skbio
import qiime2
from ..plugin_setup import plugin
from . import OrdinationFormat, ProcrustesStatisticsFmt
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------




def _ordination_format_to_ordination_results(ff):
    return skbio.OrdinationResults.read(str(ff), format='ordination',
                                        verify=False)


def _ordination_format_to_dataframe(ff):

# Path: q2_types/plugin_setup.py

# 
# Path: q2_types/ordination/_format.py
# class OrdinationFormat(model.TextFileFormat):
#     def sniff(self):
#         sniffer = skbio.io.io_registry.get_sniffer('ordination')
#         return sniffer(str(self))[0]
# 
# class ProcrustesStatisticsFmt(model.TextFileFormat):
#     METADATA_COLUMNS = {
#         'true M^2 value',
#         'p-value for true M^2 value',
#         'number of Monte Carlo permutations',
#     }
# 
#     def validate(self, level):
#         try:
#             md = qiime2.Metadata.load(str(self))
#         except qiime2.metadata.MetadataFileError as md_exc:
#             raise ValidationError(md_exc) from md_exc
# 
#         for column in sorted(self.METADATA_COLUMNS):
#             try:
#                 md.get_column(column)
#             except ValueError as md_exc:
#                 raise ValidationError(md_exc) from md_exc


# Path: q2_types/ordination/_transformer.py
import pandas as pd
import skbio
import qiime2
from ..plugin_setup import plugin
from . import OrdinationFormat, ProcrustesStatisticsFmt

# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------




def _ordination_format_to_ordination_results(ff):
    return skbio.OrdinationResults.read(str(ff), format='ordination',
                                        verify=False)


def _ordination_format_to_dataframe(ff):

    ordination_results = _ordination_format_to_ordination_results(ff)