Design for DE analysis in tidybulk
1
1
Entering edit mode
@2df64073
Last seen 13 days ago
India

Hi everyone,

I have 12 samples - 3 Controls, 3 T1 , 3 T2 and 3 T3. I am interested in looking at genes that are different between controls and treatment. Also I would like to obtain DE genes that are different between control average and treatment average for which I had provided the contrast above that I want from the analysis (T1 + T2 + T3)/3 - Controls. I am unable to input such contrasts in the test_differential_abundance function under the contrasts argument. Can you suggest the design and contrasts arguement for looking at control vs treatments and controls average versus treatment average.

DESeq2 designmatrix edgeR limma tidybulk • 286 views
1
Entering edit mode
@stefanomangiola-6873
Last seen 6 weeks ago
Australia

For edgeR and Voom

if your column is called treatment then the contrast argument would be

contrast = "(treatmentT1 + treatmentT2 + treatmentT3)/3 - treatmentControls"

For DESeq2

you provide a contrast = list(...), in the same way you do for DESeq2

Some examples from the tidybulk documentation below.

@examples
# edgeR

tidybulk::se_mini |>
identify_abundant() |>
test_differential_abundance( ~ condition )

# The function test_differential_abundance operates with contrasts too

tidybulk::se_mini |>
identify_abundant() |>
test_differential_abundance(
~ 0 + condition,
contrasts = c( "conditionFALSE - conditionTRUE")
)

# DESeq2 - equivalent for limma-voom

my_se_mini = tidybulk::se_mini
my_se_mini$condition = factor(my_se_mini$condition)

my_se_mini  |>
identify_abundant() |>
test_differential_abundance( ~ condition, method="deseq2" )

# The function test_differential_abundance operates with contrasts too

my_se_mini |>
identify_abundant() |>
test_differential_abundance(
~ 0 + condition,
contrasts = list(c("condition", "FALSE", "TRUE")),
method="deseq2"
)

1
Entering edit mode

Thanks Stefano.

In DESeq2 you can pass character, list, or numeric contrasts. Here perhaps easiest would be numeric: c(-1, 1/3, 1/3, 1/3).

0
Entering edit mode

Thank you, Stefano and Michael for the help and also for toning it down for me. That would be comparing mean of controls vs mean treatment.

Another question along the same lines. I am interested in looking at genes that are different between controls and overall treatment. One method that was suggested to me was combine T1,T2,T3 into one and then look at controls versus treatment pairwise comparison. Is there any other way?? How would I compare just the controls versus overall treatment (T1,T2,T3), not taking the average.

I am bad at linear modeling and would appreciate you inputting the answer like above.

0
Entering edit mode

To add to the above question. Will similar contrasts control vs overall treatment & control average vs. treatment average work for ordinal values (not leveled factors) . I am not sure if DESeq2 provides support for ordinal values. I have tried with edgeR and limma . They work with ordinal factors well.

Currently, I also have ordinal rank set up in the form of C < T1 < T2 < T3 levels.

0
Entering edit mode

The mapping from what you want to a contrast is a long conversation. You can make pairwise comparisons or numeric contrasts or really anything you want. I have to reserve the time I spend on the support site to helping with software-related issues, but I'd recommend you consult with a statistician to decide on what analysis plan you want to take.

You can encode ordinal factors with new variables: e.g.:

1 0 0 0
1 1 0 0
1 1 1 0
1 1 1 1