I have two files
genelist.txt simply contains a single column of ~500 gene names, whereas
data.txt is a tab delimited file that contains ~1000 columns (the samples) and ~30,000 rows (gene names). The general scheme of
data.txt is outlined below.
Sample 1 Sample 2 Sample 3 Sample 4
Gene A 1.04 1.81 1.92 0.45
Gene B 1.11 1.12 1.32 0.92
Gene C 0.72 0.71 0.85 1.12
Gene D 1.19 1.42 0.13 0.32
I need to extract each row (the entire row, i.e. all samples) from
data.txt containing each of the ~500 gene names in
genelist.txt and have these rows extracted to a separate file. I've been told to use grep or awk and have looked into how to do this, however as a simple biologist with little/no coding experience I'm having a bit of trouble. Would it be possible for someone to explain how this is done, and hopefully provide some code for me to get underway.
It would also be neat if the extraction returned only terms that match the entire gene name in
genelist.txt. For example, if I had ABC123 but not ABC1234 in
genelist.txt, I would want only ABC123 to be extracted and not ABC1234.
Furthermore, after this is done how would I then check to see which of my genes from
genelist.txt were not included in the extraction? (i.e. some genes may be incorrectly named, so I would have to go back and re-extract them with their alternative and/or correct name).