[Bioperl-l] Saving Codeml Output file

Lorenzo Carretero Paulet locarpau at upvnet.upv.es
Tue Aug 30 14:58:51 UTC 2011


Thanks Jason,
Ok, I see. That's what I was triying at the beggining. This runs OK in my
scripts  for
branch-specific models. However, when I try branch-site models (NSsites > 0)
and try to parse the results using
my $model_result= $paml_result->get_NSSite_results
I start to have problems.

According to Dumper, I'm able to generate a Bio::Tools::Phylo::PAML object
$paml_result but this doesn't
store any Bio::Tools::Phylo::PAML::ModelResult that could be accessed using
get_NSSite_results. See below a little piece of code to illustrate what I'm
saying.

my $codeml_factory = new Bio::Tools::Run::Phylo::PAML::Codeml
						(
								-alignment => $codon_MSA,
								-tree =>	$biotree,
								-params => 	{
                                                                               
...
										...parameter values
                                                                               
...
										},
						);

my ($rc,$parser) = $codeml_factory->run(); # or run($dna_aln,$biotree)
#$codeml_factory->cleanup();
my $paml_result = $parser->next_result;
say Dumper $paml_result; #This returns a true Bio::Tools::Phylo::PAML::Result
object!!!
my $model_result= $paml_result->get_NSSite_results;
say Dumper $model_result; #This doesn't return a true
Bio::Tools::Phylo::PAML::ModelResult object ($VAR1 = 0;)!!!
$ns_string = "model
".$model_result->model_num."\n".$model_result->model_description()."\n".$model_result->time_used."\n";

As no ModelResult object is generated, the script stops returning:

Can't call method "model_num" without a package or object reference

That's why I was trying to save the mlc output file and parse it, instead of
parsing directly the Bio::Tools::Phylo::PAML object.

Best,
Lorenzo

PS: I´m using paml version 4.4b, July 2010 and Bioperl 1.006901.

on mac osx


  Mensaje citado por Jason Stajich <jason.stajich at gmail.com>:

