15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Bioin<strong>for</strong>matics Programming 631<br />

Although a language like C/C++ runs on multiple plat<strong>for</strong>ms, porting a program<br />

from Windows to Linux often requires rewriting to optimize the program <strong>for</strong><br />

each particular operating system. While figuring out C/C++ isn’t necessarily<br />

hard, it’s not easy either.<br />

A more appropriate <strong>programming</strong> language is a scripting language. Scripting languages,<br />

such as Perl, run on almost every operating system, are easy to learn<br />

and use, and include built-in commands <strong>for</strong> manipulating strings. Best of all,<br />

scripting languages are specifically designed to work with existing programs<br />

by feeding data to another program and retrieving the results back again.<br />

Although Perl has become the unofficial standard <strong>programming</strong> language <strong>for</strong><br />

bioin<strong>for</strong>matics, biologists also rely on other <strong>programming</strong> languages because<br />

many people feel that Perl is too confusing. Perl’s motto is “There’s more than<br />

one way to do it” — you can per<strong>for</strong>m the exact same action in Perl with<br />

entirely different commands.<br />

For example, to concatenate two strings, Perl offers two different methods.<br />

The first is to smash two strings together, like this:<br />

$DNA3 = “$DNA1$DNA2”;<br />

The second way to concatenate the same two strings uses the dot operator,<br />

like this:<br />

$DNA3 = $DNA1 . $DNA2;<br />

Book VII<br />

Chapter 2<br />

The second most popular language used in bioin<strong>for</strong>matics is Python. Python<br />

offers identical features as Perl but many people feel that Python is a simpler<br />

language to understand and use because its motto is, “There should be one —<br />

and preferably only one — obvious way to do it.” To concatenate strings in<br />

Python, you can use this command:<br />

Bioin<strong>for</strong>matics<br />

$DNA3 = $DNA1 + $DNA2<br />

Another popular bioin<strong>for</strong>matics <strong>programming</strong> language is Java. Not only are<br />

more programmers familiar with Java, but Java’s cross-plat<strong>for</strong>m capability also<br />

allows it to create compiled programs <strong>for</strong> each operating system. In comparison,<br />

both Perl and Python are interpreted languages — you must load the<br />

source code of a Perl or Python program and run it through an interpreter first.<br />

Java gives you the convenience of copying and running a compiled program<br />

without the nuisance of running source code through an interpreter.<br />

Despite the advantages of other <strong>programming</strong> languages, Perl is still the<br />

language of bioin<strong>for</strong>matics. If you’re going to work in bioin<strong>for</strong>matics, first<br />

learn Perl and then learn Python or Java.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!