<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[hmargin=1in, vmargin=0.75in]{geometry} % Document margins

\title{Homework}
\author{Bioinformatics / Prof. Singh}
\date{}

\usepackage{natbib}
\usepackage{graphicx}

\begin{document}

\maketitle

Multiple Sequence Alignment or MSA serves as the basis for forming models for patterns. MSA is an extension of the pairwise sequence alignment to alignment of multiple sequence. The sequences to be aligned may be presented as a cell array, or as a structure array constructed from a FASTA Library. Let's begin with computing and viewing a Multiple Sequence Alignment by providing some sample sequences in a cell array\footnote{Note: Ellipses {(\ldots)} are used in MATLAB to indicate continuation.}
    \begin{verbatim}
        S = { 'ATTATTTGGACACTT'; ...
              'ATTTTATTATGGATTTC'; ...
              'AAATTTATGGATTTC'};
      
        ma = multialign(S, 'verbose' , true);
        seqalignviewer(ma);
    \end{verbatim}


\begin{enumerate}
    
    \item \label{seqalignviewer} What is the \textit{consensus} sequence of the multiple sequence alignment? 
     \item \textbf{SeqLogos:}Run the command, \verb+seqlogo(ma)+ to view the sequence logo corresponding to the local alignment. What additional information does the sequence logo in comparison to the consensus sequence?
    
    \item[] \textbf{Globin HMM from sequence samples}
    \item Next,  step requires working with a FASTA library of globin sequences. Essentially, a FASTA library is a collection of sequences in a single file wherein each sequence is represented in a FASTA format. We will read in the FASTA library of amino acid sequences for globin orthologs,  construct an MSA, and build a HMM or Hidden Markov Model for the globin family of proteins.
    
    \item Read in the globin sequences from the file \verb+globins.fa+ and compute the multiple alignment using the command below:
    \begin{verbatim}
    globins = fastaread('globins.fa');
    msaGlobins = multialign (globins)
    \end{verbatim}
    
    \item Determine the number of match states for the HMM. This will be equal to the length of the consensus sequence. Let this length be \texttt{L}. Construct and train the model with the appropriate value of \texttt{L}.
    \begin{verbatim}
    hmmInit   = hmmprofstruct (L, 'ALPHABET', 'AA');
    hmmGlobin  = hmmprofestimate (hmmInit, msa);
    showhmmprof (hmmGlobin, 'scale', 'logodds');
    \end{verbatim}
     
    \item \label{score}  The alignment of a query sequence \textbf{q} with a model \textbf{hmm} is computed and include the option to show scores -- i.e. color map of the alignment grid:\\
    \verb+&gt;&gt; [scr aln] = hmmprofalign (hmm, q, 'ShowScore', true) + \\
     
     \item[] \textbf{Globin HMM from PFAM Database}

     \item Globin family HMM from Pfam Database is provided to you as the file \texttt{globin.hmm}. 
     \begin{verbatim}
    	pfamGlobin = pfamhmmread('globin.hmm')
	    showhmmprof (pfamGlobin, 'scale', 'logodds');
    \end{verbatim}
     
     \item[] \textbf{Matching Query Sequences to the Two Globin HMMs}         
    \item The file \texttt{query\_hmm.fa} has ten (10) query sequences. Each of these is alignied with the two models -  the globin family model  \textbf{hmmGlobin}, and the Pfam model \textbf{pfamGlobin}.  Complete the following table, and make a putative assignment of the query to the globins family. You need to (a) Read FASTA file with query sequences, (b) Use a for loop to run through each query sequence and compute the two scores. Include the MATLAB code with your answer. 
    
    Draw a stacked bar graph to visualize the comparison of the two scores produced by \textbf{hmmGlobin} and \textbf{pfamGlobin}
    
    \begin{figure}[h!]
    \centering
    \includegraphics[scale=1.2]{Figures/hmm_query_scores}
    \caption{\textbf{Scores of pfamGlobin and hmmGlobin}}
    \label{fig:query_hmm}
    \end{figure}
    
\end{enumerate} 

\end{document}
</pre></body></html>