[Bioperl-l] [Fwd: Re: A question about iBio::Index: and its correct use]

Mark A. Jensen maj at fortinbras.us
Thu Nov 5 16:02:09 UTC 2009


Hey José,
The first thing that jumps out it the index file name. Looks
like you create it as
PC9.fasta.idx
But you read it as
PC9.fasta
Not an unusual mistake. Do
my $inx = Bio::Index::Fasta->new('PC9.fasta.idx');
and see if it works.
MAJ
----- Original Message ----- 
From: <jluis.lavin at unavarra.es>
To: <bioperl-l at lists.open-bio.org>
Sent: Thursday, November 05, 2009 10:46 AM
Subject: [Bioperl-l] [Fwd: Re: A question about iBio::Index: and its correct 
use]




---------------------------- Mensaje original ----------------------------
Subject: Re: [Bioperl-l] A question about iBio::Index: and its correct use
From:    jluis.lavin at unavarra.es
Fecha:   Jue, 5 de Noviembre de 2009, 16:46
To:      "Mark A. Jensen" <maj at fortinbras.us>
--------------------------------------------------------------------------

Hi Mark,

I´ve actually got two scripts, the first one is to create the index and
the second one is to retrieve the sequence lis from the indexed file.

1)Here is the Index creation script:

#!/c:/Perl -w
use strict;
use Bio::Index::Fasta;
use strict;

print "Enter file for indexing: \n";
my $Index_File_Name = <STDIN>;
my $inx = Bio::Index::Fasta->new(-filename => $Index_File_Name.".idx",
    -write_flag => 1);
$inx->make_index(my $File_Name);

2)And here is the sequence retrieval script:

#!/c:/Perl -w
use Bio::Index::Fasta;
use strict;
#PC9.fasta is my genomic file
my $Index_File_Name ="PC9.fasta";
my $inx = Bio::Index::Fasta->new($Index_File_Name);
#LCS.txt is my sequences list
@ARGV = <lCS.txt>;
foreach  my $id (@ARGV) {
if ($id eq ''){
die ("empty list")
}
else {
my $seqobj = $inx->fetch($id);
my $out = new Bio::SeqIO (-file => ">>extracted_seqs.fasta",
-format => 'fasta');
$out->write_seq($seqobj);
}
}
exit;
}

I hope this code is not a total scum...

Thanks in advance ;)



El Jue, 5 de Noviembre de 2009, 16:39, Mark A. Jensen escribió:
> José -- It looks like this is a good solution to your problem. Please send
> you
> script so we can look at it-
> cheers Mark
> ----- Original Message -----
> From: <jluis.lavin at unavarra.es>
> To: <bioperl-l at lists.open-bio.org>
> Sent: Thursday, November 05, 2009 10:28 AM
> Subject: [Bioperl-l] A question about iBio::Index: and its correct use
>
>
>
> Hello to all,
>
> I´m trying to write a script to retrieve a list of sequences from a local
> FASTA file (for example a fasta archive where all the protein models of an
> organism are stored). This file would be used by me as some kind "local
> database" (sorry if I mistake a few concepts...)
> I´ve been reading the BioPerl HOWTOs and I came across the
> Bio::Index::Fasta tool.
> If I didn´t misunderstood what I read (which can be easy because my low
> level on programming) this Indexing tool should do the job.
> I wrote a couple of scripts based on the documentation i read about this
> tool, but I don´t seem to be able to create the index file to be used
> later (to retrieve the sequences from).
> -First of all, I want to ask the people in this forum if the
> Bio::Index::Fasta is the right one to chose for this tasks.
> -Then I´ll beg you to take a look at my scripts, because I don´t seem to
> catch the bug...
>
> Best wishes to you all and thanks in advance ;)
>
> --
> José Luis Lavín Trueba, PhD
>
> Dpto. de Producción Agraria
> Grupo de Genética y Microbiología
> Universidad Pública de Navarra
> 31006 Pamplona
> Navarra
> SPAIN
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>
>


-- 
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



-- 
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


_______________________________________________
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