Transformation of Log2FC to average logFC
1
0
Entering edit mode
18 months ago
shamza • 0

Hey, I am actually trying to transform Log2FC to the average_logFC using R does any know to do it?

Thank you

log2FC • 2.2k views
ADD COMMENT
0
Entering edit mode

Can you expand on what type of data this is, how you got the log2FCs, and what you mean by wanting to get the average?

ADD REPLY
0
Entering edit mode

I have followed the DEseq analysis on the data from this website https://satijalab.org/seurat/articles/de_vignette.html and it gives me a data frame, which looks like this

                 p_val   avg_log2FC pct.1 pct.2    p_val_adj
S100A9        1.887262e-58  2.538360490 0.996 0.870 2.588191e-54
LYZ           4.198394e-52  1.987961716 1.000 0.988 5.757678e-48
S100A8        5.747352e-49  2.784247955 0.975 0.500 7.881918e-45
FCGR3A        1.315842e-35 -2.949992172 0.131 0.975 1.804546e-31
RPS19         1.514561e-33 -1.614892111 0.990 1.000 2.077068e-29
IFITM2        1.227042e-26 -2.212583159 0.677 1.000 1.682765e-22
LGALS2        1.934655e-23  1.752577341 0.908 0.265 2.653186e-19
MS4A6A        1.281115e-16  1.113484307 0.685 0.185 1.756921e-12
COTL1         1.471544e-16 -1.249764073 0.973 1.000 2.018075e-12
RHOC          1.530872e-15 -1.697437230 0.162 0.864 2.099437e-11
CD14          9.242211e-15  1.143041707 0.667 0.154 1.267477e-10
GPX1          8.258457e-14  1.027229650 0.923 0.654 1.132565e-09
FCER1G        9.935568e-11 -1.506037733 0.940 1.000 1.362564e-06
RP11-290F20.3 1.986892e-10 -1.258508091 0.292 0.840 2.724823e-06
NAP1L1        2.086134e-10 -1.300474496 0.442 0.877 2.860925e-06
IFITM3        3.033173e-10 -1.291561421 0.623 0.975 4.159693e-06
AIF1          5.768209e-10 -1.296809810 0.958 1.000 7.910522e-06
LST1          6.630026e-10 -1.647414009 0.958 1.000 9.092418e-06
B2M           9.394949e-10 -1.146576812 0.998 1.000 1.288423e-05
PFN1          1.875562e-09 -0.997121124 0.963 0.994 2.572146e-05
SAT1          3.502773e-09 -1.050781700 0.967 0.994 4.803702e-05
NACA          1.279091e-08 -1.247293964 0.956 1.000 1.754145e-04
DRAP1         2.224727e-08 -1.173646773 0.475 0.889 3.050991e-04
GRN           2.742650e-08  0.547408698 0.758 0.556 3.761270e-04
MALAT1        3.049140e-08 -1.242704169 1.000 1.000 4.181591e-04
CEBPB         4.013070e-08 -1.110825687 0.665 0.926 5.503524e-04
PLBD1         4.210003e-08  0.412781525 0.344 0.191 5.773598e-04
TIMP1         1.027500e-07 -1.428036086 0.633 0.914 1.409114e-03
CD99          1.081787e-07  0.611460303 0.546 0.222 1.483563e-03
IFITM1        1.326866e-07 -1.005637881 0.150 0.691 1.819664e-03
ALDH2         1.580105e-07  0.543922910 0.442 0.173 2.166955e-03
YBX1          1.730706e-07 -0.967578522 0.865 0.994 2.373

but I want average_logFC and not log2Foldchange and I was wondering if there was a way I can transform log 2FC to avg_log 2FC

ADD REPLY
1
Entering edit mode
18 months ago
LChart 4.5k

avg_log2FC is not the average log2 fold change, it is the log2 fold change of the average expression. If you are comparing expression values in R, then the log2FC reported by R is measuring the same thing as the "avg_log2FC" reported by Seurat; modulo slight differences like normalization constants and logarithmic offsets.

ADD COMMENT
0
Entering edit mode

sorry I meant avg_log2FC to avg_logFC

ADD REPLY
0
Entering edit mode

Can you elaborate please what that means? So is it the average expression (baseMean from DESeq2) from a given cluster versus the average of the baseMeans from all other clusters? How is that tested in DESeq2?

ADD REPLY
0
Entering edit mode

Yes, it is average expression (baseMean from DESeq2) from a given cluster versus the average of the baseMeans from all other clusters.

They have used the following command to do that :

FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = NULL, test.use = "DESeq2", max.cells.per.ident = 50)

and this is how it looks

##                     p_val avg_log2FC pct.1 pct.2    p_val_adj
## S100A9 1.887262e-58   2.538360 0.996 0.870 2.588191e-54
## LYZ    4.198394e-52   1.987962 1.000 0.988 5.757678e-48
## S100A8 5.747352e-49   2.784248 0.975 0.500 7.881918e-45
## FCGR3A 1.315842e-35  -2.949992 0.131 0.975 1.804546e-31
## RPS19  1.514561e-33  -1.614892 0.990 1.000 2.077068e-29
## IFITM2 1.227042e-26  -2.212583 0.677 1.000 1.682765e-22

now when I am trying to construct a p-fold plot I am getting this visualization enter image description here

but I want to have a visualization like this: enter image description here

in order to get the plot to look like a wave I need to use avg_logFC and not avg_log2FC, but I don't know how to convert avg_log2FC to avg_logFC

ADD REPLY
2
Entering edit mode

You're clearly using the absolute value of the log fold change, which is why you don't have any negative values. Note that FCGR3A has a negative value in their table; so if you're running their command exactly you should also have negative values.

Nothing to do with averages, or the base of the logarithm. Just use the logFC rather than the absolute value of the logFC.

I should point out that you have not shown any of your own data, which makes it extremely difficult to provide support.

ADD REPLY

Login before adding your answer.

Traffic: 2201 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6