Learn R Programming

⚠️There's a newer version (3.1.0) of this package.Take me there.

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. Learning causal biological networks

with the principle of Mendelian randomization. Frontiers in Genetics 2019, 10(460).

  1. Md. Bahadur Badsha, Evan A Martin, Audrey Qiuyan Fu. MRPC: An R package for accurate inference of causal graphs. arXiv. 1806.01899.

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

307

Version

2.2.0

License

GPL (>= 2)

Maintainer

Md Badsha

Last Published

November 16th, 2019

Functions in MRPC (2.2.0)

MRPC

Infer a causal network using the MRPC algorithm
RecallPrecision

Calculate recall and precision for two graphs
mpinv

Calculate the inverse matrix
PlotGraphWithModules

Plot a graph with nodes in modules indicated by colors
empty

Check empty matrix
SimulateData2P

Simulate data for a node with two parents
SimulateData3P

Simulate data for a node with three parents
data_with_outliers

Example data with outliers (noises)
data_without_outliers

Example data without outliers (noises)
SimulateDataNP

Simulate data for a node with no parent
RobustCor

Calculate robust correlation matrix
SimulateData1P

Simulate data for a node with one parent
data_examples

Example data under a simple and complex models
data_GEUVADIS_combined

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

Simulate data under certain graphs
simu_data_M3

Data for Model 3
simu_data_M4

Data for Model 4
seqDiff

Deviation between two graphs represented by two sequences
simu_data_layered

Data for the layered model
SeqFDR

Sequential FDR
simu_data_M0

Data for Model 0
aSHD

Adjusted structural hamming distance (aSHD)
simu_data_multiparent

Data for the multiple-parent model
simu_data_M2

Data for Model 2
simu_data_M1

Data for Model 1
simu_data_starshaped

Data for the star model
MRPCclass-class

Class of MRPC algorithm results
CutModules

Cut a numeric variable into intervals
ModiSkeleton

Infer a graph skeleton (undirected graph)
CompareMethodsNodeOrdering

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

Perform edge orientation under the MRPC algorithm
MRPCtruth

Graphs used as truth in simulation
PlotDendrogram

Plot a dendrogram and display node groups in colored modules
CompareMethodsVStructure

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

GEUVADIS data with 62 eQTL-gene sets