Skip to contents

Given glycan compositions, this function matches them to all compatible glycan structures in the glydb database. Generic, concrete, and mixed residue identities are matched residue by residue.

Usage

comp_to_struc(comps, db = NULL, return_best = FALSE)

Arguments

comps

Glycan compositions to match against. Can be either:

  • A glyrepr::glycan_composition() vector.

  • Byonic style composition strings (e.g. Hex(5)HexNAc(2)).

  • Simple style composition strings (e.g. H5N4F1S1).

db

Glycan structures to match against. Can be a glyrepr::glycan_structure() vector or any structure strings supported by glyparse::auto_parse(). Structures with unresolved floating parts or substituents are excluded with a warning. If not provided, glydb::glydb_structures(structure_level = "intact") will be used.

return_best

If TRUE, only return the highest confidence match for each composition. Requires db to have a confidence attribute. Use glydb::glydb_structures() for db to enable this feature. Default is FALSE.

Value

If return_best=TRUE: A glyrepr::glycan_structure() vector with the same length as comps. Unmatched compositions are returned as NA. If return_best=FALSE: A tibble with the following columns:

  • composition: The glycan compositions, as glyrepr::glycan_composition() vector.

  • structure: The possible glycan structures, as glyrepr::glycan_structure() vector.

  • confidence: The database confidence score for each structure, or NA when no score is available. Note that one glycan composition can have multiple rows in the result, corresponding to different possible glycan structures.

How to set db

The db parameter is very important for all functions in this package. By default, it uses all available glycans in the glydb package, which is usually larger than what you need. You can use helper functions in glydb to narrow down the database, e.g. glydb::glydb_compositions() or glydb::glydb_structures().

You can use the species and glycan_type parameters to focus on specific species and glycan type. For example, if you are only interested in N-glycan compositions in human, you can use glydb::glydb_compositions(species = "Homo sapiens", glycan_type = "N"). Also, you can decide the level of information in the database by setting mono_type of glydb::glydb_compositions() and structure_level of glydb::glydb_structures().

You can then pass the result to the db parameter of this function. For example,

my_db <- glydb::glydb_compositions(species = "Homo sapiens", glycan_type = "N")
mz_to_comp(mz, db = my_db)

Examples

comp_to_struc("H5N2")
#> # A tibble: 79 × 3
#>    composition     structure                                          confidence
#>    <comp>          <struct>                                                <dbl>
#>  1 Hex(5)HexNAc(2) Man(b1-2)Man(b1-3)[Man(b1-3)Man(b1-6)]Man(b1-4)Gl…      -1   
#>  2 Hex(5)HexNAc(2) GlcNAc(b1-2)Man(a1-3)[Man(a1-3)[Man(a1-6)]Man(a1-…      -1   
#>  3 Hex(5)HexNAc(2) Man(a1-2)Man(a1-3)[Man(a1-3)Man(a1-6)]Man(b1-4)Gl…       3.22
#>  4 Hex(5)HexNAc(2) Man(a1-3)[Man(a1-6)]Man(a1-6)[Man(a1-3)]Man(a1-4)…       1.39
#>  5 Hex(5)HexNAc(2) Man(a1-2)Man(a1-2)Man(a1-3)[Glc(a1-6)]Man(b1-4)Gl…      -1   
#>  6 Hex(5)HexNAc(2) Man(a1-3)Man(a1-3)[Man(a1-3)Man(a1-6)]Man(b1-4)Gl…      -1   
#>  7 Hex(5)HexNAc(2) Man(a1-3)[Man(a1-6)]Man(a1-6)Man(a1-3)Man(b1-4)Gl…      -1   
#>  8 Hex(5)HexNAc(2) Man(a1-2)Man(a1-3)[Man(a1-6)Man(a1-6)]Man(a1-4)Gl…      -1   
#>  9 Hex(5)HexNAc(2) Man(a1-2)Man(a1-3)Man(a1-6)[Man(a1-3)]Man(b1-4)Gl…       1.61
#> 10 Hex(5)HexNAc(2) Gal(a1-6)Man(b1-3)[Man(b1-6)Man(a1-6)]Man(b1-4)Gl…      -1   
#> # ℹ 69 more rows