Learn R Programming

podkat (version 1.4.2)

sort-methods: Sort Association Test Results

Description

Rearrange association test results according to sort criterion

Usage

## S3 method for class 'AssocTestResultRanges':
sort(x, decreasing=FALSE,
     sortBy=c("p.value", "p.value.adj", "p.value.resampled",
              "p.value.resampled.adj", "genome"))

Arguments

x
object of class AssocTestResultRanges
decreasing
logical indicating if sorting should be done in decreasing order
sortBy
sort criterion (see details below)

Value

  • an AssocTestResultRanges object;

Details

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.

References

http://www.bioinf.jku.at/software/podkat

See Also

AssocTestResultRanges

Examples

Run this code
## 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")

Run the code above in your browser using DataLab