def generate_visualizations(methods, data, true_labels, base_dir = '<STR_LIT>',<EOL>figsize=(<NUM_LIT>,<NUM_LIT:10>), **scatter_options):
plt.figure(figsize=figsize)<EOL>for method in methods:<EOL><INDENT>preproc= method[<NUM_LIT:0>]<EOL>if isinstance(preproc, Preprocess):<EOL><INDENT>preprocessed, ll = preproc.run(data)<EOL>output_names = preproc.output_names<EOL><DEDENT>else:<EOL><INDENT>p1 = data<EOL>output_names = ['<STR_LIT>']<EOL>for p in preproc:<EOL><INDENT>p1, ll = p.run(p1)<EOL>p1 = p1[<NUM_LIT:0>]<EOL>output_names[<NUM_LIT:0>] = output_names[<NUM_LIT:0>] + p.output_names[<NUM_LIT:0>]<EOL><DEDENT>preprocessed = [p1]<EOL><DEDENT>for r, name in zip(preprocessed, output_names):<EOL><INDENT>print(name)<EOL>if r.shape[<NUM_LIT:0>]==<NUM_LIT:2>:<EOL><INDENT>r_dim_red = r<EOL><DEDENT>else:<EOL><INDENT>if sparse.issparse(r) and r.shape[<NUM_LIT:0>] > <NUM_LIT:100>:<EOL><INDENT>name = '<STR_LIT>' + name<EOL>tsvd = TruncatedSVD(<NUM_LIT:50>)<EOL>r_dim_red = tsvd.fit_transform(r.T)<EOL>try:<EOL><INDENT>tsne = TSNE(<NUM_LIT:2>)<EOL>r_dim_red = tsne.fit_transform(r_dim_red).T<EOL>name = '<STR_LIT>' + name<EOL><DEDENT>except:<EOL><INDENT>tsvd2 = TruncatedSVD(<NUM_LIT:2>)<EOL>r_dim_red = tsvd2.fit_transform(r_dim_red).T<EOL><DEDENT><DEDENT>else:<EOL><INDENT>name = '<STR_LIT>' + name<EOL>tsne = TSNE(<NUM_LIT:2>)<EOL>r_dim_red = tsne.fit_transform(r.T).T<EOL><DEDENT><DEDENT>if isinstance(method[<NUM_LIT:1>], list):<EOL><INDENT>for clustering_method in method[<NUM_LIT:1>]:<EOL><INDENT>try:<EOL><INDENT>cluster_labels = clustering_method.run(r)<EOL><DEDENT>except:<EOL><INDENT>print('<STR_LIT>')<EOL>continue<EOL><DEDENT>output_path = base_dir + '<STR_LIT>'.format(name, clustering_method.name)<EOL>visualize_dim_red(r_dim_red, cluster_labels, output_path, **scatter_options)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>clustering_method = method[<NUM_LIT:1>]<EOL>try:<EOL><INDENT>cluster_labels = clustering_method.run(r)<EOL><DEDENT>except:<EOL><INDENT>print('<STR_LIT>')<EOL>continue<EOL><DEDENT>output_path = base_dir + '<STR_LIT>'.format(name, clustering_method.name)<EOL>visualize_dim_red(r_dim_red, cluster_labels, output_path, **scatter_options)<EOL><DEDENT>output_path = base_dir + '<STR_LIT>'.format(name)<EOL>visualize_dim_red(r_dim_red, true_labels, output_path, **scatter_options)<EOL><DEDENT><DEDENT>
Generates visualization scatters for all the methods.

Args:
    methods: follows same format as run_experiments. List of tuples.
    data: genes x cells
    true_labels: array of integers
    base_dir: base directory to save all the plots
    figsize: tuple of ints representing size of figure
    scatter_options: options for plt.scatter