#need to make vignette compile library(Rcpp) library(CASMAP)
CASMAP package provides methods for searching for combinatorial associations inbinary data while taking categorical covariates into account. There are two main modes: the methods either search for region-based mappings or for higher order epistatic interactions.
To create a
CASMAP object, it is necessary to specify the mode. The first example below creates an object that will perform a region-based GWAS search, and then sets the target family-wise error rate to
library(CASMAP) # An example using the "regionGWAS" mode fastcmh <- CASMAP(mode="regionGWAS") # initialise object fastcmh$setTargetFWER(0.01) # set target FWER
The next example shows how to create an object that will search for arbitrary combinations, i.e. a higher order epistatic search. Note that it is also possible to set the target family-wise error rate when constructing the object by setting
By printing the object, one can see certain information. The field Maximum combination size = 0 indicates that combinations of all possible length will be considered. In future versions, it will be possible to limit this number, for example to combinations of maxmimum length 4.
library(CASMAP) # Another example, doing higher order epistasis search with target FWER 0.01 facs <- CASMAP(mode="higherOrderEpistasis", alpha=0.01) print(facs)
Once the object is created, the next step is to read in the data files.
readLines command is used, and paths to the data files should be specified for the parameters
phenotype_file and (optionally)
covariate_file. We have provided example data files with the package, as well as functions to easily get the paths to these data files:
library(CASMAP) fastcmh <- CASMAP(mode="regionGWAS") # initialise object datafile <- getExampleDataFilename() # file name of example data labelsfile <- getExampleLabelsFilename() # file name of example labels covfile <- getExampleCovariatesFilename() # file name of example covariates # read the data, labels and (optionally) covariate files fastcmh$readFiles(genotype_file=getExampleDataFilename(), phenotype_file=getExampleLabelsFilename(), covariate_file=getExampleCovariatesFilename()) #The object now displays that data files have been read, and covariates are used print(fastcmh)
Note that the
CASMAP methods expect the data file to be a text file consisting of space-separated
1s, in an $p \times n$ matrix, where each of the $p$ rows is a feature, and each of the $n$ columns is a sample/subject. The labels and covariates files are single columns of $n$ entries, where each entry is
1. To see an example of the data format, take a look at the included example files, the paths to which are given by the commands
#to see where these data files are located on your local drive: print(getExampleDataFilename()) ## Example: ##  "/path/to/pkgs/CASMAP/extdata/CASMAP_example_data_1.txt"
In future versions the PLINK data format will be supported.
Once you have read in the data, label and covariates files, you are ready to execute the algorithm. Simply use the
execute command. Note that, depending on the size of your data set, this could take some time.
# execute the algorithm (this may take some time) fastcmh$execute()
There are two main sets of results:
The summary results provide information on how many regions/interactions were processed, how many are testable, and what are the significance and testable thresholds:
#get the summary results summary_results <- fastcmh$getSummary() print(summary_results)
It is also possible to write this information to file directly using the
The significant regions lists all the regions that are considered significant.
However, it is possible that these regions overlap into clusters. The most significant regions in these clusters can be extracted using the
getSignificantClusterRepresentatives command. In the example below, there is only one significant regions, so it is its own cluster representative:
#get the significant regions sig_regions <- fastcmh$getSignificantRegions() print(sig_regions)
#get the clustered representatives for the significant regions sig_cluster_rep <- fastcmh$getSignificantClusterRepresentatives() print(sig_cluster_rep)
Note that the $p$-value and odds ratio for the regions/representatives is provided along with the location.
higherOrderEpistasis mode, the method
getSignificantInteractions should be used (and there are no cluster representatives).
It is also possible to perform a search without any covariates:
## Another example of regionGWAS fais <- CASMAP(mode="regionGWAS") # initialise object # read the data and labels, but no covariates fais$readFiles(genotype_file=getExampleDataFilename(), phenotype_file=getExampleLabelsFilename()) print(fais)
The binary data could be encoded with either a dominant or recessive encoding. The default for
dominant, but it is also possible to specify the coding explicitly:
library(CASMAP) fastcmh <- CASMAP(mode="regionGWAS") # using the dominant encoding (default) fastcmh$readFiles(genotype_file=getExampleDataFilename(), phenotype_file=getExampleLabelsFilename(), covariate_file=getExampleCovariatesFilename(), encoding="dominant") # using the dominant encoding (default) fastcmh$readFiles(genotype_file=getExampleDataFilename(), phenotype_file=getExampleLabelsFilename(), covariate_file=getExampleCovariatesFilename(), encoding="recessive")
Note that future versions of the package will include the option to read PLINK files, and the option to set the maximum combination length.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.