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

Tolerate extra empty columns #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions analysis/R/read_input.R
Original file line number Diff line number Diff line change
@@ -67,9 +67,17 @@ ReadCountsFile <- function(counts_file, params, adjust_counts = FALSE) {
nrow(counts), params$m))
}

if ((ncol(counts) - 1) != params$k) {
stop(paste0("Counts file: number of columns should equal to k + 1: ",
ncol(counts)))
# Tolerate extra empty columns
if (ncol(counts) > (params$k + 1)) {
extra <- counts[,(params$k + 2):ncol(counts)]
if (all(extra == 0)) {
counts <- counts[,1:(params$k + 1)]
}
}

if (ncol(counts) != params$k + 1) {
stop(sprintf("Counts file: Got %d columns, expected k + 1 = %d",
ncol(counts), params$k + 1))
}

if (any(counts < 0)) {