Sliding window plot using Python

Sliding window plot using Python

1

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:

Polymorphism density plot using a window size of 1,000,000 with an increment (step) of 100,000

Any help will be appreciated!


python


SNP


PLOT

• 32 views

updated 19 minutes ago by

★

1.1k

written 2 hours ago by

▴

20

Read more here: Source link