This book is designed to be useful in theory and practical classes of UG and PG bioinformatics students. Moreover, it will be beneficial to other persons who wish to learn Perl programming language. To explain the Perl jargon, program based approach is used throughout the book. Important points are provided at the end of each chapter along with questions to test the skills. Solutions of find errors are provided at the end of the book. All the programs are tested on Windows 7 with Perl v5.18.1.
The book is divided into thirteen chapters which gradually take a reader from basic to advanced Perl. Although the book has been drafted with utmost care, it is quite possible that some errors/misprints might have crept in the book. I request the readers for their valuable suggestions and comments for further improvement of the book.
Table of Contents
1. Introduction (Quick start)
2. Variables and Data Formatting
Scalar variable
New line
Tab
Uppercase
Lowercase
3. Arithmetic Operations and Standard Input
Addition
Subtraction
Multiply
Division
Remainder
Exponent
Autoincrement
Autodecrement
Add assign
Subtract assign
4. Arrays
Quote word
Push
Pop
Unshift
Shift
Splice
Reverse
Sort
Join
5. Associative Arrays
Keys
Values
Each
Delete
6. Comparison Operators and Choices
Equal to
Not equal to
Greater than
Greater than or equal to
Less than
Less than or equal to
if
if-else
if-elsif-else
Boolean operators
AND
OR
NOT
7. Loops
For
While
Foreach
8. Regular Expressions
Match operator
Substitute operator
Translate operator
9. Functions for Strings
Index
Substr
Length
Reverse
Split
10. References
Dereferencing
Anonymous array
Anonymous associative array
Two dimensional array
11. Subroutines
Arguments
Scalar as an argument
Array as an argument
Associative array as an argument
Return
12. File and Directory Handling
Read
Write
Append
Open
File handle
Opendir
Directory handle
Readdir
Close
13. Modules and Packages
Reusable code
Namespace
Objectives & Core Topics
This book aims to introduce the Perl programming language to biology and bioinformatics students, focusing on practical, problem-oriented learning to handle biological data tasks. The book addresses the specific difficulty students with a biological background often face when learning programming, ensuring that even beginners can master the concepts through numerous programming examples and structured lessons.
- Basic to advanced Perl programming syntax and logic.
- Practical data manipulation techniques including pattern matching and parsing.
- Integration of Perl in common bioinformatics workflows and biological data analysis.
- Effective use of subroutines, modules, and packages for code reusability.
- File and directory handling for automated processing of large-scale genomic data.
Excerpt from the Book
Chapter 3: Arithmetic Operations and Standard Input
Arithmetic operations can be performed on scalar variables using arithmetic operators.
Instead of providing values to a variable directly in a program, values can also be assigned to a variable by taking input from keyboard during program execution.
Program 3.11
# Program to get input using keyboard
use strict;
use warnings;
my $first_number = <stdin>;
my $second_number = 4;
my $sum = $first_number + $second_number;
print "$sum";
Output:
6
10
Explanation: When execution of this program starts by typing perl programName.pl and pressing enter on command prompt the cursor starts blinking and nothing happens. The cursor blinks due to <stdin> in the program where it asks for input through keyboard. If the input is not provided it will not move to the next statement for execution. Here the number 6 is provided using keyboard. As soon as the enter key is pressed the other statements get executed and another number 10 appears in the output which is the sum of 6 + 4.
Summary of Chapters
Chapter 1: Provides a quick start guide to understanding the history of Perl and how to run basic test programs on various operating systems.
Chapter 2: Introduces variables as data containers in Perl and explains different data formatting techniques, including case sensitivity and backslash-based formatting characters.
Chapter 3: Covers essential arithmetic operators and demonstrates how to take user input from the keyboard for more interactive programs.
Chapter 4: Explains the structure and manipulation of arrays, including adding, removing, and sorting elements to manage collections of data.
Chapter 5: Details the use of associative arrays (hashes) as collections of key-value pairs and the associated functions to retrieve or delete data.
Chapter 6: Describes how to make logical choices in programming using comparison operators and conditional control structures like if-else.
Chapter 7: Explores different looping mechanisms such as for, while, and foreach to automate repetitive tasks and data processing.
Chapter 8: Focuses on regular expressions for pattern matching and substitution, which are powerful tools for biological sequence analysis.
Chapter 9: Introduces built-in functions for string manipulation, such as finding lengths, splitting strings, and retrieving substrings.
Chapter 10: Examines the concept of references in Perl, which are crucial for creating complex data structures like two-dimensional arrays.
Chapter 11: Discusses how to create and use user-defined subroutines to avoid code duplication and improve modularity.
Chapter 12: Covers file and directory handling, which is vital for performing automated analyses on large biological datasets.
Chapter 13: Explains the importance of modules and packages for organizing and reusing code effectively across multiple programs.
Key Terms
Perl, Bioinformatics, Scalar variables, Arrays, Associative arrays, Hash, Arithmetic operators, Loops, Regular expressions, Subroutines, References, File handling, Directory handling, Modules, Packages
Frequently Asked Questions
What is the primary focus of this book?
The book is designed as a practical guide for undergraduate and postgraduate students in bioinformatics, teaching them how to use the Perl programming language to solve problems related to biological data.
What are the central thematic areas covered?
The core themes include fundamental programming concepts, data manipulation, pattern recognition in sequences, file and directory management, and modular programming techniques.
What is the main objective of the provided content?
The main objective is to enable learners to build interactive and efficient programs that can parse, analyze, and manipulate large-scale biological data without requiring prior programming knowledge.
Which programming methodologies are emphasized?
The book utilizes a program-based approach, providing code snippets for every concept, which allows students to learn through implementation and experimentation.
What topics are discussed in the later chapters of the book?
Later chapters progress to more advanced topics such as references, creating multidimensional data structures (like arrays of arrays), subroutines for reusability, and creating custom modules and packages.
Which keywords best describe the material in this work?
The work is best characterized by keywords like Perl, bioinformatics, sequence analysis, data parsing, regex, file handling, and modular programming.
How does this book handle errors?
Each chapter concludes with a section titled "Find errors," where common beginner mistakes are presented along with their explanations, helping readers understand how to debug and refine their code.
Is prior knowledge of other programming languages required?
No, the layout and the pedagogical approach are specifically crafted to guide readers who have no prior experience with programming languages.
- Quote paper
- Asheesh Shanker (Author), 2015, The programming language "Perl" for Biologists, Munich, GRIN Verlag, https://www.grin.com/document/293272