Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update logo, and simple_white template for plot gene expression + legend fix #47

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions anoexpress/anoexpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ def plot_gene_expression(gene_id, analysis="gamb_colu_arab_fun", microarray=Fals
fc_data = fc_data.drop(columns=['GeneName', 'GeneID', 'GeneDescription']).melt(id_vars='Label', var_name='comparison', value_name='log2FC')
fc_data = fc_data.merge(df_metadata, how='left')

#reorder fc data to match count_data ordering (important for legends/colours matching)
fc_data = fc_data.set_index('species').loc[count_data.species.unique()].reset_index()

if not height:
height = np.min([fc_data.shape[0]*12, 2500])

Expand All @@ -243,7 +246,7 @@ def plot_gene_expression(gene_id, analysis="gamb_colu_arab_fun", microarray=Fals
color='species',
title="title",
hover_data=['resistant', 'susceptible', 'species', 'country', 'technology'],
template='ggplot2'
template='simple_white'
)

figure2 = myplot(
Expand All @@ -253,7 +256,7 @@ def plot_gene_expression(gene_id, analysis="gamb_colu_arab_fun", microarray=Fals
color='species',
orientation='h',
hover_data=['sampleID', 'species', 'country'],
template='ggplot2',
template='simple_white',
)

for i in range(len(figure2.data)):
Expand All @@ -277,7 +280,7 @@ def plot_gene_expression(gene_id, analysis="gamb_colu_arab_fun", microarray=Fals
# reset boxmode to group so species are separate, resize plots, set axes titles, labels and vlines
final_figure.layout['boxmode'] = 'group'
final_figure.layout['xaxis2']['domain'] = (0.65, 1.0)
final_figure.update_layout(title_text=title, title_x=0.5, width=width, height=height)
final_figure.update_layout(title_text=title, title_x=0.5, width=width, height=height, template='simple_white')
final_figure.update_yaxes(title_text="Gene", row=1, col=1, title_font = {"size": 18}, tickfont={"size":14}),
final_figure.update_yaxes(showticklabels=False, row=1, col=2)
final_figure.update_xaxes(title_text="log2 fold change", row=1, col=1, title_font = {"size": 18})
Expand Down Expand Up @@ -696,7 +699,7 @@ def plot_contig_expression_track(
title=None,
width=800,
height=600,
color=True,
palette=None,
sizing_mode='stretch_width',
x_range=None,
y_range=None,
Expand Down Expand Up @@ -755,7 +758,7 @@ def plot_contig_expression_track(
df_metadata = metadata(analysis=analysis, microarray=microarray)
fold_change_df = fold_change_df.merge(df_metadata)

if color:
if palette:
# add color column
fold_change_df['color'] = np.select(
[
Expand All @@ -764,13 +767,9 @@ def plot_contig_expression_track(
fold_change_df['species'] == "arabiensis",
fold_change_df['species'] == "funestus"
],
[
'#f78181',
'#f5eeba',
'#b2ebc1',
'#798bfc'
],
default='grey'
list(palette),

default='grey'
)
color = 'color'
else:
Expand Down Expand Up @@ -844,7 +843,7 @@ def plot_contig_expression_track(



def plot_contig_expression(contig, analysis, data_type='fcs', microarray=False, size=10, step=5, pvalue_filter=None, y_range=(-10,15), height=400, width=600, title=None, show=False):
def plot_contig_expression(contig, analysis, data_type='fcs', microarray=False, size=10, step=5, pvalue_filter=None, palette=None,y_range=(-10,15), height=400, width=600, title=None, show=False):
"""
Plot fold change data for a given contig with a gene track.

Expand Down Expand Up @@ -888,6 +887,7 @@ def plot_contig_expression(contig, analysis, data_type='fcs', microarray=False,
data_type=data_type,
microarray=microarray,
pvalue_filter=pvalue_filter,
palette=palette,
size=size,
step=step,
y_range=y_range,
Expand Down
Binary file modified docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading