From 811c264026d572854960b49c23dfa4d5a8e30e10 Mon Sep 17 00:00:00 2001 From: Ilari Scheinin Date: Fri, 25 Feb 2022 11:07:11 +0200 Subject: [PATCH] Prevent data.frames from turning into vectors Hopefully fixes #102 (untested) --- R/exportBins.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/exportBins.R b/R/exportBins.R index 4c9c3a7..364173f 100644 --- a/R/exportBins.R +++ b/R/exportBins.R @@ -285,7 +285,7 @@ exportVCF <- function(obj, fnames) { colnames(out) <- c("#CHROM", "POS", "ID", "REF", "ALT", "QUAL", "FILTER", "INFO", "FORMAT", pd$name[i]) ## Drop copy-neutral segments - out <- out[dsel[posI, 4] != 0, ] + out <- out[dsel[posI, 4] != 0, , drop = FALSE] write.table(vcfHeader, file=fnames[i], quote=FALSE, sep="\t", col.names=FALSE, row.names=FALSE) suppressWarnings(write.table(out, file=fnames[i], quote=FALSE, sep="\t", append=TRUE, col.names=TRUE, row.names=FALSE)) @@ -352,7 +352,7 @@ exportSEG <- function(obj, fnames=NULL) { colnames(out) <- c("SAMPLE_NAME", "CHROMOSOME", "START", "STOP", "DATAPOINTS", "LOG2_RATIO_MEAN") ## Drop copy-neutral segments - out <- out[dsel[posI, 4] != 0, ] + out <- out[dsel[posI, 4] != 0, , drop = FALSE] write.table(out, file = fnames[i], quote=FALSE, sep="\t", append=FALSE, col.names=TRUE, row.names=FALSE) stopifnot(file_test("-f", fnames[i]))