Skip to content

Commit bd8b1a4

Browse files
authored
Merge pull request #72 from uclahs-cds/nzeltser-fix-datatable-syntax
update data.table syntax to avoid triggering CRAN check NOTE
2 parents 81ce1d9 + 2374cb8 commit bd8b1a4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import('vcfR');
22
importFrom(
33
'data.table',
44
'tstrsplit',
5-
'setDT'
5+
'setDT',
6+
':='
67
);
78
import('reshape2');
89
import('BoutrosLab.plotting.general');

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)