#!/usr/bin/env Rscript ################################################ ### Diff. gene expression with sleuth ########## ################################################ ################################################ #### Test area (Within R) ################################################ # arc_root <- "~/gitlab_dataplant/samplearc_rnaseq/" # in_sleuth <- "runs/kallisto_collect/kallisto_sleuthObject.RData" # out_folder <- "runs/kallisto_sleuth" ################################################ #### Load required library ################################################ library(sleuth) ################################################ #### Read arguments from CLI ################################################ args <- commandArgs(trailingOnly = T) arc_root <- args[1] in_sleuth <- args[2] out_folder <- args[3] ################################################ #### If it does not exist, create out dir ################################################ dir.create(paste(arc_root, out_folder, sep = "/"), recursive = T, showWarnings = F) ################################################ #### Load sleuth object ################################################ load(file = paste(arc_root, in_sleuth, sep = "/")) ################################################ #### Run sleuth fit ################################################ so <- sleuth_fit(so) so <- sleuth_fit(so, ~condition, "full") so <- sleuth_fit(so, ~1, "reduced") so <- sleuth_lrt(so, "reduced", "full") sleuth_table <- sleuth_results(so, "reduced:full", "lrt", show_all = FALSE) ################################################ #### write to file ################################################ write.csv(sleuth_table, paste(arc_root, out_folder, "sleuth_dge.csv", sep = "/"), row.names = F)