Hi,

I have the following code that does multiple sequence alignment using T-Coffee/Clustalw via Bioperl. You can ignore the code *except* the last lign. That's where the object header, it basically print the result in STDOUT.
#!/usr/bin/perl -w use strict; use Bio::AlignIO; BEGIN {$ENV{TCOFFEEDIR} = '/home/edward/MyBioTool/T-COFFEE_Ver1.37/bin/'; } use Bio::Tools::Run::Alignment::TCoffee; my @params = ( '-outfile' => 'tcof.out', '-maxlen' => '100' ); my $factory = Bio::Tools::Run::Alignment::TCoffee->new(@params); my @array = qw( GGGTGTTATTCAAGCAAAAAAA TTTGGAAGTCAATATTTTGTCG CCTTTTATCTGTTTTGACAGTC ACTGAAAAGCTTAGGAAATGGT TATTTGCAGTGATGTAATCAGC ); foreach ( 0..$#array ) { push @seqs2, (Bio::Seq->new(-seq => $array[$_], -display_id => 'seq_'.$_ )); } my $seq_array_ref = \@seqs2; my $aln2 = $factory->align($seq_array_ref); #final line that prints +to STDOUT __END__
The result look like this
....some text, followed by..... T-COFFEE, Version_1.37 (Wed Jul 11 14:38:06 PDT 2001) Notredame, Higgins, Heringa, JMB(302)pp205-217,2000 CPU 0 sec SCORE 524 **Desired text to be captured NSEQ 5 LEN 41 seq_1 ---TTTGGAAGTCAATATTTT------GTCG---------- seq_2 CCTTTTATCTG------TTTTGACA--GTC----------- seq_3 -------ACTGAAAAGCTTAGGAAATGGT------------ seq_0 -------G-GG---------TGTTAT--TCAAGCAAAAAAA seq_4 --TATTTGCAG---------TGATGTAATC-AGC------- * *
Update
My questions are:
1. How can I *capture* this object header, such that I can parse the text which it prints? I don't seem to find any existing Bioperl::AlignIO for this method. Basically I just want to capture the line that begins with SCORE, and take the value. Storing it in the scalar would do
2. How can I suppress align() such that it wont' *print*, but only to store it in object reference, so I can manipulate it.

Regards,
Edward

In reply to Parsing Text from Object Header that prints to STDOUT by monkfan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.