Created
June 2, 2016 18:51
-
-
Save ShaiberAlon/96e14b60594dc27a751dab3ee1764743 to your computer and use it in GitHub Desktop.
Converting tab delimited file to a fasta format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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