Convert fasta to 1l fasta.sh
Revision as of 17:10, 3 October 2016 by Angry piranha (talk | contribs) (convert_fasta_to_1l_fasta.sh)
convert_fasta_to_1l_fasta.sh
emacs convert_fasta_to_1l_fasta.sh
Copy and paste the following snippet of code:
#This script is to convert files from multiple lines fasta into 1-line fasta for easy grepping. #call it by typing "sh convert_fasta_to_1l_fasta.sh file.fasta" namefile=`echo $1 | sed 's/\.fa$//g;s/\.fas$//g;s/\.fasta$//'`; #echo $namefile; sed '/>/s/$/</' $1 | tr -d "\n" | tr ">" "\n" | sed '//' | sed '1d' | tr "<" "\n" > ${namefile}.1l.fasta;
To make it self-executable, you can copy it into your ~/bin directory and then do:
chmod a+x ~/bin/convert_fasta_to_1l_fasta.sh;