Thanks. It works well. But it is very slow.
• 0 views
•
link
Hi All, Merry Christmas, I have two gene list, for example, file1
A
B
C
D
file2
B
C
D
E
F
G
H
I want to compare them which IDs is different and same? Thanks,
Common genes:
grep -h -w -f file2 file1
Genes in file1 not in file2:
grep -h -v -w -f file2 file1
Genes in file2 not in file1:
grep -h -v -w -f file1 file2
Thanks. It works well. But it is very slow.
$ more f1
A
B
C
D
F
G
$ more f2
B
C
D
E
F
J
K
L
The comm utility reads file1 and file2, which should be sorted lexically, and produces three text columns as output: lines only in file1; lines only in file2; and lines in both files.
$ comm <(sort f1) <(sort f2)
A
B
C
D
E
F
G
J
K
L
This is work well fast.
You can use http://bioinfogp.cnb.csic.es/tools/venny/
This can not handle lots of data. I tried it.
Log in to answer this question.
I'm having a similar issue, albeit a more complex example, and have an ongoing question on Stack Overflow where
grep -h -w -f file2 file1should work but for unknown reasons is not working. I would appreciate it if someone could take a look at this and suggest a solution.I think you forgot to include a link to SO.
Indeed I did facepalm, edited the post to include it now
join -j 1 file1 file2seems to work for what you want (where the first column is the numbers in your example).Sadly this does not work even on numerically sorted ASCII text files
Hello fufuyou!
We believe that this post does not fit the main topic of this site.
Not bioinformatics, simple unix
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!