importLrrBaf | R Documentation |
This function imports the LRR/BAF values and create a node for each one in
the GDS file at the working folder 'Inputs' created by the
setupCnvGWAS
function. Once imported, the LRR values can be
used to perform a GWAS directly as an alternative to copy number dosage
importLrrBaf(
all.paths,
path.files,
list.of.files,
gds.file = NULL,
verbose = TRUE
)
all.paths |
Object returned from |
path.files |
Folder containing the input CNV files used for the CNV calling (i.e. one text file with 5 collumns for each sample). Columns should contain (i) probe name, (ii) Chromosome, (iii) Position, (iv) LRR, and (v) BAF. |
list.of.files |
Data-frame with two columns where the (i) is the file name with signals and (ii) is the correspondent name of the sample in the gds file |
gds.file |
Path to the GDS file which contains nodes harboring respective LRR and BAF values. The ‘snp.rs.id’, ‘sample.id’, ‘LRR’ and ‘BAF’ nodes are mandatory. Both the SNPs and samples should follow the order and length in the CNV.gds (located at all.paths["Inputs"] folder). ‘path.files’ and ‘list.of.files’ will be ignored if ‘gds.file’ is not NULL |
verbose |
Print the samples while importing |
Writes to the specified GDS file by side effect.
Vinicius Henrique da Silva
# Load phenotype-CNV information
data.dir <- system.file("extdata", package="CNVRanger")
phen.loc <- file.path(data.dir, "Pheno.txt")
cnv.out.loc <- file.path(data.dir, "CNVOut.txt")
map.loc <- file.path(data.dir, "MapPenn.txt")
phen.info <- setupCnvGWAS('Example', phen.loc, cnv.out.loc, map.loc)
# Extract path names
all.paths <- phen.info$all.paths
# List files to import LRR/BAF
list.of.files <- list.files(path=data.dir, pattern="cnv.txt.adjusted$")
list.of.files <- as.data.frame(list.of.files)
colnames(list.of.files)[1] <- "file.names"
list.of.files$sample.names <- sub(".cnv.txt.adjusted$", "", list.of.files$file.names)
# All missing samples will have LRR = '0' and BAF = '0.5' in all SNPs listed in the GDS file
importLrrBaf(all.paths, data.dir, list.of.files)
# Read the GDS to check if the LRR/BAF nodes were added
cnv.gds <- file.path(all.paths["Inputs"], 'CNV.gds')
genofile <- SNPRelate::snpgdsOpen(cnv.gds, allow.fork=TRUE, readonly=FALSE)
SNPRelate::snpgdsClose(genofile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.