Skip to content
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: 8 additions & 6 deletions R/matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ sleuth_to_matrix <- function(obj, which_df, which_units) {

which_units <- check_quant_mode(obj, which_units)

if (obj$gene_mode && which_df == "obs_raw") {
warning("This object is in gene mode, and the raw values are ",
"transcripts. Using 'obs_norm' instead.")
which_df <- "obs_norm"
}

data <- as.data.frame(obj[[which_df]])

res <- list()
Expand All @@ -56,5 +50,13 @@ sleuth_to_matrix <- function(obj, which_df, which_units) {
s_data$target_id <- NULL
s_data <- as.matrix(s_data)

if (obj$gene_mode && which_df == "obs_raw") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you still want to issue a warning here to make sure the user understand the drawbacks of what he's doing? 😉

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I think this is a nice idea to expose the drawbacks.
What do you think that should be warned here?

  • scaled_reads_per_base is a artificial measure to represent the read counts of genes (in this case, the same warning appear when the user requests obs_norm).
  • The raw values of scaled_reads_per_base are not normalized and, therefore, should not be directly compared.

if (which_units == "scaled_reads_per_base") {
s_data <- t(t(s_data)*obj$est_counts_sf)
} else {
s_data <- t(t(s_data)*obj$tpm_sf)
}
}

s_data
}