Skip to content

Instantly share code, notes, and snippets.

@ShaiberAlon
Created June 2, 2016 18:51
Show Gist options
  • Save ShaiberAlon/96e14b60594dc27a751dab3ee1764743 to your computer and use it in GitHub Desktop.
Save ShaiberAlon/96e14b60594dc27a751dab3ee1764743 to your computer and use it in GitHub Desktop.
Converting tab delimited file to a fasta format
#!bin/bash
#
# expects tab-delimited table with only two columns and no header
# column 1 - name of each sequence
# column 2 - sequence
# performs two actions:
# Adds > at the begining of each row
# converts all the tabs to new lines
#
while [ "$1" != "" ]; do
case $1 in
-f | --file ) shift
file=$1
;;
-o | --output ) shift
output=$1
;;
* ) exit 1
esac
shift
done
sed -e 's/^/>/' < $file |\
tr '\t' '\n/' > $output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment