translate_to_hg19: Translate chromosome names to the hg19 naming convention

Description Usage Arguments Value Examples

View source: R/basic_functions.R

Description

translate_to_hg19: In hg19 naming convention, chromosome names start with the prefix chr and the gonosomes are called X and Y. If data analysis is performed e.g. with BSgenome.Hsapiens.UCSC.hg19, this naming convention is needed. The inverse transform is done with translate_to_1kG.

translate_to_1kG: In 1kG, i.e. 1000 genomes naming convention, chromosome names have no prefix chr and the gonosomes are called 23 for X and 24 for Y. If data analysis is performed e.g. with hs37d5.fa, this naming convention is needed. The inverse transform is done with translate_to_hg19.

Usage

1
2
3
translate_to_hg19(in_dat, in_CHROM.field = "CHROM", in_verbose = FALSE)

translate_to_1kG(in_dat, in_CHROM.field = "chr", in_verbose = FALSE)

Arguments

in_dat

GRanges object, VRanges object or data frame which carries one column with chromosome information to be reformatted.

in_CHROM.field

String indicating which column of in_dat carries the chromosome information

in_verbose

Whether verbose or not.

Value

GRanges object, VRanges object or data frame identical to in_dat, but with the names in the chromosome column replaced (if dealing with data frames) or alternatively the seqlevels replaced (if dealing with GRanges or VRanges objects).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
test_df <- data.frame(CHROM=c(1,2,23,24),POS=c(100,120000000,300000,25000),
                      dummy=c("a","b","c","d"))
hg19_df <- translate_to_hg19(test_df, in_CHROM.field = "CHROM")
hg19_df

test_df <- data.frame(CHROM=c(1,2,23,24),POS=c(100,120000000,300000,25000),
                      dummy=c("a","b","c","d"))
hg19_df <- translate_to_hg19(test_df, in_CHROM.field = "CHROM")
onekG_df <- translate_to_1kG(hg19_df, in_CHROM.field = "CHROM")
onekG_df

YAPSA documentation built on Nov. 8, 2020, 4:59 p.m.