Confusion with grep command
0
0
Entering edit mode
6.3 years ago
jaqx008 ▴ 110

Hey all. I am doing a differential expression analysis and trying to use grep to find genes that are up-regulated and also those that are down-regulated by comparing the genes ortholog of different species of a bacteria to the Deseq2 result of each species. However, I think something is wrong with my grep command and I am getting an error. I would appreciate any help or explanation.

the command I am using to find the up-regulated gene (in terminal) is

grep -f up./Users/flynt/Desktop/Deseq2/3084DEortho.txt geneortholg./Users/flynt/Desktop/Deseq2/30_84_vs_all.txt > 3084DE.txt

I am a beginner in this field. Thanks in advance

grep Deseq2 terminal geneOrtholog • 1.6k views
ADD COMMENT
2
Entering edit mode

Adding to what genomax said: if you're finding a list of genes using grep, it is always good idea to add -F where it evaluates the search terms as fixed strings and -w for whole word, so you don't bring up 10, 100, 1000 when searched with 10.

ADD REPLY
0
Entering edit mode

Thanks Arnstrm. your suggestion was helpful. Thanks again

ADD REPLY
0
Entering edit mode

When you are specifying full directory paths such as /Users/flynt/Desktop/Deseq2/3084DEortho.txt there is no reason to add . at the beginning. I assume up is a a file containing the genes that are up-regulated? Try:

grep -f up /Users/flynt/Desktop/Deseq2/3084DEortho.txt geneortholg /Users/flynt/Desktop/Deseq2/30_84_vs_all.txt > 3084DE.txt
ADD REPLY
0
Entering edit mode

Thanks Max. I tried the command and got same error

grep -f up /Users/flynt/Desktop/Deseq2/3084DEortho.txt geneortholg./Users/flynt/Desktop/Deseq2/30_84_vs_all.txt > checked3084.txt
grep: up: No such file or directory
ADD REPLY
0
Entering edit mode

That means you don't have a file called up in the directory you are running this from. If that file is in some other directory then provide full path for up file in your command. Also consider adding additional options suggested by @arnstrm below.

ADD REPLY
0
Entering edit mode

Ok. I think the "up" is just part of the command to help grep find up-regulated genes in the ortholog? I don't have an actual file called 'up'.

ADD REPLY
1
Entering edit mode

If you take a look at the help for grep you will see that -f option expects a filename. That file will contain pattern(s) (one per line, say a gene name) that it will use to search. You can't do any quantitative searching with grep. You will need to use sort to sort your file by columns (if you have values in columns) to get genes that may be over-expressed (based on ratios/fold-change what ever it is that you have in the file) to get them to the top or bottom of the file.

ADD REPLY
0
Entering edit mode

Ok. My file has a sorted (based on 2foldchange) list of gene id's. so I now used this command

grep -f /Users/flynt/Desktop/Deseq2/3084DEortho.txt /Users/flynt/Desktop/Deseq2/30_84_vs_all.txt > file.txt

and got an out put .txt file.

The idea was to include up to generate up-regulated and repeat the command with down, to get down regulated I guess. But I am thinking this is wrong.

I can't tell if the text file generated form the above command is up or down since I didn't specify in the command.

ADD REPLY
0
Entering edit mode

Thanks Max. I figured I didn't understand the instruction . The command works fine now. Thanks again

ADD REPLY

Login before adding your answer.

Traffic: 3007 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6