Learn R Programming

MRPC builds on existing PC algorithms and learns a causal network with increased accuracy. The inferred causal network contains directed and undirected edges, with the direction indicating causality. For genomic data, MRPC determines edge direction under the principle of Mendelian randomization when genotype and molecular phenotype (e.g. gene expression) data are both available at the individual level. Nodes in the inferred network may be a genotype or a molecular phenotype.
Development of the R package MRPC is at https://github.com/audreyqyfu/mrpc, and official releases are available on CRAN: https://cran.r-project.org/web/packages/MRPC/index.html.

References:

  1. Md. Bahadur Badsha, Audrey Qiuyan Fu (2019) Learning causal biological networks

with the principle of Mendelian randomization. Frontiers in Genetics. 10:460.

  1. Md. Bahadur Badsha, Evan A Martin, Audrey Qiuyan Fu (2021) MRPC: An R package for inference of causal graphs. Frontiers in Genetics. 12:651812.

Installation

1. Installation of the most recent version from GitHub.

First install the R package devtools available on CRAN, if it is not already installed. This package provides function install_github() that enables installing packages directly from github with the following command.

Invoke R and then type with the following command:

R> install.packages ("devtools")
R> library (devtools)
# install R packages that MRPC depends on before running the next line 
# see details below
R> install_github ("audreyqyfu/mrpc")

MRPC depends on several R packages from CRAN and from Bioconductor. It is likely that some of these packages are not installed on your computer. If the R package is available on CRAN, you may use the following command line for installation (change packagename to the name of the package to be installed, e.g, bnlearn, pcalg, etc.) before running function install_github:

R> install.packages ("packagename")

The following Bioconductor packages also need to be installed before running function install_github or install.packages:

R> if (!requireNamespace ("BiocManager", quietly = TRUE))
    install.packages ("BiocManager")
R> BiocManager::install ('AnnotationDbi')
R> BiocManager::install ('GO.db')
R> BiocManager::install ('graph')
R> BiocManager::install ('impute')
R> BiocManager::install ('preprocessCore')
R> BiocManager::install ('RBGL')
R> BiocManager::install ('Rgraphviz')

2. Installation from the source of a released package.

Download the package source MRPC_xxx.tar.gz.

In Terminal, navigate to the directory where the package is stored, and run the following command line:

$ R CMD INSTALL MRPC_xxx.tar.gz

Again, you may need to first install the Bioconductor packages that MRPC depends on using the instructions above. Alternatively, you may also run the following command line in R, after changing the working directory to where MRPC_xxx.tar.gz is stored on your computer:

R> install.packages ("MRPC_xxx.tar.gz", repos = NULL, type="source")

3. Installation from CRAN.

Official releases are available on CRAN. To install,

R> install.packages ("MRPC")

Using MRPC

After installation, load the MRPC package into R:

R> library (MRPC)

Bring up the documentation of the package:

R> library (help=MRPC)

Copy Link

Version

Install

install.packages('MRPC')

Monthly Downloads

304

Version

3.1.0

License

GPL (>= 2)

Maintainer

Audrey Q Fu

Last Published

April 11th, 2022

Functions in MRPC (3.1.0)

IdentifyAssociatedPCs

Identifyprincipal components (PCs) that are significantly associated with eQTLs and genes
RecallPrecision

Calculate recall and precision for two graphs
data_GEUVADIS_combined

Combined genotype and gene expression data from 62 eQTL-gene sets in 373 Europeans from GEUVADIS
PlotGraphWithModules

Plot a graph with nodes in modules indicated by colors
MRPCtruth

Graphs used as truth in simulation
SimulateData

Simulate data under certain graphs
MRPCclass-class

Class of MRPC algorithm results
data_examples

Example data under simple and complex models
CompareMethodsVStructure

Comparison of inference accuracy of different methods on data with and without a v-structure
ModiSkeleton

Infer a graph skeleton (undirected graph)
SimulateData3P

Simulate data for a node with three parents
data_with_outliers

Example data with outliers
SimulateDataNP

Simulate data for a node with no parent
PlotDendrogram

Plot a dendrogram and display node groups in colored modules
simu_data_starshaped

Data for the star model
data_without_outliers

Example data without outliers
simu_data_M4

Data for Model 4
simu_data_M3

Data for Model 3
aSHD

Adjusted structural hamming distance (aSHD)
CutModules

Cut a numeric variable into intervals
simu_data_multiparent

Data for the multiple-parent model
SimulateData1P

Simulate data for a node with one parent
simu_data_layered

Data for the layered model
empty

Check empty matrix
mpinv

Calculate the inverse matrix
RobustCor

Calculate robust correlation matrix
simu_data_M0

Data for Model 0
seqDiff

Deviation between two graphs represented by two sequences
SeqFDR

Sequential FDR
simu_data_M1

Data for Model 1
simu_data_M2

Data for Model 2
CompareMethodsNodeOrdering

Comparison of inference accuracy using the same data but with different node orderings.
MRPC

Infer a causal network using the MRPC algorithm
data_GEUVADIS

GEUVADIS data with 62 eQTL-gene sets
AdjustMatrix

Adjust the columns of the input matrix same as in the reference matrix
EdgeOrientation

Perform edge orientation under the MRPC algorithm
SimulateData2P

Simulate data for a node with two parents