Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit c83448b

Browse files
committed
Tolerate extra empty columns
1 parent 5a05231 commit c83448b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

analysis/R/read_input.R

+11-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,17 @@ ReadCountsFile <- function(counts_file, params, adjust_counts = FALSE) {
6767
nrow(counts), params$m))
6868
}
6969

70-
if ((ncol(counts) - 1) != params$k) {
71-
stop(paste0("Counts file: number of columns should equal to k + 1: ",
72-
ncol(counts)))
70+
# Tolerate extra empty columns
71+
if (ncol(counts) > (params$k + 1)) {
72+
extra <- counts[,(params$k + 2):ncol(counts)]
73+
if (all(extra == 0)) {
74+
counts <- counts[,1:(params$k + 1)]
75+
}
76+
}
77+
78+
if (ncol(counts) != params$k + 1) {
79+
stop(sprintf("Counts file: Got %d columns, expected k + 1 = %d",
80+
ncol(counts), params$k + 1))
7381
}
7482

7583
if (any(counts < 0)) {

0 commit comments

Comments
 (0)