tests/testthat/test-parse-pglyco.R

test_that("(N(F)(N(H(H(N))(H(N(H))))))", {
  skip_on_old_win()
  glycan <- parse_pglyco_struc("(N(F)(N(H(H(N))(H(N(H))))))")
  expect_snapshot(print(glycan, verbose = TRUE))
})


test_that("(N(F)(N(H(H(N(H)))(H(N(H(A)))))))", {
  skip_on_old_win()
  glycan <- parse_pglyco_struc("(N(F)(N(H(H(N(H)))(H(N(H(A)))))))")
  expect_snapshot(print(glycan, verbose = TRUE))
})


test_that("single monosaccharide", {
  skip_on_old_win()
  glycan <- parse_pglyco_struc("(N)")
  expect_snapshot(print(glycan, verbose = TRUE))
})


test_that("pH and aH monosaccharides", {
  skip_on_old_win()
  glycan <- parse_pglyco_struc("(pH(aH))")
  expect_snapshot(print(glycan, verbose = TRUE))
})


test_that("pGlyco array assembly preserves branched topology", {
  graph <- parse_pglyco_struc_arrays(
    "(N(F)(N(H(H(N))(H(N(H))))))"
  )

  expect_identical(
    matrix(as.double(graph$edges), ncol = 2, byrow = TRUE),
    matrix(
      c(
        1,
        2,
        1,
        3,
        3,
        4,
        4,
        5,
        5,
        6,
        4,
        7,
        7,
        8,
        8,
        9
      ),
      ncol = 2,
      byrow = TRUE
    )
  )
  expect_identical(
    graph$mono,
    c(
      "HexNAc",
      "dHex",
      "HexNAc",
      "Hex",
      "Hex",
      "HexNAc",
      "Hex",
      "HexNAc",
      "Hex"
    )
  )
  expect_identical(
    graph$linkage,
    rep("??-?", 8)
  )
})

Try the glyparse package in your browser

Any scripts or data that you put into this service are public.

glyparse documentation built on Oct. 31, 2026, 9:06 a.m.