[Bioperl-l] Detecting type of an object.

hilmar.lapp@pharma.Novartis.com hilmar.lapp@pharma.Novartis.com
Thu, 12 Oct 2000 12:28:35 +0100


I'm not sure why you want to test the object type in this case. Anyway, you
can ask

   $class_name = ref($obj);
   # branch depending on the value of class_name

and

   if(! $obj->isa('Bio::PrimarySeqI')) {
      print "Object $obj is not a BioPerl seq object\n";
   }

Does this help?

     Hilmar





gert thijs <gert.thijs@esat.kuleuven.ac.be>@bioperl.org on 12.10.2000
11:38:19

Sent by:  bioperl-l-admin@bioperl.org


To:   bioperl mailinglist <bioperl-l@bioperl.org>
cc:
Subject:  [Bioperl-l] Detecting type of an object.


I am wondering if it is possible to detect the type of an object.
For instance, I have written a module that parses a blast report to select
a
sequence. The module returns the sequence as a Bio::Seq object if the
parsing
was succesful and some error message when there was no good hit found.
Now when I use this module in a script I would like to test whether or not
there is a sequence found before doing something with the sequence. Is
there a
proper way to tackle such a problem?

Thanks,
Gert Thijs


--
==========================================================
+ Gert Thijs              gert.thijs@esat.kuleuven.ac.be +
+                                                        +
+ Dept. Elektrotechniek ESAT-SISTA                       +
+ Kardinaal Mercierlaan, 94                              +
+ B-3001 HEVERLEE  Belgium                               +
+ Tel :  +32-16-32 18 84 ---- Fax : +32-16-32 19 70      +
==========================================================
_______________________________________________
Bioperl-l mailing list
Bioperl-l@bioperl.org
http://bioperl.org/mailman/listinfo/bioperl-l