vcf2df | R Documentation |
Function to convert a VariantAnnotation
CollapsedVCF
/ExpandedVCF
object to a data.frame
.
vcf2df(
vcf,
add_sample_names = TRUE,
add_rowranges = TRUE,
drop_empty_cols = TRUE,
unique_cols = TRUE,
unique_rows = TRUE,
unlist_cols = TRUE,
sampled_rows = NULL,
verbose = TRUE
)
vcf |
Variant Call Format (VCF) file imported into R as a VariantAnnotation CollapsedVCF/ ExpandedVCF object. |
add_sample_names |
Append sample names to column names (e.g. "EZ" –> "EZ_ubm-a-2929"). |
add_rowranges |
Include |
drop_empty_cols |
Drop columns that are filled entirely with:
|
unique_cols |
Only keep uniquely named columns. |
unique_rows |
Only keep unique rows. |
unlist_cols |
If any columns are lists instead of vectors, unlist them.
Required to be |
sampled_rows |
First N rows to sample.
Set |
verbose |
Print messages. |
data.frame version of VCF
if(!require("pinfsc50")) install.packages("pinfsc50") vcf_file <- system.file("extdata", "pinf_sc50.vcf.gz", package = "pinfsc50") vcf <- read.vcfR( vcf_file, verbose = FALSE ) vcf_df_list <- vcfR::vcfR2tidy(vcf, single_frame=TRUE) vcf_df <- data.table::data.table(vcf_df_list$dat)
#### VariantAnnotation ####
# path <- "https://github.com/brentp/vcfanno/raw/master/example/exac.vcf.gz"
path <- system.file("extdata", "ALSvcf.vcf",
package = "MungeSumstats")
vcf <- VariantAnnotation::readVcf(file = path)
vcf_df <- MungeSumstats:::vcf2df(vcf = vcf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.