Learn R Programming

hpoPlot (version 1.0)

get.term.adjacency.matrix: Get HPO Term Adjacency Matrix

Description

Get adjacency matrix based on the HPO for a set of terms.

Usage

get.term.adjacency.matrix(hpo.terms, terms)
get.term.pseudo.adjacency.matrix(hpo.terms, terms)

Arguments

hpo.terms
An R-Object representing the HPO, as returned by get.hpo.terms.
terms
Character vector of hpo terms.

Value

  • Matrix of logicals x, where x[row, col] is TRUE if row is a parent of column and FALSE otherwise.

Details

get.term.adjacency.matrix only creates edges between parents and children, whereas get.term.pseudo.adjacency.matrix also creates edges from a node to its most recent ancestors in the set of terms if its parent is absent.

Examples

Run this code
data(hpo)

	migraine.terms <- get.ancestors(hpo.terms, hpo.terms$id[hpo.terms$name == "Migraine"])

	migraine.adj.mat <- get.term.adjacency.matrix(hpo.terms, migraine.terms)

	#plot simple graph of migraine terms
	plot(
		new(
			"graphAM", 
			adjMat=migraine.adj.mat, 
			edgemode="directed"
		)
	)

Run the code above in your browser using DataLab