How can we separate downregulated genes and upregulated genes from list of dataframes separately??
1
0
Entering edit mode
19 months ago
Bioinfo ▴ 30

This is the list of dataframes from which i need to separate out UP and down regulated genes in a form of dataframes only means two separate list of genes(up and down) with dataframes.

str(FindMarkers_list)

    List of 4
     $ 0 :'data.frame': 1730 obs. of  5 variables:
      ..$ p_val     : num [1:1730] 7.02e-154 1.04e-116 4.45e-86 1.52e-82 2.32e-78 ...
      ..$ avg_log2FC: num [1:1730] 1.341 1.015 3.719 1.329 0.679 ...
      ..$ pct.1     : num [1:1730] 0.631 0.468 0.83 0.66 0.234 0.617 0.688 0.73 0.56 0.319 ...
      ..$ pct.2     : num [1:1730] 0.04 0.027 0.228 0.119 0.007 0.99 0.149 0.172 0.092 0.022 ...
      ..$ p_val_adj : num [1:1730] 1.61e-149 2.39e-112 1.02e-81 3.48e-78 5.31e-74 ...
     $ 1 :'data.frame': 1755 obs. of  5 variables:
      ..$ p_val     : num [1:1755] 4.14e-240 2.34e-120 1.87e-116 1.50e-87 2.69e-85 ...
      ..$ avg_log2FC: num [1:1755] -2.52 -2.75 -1.89 -1.2 -1.11 ...
      ..$ pct.1     : num [1:1755] 0 0.19 0.12 0.038 0 0.397 0.007 0.072 0.118 0.386 ...
      ..$ pct.2     : num [1:1755] 0.687 0.806 0.757 0.448 0.257 0.881 0.287 0.526 0.631 0.866 ...
      ..$ p_val_adj : num [1:1755] 9.47e-236 5.36e-116 4.28e-112 3.43e-83 6.16e-81 ...
 $ 2 :'data.frame': 1828 obs. of  5 variables:
  ..$ p_val     : num [1:1828] 4.13e-191 3.41e-147 4.16e-142 1.80e-141 7.22e-136 ...
  ..$ avg_log2FC: num [1:1828] -3.14 -2.07 -2.01 -1.74 -2.07 ...
  ..$ pct.1     : num [1:1828] 0 0.52 0.913 0.778 0.111 0.997 0.951 0.28 0.459 0.331 ...
  ..$ pct.2     : num [1:1828] 0.925 0.998 0.998 0.993 0.89 1 1 0.965 0.983 0.94 ...
  ..$ p_val_adj : num [1:1828] 9.45e-187 7.81e-143 9.52e-138 4.11e-137 1.65e-131 ...
 $ 3 :'data.frame': 2959 obs. of  5 variables:
  ..$ p_val     : num [1:2959] 2.44e-70 6.15e-49 2.02e-43 7.23e-42 2.83e-37 ...
  ..$ avg_log2FC: num [1:2959] -1.45 -1.38 -2.32 -3.62 -1.84 ...
  ..$ pct.1     : num [1:2959] 0 0.021 0 0.006 0.104 0.138 0 0 0.972 0.061 ...
  ..$ pct.2     : num [1:2959] 0.433 0.483 0.267 0.317 0.7 0.783 0.217 0.217 0.25 0.55 ...
  ..$ p_val_adj : num [1:2959] 5.58e-66 1.41e-44 4.63e-39 1.66e-37 6.47e-33 ...
Differentially-expressed-genes scRNA R • 992 views
ADD COMMENT
0
Entering edit mode

not sure what you want but if you need to translate your list of two dataframes within one dataframe you can use do.call(rbind,dat) if dat is your list input list

ADD REPLY
0
Entering edit mode

Thanks Nicolas for the response

I want to separate above mentioned list into two separate list with same format dataframes. Genes names are present in each rows. list 1 i.e. up_regulated_genes <- avg_log2FC > 0 & p_val < 0.05 list 2 i.e. down_regulated_genes <- avg_log2FC < 0 & p_val > 0.05

Thanks in advance.

ADD REPLY
2
Entering edit mode
19 months ago

With lapply(), you can apply any function to each list element:

up_regulated_genes <- lapply(FindMarkers_list, subset, avg_log2FC > 0, p_val < 0.05)
down_regulated_genes <- lapply(FindMarkers_list, subset, avg_log2FC < 0, p_val < 0.05)
ADD COMMENT
0
Entering edit mode

Thank you so much... it works. Thanks a lot.

ADD REPLY

Login before adding your answer.

Traffic: 1486 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