-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
Using sleuth I can calculate the TPM-Value of a gene in a Sample (sleuth_prep followed by sleuth_to_matrix).
Now if I have 6 samples (6 abundance tables from Kallisto) with two belonging to on of the three conditions P, G and H, I would expect to get one TPM-Value per gene per sample.
However, the TPM-Value for Gene i in sample j is not a fixed value, but i varies depended on the combinations of conditions which go into sleuth_prep.
E.g. gene i in P1 has a different TPM-value when condition P and G goes into sleuth_prep compared to gene i in P1 with the condition P and H. See minimal example below:
getSleuthObj <- function(s2c){
transcript2gene <- read_delim(transcript2genePath, delim = "\t", col_names=c("target_id","ens_gene","ext_gene"),show_col_types = FALSE )
sleuth.obj <- sleuth_prep(sample_to_covariates = s2c,
target_mapping = transcript2gene,
extra_bootstrap_summary = TRUE,
read_bootstrap_tpm = TRUE,
aggregation_column = 'ens_gene',
num_cores = numberOfCores,
gene_mode = TRUE
)
tpms <- sleuth_to_matrix(sleuth.obj, "obs_norm", "tpm")
tpms <- as.data.frame(tpms)
tpms$ens_gene <- rownames(tpms)
tpms$ext_gene <- sleuth.obj$target_mapping$ext_gene[match(tpms$ens_gene, sleuth.obj$target_mapping$ens_gene)]
rownames(tpms) <- NULL
return(tpms)
}
sleuth_PG <- getSleuthObj(rbind(
data.frame(sample = c("P1","P2"),
condition = "P",
path = c("/home/keks/app/data/P1","/home/keks/app/data/P2"),
stringsAsFactors = FALSE)
,
data.frame(sample = c("G5","G6"),
condition = "G",
path = c("/home/keks/app/data/G5","/home/keks/app/data/G6"),
stringsAsFactors = FALSE)
))
sleuth_PH <- getSleuthObj(rbind(
data.frame(sample = c("P1","P2"),
condition = "PC",
path = c("/home/keks/app/data/P1","/home/keks/app/data/P2"),
stringsAsFactors = FALSE)
,
data.frame(sample = c("H3","H4"),
condition = "H",
path = c("/home/keks/app/data/H3","/home/keks/app/data/H4"),
stringsAsFactors = FALSE)
))
Metadata
Metadata
Assignees
Labels
No labels