in reply to Re: how to combine these two scripts in perl?
in thread how to combine these two scripts in perl?

i could use the following factory instead of that in the 1st script,but that would give me a file(out_file)

my $factory = Bio::Tools::Run::Alignment::Clustalw->new(-matrix => 'BLOSUM','outfile' => 'out_file','outype'=clustalw);

This file matches to first line my $alnio = Bio::AlignIO->new('-file'=> 'out_file','-format' => 'clustalw');

of the 2nd script,and when combining the two scripts, the whole (1+2) script works fine. But

yeap, i want to pass a variable and have only one file produced at the end of final whole (1+2)script with my final Tree.

Replies are listed 'Best First'.
Re^3: how to combine these two scripts in perl?
by GotToBTru (Prior) on Mar 15, 2016 at 14:45 UTC

    If you have unwanted files left over, the solution to that is easy.

    # script 1 use strict; use warnings; use Storable; my $storable_file = 'store.file'; $var = complicated multilevel structure; store(\$var,$storable_file); # script 2 use strict; use warnings; use Storable; my $storable_file = 'store.file'; my $var = retrieve($storable_file); unlink $storable_file; open my $outfile,'>','output.file'; print $outfile $var; close $outfile;

    Only file created will be output.file.

    But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

      please excuse me for the confusion. I edited my previous comment. I have 3 different things in my mind:

      I want to highlight also that  $aln at the last line of the first script has the alignment.

      #I tried at first to pass this alignment to the my $alnio = Bio::AlignIO but didn't succeed it.

      ##My second try was changing  $factory and outputting a file(out_file) from my $factory = Bio::Tools::Run::Alignment::Clustalw->new(-matrix => 'BLOSUM','outfile' => 'out_file','outype'=clustalw); in order to use it in my $alnio = Bio::AlignIO->new('-file'=> 'out_file','-format' => 'clustalw');

      This is what I was searching to do through a variable and not a file

      ###Thrird, now I'm thinking of finding a way to delete the file out_file

      after it is used from

      my $alnio = Bio::AlignIO but seems me not the right way.

        I know nothing about bioinformatics but have you tried using the object returned by ->align in the iterator loop ?

        #!perl my $factory = Bio::Tools::Run::Alignment::Clustalw ->new(-matrix => 'BLOSUM'); . . . my $alnio = $factory->align($seq_array_ref); while( my $aln = $alnio->next_aln ) { . . }
        poj