Great solution, Thank you very much
• 0 views
•
link
Hello community!
I have a , maybe, silly question. I have downloaded table with raw counts and normalized counts that looks like this
sample_id raw_read_count gene_id normalized_read_count
168-2-1 9685 ENSG00000000003 48.56
168-2-1 25 ENSG00000000005 0.25
168-2-1 4630 ENSG00000000419 47.89
168-2-1 1847 ENSG00000000457 6.81
and other table with the metadata info
sample_id treatment
168-2-1 Pre-treatment
004-1-5 Pre-treatment
005-1-8 Pre-treatment
034-1-0 Pre-treatment
034-3-8 Post-treatment
And I was wondering how is the best way to do a DE analysis using data, as I always start from RNAseq samples, I don't have much idea about how to start. Any advice or tip would be great!! Thanks!!
You want to convert your data into a wide format raw count matrix first.
Your example counts data.
cts <- structure(list(sample_id = c("168-2-1", "168-2-1", "168-2-1",
"168-2-1"), raw_read_count = c(9685L, 25L, 4630L, 1847L), gene_id = c("ENSG00000000003",
"ENSG00000000005", "ENSG00000000419", "ENSG00000000457"), normalized_read_count = c(48.56,
0.25, 47.89, 6.81)), class = "data.frame", row.names = c(NA,
-4L))
Using tidyverse for the convenience.
library("tidyverse")
mat <- cts %>%
select(!normalized_read_count) %>%
pivot_wider(names_from=sample_id, values_from=raw_read_count) %>%
column_to_rownames("gene_id") %>%
as.matrix
> mat
168-2-1
ENSG00000000003 9685
ENSG00000000005 25
ENSG00000000419 4630
ENSG00000000457 1847
This matrix and the meta-data file can then be used as input to DESeq2
Great solution, Thank you very much
Log in to answer this question.