Entering edit mode
3.1 years ago
A_Lh
▴
30
I want to plot the number of positions in a sliding window of 1000 and a step of 20 for each sample (A-D).
Interpretation:
1
: position exists;NA
: position does not exist.
I have tested a dozen tools in bash
, R
and other but I am looking for a Python
solution.
Your advice please.
#This is an example of my data:
window = 1000
step = 20
# Example of dataframe
POSITION A B C D
1250 1 1 1 1
1750 NA 1 NA 1
1786 1 NA 1 1
1812 1 1 1 1
1855 1 1 1 1
1896 1 NA 1 NA
2635 NA 1 1 1
1689 1 1 NA NA
3250 1 1 1 1
3655 1 NA 1 1
3589 NA 1 1 1
I am looking for some thing like this:
Any help will be appreciated!
Previous question: How to plot SNPs distribution on each chromosome?
Just need to adjust BEDOPS
bedmap
commands to count SNPs over sliding windows, and then feed that as input to the provided script.