Skip to content

Commit 321bf73

Browse files
committed
Bug fixes for single replicate with >2 conditions and reading args.txt
1 parent 0528d20 commit 321bf73

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

superviolin/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
setup(
1616
name = "superviolin",
1717
py_modules = ["plot_cli", "plot"],
18-
version = "1.0.2",
18+
version = "1.0.3",
1919
url = "",
2020
description = "Python CLI to make Violin SuperPlots",
2121
long_description = long_description,

superviolin/superviolin/plot.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
@author: Martin Kenny
66
"""
77

8-
import os
98
import numpy as np
109
import pandas as pd
1110
import scikit_posthocs as sp
@@ -639,7 +638,7 @@ def get_statistics(self, centre_val="mean", paired="no",
639638

640639
num_groups = len(self.subgroups)
641640

642-
if num_groups > 2:
641+
if num_groups > 2 and len(self.unique_reps) > 1:
643642
# compute one-way ANOVA test results
644643
stat, p = f_oneway(*data)
645644

@@ -669,6 +668,10 @@ def get_statistics(self, centre_val="mean", paired="no",
669668
else:
670669
print(f"Paired t-test P-value: {p:.3f}")
671670

671+
else:
672+
stat = "Can't run statistics for only 1 replicate"
673+
p = stat
674+
print(p)
672675
# plot statistics if only 2 or 3 groups
673676
if on_plot == "yes" and num_groups in [2, 3]:
674677
ax = plt.gca()

superviolin/superviolin/plot_cli.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ def process_txt(txt):
3838
lines = [i.rstrip() for i in txt if not i.startswith("#")]
3939
lines = [i for i in lines if len(i) > 0]
4040
for l in lines:
41-
k, v = l.replace("\n", "").split(": ")
42-
try:
43-
arg_dict[k] = float(v)
44-
except ValueError:
45-
if k == "None":
46-
arg_dict[k] = None
47-
else:
48-
arg_dict[k] = v
41+
if ":" in l:
42+
k, v = l.replace("\n", "").split(": ")
43+
try:
44+
arg_dict[k] = float(v)
45+
except ValueError:
46+
if k == "None":
47+
arg_dict[k] = None
48+
else:
49+
arg_dict[k] = v
4950
return arg_dict
5051

5152
def get_args(demonstration=False, preferences=False):

0 commit comments

Comments
 (0)