sort-methods | R Documentation |
Rearrange association test results according to sort criterion
## S4 method for signature 'AssocTestResultRanges'
sort(x, decreasing=FALSE,
sortBy=c("p.value", "p.value.adj", "p.value.resampled",
"p.value.resampled.adj", "genome"))
x |
object of class |
decreasing |
logical indicating if sorting should be done in decreasing order |
sortBy |
sort criterion (see details below) |
The function sort
takes an AssocTestResultRanges
object x
and returns a new object of the same class, but with
the regions rearranged according to the sort criterion sortBy
.
As an example, if sortBy
is “p.value” regions are sorted
according to raw p-values in ascending order, analogously for the choices
“p.value.adj”, “p.value.resampled”, and
“p.value.resampled.adj”. If sortBy
is “genome”, the
regions are arranged along the genome in the same way as a
GRanges
object would be sorted.
If decreasing
is TRUE
, the order is reversed.
an AssocTestResultRanges
object;
Ulrich Bodenhofer
https://github.com/UBod/podkat
AssocTestResultRanges
## load genome description
data(hgA)
## partition genome into overlapping windows
windows <- partitionRegions(hgA)
## load genotype data from VCF file
vcfFile <- system.file("examples/example1.vcf.gz", package="podkat")
Z <- readGenotypeMatrix(vcfFile)
## read phenotype data from CSV file (continuous trait + covariates)
phenoFile <- system.file("examples/example1lin.csv", package="podkat")
pheno <-read.table(phenoFile, header=TRUE, sep=",")
## train null model with all covariates in data frame 'pheno'
nm.lin <- nullModel(y ~ ., pheno)
## perform association test for multiple regions
res <- assocTest(Z, nm.lin, windows)
## perform multiple testing correction
res.adj <- p.adjust(res)
## show sorted results (default: by raw p-value)
as(sort(res), "GRanges")
print(sort(res), sortBy="none")
## show results sorted by adjusted p-value
as(sort(res.adj, sortBy="p.value.adj"), "GRanges")
print(sort(res.adj, sortBy="p.value.adj"), sortBy="none")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.