> setwd("C:/Users/SKULTER/Desktop/New folder/")
> directory <- 'C:/Users/SKULTER/Desktop/New folder/'
> samplefiles <- grep("SRR",list.files(directory),value = TRUE)
> condition <- c('SRR5500529.txt','SRR5500530.txt')
> sampletable <- data.frame(samplname = samplefiles,filename = samplefiles,condition = condition)
library(DESeq2)
ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampletable,
+ directory = directory,
+ design = ~ condition)
dds <- DESeq(ddsHTSeq)
estimating size factors
estimating dispersions
Error in checkForExperimentalReplicates(object, modelMatrix) :
The design matrix has the same number of samples and coefficients to fit,
so estimation of dispersion is not possible. Treating samples
as replicates was deprecated in v1.20 and no longer supported since v1.22.
AFTER THIS I CHANGED CONDITION = ~ 1, It worked but I'm not getting proper log2foldchang values ie no downregulated genes.
3 answers
Do I see this correctly that you only have two samples overall and want to do a 1 vs 1 comparison? If so this is statistically not valid and therefore DESeq2 rejects this analysis. Nothing you can do about it. Please read existing threads about experiments without replicates. The edgeR manual also covers this.
You CAN run DESEQ2, but the statistical analyses and comparisons will have no real meaning. To perform DESEQ2 without replicates: change "~ condition" to "~ 1" in the DESeqDataSetFromHTSeqCount().
Edit: Just now I see your final comment and see you have already done that. The log2foldchange is one of the things you cannot use without replicates. You can take the counts and attempt a different comparison.
Now I would like to know I have 50 normal and 50 cancer same sample numbers. How I find differentially expresssed genes in these two conditions.
condition <- cc('C1','C2'.....so on ,'N1','N2', and so on) file_list <- list.files(path = directory, pattern ="*.bam.count") sampleFiles <- c(file_list)
sampleTable <- data.frame(sampleName = sampleFiles, fileName = sampleFiles, condition = condition)
ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable, directory = directory2, design =~ condition) Warning message: In DESeqDataSet(se, design = design, ignoreRank) : some variables in design formula are characters, converting to factors
ddsHTSeq class: DESeqDataSet dim: 47051 100 metadata(1): version assays(1): counts rownames(47051): A1BG A1BG-AS1 ... ZZZ3 bA395L14.12 rowData names(0): colnames(100): C1.bam.count C10.bam.count ... N8.bam.count N9.bam.count colData names(1): condition
ddsHTSeq <- DESeq(ddsHTSeq)
estimating size factors estimating dispersions Error in checkForExperimentalReplicates(object, modelMatrix) :
The design matrix has the same number of samples and coefficients to fit,
so estimation of dispersion is not possible. Treating samples as replicates was deprecated in v1.20 and no longer supported since v1.
When I mentioned design =~ 1 in
ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable, directory = directory2, design =~ 1) Warning message: In DESeqDataSet(se, design = design, ignoreRank) : some variables in design formula are characters, converting to factors
ddsHTSeq class: DESeqDataSet dim: 47051 100 metadata(1): version assays(1): counts rownames(47051): A1BG A1BG-AS1 ... ZZZ3 bA395L14.12 rowData names(0): colnames(100): C1.bam.count C10.bam.count ... N8.bam.count N9.bam.count colData names(1): condition
ddsHTSeq <- DESeq(ddsHTSeq)
estimating size factors estimating dispersions ....................give the result.
Now please guide me how to differentiate among two samples from same organism. I will be heartily thankful to you.
Log in to answer this question.