knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(systematicQTL)
We generate some sample data, genotypes and phenotypes, to show the functions of the package then, as the first step of the pipeline we generate the QTL cross2 object class with the function build_cross2_dataset
.
geno_filename = '../tests/testthat/random.genotypes.csvs' pheno_filename = '../tests/testthat/random.pheno.csv' chosen_alleles = c('A','B') chosen_covars = c('pheno_var1', 'pheno_var2', 'pheno_var3') chosen_phenotypes = c('signature1', 'signature2', 'signature3') cross2 = systematicQTL::build_cross2_dataset( geno_filename = geno_filename, pheno_filename = pheno_filename, covar_column_names = chosen_covars, pheno_column_names = chosen_phenotypes, alleles = chosen_alleles ) qtl_wrapper = systematicQTL::QtlWrapper(qtl = cross2)
Next step is to set the minimal threshold for all signatures (0.5) and define the empirical significance value of the LOD
qtl_wrapper = systematicQTL::set_significance_lod(qtl_wrapper,0.5) qtl_wrapper = systematicQTL::set_empirical_significance_lod(qtl_wrapper, 100, 0.05, 1)
We then find the peaks in a set of LOD curves with find_peaks
and draw a plot for each phenotype peaks with build_genescan_plot
.
qtl_wrapper = systematicQTL::find_peaks(qtl_wrapper) for(phenotype in qtl_wrapper@phenotypes){ systematicQTL::build_genescan_plot(qtl_wrapper, phenotype, sprintf('Pheno: %s', phenotype)) }
Finally we retrieve the LOD scores from the QTL object.
lods = systematicQTL::lod(qtl_wrapper) for( i in 1:nrow(lods)){ this_lod = lods[i,] systematicQTL::build_pdx_plot( qtl_wrapper, chr = this_lod$chr, cm = this_lod$cm, 'signature1', sprintf('%s-signature1', this_lod$snp), sprintf('LOD score: %.3f, (tresh. %.3f)', this_lod$signature1, this_lod$signature1.threshold) ) } print(lods)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.