Remove text and add a string in odd rows in a fasta file using awk

Remove text and add a string in odd rows in a fasta file using awk

2

I have a file organized as such:

>Prevalence_Sequence_ID:13|ARO_Name:AxyX|ARO:3004143|Detection_Model:Protein Homolog Model
ATGAAGCAAAGAGTCCCTCTACGCACGTTCGTCCTATCTGCCGTATTAATTCTTATTACTGGTTGCTCGAAACCGGAAACCCAACCAGCCG
>Prevalence_Sequence_ID:14|ARO_Name:adeF|ARO:3004143|Detection_Model:Protein Homolog Model
ATGAATATCTCGAAATTCTTCATCGACCGGCCGATCTTCGCCGGCGTGCTTTCGATCCTGGTGTTGCTGGCGGGCATACTGGCCATGTTCC

For every odd row, i need to keep only the first and third column and add the text “|kraken:taxid|32630” at the end. Example below

>Prevalence_Sequence_ID:13|ARO:3004143|kraken:taxid|32630
ATGAAGCAAAGAGTCCCTCTACGCACGTTCGTCCTATCTGCCGTATTAATTCTTATTACTGGTTGCTCGAAACCGGAAACCCAACCAGCCG
>Prevalence_Sequence_ID:14|ARO:3004143|kraken:taxid|32630
ATGAATATCTCGAAATTCTTCATCGACCGGCCGATCTTCGCCGGCGTGCTTTCGATCCTGGTGTTGCTGGCGGGCATACTGGCCATGTTCC

Is there a simple awk script that i can use? In alternative i could also keep only the first column if it’s easier


awk

• 37 views

updated 16 minutes ago by

17k

written 2 hours ago by

▴

10

Read more here: Source link