[Bioperl-l] using HMMER

Chris Fields cjfields at illinois.edu
Wed Aug 11 15:07:36 UTC 2010


might also want to check whether you are using hmmer2 vs hmmer3.  not sure if the wrapper works for hmmer3.

chris

On Aug 11, 2010, at 9:32 AM, Roy Chaudhuri wrote:

> Hi Fayroz,
> 
> Your $seq variable contains a Bio::SeqIO object (a biological filehandle), not a Bio::Seq (sequence object).
> 
> You need to change that line to:
> my $seqio = Bio::SeqIO->new(-file=>'one_seq.fa', -format=>'fasta');
> my $seq=$seqio->next_seq;
> 
> If you have multiple sequences in the file, then you will need to loop over them:
> while (my $seq=$seqio->next_seq) {
> # Code to run Hmmer goes here
> }
> 
> Also, I don't think you need to specify -informat for your Bio::Tools::Run::Hmmer object, since you're passing it a sequence object, not a filename.
> 
> Hope this helps.
> Roy.
> 
> On 08/08/2010 09:24, fayroz wrote:
>> i need your help, i am a new perl user and want to use bioperl modules to run
>> HMMER program ( HMMsearch) i have" model.hmm" and a "fasta file" to see which of
>> them are similar with the model
>> i write this code but there is a problems
>> 
>> #!/usr/local/bin/perl W
>> use Bio::AlignIO;
>> use Bio::SearchIO;
>> use Bio::SeqIO ;
>> use Bio::Tools::Run::Hmmer;
>> 
>> # run hmmsearch (similar for hmmpfam)
>> my $factory = Bio::Tools::Run::Hmmer->new(-hmm =>  'h6_avian.hmm',-informat =>
>> 'fasta');
>> my $seq = Bio::SeqIO->new('-file'=>  "one_seq.fa", '-format'=>'Fasta');
>> 
>> # Pass the factory a Bio::Seq object or a file name, returns a Bio::SearchIO
>> my $searchio = $factory->hmmsearch($seq);
>> 
>> while (my $result = $searchio->next_result){
>> while(my $hit = $result->next_hit){
>> while (my $hsp = $hit->next_hsp){
>> print join("\t", ( $result->query_name,
>> $hsp->query->start,
>> $hsp->query->end,
>> $hit->name,
>> $hsp->hit->start,
>> $hsp->hit->end,
>> $hsp->score,
>> $hsp->evalue,
>> $hsp->seq_str,
>> )), "\n";
>> }
>> }
>> }
>> 
>> 
>> exceptions:
>> MSG: Unknown kind of input 'Bio::SeqIO::fasta=HASH(0x329a504)'
>> STACK Bio::Tools::Run::Hmmer::_setinput
>> D:/Perl/site/lib/Bio/Tools/Run/Hmmer.pm:381
>> STACK Bio::Tools::Run::Hmmer::hmmsearch
>> D:/Perl/site/lib/Bio/Tools/Run/Hmmer.pm:352
>>  STACK toplevel test_bioperl.pl:12
>> thank you
>> 
>> fayroz
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> _______________________________________________
> 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