Created
November 14, 2014 04:09
-
-
Save nathanhaigh/ba6264aa6ef70db4e743 to your computer and use it in GitHub Desktop.
Convert a FASTA file containing multi-line (wrapped) sequences to occupy a single line
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 | |
# Convert a multi-line FASTA file into a single line FASTA file | |
# These are easier/faster to process using native UNIX tools like paste - - < in.fasta | |
dos2unix | awk 'BEGIN { RS = "\n>"; FS = "\n"; OFS = "" }; | |
{ | |
if (NR == 1) { | |
print $1 | |
} else | |
if (NR > 1) { | |
print ">"$1 | |
} | |
$1="" | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment