Learn R Programming

CAPE

Introduction

An R package for the Combined Analysis of Epistasis and Pleiotropy

The CAPE R package implements a method, originally described in Carter et al. (2012), that infers directed interaction networks between genetic variants for predicting the influence of genetic perturbations on phenotypes. This method takes advantage of complementary information in partially pleiotropic genetic variants to resolve directional influences between variants that interact epistatically. CAPE can be applied to a variety of genetic variants, such as single nucleotide polymorphisms (SNPs), copy number variations (CNVs) or structural variations (SVs).

For detailed documentation about how to format data, load data, and analyze data, please see the CAPE vignette.

New Features!

  • new run_cape() function runs the entire cape pipeline with one command
  • read in data in multiple formats (R/qtl, R/qtl2, and PLINK)
  • performs kinship correction using linear mixed models as described in Kang et al. (2008)
  • Handles multi-parent populations
  • R6 reformatting improves speed and handling of large data

Installation

CAPE requires R 3.6+ to run.

# Install the released version from CRAN
install.packages("cape")

# Or the development version from GitHub
# install.packages("devtools")
devtools::install_github("TheJacksonLaboratory/cape")

Demos

CAPE provides demo scripts, which you can run to verify that the installation was successful.

demo(package = "cape")
demo(demo_plink)
demo(demo_qtl)
demo(demo_qtl2)

To-Do:

  • enable CAPE run in parallel

License

CAPE is licensed under GPL-3

References

Tyler, A. L., Lu, W., Hendrick, J. J., Philip, V. M. & Carter, G. W. CAPE: an R package for combined analysis of pleiotropy and epistasis. PLoS Comput. Biol. 9, e1003270 (2013).

Kang, H. M. et al. Efficient control of population structure in model organism association mapping. Genetics 178, 1709–1723 (2008).

Related Publications

Carter, G. W. Inferring gene function and network organization in Drosophila signaling by combined analysis of pleiotropy and epistasis. G3 (Bethesda) 3, 807–814 (2013).

Carter, G. W., Hays, M., Sherman, A. & Galitski, T. Use of pleiotropy to model genetic interactions in a population. PLoS Genet. 8, e1003010 (2012).

Tyler, A. L., McGarr, T. C., Beyer, B. J., Frankel, W. N. & Carter, G. W. A genetic interaction network model of a complex neurological disease. Genes, Brain and Behavior 13, 831–840 (2014).

Tyler, A. L. et al. Epistatic Networks Jointly Influence Phenotypes Related to Metabolic Disease and Gene Expression in Diversity Outbred Mice. Genetics 206, 621–639 (2017).

Tyler, A. L. et al. Epistatic networks jointly influence phenotypes related to metabolic disease and gene expression in diversity outbred mice. Genetics 206, 621–639 (2017).

Tyler, A. L., Donahue, L. R., Churchill, G. A. & Carter, G. W. Weak Epistasis Generally Stabilizes Phenotypes in a Mouse Intercross. PLoS Genet. 12, e1005805–22 (2016).

Copy Link

Version

Install

install.packages('cape')

Monthly Downloads

318

Version

3.1.2

License

GPL-3

Maintainer

Anna L Tyler

Last Published

January 9th, 2024

Functions in cape (3.1.2)

plot_svd

Plots eigentraits
calc_delta_errors

Error propagation
impute_missing_geno

Impute missing genotype data using k nearest neighbors
check_geno

Check to see if the any markers in the supplied genotype matrix is one of the covariates.
get_color

get a hex color string
qtl2_to_cape

Convert qtl2 object to cape format
bin_vector

Snap continuous values to a grid
error_prop

Estimate Errors of Regression Coefficients
kinship

Calculate the kinship matrix
check_communities

Check community assignments
calc_emp_p

Calculate empirical p-values
get_color2

Generate color ramp
check_underscore

Checks for underscores in marker names
get_line

Get line coordinates
pheno2covar

Create a covariate from a trait
get_marker_covar

Get genotype or covariate values
get_marker_chr

Get chromosome numbers for markers
calc_p

Calculate P Values for Interactions Based on Permutations
pairscan_kin

Run the pairscan with a kinship correction
get_linearly_independent

Check selected markers for linear independence.
kin_adjust

Corrects genotypes, phenotypes, and covariates for kinship.
draw_pie

Draw a pie chart
pairscan_noKin

Perform pairscan without a kinship correction
qnorm_pheno

Plot trait distributions
genome_wide_threshold_1D

