This is a test version of Biostars. For the public version, visit https://www.biostars.org.
python script revision for sequencing depth

Hello,

After calculation of sequencing depth using samtools, I am trying to print out the result of sequencing depth using python script. But, I would like to make a limitation for y-axis to be "200".

The python script I am using as follosw: Probably, I need to revise one that I make a bold. Please, help me.

--script ----

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys


input_data = sys.argv[1]
output_data = sys.argv[2]
column_names 
data = pd.read_csv(input_data, sep='\t', header=None, names=column_names)


x = data['基因组位置']
y = data['覆盖深度']

# ************
average_coverage_depth = y.mean()
maximal_depth = y.max()
minimal_depth = y.min()
total_genome_length = x.iloc[-1]
# ************


plt.figure(figsize=(12, 6))
plt.plot(x, y, color='blue', linewidth=1, linestyle='-')


plt.title('Sequencing Depth and Coverage Map', fontsize=18, pad=20)
plt.xlabel('Genomic Position (bp)', fontsize=14)
plt.ylabel('Sequencing Depth (×)', fontsize=14)

plt.xticks(fontsize=12)
plt.yticks(fontsize=12)

plt.grid(True, linestyle='--', alpha=0.5)
script sequencing depth python range

1 answer

Literally the first search result

plt.ylim(0,200)

Log in to answer this question.