Learn R Programming

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

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

147

Version

3.1.1

License

GPL-3

Maintainer

Anna L Tyler

Last Published

May 19th, 2022

Functions in cape (3.1.1)

calc_p

Calculate P Values for Interactions Based on Permutations
calc_m

Calculate m
cape2mpp

Converts a read_population object to a multi-parent object
calc_delta_errors

Error propagation
calc_emp_p

Calculate empirical p-values
bin_vector

Snap continuous values to a grid
center_std

This function mean centers and standardizes a vector
Cape-class

The CAPE data object
check_bad_markers

Checks for unused markers
bin_curve

Bins a single scan curve into peaks automatically
chunkV

Bins a vector into chunks
check_underscore

Checks for underscores in marker names
check_communities

Check community assignments
check_geno

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

Get allele assignments for linkage blocks
get_allele_colors

Get DO colors
error_prop

Estimate Errors of Regression Coefficients
get_concent_circ

Generate list of concentric circles
colors_from_values

Retrieve colors based on numeric values
direct_influence

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

get a hex color string
compare_markers

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

Exponential color function
draw_pie

Draw a pie chart
flatten_array

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

Generate coordinates for a circle
get_covar

Get covariate information
get_layout_mat

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

Loads input and run CAPE
get_interaction_error

Get error bars for interaction plot
consec_pairs

Generate a matrix of consecutive elements
get_color2

Generate color ramp
get_geno

Gets the geno object
get_marker_num

Get numbers for markers
get_eigentraits

Calculate eigentraits
get_marker_name

Get marker names
kinship

Calculate the kinship matrix
linkage_blocks_network

Identify linkage blocks
get_marker_location

Get marker genomic position
marker2covar

Creates a covariate from a genetic marker
my_image_plot

Generate a Heatmap-type image
get_marker_idx

Get original indices for markers
pheatmap_generate_breaks

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

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

Get chromosome numbers for markers
impute_missing_geno

Impute missing genotype data using k nearest neighbors
get_col_num

Find column numbers using column names
get_marker_covar

Get genotype or covariate values
pheatmap_scale_colours

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

Select marker pairs for pairscan
get_geno_with_covar

Return the genotype matrix with covariates added.
get_network

Convert the final results to an adjacency matrix.
norm_pheno

Mean-center and normalize phenotypes
plot_bars

Plot phenotypic effect for two markers as a bar plot
pairscan_kin

Run the pairscan with a kinship correction
get_geno_dim

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

Get all pairs of elements in a vector
qtl2_to_cape

Convert qtl2 object to cape format
plot_effects

Plot Interaction Effects
read_parameters

Read the parameter file, add missing entries
image_with_text

Plot a heatmap
plot_network

Plots cape results as a circular network
hist_pheno

Plot trait histograms
plot_singlescan

Plot results of single-locus scans
plot_points

Plot phenotypic effect for two markers as points
plot_lines

Plot interaction plot for traits and genetic markers
pairscan_null_kin

Generates a null distribution for the pairscan
pairscan_null

Generate a null distribution for the pairscan.
pheno2covar

Create a covariate from a trait
pairscan

This function performs the pairwise scan on all markers.
remove_missing_genotype_data

Removes individuals and/or markers with missing data
delete_underscore

Delete underscores from marker names
kin_adjust

Corrects genotypes, phenotypes, and covariates for kinship.
rz_transform

Rank Z normalize
run_cape

Runs CAPE
remove_ind

Remove individuals
select_eigentraits

Assign selected eigentraits in the Cape object
pairscan_noKin

Perform pairscan without a kinship correction
singlescan

Runs marker regression on each individual genetic marker
read_population

Reads in data in the R/qtl csv format
remove_unused_markers

Take out markers not used in cape
segment_region

Divide a region into equal parts.
plink2cape

Convert plink2 files to cape format
sort_by_then_by

Sort a table by a list of columns
select_pheno

This function selects the phenotypes in a Cape object
select_markers_for_pairscan

Select markers for the pairwise scan.
get_line

Get line coordinates
get_linearly_independent

Check selected markers for linear independence.
plot_svd

Plots eigentraits
plot_int_heat

Plot phenotypic effects for two markers as a heat map
plot_full_network

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

Perform linear regression on multi-allele markers.
get_pheno

Get the phenotype matrix
one_singlescanDO

Performs marker regression
plot_pairscan

Plot the result of the pairwise scan
report_progress

Report Progress of a Process
plot_trait_circ

Plot concentric trait circles
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).
plot_variant_influences

Plot cape coefficients
qnorm_pheno

Plot trait distributions
write_variant_influences

Write significant cape interactions to a csv file
write_population

Save the cross data in R/qtl CSV format
plot_pheno_cor

Plot trait pairs against each other
remove_markers

Removes genetic markers
remove_kin_ind

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

Orients a matrix for proper display in a plot