This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trouble Using Bio::Alignio In Perl Script To Covert Alignment To Maf Format

Hello there,

I hope someone might have some insight into a problem I am having using the BioPerl module Bio::AlignIO in a perl script to convert a fasta formatted alignment into MAF format. I would appreciate any help you could offer in terms of getting the conversion script to work OR information about other tools to convert files into MAF format. Thank you and here is the script:

use Bio::AlignIO;
$inputfilename = $ARGV[0];
$in  = Bio::AlignIO->newFh(-file => $inputfilename ,
                           '-format' => 'fasta');
$out = Bio::AlignIO->newFh('-format' => 'maf');

print $out $_ while <$in>;

When I run it here is the output:

------------- EXCEPTION: Bio::Root::NotImplemented -------------
MSG: Abstract method "Bio::AlignIO::maf::write_aln" is not implemented by package Bio::AlignIO::maf.
This is not your fault - author of Bio::AlignIO::maf should be blamed!

STACK Bio::Root::RootI::throw_not_implemented /opt/local/lib/perl5/site_perl/5.12.4/Bio/Root/RootI.pm:748
STACK Bio::AlignIO::maf::write_aln /opt/local/lib/perl5/site_perl/5.12.4/Bio/AlignIO/maf.pm:189
STACK Bio::AlignIO::PRINT /opt/local/lib/perl5/site_perl/5.12.4/Bio/AlignIO.pm:503
STACK toplevel test.pl:10
----------------------------------------------------------------
bioperl maf

How would one even be able to convert FASTA to MAF?

2 answers

For some AlignIO modules, only reading is implemented and not writing, or vice versa. The error message indicates that writing is not implemented. It's possible that someone on Biostar knows whether there are plans to implement it.

check this https://github.com/csw/bioruby-maf/blob/master/features/maf-to-fasta.feature

Log in to answer this question.