[Bioperl-l] Using Bio::SeqUtils->cat()

Roy Chaudhuri roy.chaudhuri at gmail.com
Mon Jun 6 17:53:24 UTC 2011


Hi Trina,

Thanks for noticing that, I have modified the documentation and 
submitted it as a patch to Redmine.

Just a note for the future - please remember to cc the list when 
replying, so others can follow the conversation.

Cheers,
Roy.

On 06/06/2011 13:49, Trina McMahon wrote:
> oops, actually the documentation does recommend this usage:
>
> my $catseq =*Bio::SeqUtils*->cat(@seqs)
>
> so maybe it would help to change this...
>
> best,
> trina
>
> On Jun 6, 2011, at 2:36 PM, Roy Chaudhuri wrote:
>
>> Hi Trina,
>>
>> That's probably how cat should work, but in fact the first sequence in
>> the list is modified by concatenating on the other sequences. The
>> function just returns 1 if it worked. So you need code like:
>>
>> Bio::SeqUtils->cat(@seqs);
>> my $mergedseqs=$seqs[0];
>>
>> You can blame the idiot who wrote that code for the slightly awkward
>> interface (sorry). I think the module documentation is correct, but
>> let us know if you think it should be clarified.
>>
>> Cheers,
>> Roy.
>>
>> On 06/06/2011 13:21, Trina McMahon wrote:
>>> Hello everyone,
>>>
>>> I am a complete (bio)perl neophyte and am struggling with what should
>>> be some very basic code.
>>>
>>> I am trying to write a simple script to merge a bunch of gbk
>>> sequences into one big sequence, while preserving the feature
>>> coordinates. I was so proud of myself because I found this function
>>> in Bio::SeqUtils called cat(). But I can't figure out how the hell
>>> to make it work!!!
>>>
>>> I'm attaching the script that I wrote below. Can you help me figure
>>> out what is wrong? I did some troubleshooting and I am pretty sure
>>> it is the Bio::SeqUtils->cat() function that is the problem. It
>>> seems like it should return a seq object but if you look at the
>>> original code in the documentation online I am not sure.
>>>
>>> thanks!! trina
>>>
>>> #!/usr/local/ActivePerl-5.10/bin/perl # #
>>>
>>> use strict; use warnings; use Bio::SeqIO; use Bio::SeqUtils; use
>>> Getopt::Long;
>>>
>>> # get command-line arguments, or die with a usage statement
>>>
>>> my $USAGE=<<USAGE;
>>>
>>> * catgb *
>>>
>>> concatenates multiple genbank records and adjusts feature coordinates
>>> in the final merged sequence
>>>
>>> catgb -i listofseqs.gbk -o mergedseqs.gbk
>>>
>>>
>>> USAGE
>>>
>>> my ($help,$infile,$outfile);
>>>
>>> GetOptions ( 'h|help'=> \$help, 'i|infile=s' =>
>>> \$infile, 'o|outfile=s' => \$outfile, );
>>>
>>> ########################################################################
>>>
>>> if ($help) { die $USAGE; } if (!$infile) { die "$USAGE\nNo
>>> input file! (-infile)\n"; } if (!$outfile) { die "$USAGE\nNo
>>> output file! (-outfile)\n"; }
>>>
>>> my @seqs;
>>>
>>>
>>> my $seqin = Bio::SeqIO->new(-file => $infile, -format=>"genbank");
>>> my $seqout = Bio::SeqIO->new(-file=> ">$outfile", -format =>
>>> "genbank");
>>>
>>>
>>> # create an array to hold the sequences from infile while (my $seq =
>>> $seqin->next_seq) { push (@seqs, $seq);
>>>
>>> }
>>>
>>> # concatenate the sequenes held in the array @seqs my $mergedseqs =
>>> Bio::SeqUtils->cat(@seqs);
>>>
>>> # write the new merged sequence into the specified file
>>>
>>> $seqout->writeseq($mergedseqs);
>>>
>>> exit;
>>> -------------------------------------------------------------------------------------
>>>
>>>
>> Katherine (Trina) McMahon, Associate Professor
>>> Goddess of Funkosity Departments of Civil and Environmental
>>> Engineering and Bacteriology Environmental Chemistry and Technology
>>> Program Limnology and Marine Science Program Microbiology Doctoral
>>> Training Program
>>>
>>> **On sabbatical leave starting August 20, 2010**
>>>
>>> Mailing Address: 3204 Engineering Hall, 1415 Engineering Drive
>>> University of Wisconsin - Madison, Madison, WI 53706-1691
>>>
>>> Alternate Office: 5552 Microbial Sciences Building
>>>
>>> Phone: 608/890-2836 Fax: 608/262-9865 Email:
>>> tmcmahon at engr.wisc.edu <mailto:tmcmahon at engr.wisc.edu> McMahon Lab:
>>> http://www.engr.wisc.edu/cee/faculty/mcmahon_katherine.html North
>>> Temperate Lakes Microbial Observatory:
>>> http://microbes.limnology.wisc.edu/
>>>
>>> -------------------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________ 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
>>
>
> -------------------------------------------------------------------------------------
> Katherine (Trina) McMahon, Associate Professor
> Goddess of Funkosity
> Departments of Civil and Environmental Engineering and Bacteriology
> Environmental Chemistry and Technology Program
> Limnology and Marine Science Program
> Microbiology Doctoral Training Program
>
> **On sabbatical leave starting August 20, 2010**
>
> Mailing Address:
> 3204 Engineering Hall, 1415 Engineering Drive
> University of Wisconsin - Madison, Madison, WI 53706-1691
>
> Alternate Office: 5552 Microbial Sciences Building
>
> Phone: 608/890-2836 Fax: 608/262-9865
> Email: tmcmahon at engr.wisc.edu <mailto:tmcmahon at engr.wisc.edu>
> McMahon Lab: http://www.engr.wisc.edu/cee/faculty/mcmahon_katherine.html
> North Temperate Lakes Microbial Observatory:
> http://microbes.limnology.wisc.edu/
>
> -------------------------------------------------------------------------------------
>
>
>
>
>
>
>
>
>
>
>
>
>




More information about the Bioperl-l mailing list