Re: Trouble parsing text with bioperl




Paul Lalli wrote:
jeffcullis@xxxxxxxxx wrote:
Hi, just having some problems running the following bioperl script.
It's supposed to download all the sequences in a file using the gi
numbers. But when I run it it only downloads one sequence of the five
in each line of the file, and that's it. When I uncomment the commented
line, the five sequences are downloaded no problem! I've even printed
out each element of @gi_nums and they correspond to the correct numbers
so I have no idea why they aren't all being downloaded. Any help on
this would be great.

#!/usr/bin/perl -w
use Bio::DB::GenPept;
open GIS, "<gis_5" or die "Can't open gi file";
my $gb = new Bio::DB::GenPept();

while($line = <GIS>) {
@gi_nums = split(' ', $line);

This would make @gi_nums be one array containing (if you're right about
your data) five elements.

#@gi_nums = ["78096912", "78096910", "78096909", "78096907",
"78096905"];

This would make @gi_nums be one array containing one element. That one
element would be a reference to an array that contains five elements.


my $seqio = $gb->get_Stream_by_id(@gi_nums);

I have no experience with BioPerl, so I have no idea what data this
method is looking for. If your commented line "works", then I would
suggest making your uncommented line match it - make it an array
containing one reference to an array, rather than an array containing
five elements:

@gi_nums = [ split(' ', $line) ];

Paul Lalli

Thanks Paul, that one change made everything work. I still have no idea
why the method needs strange input like that.

.



Relevant Pages

  • Re: Trouble parsing text with bioperl
    ... It's supposed to download all the sequences in a file using the gi ... This would make @gi_nums be one array containing one element. ... element would be a reference to an array that contains five elements. ...
    (perl.beginners)
  • Need help for the function ereg()
    ... Hi i'm a beginner in php and i would like to know why this code dosent ... echo $file_name; ... }//if download is choosen ... }//end if file name found in the array ...
    (comp.lang.php)
  • Re: Advice Please As I Am Thinking Of Buying
    ... > Work on a grant application and a couple of papers in Word (with help ... > Use MacVector and Safari to download sequences from GenBank ...
    (comp.sys.mac.advocacy)
  • Re: NumPy 1.0 release
    ... download at http://www.numpy.org ... the 'array wars' are over; ... and its derivative distros than NumPy per se. ... undefined symbol: s_cat". ...
    (comp.lang.python)
  • Re: Return non-blank cells
    ... That formula is designed to be entered as a range array. ... select a range of 10 cells like C1:C10 then you enter the formula in all the ... process was the same on both the download and my worksheet. ...
    (microsoft.public.excel.misc)