This is a test version of Biostars. For the public version, visit https://www.biostars.org.
problem with replacing accession number/id only in fasta file using seqkit

i have a task and i am having difficulty in getting the key values out of my key-value file , at the replacement. i have tried several versions of this seqkit replacement command but not able to get the right result. my key-value file:

WP_000014594.1 WP_000014594.1#0001
WP_000025662.1 WP_000025662.1#0001

so the column1 has accession numbers/ids that will find in my fasta file header and i need to replace these with values given in column2.

but im either getting blank space there (command a.)or partial ids like this >_000014594 (command b.)

command a.

$ seqkit replace -p "^(\w+)_(\d+).(\d+)" --replacement "{kv}" -k accesskey_idsvalue1 GCF_000016305.1_ASM1630v1_protein.faa

command b.

$ seqkit replace -p "^(\w+)_(\d+).(\d+)" --replacement '{kv}_${2}' -k accesskey_idsvalue1 GCF_000016305.1_ASM1630v1_protein.faa
seqkit
-p "^(\w+_\d+\.\d+)" -r "{kv}"

if fasta has only OP strings, you can use ^(\w+\.\w) or ^(\w+\.\d) pattern.

0 answers

No answers yet.

Log in to answer this question.