Skip to main content

Matrix Operations and Bioinformatics Insights: Week 6

 Matrix Operations and Bioinformatics Insights: Week 6





This week, I worked on an assignment focused on using R for matrix operations and did some bioinformatics practice related to CDR3 sequences. Here's a simple breakdown of what I did and my takeaways.

What I Did This Week

  1. Adding and Subtracting Matrices
    I started by creating two matrices, and then added and subtracted them using R. Here's the code I used:


This code performs basic matrix operations, and it was a good way to understand how matrix math works in R.

Building a Diagonal Matrix

Next, I used the diag() function to create a matrix with specific values on the diagonal. The code looked like this:



Creating a Custom Matrix

I then built a matrix with specific values in the rows and columns > diag(3,5). Here's how I did it:


This code sets up the matrix with a diagonal of 3 and modifies the first row and column. It was a fun challenge that helped me see how to control matrix structure using R’s indexing features.


Bioinformatics Practice: Comparing CDR3 Sequences


I also practiced comparing CDR3 sequences using R. I analyzed the VDJ recoveries dataset and compared it to the VDJdb to find common CDR3 sequences. Here’s how I did it:



This code helped me find and analyze CDR3 sequence matches. I got more comfortable using the dplyr package and learned how to manipulate data frames to get meaningful information.


What I Learned

  • Matrix Math Basics: Adding and subtracting matrices in R gave me confidence in understanding and using basic matrix operations.
  • Using R Functions: Practicing with the diag() function and learning how to create different matrix structures was useful.
  • Bioinformatics Analysis: Comparing CDR3 sequences using R allowed me to apply my coding skills to a bioinformatics problem. It was exciting to see how the data matched up and how the R code can be used to gain insights.
  • Debugging and Writing Code: Throughout the assignment and the CDR3 analysis, I encountered and fixed small errors. This experience was valuable for building my coding skills and learning to troubleshoot in R.

Overall, this week was a mix of practicing basic matrix operations and applying my skills to bioinformatics. I feel more confident using R and am excited to keep exploring data analysis in bioinformatics as I progress!


For a more detailed exploration of the data manipulation techniques and code examples, you can find everything in my GitHub repository.



Comments

Popular posts from this blog

DNA Sequence Alignment and Visualization with "SequenceAlignment" Package

 DNA Sequence Alignment and Visualization with "SequenceAlignment" Package In bioinformatics, sequence alignment plays a crucial role in comparing biological sequences, especially DNA sequences. It helps in identifying similarities, differences, and evolutionary relationships between sequences. In this blog, we’ll explore how to use the SequenceAlignment R package for performing sequence alignments, visualizing the results with plots like barplots and heatmaps , and analyzing DNA sequences against multiple reference sequences stored in FASTA files. What is Sequence Alignment? Sequence alignment is the process of comparing two or more biological sequences (e.g., DNA, RNA, or proteins) to identify regions of similarity or difference. In DNA sequence alignment, the sequences are compared to see how closely they match, which can provide insights into genetic similarities, mutations, or evolutionary trends. The SequenceAlignment Package The SequenceAlignment package is a powerf...

Journey Through R Programming: Week 1

  Journey Through R Programming: Week 1 Introduction Welcome to my blog! As part of my Open Source R course with Professor Alon Friedman at the University of South Florida, I’m excited to document my weekly progress in learning R programming. A bit about me: I’m currently pursuing a Master’s in Bioinformatics & Computational Biology, following an undergrad in Biotechnology. My programming journey began with Python through the “100 Days of Code: The Complete Python Pro Bootcamp” on Udemy, which included around 8 mini projects. This experience has made transitioning to R a bit smoother, as many concepts overlap. To support my learning, I’m using the book  The Art of R Programming  and the edX course  Data Science: R Basics  from Harvard University. These resources have been invaluable in deepening my understanding of R. Summary 1. Function Creation Objective: Create a function to count the number of odd numbers in a vector. Code: What I Learned: The modulus op...

Week 9 : Exploring Cancer Survival Data Visualization in R

 Week 9 : Exploring Cancer Survival Data Visualization in R In this Assignment, I explored ways to visualize cancer survival data across different organs using a variety of R plotting methods, including base R’s   barplot() ,   ggplot2 , and an   xyplot()   with   lattice . Here’s a breakdown of the journey, the challenges faced, and what I learned along the way. The Data: Mean Survival Time by Organ The dataset I worked with contains information on the survival times across different organs from cancer . To understand the average survival time for each organ, I first calculated the mean survival time by using the following code: Once I had the mean survival times, I set out to visualize the data using four different approaches, each with its unique set of functionalities and aesthetics. 1. Basic Bar Plot with Base R My first plot used a simple   barplot()   to display the mean survival times. This method provided a quick and straightforward way t...