filterLargep.link: Pre-process of Large VCF File(s)

filterLargep.linkR Documentation

Description

Filter/extract one or multiple gene(s)/range(s) from a large p.link file.

Usage

filterLargeP.link(
  root,
  rootOut = rootOut,
  Chr = Chr,
  POS = NULL,
  start = start,
  end = end,
  override = TRUE,
  sep = "\t"
)

Arguments

root

The file name without suffix. This function only support p.link file format stored in "map" and "ped" format, the file names after removed suffix should be same with each other.

rootOut

Path(s) of output p.link file stored in "ped&map" format.

Chr

a single CHROM name or CHROM names vector.

POS, start, end

provide the chromosome name should be extract from orignal p.link dataset. POS: a vector consist with start and end position, eg.: c(1,200) indicates 3 ranges (1~200, 300~500 and 300~400). if POS is NULL, start and end are needed.

override

whether override existed file or not, default as TRUE.

sep

a character indicate the separation of map and ped file, default is ⁠\t⁠.

Details

This package import P.link files. However, import a large P.link file is time and memory consuming. It's suggested that extract variants in target range with filterLargeP.link() before identification of haplotype.

When filter/extract multi genes/ranges, the parameter of Chr and POS must have equal length. Results will save to a single file if the user provide a single file path or save to multiple P.link file(s) when a equal length vector consist with file paths is provided.

Value

No return value

Examples


 # The filteration of P.link of regular size should be done with `filter_plink.pedmap()`.
 # however, here, we use a mini vcf instead just for example and test

 pedfile <- system.file("extdata",
                        "snp3kvars-CHR8-25947258-25951166-plink.ped",
                        package = "geneHapR")
 mapfile <- system.file("extdata",
                        "snp3kvars-CHR8-25947258-25951166-plink.map",
                        package = "geneHapR")
 oldDir <- getwd()
 temp_dir <- tempdir()
 if(! dir.exists(temp_dir))
   dir.create(temp_dir)
 setwd(temp_dir)
 file.copy(pedfile, "test.ped")
 file.copy(mapfile, "test.map")

 # extract a single gene/range from large vcf
 filterLargeP.link(root = "test",
                   rootOut = "filtered_test",
                   Chr = "scaffold_1", POS = c(4300,5000), override = TRUE)

setwd(oldDir)

# delete temp_dir
unlink(temp_dir, recursive = TRUE)


geneHapR documentation built on May 29, 2024, 11:59 a.m.