Question: Help with OrderedList
0
gravatar for sgujja
14 months ago by
sgujja20
United States
sgujja20 wrote:

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 • 389 views
ADD COMMENTlink modified 13 months ago by Biostar ♦♦ 20 • written 14 months ago by sgujja20

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

ADD REPLYlink written 14 months ago by Sej Modha4.2k

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)

ADD REPLYlink written 14 months ago by lieven.sterck5.5k

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

ADD REPLYlink written 14 months ago by sgujja20

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

ADD REPLYlink modified 14 months ago by genomax69k • written 14 months ago by sgujja20
  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
ADD REPLYlink modified 14 months ago • written 14 months ago by genomax69k

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

ADD REPLYlink written 14 months ago by lieven.sterck5.5k

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%
  --------------------------------------------------
ADD REPLYlink modified 14 months ago by genomax69k • written 14 months ago by sgujja20

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

ADD REPLYlink written 14 months ago by lieven.sterck5.5k

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.

ADD REPLYlink written 14 months ago by sgujja20

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 ...

ADD REPLYlink written 14 months ago by lieven.sterck5.5k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1517 users visited in the last hour