Hi,
I am analyzing a dataset GSE183852. Authors in this manuscript have submitted their R object and I am working with it to get some output for differential expression for DCM vs. donor in different cell types.
The codes I am using are as follows:
1. Get the average gene expression for each sample
## code-block-1
ae_celltype_condition_sample <- AverageExpression(RefMerge, group.by = "CellType_Condition_Sample",assays="RNA",slot="data")
write.table(ae_celltype_condition_sample,"AverageExpressionByCellTypeAndConditionAndSample.txt",sep="\t",row.names=TRUE)
2. Get the average gene expression for each condition
## code-block-2
ae_celltype_condition <- AverageExpression(RefMerge, group.by = "CellType_Condition",assays="RNA",slot="data")
write.table(ae_celltype_condition,"AverageExpressionByCellTypeAndCondition.txt",sep="\t",row.names=TRUE)
3. Obtain differentially expression of genes in Fibroblast cluster (DCM vs. Donor)
Basically, take all cells in Fibroblast cluster, and find markers that separate cells in the 'DCM' group (metadata variable 'condition')
## code-block-3
markers_DCM_Fibroblasts <- FindMarkers(RefMerge, ident.1 = "DCM", group.by = 'condition', subset.ident = "Fibroblasts", slot="data")
write.table(markers_DCM_Fibroblasts,"DCM_Markers_Fibroblasts.txt",sep="\t",row.names=TRUE)
Questions:
a) The files that get generated do not match. The excel files generated from code blocks 1 and 2 do not match. Meaning if I calculate average expression of a gene X in all samples for one condition (DCM) generated from code block 1, it does not match the average expression of the same gene X in all samples for the same condition (DCM) from code block 2.
b) None of the average expression values from code blocks 1 or 2 match the log 2 fold changes obtained from code block 3, I cannot figure out the math which gives the log2FC values from the average expression values generated through either code blocks 1 or 2.
c) Is there a way to obtain an output (excel sheet or txt file) which shows: log2FC (Group2 vs. Group1), p-value, corrected p-value, pct1, pct2, average expression for group1 and average expression of group2 for genes in one cluster/ cell type (e.g., Fibroblasts)?
Please guide me through this process. I can send any additional files or information if needed
Thank you
Best,
R