Calculate a genome-wide significance threshold for the single-variant scan
remove_kin_ind

Removes individuals from the kinship object to match the cape.obj
get_interaction_error

Get error bars for interaction plot
plot_variant_influences

Plot cape coefficients
cape2mpp

Converts a read_population object to a multi-parent object
plink2cape

Convert plink2 files to cape format
chunkV

Bins a vector into chunks
direct_influence

Calculate the significance of direct influences of variant pairs on phenotypes
remove_markers

Removes genetic markers
plot_points

Plot phenotypic effect for two markers as points
get_marker_location

Get marker genomic position
segment_region

Divide a region into equal parts.
singlescan

Runs marker regression on each individual genetic marker
my_image_plot

Generate a Heatmap-type image
flatten_array

Drop the 3rd dimension of an array using a summary function, e.g., min max, mean
plot_int_heat

Plot phenotypic effects for two markers as a heat map
get_geno_dim

Returns which dimensions the individual, locus, and alleles are in in the genotype object.
get_marker_name

Get marker names
get_allele_colors

Get DO colors
get_block_allele

Get allele assignments for linkage blocks
get_circle

Generate coordinates for a circle
get_marker_num

Get numbers for markers
get_network

Convert the final results to an adjacency matrix.
pheatmap_generate_breaks

pheatmap generate breaks found at this link https://cran.r-project.org/package=pheatmap
get_marker_idx

Get original indices for markers
get_concent_circ

Generate list of concentric circles
Cape-class

The CAPE data object
colors_from_values

Retrieve colors based on numeric values
get_layout_mat

Get the best layout matrix for a given number of panes per page.
image_with_text

Plot a heatmap
marker2covar

Creates a covariate from a genetic marker
pairscan_null

Generate a null distribution for the pairscan.
calc_m

Calculate m
get_pheno

Get the phenotype matrix
plot_effects

Plot Interaction Effects
load_input_and_run_cape

Loads input and run CAPE
plot_singlescan

Plot results of single-locus scans
remove_missing_genotype_data

Removes individuals and/or markers with missing data
run_cape

Runs CAPE
compare_markers

Removes markers from data_obj that are not present in the geno_obj
get_covar

Get covariate information
norm_pheno

Mean-center and normalize phenotypes
plot_pairscan

Plot the result of the pairwise scan
write_population

Save the cross data in R/qtl CSV format
get_geno_with_covar

Return the genotype matrix with covariates added.
delete_underscore

Delete underscores from marker names
get_col_num

Find column numbers using column names
hist_pheno

Plot trait histograms
plot_full_network

Plot the final epistatic network in a traditional network view.
bin_curve

Bins a single scan curve into peaks automatically
pairscan_null_kin

Generates a null distribution for the pairscan
consec_pairs

Generate a matrix of consecutive elements
pheatmap_scale_colours

pheatmap scale colours found at this link https://cran.r-project.org/package=pheatmap
read_population

Reads in data in the R/qtl csv format
sort_by_then_by

Sort a table by a list of columns
get_stats_multiallele

Perform linear regression on multi-allele markers.
center_std

This function mean centers and standardizes a vector
check_bad_markers

Checks for unused markers
plot_bars

Plot phenotypic effect for two markers as a bar plot
linkage_blocks_network

Identify linkage blocks
plot_pheno_cor

Plot trait pairs against each other
one_pairscan_parallel

This is an internal function to run a single pairscan It is used both to do the actual pairscan (pairscan_kin and pairscan_noKin), as well as to do the permutations of the pairscan pairscan_null).
get_eigentraits

Calculate eigentraits
report_progress

Report Progress of a Process
remove_ind

Remove individuals
plot_trait_circ

Plot concentric trait circles
exp_color_fun

Exponential color function
one_singlescanDO

Performs marker regression
select_eigentraits

Assign selected eigentraits in the Cape object
plot_lines

Plot interaction plot for traits and genetic markers
get_pairs_for_pairscan

Select marker pairs for pairscan
rotate_mat

Orients a matrix for proper display in a plot
write_variant_influences

Write significant cape interactions to a csv file
read_parameters

Read the parameter file, add missing entries
get_geno

Gets the geno object
rz_transform

Rank Z normalize
remove_unused_markers

Take out markers not used in cape
plot_network

Plots cape results as a circular network
pair_matrix

Get all pairs of elements in a vector
select_markers_for_pairscan

Select markers for the pairwise scan.
pairscan

This function performs the pairwise scan on all markers.
select_pheno

This function selects the phenotypes in a Cape object