twas: An EM model fit jointly to transcriptome and trait data

Description Usage Arguments Value See Also Examples

Description

twas returns a model fit from two data sets from different subjects: one set of transcriptome data and the other of trait data. twas iteratively fits the trait data to the subjects in the transcriptome data and vice versa, until convergence.

Usage

1
2
3
4
twas(transcriptome, traits, tx.genotypes, trait.genotypes, gene, trait.names,
  markers, LD.reduction = FALSE, tx.id.col = 1, trait.id.col = 1, tx.max,
  rounds = 1000, epsilon = 1e-06, tiny.weights = 1e-16,
  show.progress = TRUE)

Arguments

transcriptome

a data frame of expression levels for one or more genes. Each row is a subject. There is one ID column and the remaining columns are genes. Expression values are non-negative integers.

traits

a data frame of one or more traits. Each row is a subject. There is one ID column and the remaining columns are traits. Trait values are numeric.

tx.genotypes

a data frame of genotypes for the transcriptome subjects. Each row is a subject. There is one ID column with the same name as used in transcriptome and the remaining columns are markers. Genotype values are non-negative integers. Subjects with any NA genotypes are ignored.

trait.genotypes

a data frame of genotypes for the trait subjects. Each row is a subject. There is one ID column with the same name as used in traits and the remaining columns are markers. Genotype values are non-negative integers. Subjects with any NA genotypes are ignored.

gene

a character identifying the column in transcriptome of the gene of interest. Default is the first column in transcriptome excluding the subject ID.

trait.names

a character vector of one or more column names in traits to be used in analysis. Defaults to all columns in traits except the subject ID.

markers

a character vector of the names of the markers to use for analysis. Defaults to the shared marker names in tx.genotypes and trait.genotypes.

LD.reduction

a logical scalar or a function to perform LD reduction. If true, then the SNPRelate package will be used on the genotypes of the two data sets for the specified markers to generate a subset of markers, which will be used in the analysis. If a function is supplied, then it must accept a matrix of columns of genotypes and return a vector of column names of the SNPs to keep. Default is false.

tx.id.col

the index or name of the column containing the subject ID in the transcriptome and tx_genotype data frames. Defaults to the first column in transcriptome.

trait.id.col

the index or name of the column containing the subject ID in the traits and trait_genotype data frames. Defaults to the first column in traits.

tx.max

an integer representing the maximum possible transcript count value to model. The default is the maximum observed value in transcriptome. Large values increase the modeling time and some observed counts are believed to be outliers. If not set and the observed count is greater than 1000, then a warning is issues.

rounds

an integer for the maximum number of EM steps. Default is 1000.

epsilon

a numeric for the EM stopping condition. If the absolute difference is less than epsilon then modeling halts. Default is 1e-6.

tiny.weights

a numeric. Any weights that are less than or equal to tiny.weights are excluded from modeling. Default is 1e-16.

show.progress

a logical indicating whether to display progress during EM iterations. If the progress package is installed the it will be used to display a progress bar. Otherwise, text will be displayed. Default is true.

Value

A list object containing the fit expression levels and trait values for all subjects in a single data frame (data), each model parameter (gamma, beta, eta), and the variance and p-value of the test statistic for each parameter.

See Also

twas.tx, twas.traits and twas.gene.markers for examples of the necessary data formats.

Examples

1
2
3
4
twas(twas.tx$transcriptome, twas.traits$traits,
     twas.tx$genotypes, twas.traits$genotypes,
     gene="LRRC16A", trait.names="logIL6",
     markers=twas.gene.markers$LRRC16A)

dkulp2/TWAS documentation built on May 25, 2019, 4:23 p.m.