module MiGA::Dataset::Type

def check_type

exception, and true otherwise (and no tests are failed)
If the dataset type is +:empty+, it returns +false+ without raising an

project type and raise an exception if any of these checks fail
Check that the dataset type is defined, known, and compatible with the
#
def check_type
  raise MiGA::Error.new('Undefined dataset type') unless type
  return false if type == :empty
  unless self.class.KNOWN_TYPES[type]
    raise MiGA::Error.new("Unknown dataset type: #{type}")
  end
  unless self.class.KNOWN_TYPES[type][:project_types].include? project.type
    raise MiGA::Error.new(
      "Dataset type (#{type}) incompatible with project (#{project.type})"
    )
  end
  true
end

def markers?

Are universal marker genes expected to be found in this dataset?
#
def markers?
  self.class.KNOWN_TYPES.dig(type, :markers)
end

def multi?

Is this dataset known to be multi-organism?
#
def multi?
  self.class.KNOWN_TYPES.dig(type, :multi)
end

def nonmulti?

Is this dataset known to be single-organism?
#
def nonmulti?
  y = self.class.KNOWN_TYPES.dig(type, :multi)
  y.nil? ? nil : !y
end

def type

Get the type of dataset as Symbol
#
def type
  metadata[:type]
end