next up previous
Next: About this document ... Up: perl1st Previous: File I/O

Subsections

Subroutines (functions)

Basic form

Scope of Variables revisited

Homework:

  1. Write a function Range(), which takes an array, and return an array with two element, (min, max), of the array.

  2. Make a program (cntBase.pl), which reads in a FASTA file, and print out the base compositions for each sequences.

    FASTA is a very simple format. There is 1 line which starts with ``>''. This line contains the name (identification) of this sequence. Then the sequence data come in several lines after the sequence name. The next sample start when you encounter the next ``>''.

    > Camel-Prion
    GCTGACACCCTCTTTATTTTGC
    AGATAAATCATCATG
    > Camel-immunoglobulin
    GGACACGGCCGTTTATTACTGC
    GCACGTCGTACTATAGTGGTGT
    GTACTCGTACACC
      :
      :
    

    You run the program like this:

    ./cntBase.pl camel.fasta

    and the expected output is something like

    > Camel-Prion 120 132 111 122
    > Camel-immunoglobulin 24 32 11 22

    The four numbers correspond to counts of bases (A, T, G, C) in each sequence.


next up previous
Next: About this document ... Up: perl1st Previous: File I/O
Naoki Takebayashi 2011-10-06