Skip to content

Commit 7251812

Browse files
committed
update data.table syntax to avoid triggering CRAN check NOTE
1 parent 81ce1d9 commit 7251812

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

R/combine-vcf-with-pgs.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
utils::globalVariables(c("ID", "new.ID", ".")); # data table syntax work-around for CRAN legitimacy
12
#' @title Combine VCF with PGS
23
#' @description Match PGS SNPs to corresponding VCF information by genomic coordinates or rsID using a merge operation.
34
#' @param vcf.data A data.frame containing VCF data. Required columns: \code{CHROM, POS}.
@@ -111,8 +112,8 @@ combine.vcf.with.pgs <- function(vcf.data, pgs.weight.data) {
111112
split.rsid.vcf.data <- merge(
112113
x = vcf.data,
113114
# split only entries with multiple rsIDs, save in new column, and merge back with the original data
114-
y = vcf.data[grepl(';', ID), unique(unlist(strsplit(as.character(ID), ';', fixed = TRUE))), by = .(Indiv, CHROM, POS)
115-
][,.(new.ID = V1, Indiv, CHROM, POS)],
115+
y = vcf.data[grepl(';', get('ID')), unique(unlist(strsplit(as.character(get('ID')), ';', fixed = TRUE))), by = .(get('Indiv'), get('CHROM'), get('POS'))
116+
][,.(new.ID = get('V1'), get('Indiv'), get('CHROM'), get('POS'))],
116117
by = c('CHROM', 'POS', 'Indiv'),
117118
all = TRUE
118119
);

0 commit comments

Comments
 (0)