There are times, we come across to
Following note is an R code examples to do above tasks. For this you would need to R (grab latest version) and dplyr package (again, grab latest package).
Before we dive into the code execution, let me briefly explain join function we will be using below. Join function does what it says. It joins. When we say join, we need to tell program how to join two gene lists (L1 and L2). Both the gene lists (L1 and L2) should have same column names for gene lists and other columns. For eg. If list 1 has gene names under column named "Genes", list2 column with gene names should have title "Genes".
When joining, there can be three types of joining: Genes common between two lists (called inner_join),Genes unique to list 1 only (exclude common genes and list2 genes) and Genes unique to list 2 only (exclude common genes and list2 genes). Common genes are those genes which are common between list1 and list 2. Now let us get to work:
Let us assume that we have two gene lists: L1 and L2 with following genes and they also have expression trends.
------------------------------------------------------------------------------
L1
------------------------------------------------------------------------------
gene Expression
L2
------------------------------------------------------------------------------
gene Expression
-------------------------------------------------------------------------------
Common genes between L1 and L2:
------------------------------------------------------------------------------
Let us find out the common genes between L1 and L2:
_____________________________________________
Code
______________________________________________
$ library(dplyr)
$ inner_join(L1,L2)
Output:
Joining, by = c("gene", "Expression")
gene Expression
1 ACTR8 down
==================================================
--------------------------------------------------------------------------------
Genes unique to L1 (exclude common genes and genes in L2)
--------------------------------------------------------------------------------
Let us find out the unique genes to L1:
_____________________________________________
Code
______________________________________________
$ library(dplyr)
$ anti_join(L1,L2) #Note L1 is on left side
Output:
Joining, by = c("gene", "Expression")
gene Expression
1 SETD1A down
2 RUVBL2 down
3 RNF40 down
4 RARA up
==================================================
----------------------------------------------------------------------------------
Genes unique to L2 (exclude common genes and genes in L1)
-----------------------------------------------------------------------------------
Let us find out the unique genes to L2:
_____________________________________________
Code
______________________________________________
$ library(dplyr)
$ anti_join(L2,L1) #Note L1 is on right side
Output:
Joining, by = c("gene", "Expression")
gene Expression
1 ACTR5 up
2 ACTL6B up
3 ACTL6A down
- Find common genes between two pathways/lists
- Find genes that are unique to list 1 excluding common genes between two lists
- Find genes that are unique to list 2, excluding common genes between two lists
Following note is an R code examples to do above tasks. For this you would need to R (grab latest version) and dplyr package (again, grab latest package).
Before we dive into the code execution, let me briefly explain join function we will be using below. Join function does what it says. It joins. When we say join, we need to tell program how to join two gene lists (L1 and L2). Both the gene lists (L1 and L2) should have same column names for gene lists and other columns. For eg. If list 1 has gene names under column named "Genes", list2 column with gene names should have title "Genes".
When joining, there can be three types of joining: Genes common between two lists (called inner_join),Genes unique to list 1 only (exclude common genes and list2 genes) and Genes unique to list 2 only (exclude common genes and list2 genes). Common genes are those genes which are common between list1 and list 2. Now let us get to work:
Let us assume that we have two gene lists: L1 and L2 with following genes and they also have expression trends.
------------------------------------------------------------------------------
L1
------------------------------------------------------------------------------
gene Expression
- RARA up
- RNF40 down
- RUVBL2 down
- SETD1A down
- ACTR8 down
L2
------------------------------------------------------------------------------
gene Expression
- ACTL6A down
- ACTL6B up
- ACTR5 up
- ACTR8 down
-------------------------------------------------------------------------------
Common genes between L1 and L2:
------------------------------------------------------------------------------
Let us find out the common genes between L1 and L2:
_____________________________________________
Code
______________________________________________
$ library(dplyr)
$ inner_join(L1,L2)
Output:
Joining, by = c("gene", "Expression")
gene Expression
1 ACTR8 down
==================================================
--------------------------------------------------------------------------------
Genes unique to L1 (exclude common genes and genes in L2)
--------------------------------------------------------------------------------
Let us find out the unique genes to L1:
_____________________________________________
Code
______________________________________________
$ library(dplyr)
$ anti_join(L1,L2) #Note L1 is on left side
Output:
Joining, by = c("gene", "Expression")
gene Expression
1 SETD1A down
2 RUVBL2 down
3 RNF40 down
4 RARA up
==================================================
----------------------------------------------------------------------------------
Genes unique to L2 (exclude common genes and genes in L1)
-----------------------------------------------------------------------------------
Let us find out the unique genes to L2:
_____________________________________________
Code
______________________________________________
$ library(dplyr)
$ anti_join(L2,L1) #Note L1 is on right side
Output:
Joining, by = c("gene", "Expression")
gene Expression
1 ACTR5 up
2 ACTL6B up
3 ACTL6A down