[Bioperl-l] nexus to fasta converter
James Wasmuth
james.wasmuth at ed.ac.uk
Mon Jan 27 22:26:25 EST 2003
There isn't a newline character at the start of the file is there? I
know is sounds trivial but I had a problem with a clustal format for
that reason?
Amit R Indap wrote:
>On Mon, 27 Jan 2003, Jason Stajich wrote:
>
>
>
>>Also the file in bioperl-live/t/data/testaln.nexus provides an example of
>>what the parser theoretically supports.
>>
>>
>
>My original nexus file was a different format; it was generated by a
>program called DnaSp which adds some extraneous features which don't
>correspond to a standard nexus file. But I'm perplexed why the program
>is complaining about the testalgn.nexus file...
>
>
>
>
>>nexus_to_fasta.pl testaln.nexus
>>
>>
>------------- EXCEPTION: Bio::Root::Exception -------------
>MSG: Not a valid interleaved NEXUS file! [#NEXUS] not starting the file
>STACK: Error::throw
>STACK: Bio::Root::Root::throw
>/usr/local/lib/perl5/site_perl/5.6.0/Bio/Root/Root.pm:315
>STACK: Bio::AlignIO::nexus::next_aln
>/usr/local/lib/perl5/site_perl/5.6.0/Bio/AlignIO/nexus.pm:98
>STACK: nexus_to_fasta.pl:8
>-----------------------------------------------------------
>
>#!/usr/bin/perl
>use Bio::AlignIO;
>$file = $ARGV[0];
>$stream = Bio::AlignIO->new(-file => $file, '-format' => 'nexus');
>$out = Bio::AlignIO->new(-file => ">out.aln.fasta" , '-format' =>
>'fasta');
>
>
>while ( my $aln = $stream->next_aln() ) { # throwing an expection here
> print "testing\n";
> $out->write_aln($aln);
>}
>
>My testaln.nexus file:
>
>[#NEXUS]
>[TITLE: Four Anthropoidea]
>
>begin data;
>dimensions ntax=4 nchar=50;
>format interleave datatype=RNA missing=N gap=-;
>
>matrix
>'Homo sapiens' AGUCGAGUC---GCAGAAACGCAUGAC-GAC
>Pan_paniscus AGUCGCGUCG--GCAGAAACGCAUGACGGAC
>Gorilla_gorilla AGUCGCGUCG--GCAGAUACGCAUCACGGAC
>Pongo_pigmaeus AGUCGCGUCGAAGCAGA--CGCAUGACGGAC
>
>'Homo sapiens' CACAUUUU-CCUUGCAAAG
>Pan_paniscus CACAUCAU-CCUUGCAAAG
>Gorilla_gorilla -ACAUCAUCCCUCGCAGAG
>Pongo_pigmaeus CACAUCAUCCCUUGCAGAG
>;
>
>endblock;
>begin assumptions;
>options deftype=unord;
>
>
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l at bioperl.org
>http://bioperl.org/mailman/listinfo/bioperl-l
>
>
More information about the Bioperl-l
mailing list