top_snps: Create table of top snp associations

View source: R/top_snps.R

top_snpsR Documentation

Create table of top snp associations

Description

Create a table of the top snp associations

Usage

top_snps(
  scan1_output,
  snpinfo,
  lodcolumn = 1,
  chr = NULL,
  drop = 1.5,
  show_all_snps = TRUE
)

Arguments

scan1_output

Output of scan1(). Should contain a component "snpinfo", as when scan1() is run with SNP probabilities produced by genoprob_to_snpprob().

snpinfo

Data frame with SNP information with the following columns (the last three are generally derived with index_snps()):

  • chr - Character string or factor with chromosome

  • pos - Position (in same units as in the "map" attribute in genoprobs.

  • sdp - Strain distribution pattern: an integer, between 1 and 2^n - 2 where n is the number of strains, whose binary encoding indicates the founder genotypes

  • snp - Character string with SNP identifier (if missing, the rownames are used).

  • index - Indices that indicate equivalent groups of SNPs, calculated by index_snps().

  • intervals - Indexes that indicate which marker intervals the SNPs reside.

  • on_map - Indicate whether SNP coincides with a marker in the genoprobs

lodcolumn

Selected LOD score column to (a numeric index, or a character string for a column name). Only one value allowed.

chr

Selected chromosome; only one value allowed.

drop

Show all SNPs with LOD score within this amount of the maximum SNP association.

show_all_snps

If TRUE, expand to show all SNPs.

Value

Data frame like the input snpinfo with just the selected subset of rows, and with an added column with the LOD score.

See Also

index_snps(), genoprob_to_snpprob(), scan1snps(), plot_snpasso()

Examples

## Not run: 
# load example DO data from web
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/main/DOex/DOex.zip")
DOex <- read_cross2(file)

# subset to chr 2
DOex <- DOex[,"2"]

# calculate genotype probabilities and convert to allele probabilities
pr <- calc_genoprob(DOex, error_prob=0.002)
apr <- genoprob_to_alleleprob(pr)

# query function for grabbing info about variants in region
dbfile <- system.file("extdata", "cc_variants_small.sqlite", package="qtl2")
query_variants <- create_variant_query_func(dbfile)

# SNP association scan, keep information on all SNPs
out_snps <- scan1snps(apr, DOex$pmap, DOex$pheno, query_func=query_variants,
                      chr=2, start=97, end=98, keep_all_snps=TRUE)

# table with top SNPs
top_snps(out_snps$lod, out_snps$snpinfo)

# top SNPs among the distinct subset at which calculations were performed
top_snps(out_snps$lod, out_snps$snpinfo, show_all_snps=FALSE)

# top SNPs within 0.5 LOD of max
top_snps(out_snps$lod, out_snps$snpinfo, drop=0.5)

## End(Not run)

qtl2 documentation built on May 29, 2024, 11:46 a.m.