One of the requests I came across is to replace the fasta header with file name. There are multiple fasta files with one sequence in each file. Each file has one fasta header and corresponding sequence. This is possible in bash shell and parallel.
Following is an example fasta where
Expected output (assumption is that first line in each fasta file is fasta header):
in bash:
using GNU-parallel:
Following is an example fasta where
HC1993.fa is a fasta file and sequence id is X58834. Now this header needs to replaced by file name.
Input:
$ cat HC1993.fa
>X58834
CCTGCATCTGCAA
Expected output (assumption is that first line in each fasta file is fasta header):
$ cat HC1993.fa
>HC1993
CCTGCATCTGCAA
in bash:
$ for i in *.fa; do sed "1s/.*/>${i%.fa}/" $i; done
>HC1993
CCTGCATCTGCAA
using GNU-parallel:
$ parallel 'sed "1s/.*/>{.}/" {}' ::: *.fa
>HC1993
CCTGCATCTGCAA