在 UpsetR 中手动排序集合失败

Manually order the set fails in UpsetR

提问人:user3523406 提问时间:12/5/2022 最后编辑:user3523406 更新时间:12/6/2022 访问量:266

问:

我尝试使用 UpsetR 来可视化输入文件,可以在这里找到。如何使 UpsetR 接受 中定义的订单?sets

keep.order = T with keep.order = T

keep.order = F with keep.order = F

> library("UpSetR")
> orthogroups_df<- read.table("orthogroups.GeneCount.tsv",  header=T, stringsAsFactors = F)
> #All species
> selected_species <- colnames(orthogroups_df)[2:(ncol(orthogroups_df) -1)] 
> selected_species
 [1] "Atha" "Cann" "NQLD" "Natt" "Ngla" "Nlab" "Nsyl" "Ntab" "Ntom" "Slyc" "Stub" "Vvin"
> head(orthogroups_df)
  Orthogroup Atha Cann NQLD Natt Ngla Nlab Nsyl Ntab Ntom Slyc Stub Vvin Total
1  OG0000000    0    0  965    0    0    3    0    0    0    0    0    0   968
2  OG0000001    0    1    3    0    0  448    0    0    0    0    0    0   452
3  OG0000002    0    1  313    0    0  120    1    0    1    0    0    0   436
4  OG0000003    0   93   15   21   46   16   33   63   36   25   39   26   413
5  OG0000004    1   42    2   34  109    6    8  154   11    9    4    0   380
6  OG0000005    0    2   61    1   34   44   91   70   43   20    1    0   367
> ncol(orthogroups_df)
[1] 14
> orthogroups_df[orthogroups_df > 0] <- 1
> # we only show intersections of interest ,  
> intersections=list(list(selected_species),
+                    list("NQLD", "Ngla", "Natt", "Nlab", "Nsyl", "Ntab", "Ntom"),
+                    list("Stub", "Slyc"),
+                    list("Atha", "Vvin"),
+                    list("Ntab", "Nsyl", "Ntom"),
+                    list("Nlab", "NQLD", "Ngla"), 
+                    list("Nlab", "NQLD", "Nsyl"), 
+                    list("Nlab", "Ngla", "Nsyl"), 
+                    list("NQLD", "Nsyl", "Ngla"))
> upset(orthogroups_df, 
+       text.scale = c(1.4),
+       sets=c("Nlab", "NQLD", "Ngla", "Nsyl", "Ntom", "Ntab", "Natt", "Cann", "Stub", "Slyc", "Vvin", "Atha"), 
+       order.by = "freq",
+       keep.order=T, 
+       intersections = intersections, 
+       sets.x.label="Total number of orthogroups", 
+       mainbar.y.label = "Number of orthogroups") 
r ggplot2 扰流板

评论

0赞 Vida 12/5/2022
您正在设置应按照从下到上输入的顺序保留集合,如果您希望它们按该顺序但从顶部开始,然后反转您的集合keep.order = Trev()
0赞 user3523406 12/6/2022
我上传了两个问题 心烦意乱的情节,一个是,另一个是.在这两种情况下,顺序似乎是随机的。我不明白发生了什么。keep.order = Tkeep.order = F
0赞 thothal 12/7/2022
keep.order = T=> 左边的条形的顺序(从下到上)与它们在数据中显示的顺序相同(是前 3 列,因此底部是 3 个柱)。 => 条形根据大小排序,因此(最大的条形)位于底部。Atha, Cann, NQLDkeep.order = FNTAB
0赞 Vida 12/7/2022
在图中,集合按字母顺序排序,这是数据中列的顺序,我看不出问题所在。keep.order = Torthogroups_df
1赞 krassowski 12/8/2022
作为替代方法,您可以改用 complex-upset

答: 暂无答案