Untitled conversation
- Usercode
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
import numpy as np
import gzip
with gzip.open('sample_001_coverage_unique_no_genes.txt.gz', 'rt') as f:
data = np.loadtxt(f)
print(data.size)
import matplotlib.pyplot as plt
import numpy as np
# Create x-axis values corresponding to the positions.
x = np.arange((3913040-5), (3913922+5))
# Slice the data array for the specified positions.
subset = data[(3913040-5): (3913922+5)]
# Plot the data.
plt.figure(figsize=(10, 5))
plt.plot(x, subset)
# Add marks for different positions
plt.axvline(x=3913092, color='r', linestyle='--', label='End GFP')
plt.axvline(x=3913802, color='g', linestyle='--', label='Start GFP')
plt.axvline(x=3913922, color='b', linestyle='--', label='Start Promotor P-J23100')
plt.axvline(x=3913888, color='y', linestyle='--', label='End Promotor P-J23100')
plt.axvline(x=3913876, color='purple', linestyle='--', label='Start TIR')
plt.axvline(x=3913850, color='orange', linestyle='--', label='End TIR')
plt.axvline(x=3913858, color='black', linestyle='--', label='Start BCD')
plt.axvline(x=3913803, color='grey', linestyle='--', label='End BCD')
plt.axvline(x=3913088, color='pink', linestyle='--', label='Start Terminator')
plt.axvline(x=3913040, color='cyan', linestyle='--', label='End Terminator')
#plt.axvline(x=3912961, color='b', linestyle='--', label='End TcR')
#plt.axvline(x=3914001, color='m', linestyle='--', label='Start glmU')
# Set Y-axis to start at 0
plt.ylim(bottom=0)
plt.xlabel('Position')
plt.ylabel('Value')
plt.title('Plot of data from positions 3912092 to 3914802')
plt.legend()
plt.show()
Make it so instead they are highlighted instead of lines. And make x-axis show full values instead of e6
I'll modify the code to use highlighted regions instead of vertical lines and adjust the x-axis to show full values instead of scientific notation. Here's the updated code:
import numpy as np
import gzip
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
with gzip.open('sample_001_coverage_unique_no_genes.txt.gz', 'rt') as f:
data = np.loadtxt(f)
print(data.size)
# Create x-axis values corresponding to the positions.
x = np.arange((3913040-5), (3913922+5))
# Slice the data array for the specified positions.
subset = data[(3913040-5): (3913922+5)]
# Plot the data.
plt.figure(figsize=(12, 6))
plt.plot(x, subset, color='black', linewidth=1)
# Define regions to highlight
regions = [
{'start': 3913092, 'end': 3913802, 'color': 'lightgreen', 'alpha': 0.3, 'label': 'GFP'},
{'start': 3913888, 'end': 3913922, 'color': 'lightblue', 'alpha': 0.3, 'label': 'Promotor P-J23100'},
{'start': 3913850, 'end': 3913876, 'color': 'lightyellow', 'alpha': 0.3, 'label': 'TIR'},
{'start': 3913803, 'end': 3913858, 'color': 'lavender', 'alpha': 0.3, 'label': 'BCD'},
{'start': 3913040, 'end': 3913088, 'color': 'mistyrose', 'alpha': 0.3, 'label': 'Terminator'},
]
# Add highlighted regions
ax = plt.gca()
for region in regions:
rect = Rectangle((region['start'], 0),
region['end'] - region['start'],
max(subset)*1.05, # Make rectangle extend above the data
facecolor=region['color'],
alpha=region['alpha'],
label=region['label'])
ax.add_patch(rect)
# Set Y-axis to start at 0
plt.ylim(bottom=0)
# Format x-axis to show full values instead of scientific notation
plt.ticklabel_format(style='plain', axis='x')
plt.xticks(rotation=45)
plt.xlabel('Position')
plt.ylabel('Coverage')
plt.title('Coverage across genetic elements')
plt.legend(loc='upper right')
plt.tight_layout()
plt.show()
This code:
The legend will show the color coding for each genetic element, making it easier to identify the different regions in the plot.