Skip to contents

This function takes a vector of glycan structures and returns the corresponding GlyTouCan accessions. It first looks up structures from glydb::glydb_data, then uses the GlycanFormatConverter API maintained by the Glycosmos project for structures not found locally.

Usage

struc_to_glytoucan(strucs)

Arguments

strucs

A glyrepr::glycan_structure() vector, or a character vector of glycan text representations supported by glyparse::auto_parse(). The glycan structure must have "concrete" monosaccharides (e.g., Gal, GalNAc). Inputs with unresolved floating parts or substituents produce a warning and return NA.

Value

A character vector of GlyTouCan accessions corresponding to the input glycan structures. If a structure cannot be converted to a GlyTouCan accession, the corresponding entry will be NA.

Details

For "topological" structures (e.g., "Gal(??-?)GalNAc(??-"), this function will first call glyrepr::fill_anomer_pos() to fill in the missing anomeric positions before looking up accessions. This is necessary because all glycan structures in GlyTouCan must have defined anomeric positions.