fixSetLabels: Fix Set labels for legibility

fixSetLabelsR Documentation

Fix Set labels for legibility

Description

Fix Set labels for legibility

Usage

fixSetLabels(
  x,
  wrap = TRUE,
  width = 25,
  maxNchar = Inf,
  suffix = "...",
  nodeType = c("Set", "Gene", "any"),
  adjustCase = TRUE,
  removeGrep = "^(KEGG|PID|REACTOME|BIOCARTA|NABA|SA|SIG|ST)[_.]",
  words_from = c("als", "ii", "iii", "iv", "v", "tgf", "nfkb", "trna", "rrna", "mirna",
    "mrna", "snrna", "snorna", "scrna", "lincrna"),
  words_to = c("ALS", "II", "III", "IV", "V", "TGF", "NFKB", "tRNA", "rRNA", "miRNA",
    "mRNA", "snRNA", "snoRNA", "scRNA", "lincRNA"),
  ...
)

Arguments

x

character vector, or igraph object. When an igraph object is supplied, the V(g)$name attribute is used as the basis of generating a label, which is then stored as V(g)$label.

wrap

logical indicating whether to apply word wrap, based upon the supplied width argument.

width

integer value used when wrap=TRUE, it is sent to base::strwrap().

maxNchar

numeric value or Inf to limit the maximum characters allowed for each string. This option is preferred when wrap=TRUE is not feasible, for example heatmap labels. When NULL or Inf no limit is applied. See base::nchar().

suffix

character value used as a suffix when maxNchar is used, the string is shortened so that the shortened string and suffix values are maxNchar characters long. It serves as an indicator that the string label has been shortened.

nodeType

character value compared to the vertex attribute "nodeType" when the input x is an igraph object. This option is used to restrict label changes to certain nodes. When NULL or nodeType="any" then all node labels are updated.

adjustCase

logical indicating whether to adjust the uppercase and lowercase lettering.

removeGrep

character regular expression pattern used to remove patterns from the resulting label. The default values remove the prefix used in MsigDB canonical pathway names, which is a prefix indicating the source of each pathway.

words_from, words_to

character vectors of words to match in case-insensitive manner, to be replaced with fixed-case alternatives. It uses perl-based regular expression matching in base::gsub(), and the ⁠\\b⁠ expression to enforce a word boundary, either via delimiter, whitespace, or the end of the string.

...

additional arguments are ignored.

Details

This function is a convenient wrapper for several steps that edit gene set and pathways labels to be slightly more legible. It operates on either a character vector, or an igraph object.

Value

vector or igraph object, to match the input x.

See Also

Other jam igraph functions: cnet2df(), cnet2im(), cnetplotJam(), cnetplot_internalJam(), color_edges_by_nodegroups(), color_edges_by_nodes_deprecated(), color_edges_by_nodes(), color_nodes_by_nodegroups(), communities2nodegroups(), drawEllipse(), edge_bundle_bipartite(), edge_bundle_nodegroups(), enrichMapJam(), flip_edges(), get_bipartite_nodeset(), igraph2pieGraph(), jam_igraph(), jam_plot_igraph(), label_communities(), layout_with_qfrf(), layout_with_qfr(), mem2emap(), memIM2cnet(), mem_multienrichplot(), nodegroups2communities(), rectifyPiegraph(), relayout_with_qfr(), removeIgraphBlanks(), removeIgraphSinglets(), reorderIgraphNodes(), rotate_igraph_layout(), spread_igraph_labels(), subgraph_jam(), subsetCnetIgraph(), subset_igraph_components(), sync_igraph_communities(), with_qfr()

Examples

x <- c("KEGG_INSULIN_SIGNALING_PATHWAY",
   "KEGG_T_CELL_RECEPTOR_SIGNALING_PATHWAY",
   "KEGG_NEUROTROPHIN_SIGNALING_PATHWAY");
fixSetLabels(x);

jamba::nullPlot();
jamba::drawLabels(txt=x,
   preset=c("top", "center", "bottom"));


jmw86069/multienrichjam documentation built on Feb. 7, 2024, 12:58 a.m.