Galaxy tool for string operations over two array/table

Hi all,
I have two arrays and a table with some ids as field:

Array 1: [ID 1, ID 2, ID 3, ID 4]
Array 2: [ID 3, ID 1, ID 5]

Table:

Gene ID | Phenotpes ID

Gene1 | ID 1, ID 3, ID 7, …
Gene2 | ID 2, ID 4, ID 8, …

I would like to know if there is a tool for string data to have as results:

  1. If comparing the two arrays, an array with common elements
  2. If comparing an array with the table, a table with only rows with common elements with the input array