add_metadata {vivaldi}R Documentation

add_metadata

Description

Adds metadata information to the vcf dataframe

Usage

add_metadata(df, metadf, by_vcf, by_meta)

Arguments

df

A rearranged vcf dataframe (arrange_data)

metadf

A metadata dataframe

by_vcf

A vector of column names in the vcf dataframe that should be used to merge the vcf data with the metadata

by_meta

A vector of column names in the metadata dataframe that should be used to merge the metadata with the vcf data

Value

A vcf dataframe with metadata included

Examples

df <- data.frame(CHROM = c("A", "B"),
                 POS = c(234, 240),
                 REF = c("G", "A"),
                 ALT = c("A", "G")
)

sizes <- data.frame(segment = c("A", "B"),
                    SegmentSize = c(2280, 2274)
)

df

sizes

# Add a new column of sizes of the segments which are necessary for
# downstream calculations such as transition:transversion (tstv) and dNdS.
add_metadata(df, sizes, c('CHROM'), c('segment'))


[Package vivaldi version 1.0.1 Index]