extractTags: Extract information form downloaded SNPedia pages.

Description Usage Arguments Details Value See Also Examples

View source: R/extractTags.R

Description

SNPedia pages usually have a table in the right hand side which summarizes most relevant information in the page. This functions help extracting this kind of information for the given tags or rows.

Usage

1
2
3
extractTags (x, tags)
extractSnpTags (x, tags)
extractGenotypeTags (x, tags)

Arguments

x

a wiki page (single character vector)

tags

character vector of tags (row names) to be collected.

Details

extractTags is a general purpose function aimed to work at any page. extractSnpTags calls extractTags with a set of predefined tags suitable for SNP pages. extractGenotypeTags does the same for genotype pages.

This functions take a character vector of length one but return a vector with as many values as the tag list provided. They are devised to be used with sapply functions.

Notice that in SNPedia not all information presented in the HTML table is available in the JSON format retrieved by the R package. Risk information for instance needs to be collected from the genotype pages as it is not available in the JSON version of the SNP pages.

Value

A character vector with the value of each of the tags if available in the page and NA otherwise.

See Also

getPages, getCategoryElements

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
res <- getPages (c ("Rs1234", "Rs53576"))
t (sapply (res, extractSnpTags))

extractTags (res[[1]], tags = c("rsid", "Chromosome", "position"))

res <- getPages (c ("Rs1234(A;A)", "Rs1234(A;C)","Rs1234(C;C)"))
t (sapply (res, extractGenotypeTags))

getPages (c ("Rs1234(A;A)", "Rs1234(A;C)","Rs1234(C;C)"),
          wikiParseFunction = extractGenotypeTags)

getPages (c ("Rs1234(A;A)", "Rs1234(A;C)","Rs1234(C;C)"),
          wikiParseFunction = extractGenotypeTags,
          tags = c("rsid", "allele1", "allele2"))

SNPediaR documentation built on Nov. 8, 2020, 5:08 p.m.