The function extracts the information about the pruned SNVs from the 1KG GDS file and adds entries related to the pruned SNVs in the Profile GDS file. The nodes are added to the Profile GDS file: 'sample.id', 'snp.id', 'snp.chromosome', 'snp.position', 'snp.index', 'genotype' and 'lap'.

addGenotypeProfile(pRAIDS)

Arguments

pRAIDS

a RAIDSparam an object with all the RAIDS parameters

Value

The function returns 0L when successful.

Author

Pascal Belleau, Astrid Deschênes and Alexander Krasnitz

Examples


## Required library for GDS
library(gdsfmt)

## Path to the demo Reference GDS file is located in this package
dataDir <- system.file("extdata/tests", package="RAIDS")
fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds")

## The data.frame containing the information about the study
## The 3 mandatory columns: "study.id", "study.desc", "study.platform"
## The entries should be strings, not factors (stringsAsFactors=FALSE)
studyDF <- data.frame(study.id = "MYDATA",
                        study.desc = "Description",
                        study.platform = "PLATFORM",
                        stringsAsFactors = FALSE)

## The data.frame containing the information about the samples
## The entries should be strings, not factors (stringsAsFactors=FALSE)
samplePED <- data.frame(Name.ID = c("ex1", "ex2"),
                    Case.ID = c("Patient_h11", "Patient_h12"),
                    Diagnosis = rep("Cancer", 2),
                    Sample.Type = rep("Primary Tumor", 2),
                    Source = rep("Databank B", 2), stringsAsFactors = FALSE)
rownames(samplePED) <- samplePED$Name.ID

## Temporary Profile GDS file
pathProfileGDS <- tempdir()
profileFile <- file.path(pathProfileGDS, "ex1.gds")

pRAIDS <- RAIDSparam(profileFile=file.path(dataDir, "ex1.txt.gz"),
    studyDF=studyDF,
    genoSource="snp-pileup",
    pedStudy=samplePED,
    pathProfileGDS=pathProfileGDS,
    fileReferenceGDS=fileGDS
    )
## Copy the Profile GDS file demo that has not been pruned yet
file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile)
#> [1] TRUE


## Compute the list of pruned SNVs for a specific profile 'ex1'
## and save it in the Profile GDS file 'ex1.gds'
pRAIDS <- pruningProfile2(pRAIDS)
RAIDS::addGenotypeProfile(pRAIDS)
#> [1] 0

content <- openfn.gds(profileFile)
content
#> File: /tmp/Rtmp46wk9V/ex1.gds (6.4K)
#> +    [  ]
#> |--+ Ref.count   { SparseInt16 11000x1, 568B }
#> |--+ Alt.count   { SparseInt16 11000x1, 74B }
#> |--+ Total.count   { SparseInt16 11000x1, 580B }
#> |--+ study.list   [ data.frame ] *
#> |  |--+ study.id   { Str8 1, 7B }
#> |  |--+ study.desc   { Str8 1, 12B }
#> |  \--+ study.platform   { Str8 1, 9B }
#> |--+ study.annot   [ data.frame ] *
#> |  |--+ data.id   { Str8 1, 4B }
#> |  |--+ case.id   { Str8 1, 12B }
#> |  |--+ sample.type   { Str8 1, 14B }
#> |  |--+ diagnosis   { Str8 1, 7B }
#> |  |--+ source   { Str8 1, 11B }
#> |  \--+ study.id   { Str8 1, 7B }
#> |--+ geno.ref   { Bit2 11000x1 LZMA_ra(10.7%), 301B }
#> |--+ pruned.study   { Str8 40, 379B }
#> |--+ sample.id   { Str8 1, 4B }
#> |--+ snp.id   { Str8 40, 379B }
#> |--+ snp.chromosome   { Int32 40, 160B }
#> |--+ snp.position   { Int32 40, 160B }
#> |--+ snp.index   { Int32 40, 160B }
#> |--+ genotype   { Bit2 40x1, 10B }
#> \--+ lap   { PackedReal8 40, 40B }

## Close the Profile GDS file (important)
closefn.gds(content)

## Remove Profile GDS file (created for demo purpose)
unlink(profileFile, force=TRUE)