How to run DESeq2 for multiple factors
0
0
Entering edit mode
3.5 years ago
Kumar ▴ 170

Hi, I have 187 samples with two factors: (affected and unaffected) and (male and female) for RNA-Seq data analysis. I have run Kallisto and got output file, now I am using DESeq2 package DGE analysis. I have samples with two factors. Please let me know how to improve the script according to the following metadata.

Here is the metadata information:

affected =94
Male =5
Female: 89

Unaffected: 93
Male: 52
Female:41

Here is the script:

names(files) <- paste0("sample", 1:187)
txi.kallisto <- tximport(files, type = "kallisto", txOut = TRUE)
head(txi.kallisto$counts)
sampleTable <- data.frame(condition = factor(rep(c("affected", "unaffected"), each = 94)))
rownames(sampleTable) <- colnames(txi.kallisto$counts)
rna-seq DESeq2 next-gen • 1.2k views
ADD COMMENT
0
Entering edit mode

Hi, I did not get my answer in the post. My initial question is how to import these two factors types of data with different numbers. I will use tx2gene after importing the data.

ADD REPLY
0
Entering edit mode

Can you give us more information?

Is your script working or is it producing an error? Which specific part of the script are you running into issues with?

If you're trying to get sampleTable to include both "factors", then can't you just create another column named sex in sampleTable?

ADD REPLY
0
Entering edit mode

Hi, first I am not sure how to load all abundance.h5 files from different folders. I have a total of 187 abundance.h5 samples files in different folders.

files <- file.path(dir, "kallisto", samples$run, "abundance.h5")

ERROR: Error in samples$run : object of type 'closure' is not subsettable

Next, how to make the change here because I have different groups and factors. The below script is for one factor (affected and unaffected), I need to add male and female as a factor also.

names(files) <- paste0("sample", 1:187)
txi.kallisto <- tximport(files, type = "kallisto", txOut = FALSE)
head(txi.kallisto$counts)
#library(DESeq2)
sampleTable <- data.frame(condition = factor(rep(c("affected", "unafected"), each = 93)))
ADD REPLY
0
Entering edit mode

Let's start with one problem at a time, and get things working with one factor first.

In general, you should start with getting the simple things working before moving onto something more complicated.

So, the first thing that needs addressing is: object of type 'closure' is not subsettable

Perhaps you might want to show us exactly what samples is. Otherwise, we can't help you just by looking at a small piece of your code.

ADD REPLY
0
Entering edit mode

Here are some samples, in such a order I have total 187 samples: However, I am trying if I can access these samples by a single command.

files <- c("/DataAnalysis/kallisto_test/270-aligned/abundance.h5", 
"/DataAnalysis/kallisto_test/272-aligned/abundance.h5",
"/DataAnalysis/kallisto_test/274-aligned/abundance.h5",
"/DataAnalysis/kallisto_test/362-aligned/abundance.h5",
"/DataAnalysis/kallisto_test/364-aligned/abundance.h5",
"/DataAnalysis/kallisto_test/366-aligned/abundance.h5",
"/DataAnalysis/kallisto_test/368-aligned/abundance.h5",
ADD REPLY
0
Entering edit mode

Hi, do you have an idea about my question as I mentioned below? Is there any command to access these all .h5 files in a variable (files)?

ADD REPLY

Login before adding your answer.

Traffic: 1846 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6