@@ -418,10 +418,9 @@ process_bootstrap <- function(i, samp_name, kal_path,
418418 rm(bs_tpm )
419419 # Make long tidy table; this step is much faster
420420 # using data.table melt rather than tidyr gather
421- tidy_tpm <- data.table :: melt(bs_tpm_df , id.vars = " bootstrap_num" ,
421+ tidy_tpm <- data.table :: melt(as.data.table( bs_tpm_df ) , id.vars = " bootstrap_num" ,
422422 variable.name = " target_id" ,
423423 value.name = " tpm" )
424- tidy_tpm <- data.table :: as.data.table(tidy_tpm )
425424 rm(bs_tpm_df )
426425 tidy_tpm $ target_id <- as.character(tidy_tpm $ target_id )
427426 tidy_tpm <- merge(tidy_tpm , mappings , by = " target_id" ,
@@ -458,7 +457,7 @@ process_bootstrap <- function(i, samp_name, kal_path,
458457 rm(bs_mat )
459458 # data.table melt function is much faster than tidyr's gather function
460459 # output is a long table with each bootstrap's value for each target_id
461- tidy_bs <- data.table :: melt(bs_df , id.vars = " bootstrap_num" ,
460+ tidy_bs <- data.table :: melt(data.table :: as.data.table( bs_df ) , id.vars = " bootstrap_num" ,
462461 variable.name = " target_id" ,
463462 value.name = " est_counts" )
464463 rm(bs_df )
@@ -485,8 +484,9 @@ process_bootstrap <- function(i, samp_name, kal_path,
485484 mappings )
486485 # this step undoes the tidying to get back a matrix format
487486 # target_ids here are now the aggregation column ids
488- bs_mat <- data.table :: dcast(scaled_bs , sample ~ target_id ,
487+ bs_mat <- data.table :: dcast(data.table :: as.data.table( scaled_bs ) , sample ~ target_id ,
489488 value.var = " scaled_reads_per_base" )
489+ bs_mat <- as.data.frame(bs_mat )
490490 # this now has the same format as the transcript matrix
491491 # but it uses gene ids
492492 bs_mat <- as.matrix(bs_mat [, - 1 ])
0 commit comments