MrOlm / inStrain

Bioinformatics program inStrain
MIT License
149 stars 33 forks source link

How to get r2 value of synonymous (or nonsynonymous) variants linked to other synonymous (or nonsynonymous) variants? #191

Closed ChenTianYi99 closed 1 week ago

ChenTianYi99 commented 2 months ago

Hi, thank you for developing inStrain. Now i want to explore the relationship between r2 of synonymous variants linked to other synonymous variants and r2 of nonsynonymous variants linked to other nonsynonymous variants. How can i get these indicators in inStrain output files (maybe linkage file)?

Thanks in advance.

MrOlm commented 1 week ago

Hello,

Thank you for using inStrain and for your interest in exploring linkage relationships!

You can analyze the relationship between r² values for synonymous and nonsynonymous variants using the linkage output file generated by inStrain. Specifically, the linkage file contains information about pairwise linkage between variants, including r² values.

To extract the specific indicators you need:

Look for the variant_type column in the linkage file to identify synonymous and nonsynonymous variants. Filter the data to group r² values by their linkage type (e.g., synonymous-synonymous or nonsynonymous-nonsynonymous).

You can look at the code, here, that shows how we do then when making the linkage plots: https://github.com/MrOlm/inStrain/blob/master/inStrain/plotting/linkage_plots.py

Best, Matt