How to plot depth coverage plot?
1
0
Entering edit mode
3.0 years ago
dyfn1947 • 0

Hello I want to plot whole chromosome depth coverage plot each chromosome size is 50Mb and they have 130Kb deletion. but when I made a plot using python It can't detect 130kb deletion (I did 10kb binning) what is my problem?

this is my python script

import sys
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Agg')

input_file = sys.argv[1]

df = pd.read_table(input_file, sep = "\t", header = None)

y = [int(a) for a in df[2]]

n =10000
y_10000 = [y[i * n:(i + 1) * n] for i in range((len(y) + n - 1) // n )]

y_10000_mean = [sum(a)/len(a) for a in y_10000]

x = [b for b in range(len(y_10000_mean))]

plt.plot(x, y_10000_mean, '-', mfc='none' )
plt.ylim([0,13])
#plt.xlim([0,5346])
#plt.autoscale(enable = True)
plt.savefig(f'{input_file}_1kb.jpg', dpi = 500

Thanks

enter image description here

enter image description here

this is deletion

this is whole chromosome (10kb binning)

coverage binning python depth slidwindow • 1.9k views
ADD COMMENT
0
Entering edit mode

Please provide a sample of your input table and the plot you are getting. Otherwise it will be difficult to help you.

ADD REPLY
0
Entering edit mode

I add figures . Thanks!

ADD REPLY
0
Entering edit mode
3.0 years ago

The more standard way to do this would be to covert your BAM file into bigwig using, for example, deeptools bamcoverage, then view the results in a genome browser like IGV, Jbrowse2 desktop etc.

This allows you to see the annotation around the breakpoints as well, which is usually the follow up question.

ADD COMMENT

Login before adding your answer.

Traffic: 1509 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6