Galgotias University
Plot No. 2, Sector – 17 A, Yamuna
Expressway Greater Noida, Gautam
Buddh Nagar, U.P., India
School of Biosciences and
Technology
LAB FILE
Course Name: Python for Biological Data Analysis
Course Code: (Q1UI207B)
Semester: Second
Program: [Link] in Food Technology
Submitted By : Submitted To :
Name : Anushka Bhardwaj
Dr. Rohtash Singh
(Assistant Professor)
Admission No. : 25SBBS1260021
Experiment Date Page
[Link]. Title of Experiment Signature
No. Performed No.
Python Basics – Numbers, Strings, and
1 1.1
Functions
2 1.2 Biological Sequences as Python Strings
3 2.1 Lists and Dictionaries
Looping Through Sequences & GC Content
4 2.2
Analysis
5 2.3 Codon Processing and Basic Translation
6 3.1 Modules and Object-Oriented Programming
Object-Oriented Programming for Biological
7 3.2
Entities
8 4.1 File Handling
9 4.2 File Handling Using Biological Data
10 5.1 NumPy Basics
11 5.2 NumPy for Biological Data Analysis
12 6.1 Pandas and Matplotlib
Pandas and Matplotlib for Biological Data
13 6.2
Visualization
Experiment 1.1: Python Basics – Numbers, Strings, and Functions
AIM
To understand basic Python programming using numerical operations, strings, and functions.
THEORY
Python supports arithmetic operations, string manipulation, and user-defined functions. These features help in
solving computational problems efficiently.
ALGORITHM
1. Start the program.
2. Calculate simple and compound interest.
3. Perform string operations.
4. Find maximum and minimum values using a function.
5. Display results.
6. Stop the program.
LEARNING OUTCOME
• Learned Python syntax and arithmetic operations.
• Performed string manipulation.
• Created and used functions.
CONCLUSION
The program successfully demonstrated numerical calculations, string operations, and functions in Python.
Experiment 1.2: Biological Sequences as Python Strings
AIM
To represent DNA, RNA, and protein sequences as Python strings and perform basic operations.
THEORY
Biological sequences can be stored as strings in Python. String operations help analyze and manipulate
sequence data.
ALGORITHM
1. Start the program.
2. Store biological sequences.
3. Validate sequence symbols.
4. Find sequence length and composition.
5. Convert DNA to RNA.
6. Display results.
7. Stop the program.
LEARNING OUTCOME
• Stored biological sequences as strings.
• Validated sequence data.
• Performed DNA to RNA conversion.
CONCLUSION
The program successfully analyzed and manipulated biological sequences.
Experiment 2.1: Lists and Dictionaries
AIM
To perform operations on lists and dictionaries.
THEORY
Lists store ordered collections of data, while dictionaries store information as key-value pairs for efficient
access.
ALGORITHM
1. Start the program.
2. Create a list and perform operations.
3. Create a dictionary.
4. Access and update values.
5. Traverse dictionary elements.
6. Display results.
7. Stop the program.
yews
LEARNING OUTCOME
• Learned list operations.
• Created and updated dictionaries.
• Traversed collection data structures.
CONCLUSION
The program successfully demonstrated list and dictionary operations.
Experiment 2.2: Looping Through Sequences & GC Content Analysis
AIM
To analyze DNA sequences using loops and calculate GC content.
THEORY
GC content represents the percentage of G and C nucleotides in a DNA sequence and is important in
bioinformatics.
ALGORITHM
1. Start the program.
2. Input a DNA sequence.
3. Count nucleotides using loops.
4. Calculate GC percentage.
5. Classify the sequence.
6. Display results.
7. Stop the program.
LEARNING OUTCOME
• Used loops for sequence analysis.
• Counted nucleotide frequencies.
• Calculated GC content.
CONCLUSION
The program successfully calculated GC content and analyzed DNA sequences.
Experiment 2.3: Codon Processing and Basic Translation
AIM
To manipulate DNA sequences into codons and generate protein sequences.
THEORY
Codons are groups of three nucleotides that encode amino acids. Translation converts nucleotide sequences
into proteins.
ALGORITHM
1. Start the program.
2. Input DNA sequence.
3. Split sequence into codons.
4. Identify start and stop codons.
5. Translate codons.
6. Generate protein sequence.
7. Display results.
8. Stop the program.
LEARNING OUTCOME
• Learned codon processing.
• Identified start and stop codons.
• Generated protein sequences.
CONCLUSION
The program successfully translated DNA sequences into protein sequences.
Experiment 3.1: Modules and Object-Oriented Programming
AIM
To understand modular programming and object-oriented concepts in Python.
THEORY
Modules improve code reusability, while OOP organizes programs using classes, objects, and inheritance.
ALGORITHM
1. Start the program.
2. Create and import a module.
3. Create classes and objects.
4. Access members and methods.
5. Demonstrate inheritance.
6. Display results.
7. Stop the program.
LEARNING OUTCOME
• Created Python modules.
• Developed classes and objects.
• Implemented inheritance concepts.
CONCLUSION
The program successfully demonstrated modules and object-oriented programming concepts.
Experiment 3.2: Object-Oriented Programming for Biological Entities
AIM
To design simple Python classes for biological sequences and genes.
THEORY
Classes can model biological entities and perform operations such as validation, transcription, and motif
searching.
ALGORITHM
1. Start the program.
2. Create a Sequence class.
3. Implement validation and transcription methods.
4. Create a Gene class.
5. Implement motif search.
6. Display results.
7. Stop the program.
LEARNING OUTCOME
• Modeled biological entities using classes.
• Implemented biological sequence methods.
• Applied OOP in bioinformatics.
CONCLUSION
The program successfully represented biological entities using object-oriented programming.
Experiment 4.1: File Handling
AIM
To perform file operations in Python.
THEORY
Python file handling enables storage and retrieval of data through reading, writing, renaming, and deleting
files.
ALGORITHM
1. Start the program.
2. Create and write to a file.
3. Read file contents.
4. Print unique words.
5. Rename and delete the file.
6. Stop the program.
LEARNING OUTCOME
• Performed file operations.
• Processed text data.
• Managed files efficiently.
CONCLUSION
The program successfully demonstrated Python file handling operations.
Experiment 4.2: File Handling Using Biological Data
AIM
To perform file operations using biological text and sequence files.
THEORY
Biological information can be stored and analyzed using text and FASTA files through Python file handling
techniques.
ALGORITHM
1. Start the program.
2. Create biological data files.
3. Read gene names.
4. Print unique gene names.
5. Read FASTA sequence data.
6. Rename and delete files.
7. Stop the program.
LEARNING OUTCOME
• Processed biological files.
• Extracted biological information.
• Worked with FASTA-like data.
CONCLUSION
The program successfully handled biological data files using Python.
Experiment 5.1: NumPy Basics
AIM
To perform numerical computations using NumPy.
THEORY
NumPy provides powerful multidimensional arrays and mathematical functions for scientific computing.
ALGORITHM
1. Start the program.
2. Create NumPy arrays.
3. Display array properties.
4. Perform addition and transpose.
5. Display results.
6. Stop the program.
LEARNING OUTCOME
• Created NumPy arrays.
• Performed matrix operations.
• Explored array properties.
CONCLUSION
The program successfully demonstrated numerical computations using NumPy.
Experiment 5.2: NumPy for Biological Data Analysis
AIM
To perform numerical operations using NumPy arrays relevant to biological data.
THEORY
NumPy arrays are widely used in biological data analysis for efficient matrix and numerical computations.
ALGORITHM
1. Start the program.
2. Create biological data arrays.
3. Inspect array properties.
4. Perform matrix operations.
5. Display results.
6. Stop the program.
LEARNING OUTCOME
• Analyzed biological data using arrays.
• Performed matrix addition and transpose.
• Applied NumPy in bioinformatics.
CONCLUSION
The program successfully performed numerical analysis on biological datasets.
Experiment 6.1: Pandas and Matplotlib
AIM
To analyze and visualize data using Pandas and Matplotlib.
THEORY
Pandas provides DataFrames for data analysis, while Matplotlib is used for graphical representation of data.
ALGORITHM
1. Start the program.
2. Create a DataFrame.
3. Add new columns.
4. Plot intersecting lines.
5. Display results.
6. Stop the program.
LEARNING OUTCOME
• Created DataFrames.
• Manipulated tabular data.
• Generated graphs using Matplotlib.
CONCLUSION
The program successfully analyzed and visualized data using Pandas and Matplotlib.
Experiment 6.2: Pandas and Matplotlib for Biological Data Visualization
AIM
To analyze and visualize biological data using Pandas and Matplotlib.
THEORY
Biological datasets can be organized using DataFrames and visualized through plots to identify trends and
patterns.
ALGORITHM
1. Start the program.
2. Create a biological DataFrame.
3. Add biological data columns.
4. Plot expression trends.
5. Display results.
6. Stop the program.
LEARNING OUTCOME
• Organized biological datasets.
• Visualized gene expression trends.
• Applied data analysis techniques in biology.
CONCLUSION
The program successfully analyzed and visualized biological data using Pandas and Matplotlib.