Friday, February 16, 2018

Brief Bioinformatics Bash

Multi FASTA to one Sequence per FASTA

Write each Sequence of a multisequence FASTA to a separate FASTA file.


multifasta2Singlefastas.sh
#/bin/bash
while read line
do
    if [[ ${line:0:1} == '>' ]]
    then
        outfile=${line#>}.fa
        echo $line > $outfile
    else
        echo $line >> $outfile
    fi
done < $1


 Don't forget to chmod +x multifasta2Singlefastas.sh

Usage:
 ./multifasta2Singlefastas.sh input.fasta

No comments:

Post a Comment