Category Archives: perl

LAB06: Abandon all hope, ye who enter here

LAB06: Abandon all hope, ye who enter here

Nello scorso laboratorio abbiamo visto due cose molto importanti: come ricevere parametri dalla shell e come leggere file. Nonostante la spiegazione anti-caos preventiva, sembra che molti di voi le trovino problematiche e quindi oggi cercheremo di fare degli esercizi mirati su questi argomenti nuovi, che sono fondamentali per raggiungere gli scopi del corso (fare un programma perl che c’entri qualcosa con la genomica).

Continue reading

A gentle tutorial

Questo tutorial permette di ripassare passo passo i fondamenti di Perl. Suggeriamo a chi si sente meno sicuro di fare questo tutorial in classe, mentre per gli altri può essere utile farlo a casa come ripassino.

Continue reading

Perl slides

Dear fellows, here you are the slides we used yesterday. Don’t forget to study this example, too.

Download link:Perl slides 2.

Tagged

Reading a text file from Perl

This short tutorial is to remember how to read a file from Perl. You should remember that it’s a two steps strategy:

  1. Open the file (that means connect to it)
  2. Read the file line-by-line (with a while loop)

Continue reading

Tagged

LAB05: Some real programming!

Lab05: Some real programming!

In the exercises until now we worked with input values that were written in the beginning of the programs. This is not how real programs work. Since we now know how to read files and pass parameters, we can start writing useful programs, that work in the same way as the shell commands we saw: taking their input from files.

Continue reading

Tagged ,

A review of Perl hashes…

Some of you had some problems with the exercise on Perl hashes, this is a short review about them. Continue reading

Tagged ,

Homeworks: Arrays and foreach

Arrays and the foreach loop hw2

In this homework we are going to do some simple changes to a perl program, like we did during the last lab session. If you have Linux on your laptop you can download the program and change it with a text editor like we did in the lab. Note that your Linux may be a little different, so you may need to looks for the Terminal and the Text Editor, but they are there somewhere. If you do not have Linux yet, you can use codepad. This task is coded “hw2“. Continue reading

Tagged

Homeworks: testing conditions

IF homework (hw1)

This is the first official homework you get! In this homework we are going to do some simple changes to a perl program, like we did during the last lab session.

If you have Linux on your laptop you can download the program and change it with a text editor like we did in the lab. Note that your Linux may be a little different, so you may need to looks for the Terminal and the Text Editor, but they are there somewhere. If you do not have Linux yet, you can use codepad. This task is coded “hw1“.

Continue reading

Tagged ,

Lab03: Cribi Crash Course

Today we met at the Vallisneri to play with the foundamentals of Perl (slides below).
Now you have some time to practice with Perl, so if you want to start from the basics here you are a step-by-step guide.
As always remember to “appello Nome Cognome” before starting, and say “goodbye” before leaving.

Screenshot 2014-04-03 13.59.43PDF of Perl slides

Lab02/3: first steps with Perl

This post is a part of the second laboratory session. Please refer to the main post. 

Ready to start programming? We hope so. This post will teach you the very first things 🙂

What a Perl program is

As we already said in class, a Perl program (or script, better), is a plain text file, as a FASTQ or SAM file is. It contains a set of instructions that the computer can execute. Unlike human beings, computers love repetitive tasks…

We are going to give you an actual lesson of Perl next Friday, but we think it is a good idea to make you touch it in advance.

Every programming language has:

  • variables: basically they are a piece of memory that can store an information, and has a name.
  • conditionals: we execute an instruction IF some condition is verified.
  • loops: we execute a set of instruction as many times as needed. Example: for every sequence in a FASTA file, calculate the reverse complement and print it.

Continue reading

Tagged , , ,