[Bioperl-l] Trouble retrieving multiple sequences from NCBI in a single list query
jluis.lavin at unavarra.es
jluis.lavin at unavarra.es
Wed Nov 4 10:14:40 UTC 2009
Thank you very very much Dave,
I´ve had a really frustrating time trying to find out what I was doing
wrong, it has been so frustrating that I was about to quit Bioperl.
Now I can try to focus on BLAST parsing for my comparative genomic analysis
You´re great in this mailing list, because you give a fast and neat advice
to all the questions asked here by newbies like me ;)
El Mie, 4 de Noviembre de 2009, 10:52, Dave Messina escribió:
>>
>> The code I´ve written seems to read mylist and retrive the sequences,
>> but
>> it kinda overwrites them so that I only get the last sequence on the
>> list.
>>
>
> With this line
>
> my $out = new Bio::SeqIO (-file => ">extracted_seqs.fasta", -format =>
> 'fasta');
>
>
> you are opening the filehandle for the output file inside your loop, so
> each
> time it is writing over the previous file with an empty file. Then, you
> write a single sequence to that file with this line
>
> $out->write_seq($seqobj);
>
>
> So when you are done, you just have the last sequence in the output file.
>
> If you move the opening of the output filehandle outside the loop (it
> needs
> to be done only once), then it should work as you expect.
>
> Also, I notice the newline characters are not being removed from your
> sequence IDs (actually I'm a little surprised that the sequences are
> being
> retrieved). Just to be safe, you may want to add the line
>
> chomp @lista;
>
>
> after
>
> my @lista = <INFILE>;
>
>
>
>
> Dave
>
--
Dr. José Luis Lavín Trueba
Dpto. de Producción Agraria
Grupo de Genética y Microbiología
Universidad Pública de Navarra
31006 Pamplona
Navarra
SPAIN
More information about the Bioperl-l
mailing list