Created
October 17, 2012 02:17
-
-
Save nathanhaigh/3903352 to your computer and use it in GitHub Desktop.
Convert contigs of an ACE file into a FASTA file.
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
#!/usr/bin/perl | |
# | |
# Convert contigs of an ACE file into a FASTA file. | |
# Usage: ace2fas.pl < my.ace > my.fas | |
# | |
use strict; | |
use warnings; | |
while(<>){ | |
next until /^CO\s+(\S+).+?$/; # read ACE file till next contig starts | |
my $contig = $1; | |
my $seq; | |
while(<>){ | |
last if /^\s*$/; # stop reading at end of sequence | |
chomp; | |
$seq .= $_; # append sequence | |
} | |
$seq =~ tr/*//d; | |
print ">$contig\n$seq\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment