Daylight Toolkit Wrappers in Perl

Created by Alex Wong
Contributed by Alex Wong and Chiron


  • Background
  • Why Bother?
  • Researchers as Hackers
  • Solution: A Scripting Languages
  • Perl
  • What Does This Give Us?
  • Was It Worth Doing?
  • Summary


  • Daylight provides great flexibility with Toolkits
  • Programming is often a barrier to use of Toolkits
  • Researchers should be able to focus on Toolkits not programming

Why Bother?

  • Toolkits make Daylight a great research tool
  • Research -> always a new question
  • Give the tools to the researchers

Researchers as Hackers

  • Researchers shouldn't have to be more than casual programmers
  • C and FORTRAN are not the easiest for casual programmers
  • Focus should be on using the toolkit

Solution: A Scripting Language

  • Easier to learn and use
  • Quite powerful these days
  • Easy to build systems to hide complexity

Perl: Man's Best Friend

  • Easy to learn and use
  • Memory Management
  • First Class String Handling
  • Better Programming Environment
  • New Object Oriented Features

What Does This Give Us?

  • Raw Toolkits
  • Common Function Libraries
  • Object-Oriented Tools

Raw Toolkits

  • Sample: use Daylight; ... $fieldstream = dt_stream($ditemh, TYP_DATAFIELD); while(($fieldh = dt_next($fieldstream)) != NULL_OB){ ... $value = dt_stringvalue($fieldh); ... } dt_dealloc($fieldstream); print $value;

Common Function Libraries

  • Sample: use Daylight; use DaylightAux; ... $varh = dt_chortin($monomertableh, $chortles); $stream = dt_stream($varh, TYP_MULTIMER); while (($multimerh = dt_next($stream)) != NULL_OB) { $smiles = dt_smiles($multimerh); $mw = da_calc_molweight_of_smiles($smiles); print "$smiles $mw\n"; dt_dealloc($multimerh); } ...

Object-Oriented Tools

  • Sample: use Daylight; use DaylightObj; use DaylightAux; $db = new ProtosDB_Session; ... $varh = dt_chortin($db->{monomertableh}, $chortles); ...

Was It Worth Doing?

  • Even one user makes it worthwhile
  • Big gain for occasional programs
  • More complex packages can be created


  • Daylight has great tools
  • Researchers need direct access to tools and shouldn't have to be programmers
  • Perl and other scripting languages are easy to learn and use
  • Perl makes Daylight Toolkit programming easier

Alex Wong may be reached at