Bash oneliner to extract all ids from a multifasta file
#List of ids - one per line in allIds.txt $ awk 'BEGIN{while((getline0)l[">"$1]=1}/^>/{f=!l[$1]}f' seq.fa # You can play with this f=!l[$1 ] if wanted to extract or not extract the ids1531 days ago
Reformat the multifasta for sequence length !
#awk oneliner to reformat the multifasta sequences awk '!/^>/ {printf "%s", $0; n = "\n"} /^>/ {print n $0; n = ""}' file.fasta | fold -w 1001385 days ago
Oneliner to convert lower-case to sequence masked with Ns
perl -pe '/^[^>]/ and $_=~ s/[a-z]/N/g' genomic.fna > genomic.N-masked.fna awk '{if(/^[^>]/)gsub(/[a-z]/,"N");print $0}' genomic.fna > genomic.N-masked.fna943 days ago
Onliner to convert multi line fasta to single line fasta !
#Oneliner to convert awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);} END {printf("\n");}' < file.fa > fileres.fa #Then delete the first empty line tail -n +2 fileres.fa > fileout.fa921 days ago