Daniel:Notebook/Haplotyping/SISSORPipeline/2014-12-2

From ZhangLabWiki
Jump to navigation Jump to search

Analyzing Eric's Algorithm[edit]

Back to Main


Eric's Original Algorithm

The purpose of today is to understand the steps in Eric's algorithm at a high level. I may, in the future, wish to edit the algorithm itself (unlikely) or simply port it to a more friendly analysis pipeline, since the current pipeline requires a decent amount of excel copy/pasting. Ideally, it should be run with a single script.

Algorithm Decomposition[edit]

Note: The decomposition uses the same numbering as Eric's original algorithm (i.e. step 1 is my analysis of his step 1)

  1. convert the bam format to sam format
  2. Baslan et al segmentation script
  3. Output from (2) is a .txt file; the fourth column is the read count information
  4. Self explanatory, but requires manual isolation of column 4
  5. Convert readcounts to a binary present/not present format (2/1). Threshold is 20 reads/bin. Uses excel function.
  6. Self explanatory, requires saving as a .csv
  7. Self explanatory, requires repeat of (1)-(6) for each of 24 chambers
  8. Load mhsmm package in R
  9. CSV file is loaded in as a vector (1s and 2s, 1x50000)
  10. Check the size is correct (verification)
  11. Set the initial parameters for a hidden Markov Model
    1. Initial conditions (1,0)
    2. Transition Matrix = [.99,.01;.01,.99]
    3. Emission Matrix = [.99,.01;.01,.99]
  12. Run smooth.discrete and plot the results
    1. smooth.discrete is based on a hidden Markov Model and smooths discrete data into only a few states
    2. plots the original object, which will be a series of 1s and 2s
    3. adds the green and orange colorbar at the bottom
    4. Plot specific regions
    5. Plot the whole genome
    6. Visualization of a region
    7. Visualize the whole genome
  13. Output the state file for future use
  14. View the transition and emission matrices after finishing

Overall Comments[edit]

I'm alright with the algorithm, it is simple and doesn't have a lot of innovation (meaning it doesn't need to be toyed with). However, it is not automated. All steps have to be repeated for each chamber, and it doesn't appear there is a very good way to finish visualizing the data. Therefore, I think it has potential for a bit of optimization. Also, the end result will have to be modified in order to produce the relevant output, similar to a samtools targetcut output.

Main Steps in Algorithm

  1. Python script for establishing bin read counts
  2. Cutoff to define initial states--may be a weak point
  3. Hidden Markov Model to smooth initial states to final states
  4. Produce a .sam format matching samtools targetcut--Extra step I need