This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Deseq2

Does Deseq2 work if I have samples with more than 2 conditions?

pydeseq2 deseq2

1 answer

The minimum is two conditions and at least one group with 2 replicates. Everything beyond that is basically possible, given you're not trying to model linear combinations of something.

Consider some effort please for your questions.

ATpoint I am using PyDeseq2 package and tried running it for 4 conditions; A,B,C and D (each condition is a sample treated with different drug and has 4 biological replicates each) and following is the code for the same:

counts = pd.read_csv("counts.txt", sep="\t")

columns_array = counts.columns.to_list()

conditions_array = ["A","A","A","A","B","B","B","B","C","C","C","C","D","D","D","D"]

metadata_df = pd.DataFrame({"condition": conditions_array}, index=columns_array)

dds = DeseqDataSet(
    counts=counts.T,
    metadata=metadata_df,
    design_factors=["condition"]
)

dds.deseq2()

print(dds)

ds = DeseqStats(dds, contrast=["condition", "A", "D"])

Running this contrast command gives me the following error

KeyError: "The tested level ('A') should correspond to one of the levels of 'condition'"

Log in to answer this question.