Morteza-M-Saber / BacGWASim

A Simulator for Bacterial Machine learning and Genome-Wide Association Studies
MIT License
21 stars 5 forks source link

Code for stacked bar chart LD plots #7

Closed benrhodes26 closed 3 years ago

benrhodes26 commented 3 years ago

I would like to create a stacked bar chart to measure LD for my own (real) bacterial species. I cannot see the code for this in your library. Could you either point me towards it / share it?

I understand that it should be simple to create using the ldPlot.LD file from haploview, but I am unsure how you are calculating 'frequency' on the y-axis. How do you normalize the counts to obtain this frequency? :)

Morteza-M-Saber commented 3 years ago

Hi Ben, Thanks for your interest in BacGWASim. The code to generate LD stacked bar chart is just added to Github (https://github.com/Morteza-M-Saber/BacGWASim/blob/master/BacGWASim/modules/ld/ld_stackplot.py). It simply get the 'ldPlot.LD' file and generates the stacked LD plot. The frequency on the y-axis is normalized by the number of markers within the specific distance range with certain level of LD, compared to the total number of markers available within that range. Please let me know if you have trouble running the code.