The function appends the information about the ld blocks into the Population Reference SNV Annotation GDS file. The information is extracted from the Population Reference GDS file and files \'.det\'.

addBlockFromDetFile(
  fileReferenceGDS,
  gdsRefAnnotFile,
  pathBlock,
  superPop,
  blockName = "ldBlock",
  blockDesc = "Not Define",
  verbose = FALSE
)

Arguments

fileReferenceGDS

a character string representing the file name of the Reference GDS file. The file must exist.

gdsRefAnnotFile

a character string representing the file name corresponding the Reference SNV Annotation GDS file. The function will open it in write mode and close it after. The file must exist.

pathBlock

a character string representing the directory where all the output file det from the plink block command are located. The directory must not include other file with the extension \'.det\'. The name of the \'.det\' must include the super-population between \'.\' and the chromosome in the form \'chrNumber.\' \( \'chr1.\'\).

superPop

a character string representing the super population.

blockName

a character string representing the id of the block. The blockName should not exist in \'gdsRefAnnotFile\'. Default: "ldBlock".

blockDesc

a character string representing the description of the block. Default: "Not Define"

verbose

a logical indicating if message information should be printed. Default: FALSE.

Value

OL when the function is successful.

Details

More information about GDS file format can be found at the Bioconductor gdsfmt website: https://bioconductor.org/packages/gdsfmt/

Author

Pascal Belleau, Astrid Deschênes and Alexander Krasnitz

Examples


## Path to the demo pedigree file is located in this package
dataDir <- system.file("extdata", package="RAIDS")

fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds")

## Demo of of output file det from the plink block
## command for chromosome 1
fileLdBlock <- file.path(dirname(fileAnnotGDS), "block.sp.EUR.Ex.chr1.blocks.det")


file.copy(file.path(dataDir, "tests",
    "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS)
#> [1] TRUE
file.copy(file.path(dataDir, "block.sp.EUR.Ex.chr1.blocks.det"),
    fileLdBlock)
#> [1] TRUE



## GDS Reference file
fileReferenceGDS  <- file.path(dataDir, "tests",
    "ex1_good_small_1KG.gds")

 # \donttest{


    ## Append information associated to blocks
    addBlockFromDetFile(fileReferenceGDS=fileReferenceGDS,
        gdsRefAnnotFile=fileAnnotGDS,
        pathBlock=dirname(fileAnnotGDS),
        superPop="EUR")
#> [1] 0

    gdsAnnot1KG <- openfn.gds(fileAnnotGDS)
    print(gdsAnnot1KG)
#> File: /tmp/RtmplgNUHa/ex1_good_small_1KG_Ann_GDS.gds (349.4K)
#> +    [  ]
#> |--+ phase   { Bit2 11000x156 LZ4_ra(21.5%), 90.2K }
#> |--+ block.annot   [ data.frame ] *
#> |  |--+ block.id   { Str8 6, 82B }
#> |  \--+ block.desc   { Str8 6, 281B }
#> \--+ block   { Int32 11000x6 LZ4_ra(23.5%), 60.5K }

    closefn.gds(gdsAnnot1KG)
# }

## Remove temporary file
unlink(fileAnnotGDS, force=TRUE)
unlink(fileLdBlock, force=TRUE)