takane
Validators for ArtifactDB file formats
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
takane Namespace Reference

takane validation functions. More...

Namespaces

namespace  atomic_vector
 Definitions for atomic vectors.
 
namespace  bam_file
 Definitions for BAM files.
 
namespace  bcf_file
 Definitions for BCF files.
 
namespace  bed_file
 Definitions for BED files.
 
namespace  bigbed_file
 Definitions for bigBed files.
 
namespace  bigwig_file
 Definitions for bigWig files.
 
namespace  compressed_sparse_matrix
 Definitions for compressed sparse matrices.
 
namespace  csv_data_frame
 Definitions for CSV data frames.
 
namespace  data_frame_factor
 Definitions for data frame factors.
 
namespace  delayed_array
 Definitions for delayed arrays.
 
namespace  dense_array
 Definitions for dense arrays.
 
namespace  fasta_file
 Definitions for FASTA files.
 
namespace  fastq_file
 Definitions for FASTQ files.
 
namespace  genomic_ranges
 Definitions for genomic ranges.
 
namespace  gff_file
 Definitions for GFF files.
 
namespace  gmt_file
 Definitions for GMT files.
 
namespace  multi_sample_dataset
 Definitions for multi-sample datasets.
 
namespace  ranged_summarized_experiment
 Definitions for ranged summarized experiments.
 
namespace  rds_file
 Definitions for RDS files.
 
namespace  sequence_information
 Definitions for sequence information objects.
 
namespace  sequence_string_set
 Definitions for sequence string sets.
 
namespace  simple_list
 Definitions for simple lists.
 
namespace  single_cell_experiment
 Definitions for single cell experiments.
 
namespace  spatial_experiment
 Definitions for spatial experiments.
 
namespace  string_factor
 Definitions for string factors.
 
namespace  summarized_experiment
 Definitions for summarized experiments.
 
namespace  vcf_experiment
 Definitions for VCF experiments.
 

Classes

struct  CsvContents
 Contents of the parsed CSV. More...
 
struct  CsvFieldCreator
 Create comservatory::Field objects to capture column contents. More...
 
struct  DummyCsvFieldCreator
 Dummy column creator. More...
 
struct  ObjectMetadata
 Object metadata, including the type and other fields. More...
 
struct  Options
 Validation options. More...
 

Functions

bool derived_from (const std::string &type, const std::string &base, const Options &options)
 
std::vector< size_t > dimensions (const std::filesystem::path &path, const ObjectMetadata &metadata, Options &options)
 
std::vector< size_t > dimensions (const std::filesystem::path &path, Options &options)
 
std::vector< size_t > dimensions (const std::filesystem::path &path)
 
size_t height (const std::filesystem::path &path, const ObjectMetadata &metadata, Options &options)
 
size_t height (const std::filesystem::path &path, Options &options)
 
size_t height (const std::filesystem::path &path)
 
bool satisfies_interface (const std::string &type, const std::string &interface, const Options &options)
 
void validate (const std::filesystem::path &path, const ObjectMetadata &metadata, Options &options)
 
void validate (const std::filesystem::path &path, Options &options)
 
void validate (const std::filesystem::path &path)
 
ObjectMetadata reformat_object_metadata (millijson::Base *raw)
 
ObjectMetadata read_object_metadata (const std::filesystem::path &path)
 

Detailed Description

takane validation functions.

Function Documentation

◆ derived_from()

bool takane::derived_from ( const std::string &  type,
const std::string &  base,
const Options options 
)
inline

Check whether a particular object type is derived from a base object type. Derived types satisfy the same file requirements of the base type, but usually add more files to represent additional functionality. This can be used by specifications to check whether arbitrary objects satisfy the file structure expectations for a particular base type.

Applications can add their own derived types for a given base class in Options::custom_derived_from. This extends the default relationships whereby derived_from() will take the union of all derived object types in the default and custom sets. Note that derived types must be manually included in every base type's set, e.g., if B is derived from A and C is derived from B, C must be added to the sets for both A and B.

Parameters
typeObject type.
baseBase object type.
optionsValidation options, containing custom derived/base relationships.
Returns
Whether type is derived from base or is equal to base.

◆ dimensions() [1/3]

std::vector< size_t > takane::dimensions ( const std::filesystem::path &  path)
inline

Overload of dimensions() with default settings.

Parameters
pathPath to a directory containing an object.
Returns
The object's dimensions.

