Skip to content

Instantly share code, notes, and snippets.

@nathanhaigh
Created October 17, 2012 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanhaigh/3903352 to your computer and use it in GitHub Desktop.
Save nathanhaigh/3903352 to your computer and use it in GitHub Desktop.
Convert contigs of an ACE file into a FASTA file.
#!/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