Question: replace values using a reference file
0
gravatar for max_19
14 months ago by
max_19130
max_19130 wrote:

Hi all,

I have a file of orthogroups and I need to convert the identifiers in it (using a conversion/reference file) so that blast will recognize them. I'm having an unexpected result using the code below.

orthogroup file looks like this (each line is an orthogroup, and members of that group are separated by space)

ortholog_group_1522: PAN|EQB60376.1 NAA|KCZ79755.1 PPS|OIR57675.1
ortholog_group_1330: EAE|EJW04139.1 IBE|XP_002650367.1

my reference/conversion file (2 column file):

PAN|EQB60376.1  gnl|BL_ORD_ID|0
NAA|KCZ79755.1  gnl|BL_ORD_ID|1
PPS|OIR57675.1  gnl|BL_ORD_ID|2

desired output is: ortholog_group_1522: gnl|BL_ORD_ID|0 gnl|BL_ORD_ID|1 gnl|BL_ORD_ID|2

I am working with the script below, but it is not producing the desired output:

replace.awk
NR==FNR { pattern[NR] = $1; replacement[NR] = $2; count++; next }
{
        for (i = 1; i <= count; i++) {
                    sub(pattern[i], replacement[i])
                    }
                    print $0
}
awk -f replace.awk conversion_file.txt my_ortho_groups.txt

any ideas on what i'm missing here?

sequencing orthogroups fasta • 256 views
ADD COMMENTlink modified 14 months ago • written 14 months ago by max_19130
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: 1840 users visited in the last hour