◆ dimensions() [2/3]

std::vector< size_t > takane::dimensions ( const std::filesystem::path &  path,
const ObjectMetadata metadata,
Options options 
)
inline

Get the dimensions of a multi-dimensional object in a subdirectory, based on the supplied object type.

Applications can supply custom dimension functions for a given type via Options::custom_dimensions. If available, the supplied custom function will be used instead of the default.

Parameters
pathPath to a directory representing an object.
metadataMetadata for the object, typically determined from its OBJECT file.
optionsValidation options.
Returns
Vector containing the object's dimensions.

◆ dimensions() [3/3]

std::vector< size_t > takane::dimensions ( const std::filesystem::path &  path,
Options options 
)
inline

Get the dimensions of an object in a subdirectory, using its OBJECT file to automatically determine the type.

Parameters
pathPath to a directory containing an object.
optionsValidation options.
Returns
The object's dimensions.

◆ height() [1/3]

size_t takane::height ( const std::filesystem::path &  path)
inline

Overload of height() with default settings.

Parameters
pathPath to a directory containing an object.
Returns
The object's height.

◆ height() [2/3]

size_t takane::height ( const std::filesystem::path &  path,
const ObjectMetadata metadata,
Options options 
)
inline

Get the height of an object in a subdirectory, based on the supplied object type.

height() is used to check the shape of objects stored in vertical containers, e.g., columns of a data_frame. For vectors or other 1-dimensional objects, the height is usually just the length of the object (for some object-specific definition of "length"). For higher-dimensional objects, the height is usually the extent of the first dimension.

Applications can supply custom height functions for a given type via Options::custom_height. If available, the supplied custom function will be used instead of the default.

Parameters
pathPath to a directory representing an object.
metadataMetadata for the object, typically determined from its OBJECT file.
optionsValidation options.
Returns
The object's height.

◆ height() [3/3]

size_t takane::height ( const std::filesystem::path &  path,
Options options 
)
inline

Get the height of an object in a subdirectory, using its OBJECT file to automatically determine the type.

Parameters
pathPath to a directory containing an object.
optionsValidation options.
Returns
The object's height.

◆ read_object_metadata()

ObjectMetadata takane::read_object_metadata ( const std::filesystem::path &  path)
inline

Reads the OBJECT file inside a directory to determine the object type.

Parameters
pathPath to a directory containing an object.
Returns
Object metadata, including the type and other fields.

◆ reformat_object_metadata()

ObjectMetadata takane::reformat_object_metadata ( millijson::Base *  raw)
inline

Parses a JSON object to obtain the object metadata.

Parameters
rawRaw JSON object, typically obtained by millijson::parse_file. Note that raw is consumed by this function and should no longer be used by the caller.
Returns
Object metadata, including the type and other fields.

◆ satisfies_interface()

bool takane::satisfies_interface ( const std::string &  type,
const std::string &  interface,
const Options options 
)
inline

Check whether a particular object type satisfies a particular object interface. This can be used by specifications to check that child components satisfy certain user-level expectations for an abstract object (e.g., data frames, lists).

Applications can extend the takane framework by adding custom types to Options::custom_satisfies_interface. This extends the default relationships whereby satisfies_interface() will take the union of all object types in the default and custom sets. Note that, if a type is included in a particular set, it is not necessary to add its derived types, as satisfies_interface() will automatically call derived_from().

Parameters
typeObject type.
interfaceInterface type.
optionsValidation options, containing custom object interface relationships.
Returns
Whether type satisfies interface.

◆ validate() [1/3]

void takane::validate ( const std::filesystem::path &  path)
inline

Overload of validate() with default settings.

Parameters
pathPath to a directory containing an object.

◆ validate() [2/3]

void takane::validate ( const std::filesystem::path &  path,
const ObjectMetadata metadata,
Options options 
)
inline

Validate an object in a subdirectory, based on the supplied object type.

Applications can supply custom validation functions for a given type via Options::custom_validate. If available, the supplied custom function will be used instead of the default.

Parameters
pathPath to a directory representing an object.
metadataMetadata for the object, typically determined from its OBJECT file.
optionsValidation options.

◆ validate() [3/3]

void takane::validate ( const std::filesystem::path &  path,
Options options 
)
inline

Validate an object in a subdirectory, using its OBJECT file to automatically determine the type.

Parameters
pathPath to a directory containing an object.
optionsValidation options.