Hello,
I am looking at Breast cancer gene expression level 3 data on TCGA.
I downloaded a dataset of 139 text files and sifted through some files manually to look for my gene of interest and its expression value. However, I haven't had any luck finding it so far.
I am thinking I ought to write a script that would give me -
the gene of interest, its expression value and the record name holding these values.
Is there a better way to go about this process? Are there any online tools I could use? Would there be any suggestions? I'd appreciate a discussion..bounce off some ideas.
Please and Thank you.
-N
Have you tried just using grep?
Thanks Devon, I tried grep and it worked like a charm. How do I write my results to a new file?
I used
grep -r "GeneName"
. This gave me a list ofFileName GeneName ExpressionValue
Thanks again. I'm working on writing these results to a file for future use.
Just use redirection, so
grep -r "GeneName" some_file > the_output.txt
I'm looking at the whole dataset as opposed to single file and here's the part of my output on the console -
Need to write this to a file.
I do not want to move my files to a different directory..just write this o/p to a file
I was looking at this link here
But I've only gotten more confused.
So a full example would be something like
Right. Thanks Devon.
I was trying to use
And I got the message -
Why is that the case? the ' . ' would ask grep to go through all the subirectories and files to look for my gene of interest..Why would it consider outfile.txt as input?
FYI, this is getting rather off-topic, since this is just basic computer usage.
On all Unix derived systems (Mac OS X, Linux, etc.), "." means the current working directory. So if you tell grep to recursively search through everything in the directory where the output is, then it'll go through the output too. It's actually quite clever that that error is even caught. That's why my example used wild-cards. The alternative is to just put the output elsewhere: "
> /home/whatever-your-username-is/filename.txt
".Thanks a lot. Appreciate it.
Right, so just put
> some_file.txt
at the end of your command as I did in my example.