> I think you are mistaken on how to use the factory running objects and
> associated parser.
>
> You don't have to instantiate a parser as this is what is returned by the run
> command. The whole point is you don't need to get to the tempdir or specify
> opening of the mlc file or all the other output files from the program. you
> get to use the parser to get the data out and then it cleans up afterwards so
> you can run many iterations of runs in separate folders without having to
> cleanup afterwards.
>
> http://www.bioperl.org/wiki/HOWTO:PAML
>
> my $factory = Bio::Tools::Run::Phylo::PAML::Codeml->new( ... );
> my ($rc,$parser) = $factory->run( );
>
> if( my $result = $parser->next_result )  {
>  #  $result is a Bio::Tools::Phylo::PAML object
> }
>
>
> On Aug 29, 2011, at 4:19 PM, Lorenzo Carretero Paulet wrote:
>
> > Kevin,
> > That's pretty reasonable, but unfortunately still doesn't run. Even if I
> create
> > the file as $outfile and give it as value to the wrapper as -outfile
> > =>$outfile. It seems as if Bio::Tools::Run::Phylo::PAML::Codeml failed at
> > creating the outfile. Did anyone manage to generate the outfile from
> > Bio::Tools::Run::Phylo::PAML::Codeml.
> > Cheers,
> > Lorenzo
> >
> > Mensaje citado por Kevin Brown <Kevin.M.Brown at asu.edu>:
> >
> >> OK, went back to the original message.
> >>
> >> And here's where the problem actually originates...
> >>
> >> my $codeml_factory = new Bio::Tools::Run::Phylo::PAML::Codeml
> >> 						(
> >> 				# this should cause it to create a file
> >> called mlc
> >> 						-outfile => '>mlc',
> >> 						-save_tempfiles => 1,
> >> 						-alignment =>
> >> $codon_MSA,
> >> 						-tree =>
> >> $biotree,
> >> 						-params =>
> >> {
> >>  	'verbose' => 1,
> >> 	'noisy' => 9,
> >> 	'runmode' => 0, #user tree
> >> 	'seqtype' => 1,
> >> 	'model' => $model,
> >> 	'NSsites' => $NSsites,
> >> 	'fix_omega' => $fix_omega,
> >> 	'omega' => $omega,
> >> 	'ncatG' => $ncatG,
> >> 	'icode' => 0, #* 0:universal code; 1:mammalian mt; 2-10:see
> >> below (5:ciliate nuclear)
> >> 	#'fix_alpha' => 0,
> >> 	#'fix_kappa' => 0,
> >> 	#'RateAncestor' => 0,
> >> 	'CodonFreq' => 2,
> >> 	'cleandata' => 1, # remove sites with amibguity data (1 yes, 0
> >> no),
> >> 	'ndata' => 1
> >> },
> >> );
> >>
> >>
> >> Kevin Brown
> >> Center for Innovations in Medicine
> >> Biodesign Institute
> >> Arizona State University
> >>
> >>> -----Original Message-----
> >>> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> >>> bounces at lists.open-bio.org] On Behalf Of Lorenzo Carretero Paulet
> >>> Sent: Monday, August 29, 2011 9:47 AM
> >>> To: bioperl-l at lists.open-bio.org
> >>> Subject: [Bioperl-l] Saving Codeml Output file
> >>>
> >>> Hi all,
> >>> I'm running codeml from the PAML package using the corresponding
> >>> Bioperl
> >>> wrapper. I'd like to save the output file as -outfile => 'mlc', as in:
> >>> my $codeml_factory = new Bio::Tools::Run::Phylo::PAML::Codeml
> >>> 						( -outfile => 'mlc',
> >>> 						-save_tempfiles => 1,
> >>> 						-alignment =>
> >> $codon_MSA,
> >>> 						-tree =>
> >> $biotree,
> >>> 						-params =>
> >>> {
> >>> #'outfile' =>'mlc',
> >>> 	'verbose' => 1,
> >>> 	'noisy' => 9,
> >>> 'runmode' => 0, #user tree
> >>> 'seqtype' => 1,
> >>> 'model' => $model,
> >>> 'NSsites' => $NSsites,
> >>> 'fix_omega' => $fix_omega,
> >>> 'omega' => $omega,
> >>> 'ncatG' => $ncatG,
> >>> 'icode' => 0, #* 0:universal code; 1:mammalian mt; 2-10:see below
> >>> (5:ciliate
> >>> nuclear)
> >>> 	#'fix_alpha' => 0,
> >>> 	#'fix_kappa' =>
> >>> 0,							#'RateAncestor'
> >> => 0,
> >>> 							'CodonFreq' =>
> >> 2,
> >>> 						'cleandata' =>
> >>> 1, # remove sites with amibguity data (1 yes, 0 no),
> >>> 'ndata' => 1
> >>>
> >> },
> >>> 						);
> >>>
> >>> and subsequently parsing it using
> >>> my $parserF= Bio::Tools::Phylo::PAML->new (-file => "mlc", -dir =>
> >>> "./");
> >>>
> >>> However, I get the following message.
> >>>
> >>> ------------- EXCEPTION -------------
> >>> MSG: Could not open mlc: No such file or directory
> >>> STACK Bio::Root::IO::_initialize_io
> >>> /Library/Perl//5.10.0/Bio/Root/IO.pm:351
> >>> STACK Bio::Tools::Phylo::PAML::new
> >>> /Library/Perl//5.10.0/Bio/Tools/Phylo/PAML.pm:239
> >>> STACK main::BranchSiteEvolAnalysis
> >>> /Users/marioafares/Documents/workspace/BactEvolGen/BactEvolGen.pl:1421
> >>> STACK toplevel
> >>> /Users/marioafares/Documents/workspace/BactEvolGen/BactEvolGen.pl:939
> >>> -------------------------------------
> >>>
> >>> what I guess means the output file is not being saved in the previous
> >>> step.
> >>> Anyone knows what's wrong.
> >>> Tnak you very much in advance for your help.
> >>> Cheers,
> >>> Lorenzo
> >>> _______________________________________________
> >>> Bioperl-l mailing list
> >>> Bioperl-l at lists.open-bio.org
> >>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >>
> >> _______________________________________________
> >> Bioperl-l mailing list
> >> Bioperl-l at lists.open-bio.org
> >> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >>
> >
> >
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>






More information about the Bioperl-l mailing list