I want to delete a sequence each time from a big fasta file. I got the following code from some online forum, it does not seem to work when I put it in a loop in bash though it works when I specify the sequence ID.
cat myfile.fasta | awk '{if (substr($0,1) == "${line}") censor=1; else if (substr($0,1,1) == ">") censor=0; if (censor==0) print $0}' > ${line}.fasta
Can anyone help in this regard?
You can easily achieve it with Biopython SeqIO.
What is
${line}
?You should define variables for awk with
-v
, e.g