This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Help with OrderedList

Hi,

I am trying to use OrderedList to compare two gene list which have about ~10% overlapping genes.

However, I get an an error running:

> compareLists(list2, list3)
Error in compareLists(list2, list3) : 
  1 element(s) of first list not found in second

Could you please help.

Thanks Sharvari

r

Can you post a sample of your data? Are you sure the datatypes of these vectors are correct?

I seem to remember I had a similar situation some time ago. If I recall correctly it was due to some list members not being present in both lists (the basic premises of this to work is that the same IDs are present in both lists)

Hello Lieven,

The manual mentions about an optional parameter "mapping" when the two lists being compared are not the same.

– mapping: Maps identifiers between the two lists. This is a matrix with two columns. All items in ID.List1 must match to exactly one entry of column 1 of the mapping, each element in ID.List2 must match exactly one element in column 2 of the mapping. If mapping is NULL, the two lists are expected to contain the same identifiers and there must be a one-to-one relationship between the two.

However, using this option gives me an error mentioned below.

Thanks Sharvari

This is what I am trying to do:

# mapping file
lista <- read.table("list_1_2.txt", header=F,sep="\t")
lista <- as.matrix(lista)
> head(lista)
     V1             V2            
[1,] "LOC101928626" "LOC101928626"
[2,] "NADK"         "ARHGEF10L"   
[3,] "PRDM16"       "RPL11"       
[4,] "ARHGEF16"     "MIR4421"     
[5,] "MIR551A"      "MIR4794"     
[6,] "LOC102724552" "RXRG"  

# list 1
listb <- as.list(read.table("list1.txt",header=F))
listb <- as.character(unlist(listb))

# list 2
listc <- as.list(fread("list2.txt",header=F))
listc <- as.character(unlist(listc))

> head(listb)
[1] "LOC101928626" "ARHGEF10L"    "RPL11"        "MIR4421"      "MIR4794"      "RXRG"        
> head(listc)
[1] "LOC101928626" "NADK"         "PRDM16"       "ARHGEF16"     "MIR551A"      "LOC102724552"

compareLists(listb, listc, mapping=lista)
868  of  1000  elements in first list not found in mapping
868  of  1000  elements in second list not found in mapping
Error in 1:n : result would be too long a vector
In addition: Warning message:
In max(nn) : no non-missing arguments to max; returning -Inf

Any feedback is appreciated.

Thanks

  1. Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized. You can edit your original post to add new information as well.
  2. Please use the formatting bar (especially the code option) to format parts of you post that contain code snippets. I've done it for you this time.
    Formatting bar

Is that the same script that produced the error message as mentioned in your initial post? This seems to be a different one?

I updated the list names and used the optional argument 'mapping' as an input. Running the function 'compareLists' seems to be working now. I just want to make sure that the mapping input is correct.

    > compareLists(listb, listc, mapping=lista)
  Simulating random scores...
  0%.......:.........:.........:.........:......100%
  --------------------------------------------------

From the outout it seems you still have issues with your mapping file as it says there are some missing (or did you only provided a subset for the mapping as testing purpose?)

you might get some other useful info from this biostar post

I did look at the other biostar post. All the entries are common in both the lists. However, in my example both the lists have only ~130 genes in common. Which is why I am using the mapping option. The mapping file has all the entries from lista and listb in the same order as in the respective lists.

OK, so you do not want to compare the complete lists but only the subset for which you provided the mapping? It might pay off to have a look at the additional options/parameters for the compareLists() function ...

0 answers

No answers yet.

Log in to answer this question.