Question: grep extract command will remove replicates automatically
0
gravatar for mxlsherry1992
11 weeks ago by
mxlsherry199230 wrote:

Dear all,

I have a file 1, containing many gene ID, and also has replicates for the gene ID. I want to extract the corresponding line from an gff file, I have a script can accomplish this, but this script will remove the replicates automatically, if I don't want to remove the replicates and want to keep the output just like the order in file 1, if there is anyway I could do this...

Here is file 1:

gene14184
gene25736
gene14184
gene8906
gene25736
gene14775
gene4224
gene8906
gene14184
gene24702

Here is the script I am using:

grep -Fwf file1.txt 001660625_genomic.gff > output.txt
rna-seq • 130 views
ADD COMMENTlink modified 11 weeks ago • written 11 weeks ago by mxlsherry199230
1

I don't know if I really understand what you want to do, but try this:

(for ID in $(cat file1); do echo -e $ID"\t"$(grep $ID gff1); done;) > output.txt
ADD REPLYlink written 11 weeks ago by hugo.avila10
0
gravatar for mxlsherry1992
11 weeks ago by
mxlsherry199230 wrote:

Solved!! and Vlookup in excel could also do this. Thanks!!

ADD COMMENTlink written 11 weeks ago by mxlsherry199230
1

Excel could also do this:

ADD REPLYlink written 11 weeks ago by zx87549.1k

Excel can do many things, but once a file gets larger it will crash plus user interaction with it is irreproducable in terms of coding it up in a script. If it helped you this time it is fine but I strongly recommend to learn how to do things outside of Excel. Imagine one of the files was 10Gb in size...what then.

ADD REPLYlink written 11 weeks ago by ATpoint31k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 968 users visited in the last hour