/usr/lib/R/site-library/snpStats/doc/data-input-vignette.R is in r-bioc-snpstats 1.24.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ### R code from vignette source 'data-input-vignette.Rnw'
###################################################
### code chunk number 1: lib
###################################################
require(snpStats)
###################################################
### code chunk number 2: sysfile
###################################################
pedfile <- system.file("extdata/sample.ped.gz", package="snpStats")
pedfile
infofile <- system.file("extdata/sample.info", package="snpStats")
###################################################
### code chunk number 3: redpedfile
###################################################
sample <- read.pedfile(pedfile, snps=infofile)
###################################################
### code chunk number 4: sample1
###################################################
sample$genotypes
col.summary(sample$genotypes)$MAF
head(col.summary(sample$genotypes))
###################################################
### code chunk number 5: sample2
###################################################
head(sample$fam)
###################################################
### code chunk number 6: sample3
###################################################
head(sample$map)
###################################################
### code chunk number 7: plink
###################################################
fam <- system.file("extdata/sample.fam", package="snpStats")
bim <- system.file("extdata/sample.bim", package="snpStats")
bed <- system.file("extdata/sample.bed", package="snpStats")
sample <- read.plink(bed, bim, fam)
###################################################
### code chunk number 8: plinkout
###################################################
sample$genotypes
col.summary(sample$genotypes)$MAF
head(sample$fam)
head(sample$map)
###################################################
### code chunk number 9: plinkselect
###################################################
subset <- read.plink(bed, bim, fam, select.snps=6:10)
subset$genotypes
col.summary(subset$genotypes)$MAF
subset$map
###################################################
### code chunk number 10: longfile
###################################################
longfile <- system.file("extdata/sample-long.gz", package="snpStats")
longfile
###################################################
### code chunk number 11: longlist
###################################################
cat(readLines(longfile, 5), sep="\n")
###################################################
### code chunk number 12: readlong
###################################################
gdata <- read.long(longfile,
fields=c(snp=1, sample=2, genotype=3, confidence=4),
gcodes=c("1", "2", "3"),
threshold=0.95)
gdata
summary(gdata)
###################################################
### code chunk number 13: readlongallele
###################################################
allelesfile <- system.file("extdata/sample-long-alleles.gz", package="snpStats")
cat(readLines(allelesfile, 5), sep="\n")
gdata <- read.long(allelesfile,
fields=c(snp=1, sample=2, allele.A=3, allele.B=4, confidence=5),
threshold=0.95)
gdata
gdata$genotypes
gdata$alleles
|