Skip to content
Snippets Groups Projects
Commit c84ad20a authored by Valentin Gallier's avatar Valentin Gallier
Browse files

Issue #13 accuracy estimate

parent 95d07fbd
No related branches found
No related tags found
1 merge request!22Issue13
class AccuracyEstimate:
# Knowing the relative expression levels of genes in the input and calculated from the simulation data, summarize the agreement.
# Input: 1. Csv-file with input values
# 2. Csv-file with mean and variance obtained from the simulation
# Output: scatter plot of initial vs inferred (mean and error bars) counts for all genes
def accuracy_estimate(input_file, simulation_file):
"""Determine the accuracy of the simulated values regarding the input values.
Knowing the relative expression levels of genes in the input and calculated from the simulation data, summarize the agreement.
Args:
input_file: Csv-file with input values
simulation_file: Csv-file with mean and variance obtained from the simulation
Returns:
Scatter plot of initial vs inferred counts for all genes with error bars
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# input_file = "input.csv"
# simulation_file = "mean_variance.csv"
df1 = pd.read_csv(input_file)
df2 = pd.read_csv(simulation_file)
# Plot mean and error bars
x = df1['Count']
y = df2['Mean']
yerr = df2['Variance']
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(x, y, vmin=0, vmax=100)
ax.errorbar(x, y, yerr=yerr, ecolor="r", fmt="bo", capsize=5)
ax.set_title("Scatter plot of initial vs inferred counts for all genes")
plt.show()
\ No newline at end of file
if __name__ == '__main__':
import accuracy_estimate
import argparse
parser = argparse.ArgumentParser(description='Do something')
parser.add_argument('input_file', metavar='FILE', type=str, help='Enter the path of the input file')
parser.add_argument('simulation_file', metavar='FILE', type=str, help='Enter the path of the simulation file')
args = parser.parse_args()
input_file = args.input_file
simulation_file = args.simulation_file
accuracy_estimate.AccuracyEstimate.accuracy_estimate(input_file, simulation_file)
GeneID,Count
gene1,125
gene2,1278
gene3,659
\ No newline at end of file
GeneID,Mean,Variance
gene1,129,35
gene2,1798,97
gene3,695,68
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment