[Bioperl-l] asn and Bio::TreeIO

Fields, Christopher J cjfields at illinois.edu
Tue Mar 4 20:07:58 UTC 2014


Yeah, we’ll likely need to set up a bug report.  I’ll try replicating before I get to that step.

chris

On Mar 4, 2014, at 8:58 AM, Lee Katz <lskatz at gmail.com<mailto:lskatz at gmail.com>> wrote:

Thank you for the suggestion.  I did not have an second line to delete.  So I added a new one anyway!  In both forms, the dnd did not work.  I did however notice ^M at the end of the original dnd file (using vim) and so I ran dos2unix on it too, but it did not help either.

I also tried explicitly defining the format just in case because it might have been trying the wrong format, but it still gives a similar error:

my $in=Bio::TreeIO->new(-file=>$inTree,-format=>"newick");

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: parse error: expected ; or ) or ,

STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/local/share/perl/5.12.4/Bio/Root/Root.pm:472
STACK: Bio::TreeIO::NewickParser::parse_newick /usr/local/share/perl/5.12.4/Bio/TreeIO/NewickParser.pm:195
STACK: Bio::TreeIO::newick::next_tree /usr/local/share/perl/5.12.4/Bio/TreeIO/newick.pm:143<http://newick.pm:143/>
STACK: main::printNewTree scripts/renameTreeNodes_v3.pl:64
STACK: main::main scripts/renameTreeNodes_v3.pl:30
STACK: scripts/renameTreeNodes_v3.pl:17





On Mon, Mar 3, 2014 at 7:07 PM, Hilmar Lapp <hlapp at drycafe.net<mailto:hlapp at drycafe.net>> wrote:
Have you tried deleting the trailing empty line and see whether that changes anything? You could also try to specify the format expressly as newick. (It looks like it's picking NEXUS by default.)

The error is because of a format mismatch between what's in the file and what the Newick parser expects. Since there are so many characters in the OTU labels that many programs would balk at, it's hard to see where the mismatch might be.

   -hilmar


On Mon, Mar 3, 2014 at 5:14 PM, Lee Katz <lskatz at gmail.com<mailto:lskatz at gmail.com>> wrote:
Just a little bigger scope of my script.  $inTree is the filename of the
input dnd file.

sub printNewTree{
  my($inTree,$map,$settings)=@_;
  my $d=$$settings{delimiter} || die "ERROR: there is no
delimiter\n".usage();
  my $suffix=$$settings{suffix};
  my $in=Bio::TreeIO->new(-file=>$inTree);
  my $out=Bio::TreeIO->new(); # stdout
  my %seen;
  my $i=0;
  while(my $tree=$in->next_tree){
    for my $node($tree->get_nodes){
      #if ($i++>100){
      #  logmsg "DEBUG";
      #  last;
      #}
      my $oldid=$node->id || "";


And there is a ton more code below this that is probably irrelevant.




On Mon, Mar 3, 2014 at 5:12 PM, Lee Katz <lskatz at gmail.com<mailto:lskatz at gmail.com>> wrote:

> It looks like I get two options here for exporting.
> http://i.imgur.com/TID5RiP.png
>
> Both of them are viewable in MEGA5, so I export Newick (.dnd).  Most times
> I can use BioPerl to look at the file.  However this particular version
> gives me problems in BioPerl.
>
> This is the current version giving me an error:
> http://wikisend.com/download/657408/Listeria_2014_03_03_kmer_tree[1].asn<http://wikisend.com/download/657408/Listeria_2014_03_03_kmer_tree%5B1%5D.asn>
> And the converted file using NCBI Workbench:
> http://wikisend.com/download/598906/Listeria_2014_03_03_kmer_tree.asn.dnd
>
> This is the TreeIO error.  Any hints on how to debug further?  Thank you!
>
> ------------- EXCEPTION: Bio::Root::Exception -------------
> MSG: parse error: expected ; or ) or ,
>
> STACK: Error::throw
> STACK: Bio::Root::Root::throw
> /usr/local/share/perl/5.12.4/Bio/Root/Root.pm:472
> STACK: Bio::TreeIO::NewickParser::parse_newick
> /usr/local/share/perl/5.12.4/Bio/TreeIO/NewickParser.pm:195
> STACK: Bio::TreeIO::newick::next_tree
> /usr/local/share/perl/5.12.4/Bio/TreeIO/newick.pm:143<http://newick.pm:143/>
> STACK: Bio::TreeIO::nexus::_parse /usr/local/share/perl/5.12.4/Bio/TreeIO/
> nexus.pm:204<http://nexus.pm:204/>
> STACK: Bio::TreeIO::nexus::next_tree
> /usr/local/share/perl/5.12.4/Bio/TreeIO/nexus.pm:129<http://nexus.pm:129/>
> STACK: main::printNewTree scripts/renameTreeNodes_v3.pl:64
> STACK: main::main scripts/renameTreeNodes_v3.pl:30
> STACK: scripts/renameTreeNodes_v3.pl:17
> -----------------------------------------------------------
>
>
> The while statement is line 64 which is where the error happens above.
>
>   my $in=Bio::TreeIO->new(-file=>$inTree);
>   my $out=Bio::TreeIO->new(); # stdout
>   my %seen;
>   my $i=0;
>   while(my $tree=$in->next_tree){
>
>
>
>
> On Mon, Mar 3, 2014 at 4:52 PM, Fields, Christopher J <
> cjfields at illinois.edu<mailto:cjfields at illinois.edu>> wrote:
>
>>  Ick; no one really uses ASN1 outside of NCBI.  No XML output option?
>>
>>  chris
>>
>>  On Mar 3, 2014, at 3:50 PM, Lee Katz <lskatz at gmail.com<mailto:lskatz at gmail.com>> wrote:
>>
>>  It is from NCBI's genome workbench
>> On Mar 3, 2014 4:40 PM, "Fields, Christopher J" <cjfields at illinois.edu<mailto:cjfields at illinois.edu>>
>> wrote:
>>
>>> Not that I’m aware of.  What was the source of the output?
>>>
>>> chris
>>>
>>> On Mar 3, 2014, at 2:32 PM, Lee Katz <lskatz at gmail.com<mailto:lskatz at gmail.com>> wrote:
>>>
>>> > Hi Bioperl, I was wondering if there is a way to read an asn file using
>>> > Bio::Perl.  This is one of the files I want to look at.
>>> >
>>> > http://wikisend.com/download/372926/Listeria_2014_02_11_kmer_tree.asn
>>> >
>>> > --
>>> > Lee Katz
>>> > _______________________________________________
>>> > Bioperl-l mailing list
>>> > Bioperl-l at lists.open-bio.org<mailto:Bioperl-l at lists.open-bio.org>
>>> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>>
>>
>
>
> --
> Lee Katz, Ph.D.
>



--
Lee Katz, Ph.D.

_______________________________________________
Bioperl-l mailing list
Bioperl-l at lists.open-bio.org<mailto:Bioperl-l at lists.open-bio.org>
http://lists.open-bio.org/mailman/listinfo/bioperl-l



--
Hilmar Lapp -:- lappland.io<http://lappland.io/>




--
Lee Katz, Ph.D.





More information about the Bioperl-l mailing list