Commit 06c17d33 authored by Blaise Li's avatar Blaise Li
Browse files

Code cleaning and documenting.

parent ed111f22
...@@ -264,32 +264,32 @@ def plot_norm_correlations(correlations): ...@@ -264,32 +264,32 @@ def plot_norm_correlations(correlations):
#correlations.plot.kde(ax=ax1) #correlations.plot.kde(ax=ax1)
#sns.violinplot(data=correlations, orient="h", ax=ax2) #sns.violinplot(data=correlations, orient="h", ax=ax2)
#ax2.set_xlabel("Pearson correlation coefficient") #ax2.set_xlabel("Pearson correlation coefficient")
ax = sns.violinplot(data=correlations, cut=0) axis = sns.violinplot(data=correlations, cut=0)
ax.set_ylabel("Pearson correlation coefficient") axis.set_ylabel("Pearson correlation coefficient")
def plot_counts_distribution(data, xlabel): def plot_counts_distribution(data, xlabel):
# TODO: try to plot with semilog x axis # TODO: try to plot with semilog x axis
#ax = data.plot.kde(legend=None) #axis = data.plot.kde(legend=None)
#ax.set_xlabel(xlabel) #axis.set_xlabel(xlabel)
#ax.legend(ncol=len(REPS)) #axis.legend(ncol=len(REPS))
try: try:
ax = data.plot.kde() axis = data.plot.kde()
except ValueError as e: except ValueError as e:
msg = "".join([ msg = "".join([
"There seems to be a problem with the data.\n", "There seems to be a problem with the data.\n",
"The data matrix has %d lines and %d columns.\n" % (len(data), len(data.columns))]) "The data matrix has %d lines and %d columns.\n" % (len(data), len(data.columns))])
warnings.warn(msg) warnings.warn(msg)
raise raise
ax.set_xlabel(xlabel) axis.set_xlabel(xlabel)
def plot_boxplots(data, ylabel): def plot_boxplots(data, ylabel):
fig = plt.figure(figsize=(6, 12)) fig = plt.figure(figsize=(6, 12))
ax = fig.add_subplot(111) axis = fig.add_subplot(111)
ax.set_ylabel(ylabel) axis.set_ylabel(ylabel)
for label in ax.get_xticklabels(): for label in axis.get_xticklabels():
label.set_rotation(90) label.set_rotation(90)
plt.tight_layout() plt.tight_layout()
...@@ -352,9 +352,9 @@ def plot_lfc_distribution(res, contrast, fold_type=None): ...@@ -352,9 +352,9 @@ def plot_lfc_distribution(res, contrast, fold_type=None):
fold_type = "log2FoldChange" fold_type = "log2FoldChange"
lfc = getattr(res, fold_type).dropna() lfc = getattr(res, fold_type).dropna() = contrast = contrast
ax = sns.kdeplot(lfc) axis = sns.kdeplot(lfc)
ax.set_xlabel(fold_type) axis.set_xlabel(fold_type)
ax.set_ylabel("frequency") axis.set_ylabel("frequency")
def make_status2colour(down_statuses, up_statuses): def make_status2colour(down_statuses, up_statuses):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment