I can try this, tomorrow its 23:42 at the moment. Thanks for the tip will update how it went.
Hi there question is in the title,
I found an article that lists a number of genes, I made a text file out of this, called MTOR. Using MTOR.txt I wanted to use UNIX or a Bash script to read the contents of this list, and then search in a CSV file (SkeletalMuscle) the lines that contain the name of the genes. These lines contain Differential gene expression. I tried using grep and awk separately but honestly I'm kinda new to UNIX, still have to get used to it and I'm at the point where I think to myself maybe I should just try using Excel and using VLOOKUP or something... please help
2 answers
sort both files and use join https://linux.die.net/man/1/join
join -1 1 -2 3 -t "," MTORsorted.txt SMsorted.csv > MTORGENE.txt
gives me an error message:
join: SMsorted.csv:3: is not sorted: 0610009E02RIK,0,-0.557568688,0.791414822,-1.504006552,0.329848873,3,12,3,6,6,0.3,0.621,0.168,0.347,0.301
But I checked SMsorted.csv and its alphabetically sorted. Any tips?
See this example. data file contains your data from above.
$ more names
LAMTOR1
LAMTOR2
LAMTOR3
4930455G09RIK
$ grep -w -f names data
4930455G09RIK,0,-2.731721932,0.371865991,-4.010039042,0.000404351,2,3,0,0,0,0.2,0.155,0,0,0
I don't know if I follow but I will try to use this tomorrow morning. My MTOR file did not contain 4930455G09RIK but I see what the output will be. I'll try, will let you know if it worked out. Thanks for the help
I added that name to demonstrate how this will work. I assume that your data csv file will contain LAM* names in it.
I tried
more MTOR.txt
followed by
grep -w -f MTOR.txt SkeletalMuscle.csv
This did not work... I also tried more MTOR.txt and then followed by grep -w -f SkeletalMuscle.csv but then the terminal does nothing.
I looked up other people with similar questions and they give a similar solution but when I convert it to a file it returns an empty file... why is that?
grep -w -f MTOR.txt SkeletalMuscle.csv > filterMTORgenes.csv
Make sure your files are in "unix" format by using dos2unix if they were created on a windows machine.
Log in to answer this question.
Show the contents of the files in question. A simple
head -5 filenameshould be adequate.This is the Simple MTOR text file:
This is the SkeletalMuscle.csv file: