Question: How to run DESeq2 for multiple factors
0
gravatar for Manoj
4 weeks ago by
Manoj80
United States
Manoj80 wrote:

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 • 145 views
ADD COMMENTlink modified 4 weeks ago • written 4 weeks ago by Manoj80

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 REPLYlink written 4 weeks ago by Manoj80

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 REPLYlink written 4 weeks ago by dsull1.6k

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 REPLYlink written 4 weeks ago by Manoj80

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 REPLYlink written 4 weeks ago by dsull1.6k

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 REPLYlink modified 4 weeks ago • written 4 weeks ago by Manoj80

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 REPLYlink written 13 days ago by Manoj80
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2219 users visited in the last hour