Skip to content

Instantly share code, notes, and snippets.

@pjbriggs
Created May 22, 2013 11:15
Show Gist options
  • Save pjbriggs/5626830 to your computer and use it in GitHub Desktop.
Save pjbriggs/5626830 to your computer and use it in GitHub Desktop.
Hacky script for converting fasta files munged by some other program into RTF files back to fasta format (used for frog data). Probably output file will need some additional corrections by hand.
#!/bin/sh
#
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Usage: $0 IN.rtf OUT.fasta"
exit 1
fi
if [ ! -e "$1" ] ; then
echo "Input file $1 not found"
exit 1
fi
sed 's/.*>/>/g' "$1" | sed 's/^\\f[0-9]/>/g' | sed 's/^\\//g' | sed 's/\\$//g' | sed 's/\t$//g' | sed 's/^> />/g' | sed 's/^>$//g' | sed 's/\t//g' | sed 's/^[^ACGT>]*//g' | grep -v "^$" > $2
##
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment