pathWAS_MR | R Documentation |
Inputs and combines aspects from your QTL SNPs, clumped SNPs, pathway genes, and omics summary stats (plus flip status) and conducts MR between these, outputting the MR for model.
pathWAS_MR(
genelist,
clumped_snps,
clumped_SNPCol = "rsid",
clumped_BetaCol = "beta1",
clumped_SECol = "se",
qtl_sumstats,
geneCol = "gene",
omics_snps,
omics_SNPCol = "rsid",
omics_BetaCol = "beta1",
omics_SECol = "se",
save_MRInput = FALSE,
save_MRInLoc = NULL,
save_MROutput = FALSE,
save_MROutLoc = NULL,
save_MRExps = FALSE,
save_MRExpsLoc = NULL,
end_point = "endprotein",
path_select = "pathway",
verbose = TRUE
)
genelist |
list. List of genes extracted from database for your pathway which overlap with your QTL data. |
clumped_snps |
data frame. The data frame of clumped SNPs output from qtl_clumpR. |
clumped_SNPCol |
character. Name/number of column containing the SNP ID in the omics data frame. |
clumped_BetaCol |
character. Name/number of column containing the effect size in the clumped SNPs data frame. |
clumped_SECol |
character. Name/number of column containing the standard error in the clumped SNPs data frame. |
qtl_sumstats |
character. File location for the QTLs used (either divided by gene or complete data). |
geneCol |
character. Name or number of column containing the name of the gene for each SNP in the QTL data. Default is "gene". Ensure the format of the name is the same as your gene list. |
omics_snps |
data frame. Summary stats of end-point omcis, now including FLIP column frm omics_MungeR |
omics_SNPCol |
character. Name/number of column containing the SNP ID in the omics data frame. |
omics_BetaCol |
character. Name/number of column containing the effect size in the omics data frame. |
omics_SECol |
character. Name/number of column containing the standard error in the omics data frame. |
save_MRInput |
logical. Should the function save the input for the MR? Default is FALSE |
save_MRInLoc |
character. If save_MRInput == TRUE, then provide a directory to save the .rds file to. |
save_MROutput |
logical. Should the function save the output from the MR (as well as output it from the function)? |
save_MROutLoc |
logical. If save_MROutput == TRUE, then provide a directory to save the .rds file to. |
save_MRExps |
logical. Should the function save the list of gene exposures from the MR (as well as output it from the function)? |
save_MRExpsLoc |
logical. If save_MRExps == TRUE, then provide a directory to save the .rds file to. |
end_point |
character. Name of end point protein (can be any string). Used for saving purposes if any save variable is set to TRUE. |
path_select |
character. Name of pathway (can be any string). Used for saving purposes if any save variable is set to TRUE. |
This function requires the input of numerous pieces of data from throughout the PathWAS pipeline. The list of genes (acquired from searching for the pathway genes) is needed to select specific QTL SNPs for conducting the MR, this list must exclude the end-point gene. A data frame containing the SNPs produced by clumping (qtl_clumpR) is needed for pruning the QTLs by clumped SNPs. A file location of the data frame of your QTL SNPs including a column with the named gene which must match the format of the input gene list (I.e. HGNC format), this can either be the total available sumstats or can point to multiple files divided up by gene. This should also include all SNPs for every gene and not just significant ones. Lastly the data frame of your end-point omics. This must have first been through the omics_MungeR function to add the "FLIP" column (you will now also be required to define columns for the effect size and standard error). The QTL file location can either be a total file of all genes and SNPs in your data, or it can be individual files divided up by gene (for easier/quicker reading). If it is the latter, then the file name must be in the following format: "/opt/dir/eqtl_data_$$$.tsv" where "$$$" will be the name of one of the gene. With all of this provided this function first creates two matrices of SNPs which overlap between the clumped SNPs and the QTL SNPs. This will provide a matrix of SNPs against genes and provide the standard error and beta of each. In the cases where there is no data for the clumped SNP for one of the genes, the standard error and beta are both set to extremely low (1 and 0.0000001 respectively). These matrices are used as the input for mr_mvinput from the MendelianRandomization R package (which is required to run this function). This function also requires the betas and SEs from the omics SNPs, with the betas now aligned to the QTLs using the newly created "FLIP" column. The mr_mvinput function creates an output specifically for use by the mr_mvlasso function which is then used to run the MR of the QTL SNPs against the omics SNPs. Any of the exposures (I.e. genes) which then have an individual P-value of < 0.05 are considered to be significant exposures within this model. The function will then return both the output from mr_mvlasso and the list of significant exposures (this is used for downstream filtering). Additionally, the option has been provided to save the output at multiple stages of the analysis so that they can be examined individually. The MR lasso input and output can be saved, along with the genes which are actually used to create the model. If you would like to save these you have to define a location where you wish the output RDS file to be saved. You also have to input a name for the end-point and pathway (only used for file-naming purposes).
## Havimg created a list of genes, clumped SNPs and munged your Omics SNPs you can input them in the following way, along with adding the option to save the MR output:
pathWAS_MR(genelist, clumped_snps, qtl_sumstats = "/opt/localdir/gene_qtls/file1_sumstats_$$$.tsv", geneCol = "gene_ensembl", omics_snps, save_MROutput = TRUE, save_MROutLoc = "/opt/localdir/mr_outputs/", path_select = "nod_signalling", end_point = "IL18")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.