1

I have tried to use UpsetR to visualize the input file which can be found here

> 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
> upset(orthogroups_df, 
+       nsets = ncol(orthogroups_df), 
+       sets = rev(c(selected_species)), 
+       queries = list(list(query = intersects, params = list("NQLD", "Nlab", "Nsyl"), color = "#238c45", active = T),
+                 list(query = intersects, params = list("NQLD", "Nlab"), color = "#ffd977", active = T)))


Error in `$<-.data.frame`(`*tmp*`, "freq", value = 45L) : 
  replacement has 1 row, data has 0

How is it possible to fix the above error?

zx8754
  • 52,746
  • 12
  • 114
  • 209
user3523406
  • 309
  • 2
  • 6
  • 17
  • 1
    Difficult to answer without knowing what `orthogroups_df` looks like. Please [make this question reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including a small representative dataset in a plain text format, or a link to the TSV file. – neilfws Nov 16 '22 at 04:01
  • 1
    I updated my question but the whole dataset can be found [here](https://cloudstor.aarnet.edu.au/plus/s/OupXC8rF2bDFtRV). – user3523406 Nov 16 '22 at 04:38

1 Answers1

0

We need to set the number of intersects - nintersects - to a higher number so that sets in query params can be shown.

By default nintersects is set to 40, and list("NQLD", "Nlab", "Nsyl") appears after 40 at 90th position, so we need a bigger number, here I tried with 90:

upset(orthogroups_df, 
      nsets = ncol(orthogroups_df), 
      sets = rev(c(selected_species)), 
      nintersects = 90,
      queries = list(
        list(query = intersects,
             params = list("NQLD", "Nlab", "Nsyl"),
             color = "red",
             active = TRUE),
        list(query = intersects, 
             params = list("NQLD", "Nlab"), 
             color = "blue", 
             active = TRUE)))

enter image description here

zx8754
  • 52,746
  • 12
  • 114
  • 209