Protocol Online logo
Top : New Forum Archives (2009-): : Bioinformatics Programming

Programmes - (Sep/10/2012 )

Try running this in padre by opening new file. We will discuss technical term then.

Example 4-1 Storing DNA in a variable, and printing it out



#!/usr/bin/perl -w
# Example 4-1 Storing DNA in a variable, and printing it out

# First we store the DNA in a variable called $DNA
$DNA = 'ACGGGAGGACGGGAAAATTACTACGGCATTAGC';

# Next, we print the DNA onto the screen
print $DNA;

# Finally, we'll specifically tell the program to exit.
exit;

-Inbox-

Working on windows,
Paste above program in padre, save it as Storing DNA in a variable, and printing it out.pl in separate folder.

press F5.

See in command prompt your first Bioinformatics program.

-Inbox-

Don't use capitals for variable names, use snake-case, unless you are defining constants. If you are going to do perl make sure you start using strict.


use strict;
my $dna = 'aaaaaatcgCCGGTTaaAT';
print "my DNA: ", $dna;


You don't need exit. I also can't remember print niceties for perl, I think perl allows variables to be embedded within double quotes....

you can:

perl

use strict;
my $dna = lc 'aaaaaatcgCCGGTTaaAT';
print "my DNA: $dna ";


python

dna = "ATCGACTCGAGTCAGCATCGA"
print "my dna:", dna.lower()


ruby

dna = "ATGAGATAGATGTC"
puts "my DNA: #{dna.downcase}"


downcase, oh ruby ...

scala

val dna = "ATGCGGCCGGG"
println("My DNA: " + dna.toLowerCase)


clojure

(use '>)
(def dna "AGAGTCTGTC")
(println "My DNA:" (lower-case dna))


haskell (in repl)

import Data.Char
let dna = "ATATGATGAT"
"my dna: " ++ (map toLower dna)

-perlmunky-

Does anybody know how to run program written in sublime Edit 2? I made perl programme file from previous post 1+. I saved it in folder as .pl file (.pl stands for perl executive file). But unlike in Padre where F5 key stands for running program. I could not find run key.
Thanks.

-Inbox-