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

Brian Osborne bosborne11 at verizon.net
Mon Jun 6 12:41:26 UTC 2011


Trina,

Never used this before, so I'm not entirely sure but the docs are saying that the first sequence in the array is the target, so something like:

Bio::SeqUtils->cat(@seqs);
my $mergedseq = shift @seqs;

?

Brian O.

On Jun 6, 2011, at 8:21 AM, 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
> 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
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list