#!/usr/bin/env python3

"""GRADitude: a computational tool for the analysis of GRAD-seq data"""

import argparse
from graditudelib import normalize
from graditudelib import visualizing_kinetics
from graditudelib import elbow_curve
from graditudelib import silhouette
from graditudelib import pca_analysis
from graditudelib import scaling
from graditudelib import robust_regression
from graditudelib import clustering
from graditudelib import min_row_sum
from graditudelib import t_sne_colored_list_clustering_features
from graditudelib import correlation_between_genes
from graditudelib import selecting_ncRNAs
from graditudelib import min_row_sum_ercc_table
from graditudelib import correlation_rna_protein
from graditudelib import plot_network_graph
from graditudelib import distribution_correlation
from graditudelib import dimension_reduction_proteins
from graditudelib import clustering_proteins
from graditudelib import correlation_specific_gene
from graditudelib import interactive_plots
from graditudelib import heatmap
from graditudelib import correlation_replicates_sequencing_data
from graditudelib import projectcreator
from graditudelib import dropping_specific_columns
from graditudelib import umap_analysis
from graditudelib import finding_complexes_complete
from graditudelib import normalize_table_spikein
from graditudelib import generate_html
from graditudelib import extract_attribute_column
from graditudelib import size_factor
from graditudelib import move_columns
from graditudelib import merge_features
from graditudelib import merge_exctract_attributes

__author__ = "Silvia Di Giorgio <digiorgio@zbmed.de>, " \
             "Konrad Foerstner <konrad@foerstner.org>"
__license__ = "ISC license"
__email__ = "digiorgio@zbmed.de"
__version__ = "0.1.0"

def main():
    parser = argparse.ArgumentParser()

    subparsers = parser.add_subparsers(help="commands")

    create_parser = subparsers.add_parser("create")
    create_parser.set_defaults(func=create_project)
    create_parser.add_argument('--create_graditude_folder',
                               required=False,
                               default="GRADitude")

    min_row_sum_ercc_parser = subparsers.add_parser("min_row_sum_ercc",
                                                    help="Filter the ERCC table "
                                                         "based on the min row sum. "
                                                         "It calculates the sum row wise "
                                                         "and discard the rows "
                                                         "with a sum below the specified threshold ")
    min_row_sum_ercc_parser.set_defaults(func=filtering_tables)
    min_row_sum_ercc_parser.add_argument("--ref_feature_count_table", "-r",
                                         required=True,
                                         help="ERCC reads count table")
    min_row_sum_ercc_parser.add_argument("--min_row_sum", "-m", type=int,
                                         default=100,
                                         help="It specifies the threshold we want "
                                              " to apply")
    min_row_sum_ercc_parser.add_argument("--filtered_ref_feature_count_table", "-fr",
                                         required=True,
                                         help="Filtered ERCC reads table as output")

    modify_min_row_parser = subparsers.add_parser("min_row_sum",
                                                  help="Filter the gene quantification "
                                                       "table based on "
                                                       "the min row sum. It "
                                                       "calculates the sum row wise "
                                                       "and discard the rows with "
                                                       "a sum below the specified threshold")
    modify_min_row_parser.set_defaults(func=find_min_rows)
    modify_min_row_parser.add_argument("--feature_count_table", "-f",
                                       required=True,
                                       help="Gene quantification table")
    modify_min_row_parser.add_argument('--feature_count_start_column', "-fc",
                                       required=True, type=int,
                                       help="Number of "
                                            "the column with the first fraction")
    modify_min_row_parser.add_argument('--feature_count_end_column', "-fe",
                                       required=True, type=int,
                                       help="Number of "
                                            "the last fraction we would like to consider in the"
                                            " analysis", default=False)
    modify_min_row_parser.add_argument("--min_row", '-m', required=True,
                                       type=int, default=100,
                                       help="Threshold we want"
                                            " to apply")
    modify_min_row_parser.add_argument("--output_file", "-o", required=True,
                                       help="Filtered table as output")

    drop_columns_parser = subparsers.add_parser("drop_column",
                                                help="It filters a table "
                                                     "dropping a specific column."
                                                     "It is usually used to drop the "
                                                     "lysate column"
                                                     " that is not required for the "
                                                     "downstream analysis "
                                                )
    drop_columns_parser.set_defaults(func=drop_column)
    drop_columns_parser.add_argument("--feature_count_table", "-f",
                                     required=True,
                                     help="Gene quantification table "
                                          "or ERCC-reads table")
    drop_columns_parser.add_argument("--column_to_drop", '-c',
                                     nargs='+',
                                     required=True,
                                     help="This parameter specify "
                                          "the name of the column you "
                                          "want to drop")
    drop_columns_parser.add_argument("--output_file", "-o",
                                     required=True,
                                     help="Filtered table as output")

    move_columns_parser = subparsers.add_parser("move_columns",
                                                help=""
                                                )
    move_columns_parser.set_defaults(func=run_move_columns)
    move_columns_parser.add_argument("--feature_count_table", "-f",
                                     required=True,
                                     help="Gene quantification table "
                                          "or ERCC-reads table")
    move_columns_parser.add_argument("--number_of_columns", '-n',
                                     required=True, type=int,
                                     help="This parameter specify "
                                          "the number of the column you "
                                          "want to move")
    move_columns_parser.add_argument("--output_file", "-o",
                                     required=True,
                                     help="Filtered table as output")

    merge_features_parser = subparsers.add_parser("merge_features",
                                                  help=""
                                                  )
    merge_features_parser.set_defaults(func=run_merge_features)
    merge_features_parser.add_argument("--feature_count_table", "-f",
                                       required=True,
                                       help="Gene quantification table "
                                            "or ERCC-reads table")
    merge_features_parser.add_argument("--output_file", "-o",
                                       required=True,
                                       help="")

    regression_parser = subparsers.add_parser("robust_regression",
                                              help="It compares the ERCC "
                                                   "concentration in mix "
                                                   "with the ERCC reads and take "
                                                   "it out the outliers")
    regression_parser.set_defaults(func=run_robust_regression)
    regression_parser.add_argument('--ref_feature_count_table', '-r',
                                   required=True, help='Filtered ERCC reads table')
    regression_parser.add_argument('--concentration_table', '-c',
                                   required=True, help="ERCC concentration table")
    regression_parser.add_argument("--number_of_outliers", "-n",
                                   required=True, type=int, help="Number of outliers")
    regression_parser.add_argument('--number_of_ercc_in_common', '-nc',
                                   type=int, default=18,
                                   help="Number of ERCC considered outliers "
                                        "in common within the different fractions")
    regression_parser.add_argument("--used_mix", "-mix",
                                   required=True, type=int,
                                   help="This parameter "
                                        "defines which ERCC mix have been"
                                        " used in the experiment,"
                                        " in case of mix1 and mix2 the "
                                        "--mix is either 3 or 4 ")
    regression_parser.add_argument("--output_table", '-o',
                                   required=True,
                                   help="Output table with the inliers ERCC")

    normalize_parser = subparsers.add_parser("normalize",
                                             help='This subcommand calculates'
                                                  ' the ERCC size factor and '
                                                  'normalize the gene quantification '
                                                  'table based on that')
    normalize_parser.set_defaults(func=normalize_table)
    normalize_parser.add_argument('--feature_count_table', '-f',
                                  required=True,
                                  help="Filtered gene quantification table")
    normalize_parser.add_argument('--feature_count_start_column', '-fc', type=int,
                                  help="Specify the number of "
                                       "the column with the first fraction")
    normalize_parser.add_argument("--feature_count_end_column", "-fe", type=int,
                                  help="Specify the number of "
                                       "the last fraction we would like to consider in the"
                                       " analysis")
    normalize_parser.add_argument("--ref_feature_count_table", "-r",
                                  required=True,
                                  help="ERCC table with the ERCC read-counts")
    normalize_parser.add_argument("--ref_feature_count_start_column", "-rc",
                                  default=1, type=int,
                                  help="Specify the number of "
                                       "the column with the first fraction for the ERCC table")
    normalize_parser.add_argument("--ref_feature_count_end_column", "-re",
                                  default=-1, type=int,
                                  help="Specify the number of "
                                       "the last fraction we would like to consider in the"
                                       " analysis for the ERCC table")
    normalize_parser.add_argument("--normalized_table", "-o", required=True,
                                  help="Table normalized"
                                  )
    normalize_parser.add_argument("--size_factor_table", "-s",
                                  default=None,
                                  help="Table with all the size factor")

    spike_in_finder_parser = subparsers.add_parser("find_spike_in",
                                                   help='')
    spike_in_finder_parser.set_defaults(func=run_finder_spikein)
    spike_in_finder_parser.add_argument('--ref_feature_count_table', '-r',
                                        required=True,
                                        help="Filtered gene quantification table")
    spike_in_finder_parser.add_argument('--size_factors_table', '-o',
                                        help="")

    normalize_spike_in_parser = subparsers.add_parser("normalize_with_spikein",
                                                      help='This subcommand calculates'
                                                           ' the ERCC size factor and '
                                                           'normalize the gene quantification '
                                                           'table based on that')
    normalize_spike_in_parser.set_defaults(func=normalize_table_with_one_spikein)
    normalize_spike_in_parser.add_argument('--feature_count_table', '-f',
                                           required=True,
                                           help="Filtered gene quantification table")
    normalize_spike_in_parser.add_argument('--feature_count_start_column', '-fc', type=int,
                                           help="Specify the number of "
                                                "the column with the first fraction")
    normalize_spike_in_parser.add_argument("--feature_count_end_column", "-fe", type=int,
                                           help="Specify the number of "
                                                "the last fraction we would like to consider in the"
                                                " analysis")
    normalize_spike_in_parser.add_argument("--size_factors_table", "-s",
                                           default=None,
                                           help="Table with all the size factor")

    normalize_spike_in_parser.add_argument("--name_column_with_values", "-c",
                                           default=True,
                                           help="")

    normalize_spike_in_parser.add_argument("--normalized_table", "-o", required=True,
                                           help="Table normalized"
                                           )

    scaling_parser = subparsers.add_parser("scaling",
                                           help="This subcommand scales tables "
                                                "using different scaling methods")
    scaling_parser.set_defaults(func=run_scaling)
    scaling_parser.add_argument('--feature_count_table', '-f',
                                required=True,
                                help="Normalized gene quantification "
                                     "table or raw tables")
    scaling_parser.add_argument('--feature_count_start_column', '-fc',
                                required=True, type=int,
                                help="Specify the number of "
                                     "the column with the first fraction")
    scaling_parser.add_argument('--feature_count_end_column', '-fe', required=True,
                                type=int,
                                help="Specify the number of "
                                     "the last fraction we would like to consider in the"
                                     " analysis")
    scaling_parser.add_argument("--pseudo_count", '-p',
                                type=int, default=1,
                                help="The pseudo count is "
                                     "a number that will always be "
                                     "added to each value; "
                                     "Adding this number avoid "
                                     "to have mathematical operation with zeros ")
    scaling_parser.add_argument(
        "--scaling_method", '-sm', required=True,
        choices=["no_normalization",
                 "to_max",
                 "to_range",
                 "log10", "log2"],
        help="Define the scaling methods you "
             "would like to apply. The user "
             "can choose between a normalization "
             "to the maximum value, to a range, "
             "a log10 and log 2 normalization. "
             "Alternatively the user can decide "
             "to not use any kind of normalization ")
    scaling_parser.add_argument("--scaled_table", "-o", required=True,
                                help="Scaled table as output")

    corr_gene_gene_parser = subparsers.add_parser("correlation_all_against_all",
                                                  help="This subcommand "
                                                       "calculate the correlation "
                                                       "coefficients all against all ")
    corr_gene_gene_parser.set_defaults(func=run_correlation_gene_gene)
    corr_gene_gene_parser.add_argument('--feature_count_table', '-f', required=True,
                                       help="Gene quantification or protein table")
    corr_gene_gene_parser.add_argument('--feature_count_start_column', '-fc', required=True,
                                       type=int, help="Specify the number of "
                                                      "the column with the first fraction")
    corr_gene_gene_parser.add_argument('--feature_count_end_column', '-fe', required=True, type=int,
                                       help="Specify the number of "
                                            "the last fraction we would like to consider in the"
                                            " analysis")
    corr_gene_gene_parser.add_argument('--correlation_type', '-corr', required=True,
                                       choices=["Pearson", "Spearman"],
                                       help="Choose if applying the Pearson or "
                                            "Spearman correlation")
    corr_gene_gene_parser.add_argument('--output_table', '-o', required=True,
                                       help="Table with correlation coefficients")

    selecting_features = subparsers.add_parser("selecting_specific_features",
                                               help="This subcommand allows to "
                                                    "select specific features in"
                                                    " a normalized "
                                                    "table (ncRNAs, CDS, etc.)")
    selecting_features.set_defaults(func=select_specific_features)
    selecting_features.add_argument('--normalized_table', '-n', required=True,
                                    help="Normalized table")
    selecting_features.add_argument('--feature_count_start_column', '-fc',
                                    required=True, type=int,
                                    help="Specify the number of "
                                         "the column with the first fraction")
    selecting_features.add_argument('--feature_count_end_column', '-fe',
                                    required=True, type=int,
                                    help="Specify the number of "
                                         "the last fraction we would like to consider in the"
                                         " analysis")
    selecting_features.add_argument('--features', '-f', nargs='+',
                                    required=True,
                                    help="This parameter specify "
                                         "the features we would like to filter of. "
                                         "It can be a single one"
                                         " or a list")
    selecting_features.add_argument('--output_file', '-o', required=True,
                                    help="Filtered table")

    p_heatmap = subparsers.add_parser("heatmap",
                                      help="This subcommand is useful "
                                           "to visualize the in-gradient"
                                           " behavior of a larger group of "
                                           "transcripts or proteins ")
    p_heatmap.set_defaults(func=plot_heatmap)
    p_heatmap.add_argument('--feature_count_table', '-f', required=True,
                           help="Gene quantification table or protein table  ")
    p_heatmap.add_argument('--feature_count_start_column', '-fc', type=int,
                           help="Specify the number of "
                                "the column with the first fraction")
    p_heatmap.add_argument('--feature_count_end_column', '-fe', type=int,
                           help="Specify the number of "
                                "the last fraction we would like to consider in the"
                                " analysis")
    p_heatmap.add_argument("--y_label", "-label", required=True,
                           help="This parameter allow you to specify the"
                                " label you would like to visualize on the y-axis")
    p_heatmap.add_argument("--output_file", "-o", required=True, help="Plot as output")

    plot_kinetics_parser = subparsers.add_parser("plot_kinetics",
                                                 help="This subcommand plot "
                                                      "the kinetics of "
                                                      "a specific transcript "
                                                      "or protein to better "
                                                      "visualize their behavior "
                                                      "within the gradient")
    plot_kinetics_parser.set_defaults(func=plot_kinetics)
    plot_kinetics_parser.add_argument("--feature_count_table", "-f",
                                      required=True,
                                      help="This parameter specified "
                                           "the table we would like to use."
                                           " It can be the normalized "
                                           "or the raw table")
    plot_kinetics_parser.add_argument('--feature_count_start_column', '-fc',
                                      required=True, type=int,
                                      help="Specify the number of "
                                           "the column with the first fraction")
    plot_kinetics_parser.add_argument('--feature_count_end_column', '-fe',
                                      required=True, type=int,
                                      help="Specify the number of "
                                           "the last fraction we would like "
                                           "to consider in the"
                                           " analysis")
    plot_kinetics_parser.add_argument("--gene_name", "-gene",
                                      required=True,
                                      help="With this parameter you can "
                                           "specify the name of the gene or the protein"
                                           "you would like to explore")
    plot_kinetics_parser.add_argument("--output_format", '-format', choices=["html", "pdf"],
                                      default="html",
                                      help="You can use this parameter to"
                                           "specify in which format you would like to"
                                           " save your plot")

    clustering_parser = subparsers.add_parser("clustering",
                                              help="This subcommand "
                                                   "performs unsupervised clustering "
                                                   "using different algorithm")
    clustering_parser.set_defaults(func=run_clustering)
    clustering_parser.add_argument("--feature_count_table", "-f", required=True,
                                   help="This parameter specified "
                                        "the table we would like to use."
                                        " It can be the normalized "
                                        "or the raw table")
    clustering_parser.add_argument("--feature_count_start_column", "-fc",
                                   required=True,
                                   help="This parameter specified the number"
                                        " of the column with the first fraction",
                                   type=int)
    clustering_parser.add_argument("--feature_count_end_column", "-fe", required=True,
                                   help="Specify the number of "
                                        "the last fraction we would like to consider in the"
                                        " analysis",
                                   type=int)
    clustering_parser.add_argument("--number_of_clusters", '-nc',
                                   default=False, type=int,
                                   help="This parameter specify the number of "
                                        "clusters, k. It is required only "
                                        "when using k-means and "
                                        "hierarchical clustering algorithm ")
    clustering_parser.add_argument("--pseudo_count", "-p", type=int,
                                   default=1,
                                   help="The pseudo count represent "
                                        "a number that will always "
                                        "be added to each value. "
                                        "Adding this number avoid to "
                                        "have mathematical operation with zero")
    clustering_parser.add_argument("--clustering_methods", "-cm",
                                   required=True,
                                   choices=["k-means",
                                            "DBSCAN",
                                            'hierarchical_clustering'],
                                   help="The user can choose"
                                        " between 3 clustering"
                                        " algorithm, k-means clustering, "
                                        "hierarchical clustering "
                                        "and DB-SCAN clustering ")
    clustering_parser.add_argument("--epsilon", "-e", default=False,
                                   help='This parameter '
                                        'is specific for the DBSCAN '
                                        'clustering algorithm. '
                                        'It defines how close'
                                        ' points should be '
                                        'in order to be considered '
                                        'part of a cluster. It is necessary'
                                        'only for DBSCAN clustering'
                                   , type=float)
    clustering_parser.add_argument("--min_samples", '-ms',
                                   default=False,
                                   help="This parameter is specific "
                                        "for the DBSCAN clustering algorithm and "
                                        "represent the minimum number"
                                        " of points necessary to form a dense region",
                                   type=int)
    clustering_parser.add_argument(
        "--scaling_method", '-sm', required=True,
        choices=["no_normalization", "to_max",
                 "to_range", "log10", "log2"],
        help="Define the scaling methods you would like to apply."
             " The user can choose between a normalization "
             "to the maximum value, to a range, a log10 and log 2 normalization."
             " Alternatively the user can decide "
             "to not use any kind of normalization"
    )
    clustering_parser.add_argument("--output_file", "-o",
                                   required=True,
                                   help="Output table "
                                        "with a new column containing the number of clusters")

    elbow_parser = subparsers.add_parser("clustering_elbow",
                                         help="This subcommands plot the elbow graph in order "
                                              "to choose "
                                              "the ideal number of clusters necessary for "
                                              "the k-means and the hierarchical clustering ")
    elbow_parser.set_defaults(func=generate_k_means_clustering_elbow)
    elbow_parser.add_argument("--feature_count_table", "-f", required=True,
                              help="Filtered gene quantification table")
    elbow_parser.add_argument("--feature_count_start_column", "-fc", required=True,
                              help="This parameter specify the number of the column "
                                   "with the first fraction")
    elbow_parser.add_argument("--feature_count_end_column", "-fe", required=True,
                              help=" Specify the number of "
                                   "the last fraction we would like to consider in the"
                                   " analysis")
    elbow_parser.add_argument("--min_number_of_clusters", '-min', required=True, type=int,
                              help="Minimum number of clusters that you want to represent "
                                   "in the plot ")
    elbow_parser.add_argument("--max_number_of_clusters", '-max', required=True, type=int,
                              help="Maximum number of clusters that you want to represent "
                                   "in the plot")
    elbow_parser.add_argument("--output_plots1", '-o1', required=True,
                              help="Plot showing the average within cluster sum "
                                   "of squares against the number of clusters")
    elbow_parser.add_argument("--output_plots2", '-o2', required=True,
                              help="Plot showing the percentage of variance explained versus "
                                   "the number of clusters")

    silhouette_parser = subparsers.add_parser("silhouette_analysis",
                                              help="This subcommand can be used to "
                                                   "interpret the distance between clusters")
    silhouette_parser.set_defaults(func=silhouette_analysis)
    silhouette_parser.add_argument("--feature_count_table", "-c",
                                   required=True,
                                   help="Gene quantification table or "
                                        "Protein table")
    silhouette_parser.add_argument("--feature_count_start_column",
                                   "-fc", required=True,
                                   help="This parameter specify "
                                        "the number of the column "
                                        "with the first fraction", type=int)
    silhouette_parser.add_argument("--feature_count_end_column", "-fe",
                                   required=True,
                                   help="Specify the number of "
                                        "the last fraction we would "
                                        "like to consider in the"
                                        " analysis", type=int)
    silhouette_parser.add_argument("--min_number_of_clusters", "-min",
                                   required=True, type=int,
                                   help="Minimum number of clusters "
                                        "that you want to represent "
                                        "in the plot")
    silhouette_parser.add_argument("--max_number_of_clusters", "-max",
                                   required=True, type=int,
                                   help="Maximum number of clusters "
                                        "that you want to represent "
                                        "in the plot"
                                   )

    pca_parser = subparsers.add_parser("pca", help="This subcommand "
                                                   "performs the PCA-principal "
                                                   "component dimension"
                                                   " reduction")
    pca_parser.set_defaults(func=run_pca)
    pca_parser.add_argument("--feature_count_table", "-f",
                            required=True,
                            help="This parameter specify the table we "
                                 "would like to use."
                                 " It can be the normalized "
                                 "or the raw table")
    pca_parser.add_argument("--feature_count_start_column", "-fc",
                            required=True, type=int,
                            help="This parameter specify the number "
                                 "of the column with the first fraction")
    pca_parser.add_argument("--feature_count_end_column", "-fe",
                            required=True, type=int,
                            help="Specify the number of "
                                 "the last fraction we would like to consider in the"
                                 " analysis")
    pca_parser.add_argument("--srna_list_files", "-list", nargs="+",
                            help="This parameter allow the user to "
                                 "specify a list of features or "
                                 "genes we would like to highlight in"
                                 " the plot")
    pca_parser.add_argument("--cluster_names", "-names", nargs="+", default=False,
                            help="This parameter is required only if you provide "
                                 "a specific list. It allows the user to "
                                 "specify the label on the third plot")
    pca_parser.add_argument("--url_link", "-url",
                            required=False,
                            default="https://www.ncbi.nlm.nih.gov/gene/?term=@gene",
                            help="This parameter allows to choose the website"
                                 " you would like to open when clicking on a "
                                 "specific point in the html plot ")
    pca_parser.add_argument("--output_file_colorized_by_clusters", "-o1",
                            required=True,
                            help="Output plot colorized using clusters information")
    pca_parser.add_argument("--output_file_colorized_by_rna_class", "-o2",
                            required=True,
                            help="Output plot colorized using attributes "
                                 "information")
    pca_parser.add_argument("--output_file_colorized_by_lists", "-o3",
                            default=False,
                            help="Output plot colorized using a specific list")

    t_sne__parser = subparsers.add_parser("t_sne",
                                          help="This subcommand "
                                               "performs the t-sne dimension"
                                               " reduction")
    t_sne__parser.set_defaults(func=run_t_sne_colored_using_different_methods)
    t_sne__parser.add_argument("--feature_count_table", "-f", required=True,
                               help="This parameter specify the table we "
                                    "would like to use."
                                    " It can be the normalized or the raw table")
    t_sne__parser.add_argument("--feature_count_start_column", "-fc", required=True,
                               type=int,
                               help="This parameter specify the number "
                                    "of the column with the first fraction")
    t_sne__parser.add_argument("--feature_count_end_column", "-fe", required=True,
                               type=int,
                               help="Specify the number of "
                                    "the last fraction we would like to consider in the"
                                    " analysis")
    t_sne__parser.add_argument("--perplexity", "-pp", required=True, type=int,
                               default=30,
                               help="The perplexity is useful to"
                                    "balance the attention between "
                                    "the global and the  "
                                    "local aspects of data. It is better to select "
                                    " a value between 5 and 50")
    t_sne__parser.add_argument("--srna_list", "-list", nargs="+", default=False,
                               help="This parameter allows the user to "
                                    "specify a list of features or "
                                    "genes we would like to highlight in the plot")
    t_sne__parser.add_argument("--cluster_names", "-names", nargs="+", default=False,
                               help="This parameter is required only if you provide "
                                    "a specific list. It allows the user to "
                                    "specify the label on the third plot")
    t_sne__parser.add_argument("--url_link", "-url", required=False,
                               default="https://www.ncbi.nlm.nih.gov/gene/?term=@gene",
                               help="This parameter allows to choose the website"
                                    " you would like to open when clicking on a "
                                    "specific point in the html plot ")
    t_sne__parser.add_argument("--output_file1", "-o1", default=False,
                               help="Output plot colorized using clusters information")
    t_sne__parser.add_argument("--output_file2", "-o2", default=False,
                               help="Output plot colorized using attributes "
                                    "information")
    t_sne__parser.add_argument("--output_file3", "-o3", default=False,
                               help="Output plot colorized using a specific list")

    umap_parser = subparsers.add_parser("umap", help="This subcommand "
                                                     "performs the umap dimension"
                                                     " reduction")
    umap_parser.set_defaults(func=run_umap)
    umap_parser.add_argument("--feature_count_table", "-f", required=True,
                             help="This parameter specify the table we "
                                  "would like to use."
                                  " It can be the normalized or the raw table")
    umap_parser.add_argument("--feature_count_start_column", "-fc", required=True,
                             type=int,
                             help="This parameter specify the number "
                                  "of the column with the first fraction")
    umap_parser.add_argument("--feature_count_end_column", "-fe", required=True,
                             type=int,
                             help="Specify the number of "
                                  "the last fraction we would like to consider in the"
                                  " analysis")
    umap_parser.add_argument("--srna_list", "-list", nargs="+", default=False,
                             help="This parameter allows the user to "
                                  "specify a list of features or "
                                  "genes we would like to highlight in the plot")
    umap_parser.add_argument("--cluster_names", "-names", nargs="+", default=False,
                             help="This parameter is required only if you provide "
                                  "a specific list. It allows the user to "
                                  "specify the label on the third plot")
    umap_parser.add_argument("--n_neighbors", "-n_neighbors", required=False, type=int,
                             help="This parameter helps to balances local vs global "
                                  "structure in the data.",
                             default=15)
    umap_parser.add_argument("--min_dist", "-min_dist",
                             required=False, type=float,
                             help="This parameter controls how "
                                  "close are the points together."
                                  "Smaller values are useful if you want to"
                                  " use the UMAP to cluster data and larger "
                                  "values are good to preserve the overall structure",
                             default=0.1)
    umap_parser.add_argument("--url_link", "-url", required=False,
                             default="https://www.ncbi.nlm.nih.gov/gene/?term=@gene",
                             help="This parameter allows to choose the website"
                                  " you would like to open when clicking on a "
                                  "specific point in the html plot ")
    umap_parser.add_argument("--output_file1", "-o1", default=False,
                             help="Output plot colorized using clusters information")
    umap_parser.add_argument("--output_file2", "-o2", default=False,
                             help="Output plot colorized using attributes "
                                  "information")
    umap_parser.add_argument("--output_file3", "-o3", default=False,
                             help="Output plot colorized using a specific list")

    corr_rna_protein_parser = subparsers.add_parser("correlation_rnas_protein",
                                                    help="This subcommand performs the "
                                                         "Spearman or Pearson correlation "
                                                         "coefficients of two"
                                                         " tables. ")
    corr_rna_protein_parser.set_defaults(func=correlation_rnas_protein)
    corr_rna_protein_parser.add_argument("--feature_count_table", "-f",
                                         required=True, help="First table, for example"
                                                             "the sequencing table")
    corr_rna_protein_parser.add_argument("--feature_count_start_column", "-fc",
                                         required=True,
                                         type=int, help="This parameter "
                                                        "specify the number "
                                                        "of the column with the first fraction"
                                                        " in the first table")
    corr_rna_protein_parser.add_argument("--feature_count_end_column", "-fe", type=int,
                                         help="Specify the number of "
                                              "the last fraction we would like to consider in the"
                                              " analysis in the first table")
    corr_rna_protein_parser.add_argument("--protein_table", "-p", required=True,
                                         help="Second table, for example "
                                              "the protein table")
    corr_rna_protein_parser.add_argument("--protein_count_start_column", "-pc",
                                         required=True,
                                         type=int, help="This parameter "
                                                        "specify the number "
                                                        "of the column with the first fraction"
                                                        " in the second table")
    corr_rna_protein_parser.add_argument("--protein_count_end_column", "-pe", type=int,
                                         help="Specify the number of "
                                              "the last fraction we would like to consider in the"
                                              " analysis in the first table")
    corr_rna_protein_parser.add_argument("--index_sequencing", "-gene", type=str)
    corr_rna_protein_parser.add_argument("--index_protein", "-protein", type=str)
    corr_rna_protein_parser.add_argument("--correlation_type", "-corr",
                                         choices=["Pearson", "Spearman"],
                                         help="Choose if want to apply the Pearson "
                                              "or Spearman correlation")
    corr_rna_protein_parser.add_argument("--output_file", "-o", default=False,
                                         help="Output table containing "
                                              "the correlation coefficients")

    corr_distr_graph_parser = subparsers.add_parser("correlation_distribution_graph",
                                                    help="This subcommand "
                                                         "plots the distribution of the "
                                                         "correlation coefficients "
                                                         "as histogram")
    corr_distr_graph_parser.set_defaults(func=correlation_distribution_graph)
    corr_distr_graph_parser.add_argument("--table_with_correlation_coefficient", "-c",
                                         required=True,
                                         help="Table with a column containing "
                                              "the correlation "
                                              "coefficients")
    corr_distr_graph_parser.add_argument("--percentile", "-p",
                                         required=True,
                                         type=int,
                                         help="Define the percentile value",
                                         default=95)
    corr_distr_graph_parser.add_argument("--index_table", "-index",
                                         required=True,
                                         type=str)
    corr_distr_graph_parser.add_argument("--output_plot", "-o",
                                         required=True,
                                         help="Histogram with the correlation "
                                              "coefficients "
                                              "distribution ")

    network_graph_parser = subparsers.add_parser("plot_network_graph",
                                                 help="This subcommand plots "
                                                      "the network plot. It can be used "
                                                      "to plot  "
                                                      "for example sequencing "
                                                      "data vs protein data or "
                                                      "ncRNAs vs proteins etc.")
    network_graph_parser.set_defaults(func=plot_network_graph_parser_rna_protein)
    network_graph_parser.add_argument("--feature_count_table", "-f", required=True,
                                      help="Table with correlation coefficients values")
    network_graph_parser.add_argument("--index_table", "-index", required=True, type=str)
    network_graph_parser.add_argument("--threshold", "-t", required=True,
                                      type=float,
                                      help="Cut-off necessary to plot only "
                                           "the genes or proteins with an "
                                           "high correlation coefficients")
    network_graph_parser.add_argument("--max_size", "-max", required=True,
                                      type=int, help="This parameter "
                                                     "is useful to set the maximum area "
                                                     "of each point. "
                                                     "All the points are then scaled based "
                                                     "on that")
    network_graph_parser.add_argument("--output_plot", "-o",
                                      help="Network plot")

    clust_proteins_parser = subparsers.add_parser("clustering_proteins",
                                                  help="This subcommand "
                                                       "performs the unsupervised "
                                                       "clustering of protein data")
    clust_proteins_parser.set_defaults(func=clustering_proteins_data)
    clust_proteins_parser.add_argument("--feature_count_table", "-f",
                                       required=True,
                                       help="Protein table")
    clust_proteins_parser.add_argument("--feature_count_start_column", "-fc",
                                       required=True, type=int,
                                       help="This parameter specify the number "
                                            "of the column with the first fraction")
    clust_proteins_parser.add_argument("--feature_count_end_column", "-fe",
                                       required=True, type=int,
                                       help="Specify the number of "
                                            "the last fraction we would like to consider in the"
                                            " analysis")
    clust_proteins_parser.add_argument("--number_of_clusters", '-nc',
                                       required=True, type=int,
                                       help="This parameter specify "
                                            "the number of clusters, k."
                                            " It is required only "
                                            "when using k-means and "
                                            "hierarchical clustering algorithm")
    clust_proteins_parser.add_argument("--clustering_methods", "-cm",
                                       required=True,
                                       choices=["k-means", "DBSCAN",
                                                'hierarchical_clustering'],
                                       help="The user can choose between "
                                            "3 clustering  algorithm, "
                                            "k-means clustering, "
                                            "hierarchical clustering and "
                                            "DB-SCAN clustering ")
    clust_proteins_parser.add_argument("--epsilon", "-e", default=False,
                                       help="This parameter is specific for "
                                            "the DBSCAN clustering algorithm. "
                                            "It defines how close points should be "
                                            "in order to be considered part of a cluster",
                                       type=float,
                                       )
    clust_proteins_parser.add_argument("--min_samples", '-ms',
                                       default=False,
                                       help="This parameter is specific "
                                            "for the DBSCAN"
                                            "clustering algorithm and "
                                            "represent the"
                                            " minimum number of points "
                                            "necessary to form a dense region",
                                       type=int)
    clust_proteins_parser.add_argument("--output_file", "-o", required=True,
                                       help="Table with a cluster column")

    dr_protein_parser = subparsers.add_parser("dimension_reduction_proteins",
                                              help='t-sne analysis of Mass spectrometry data')
    dr_protein_parser.set_defaults(func=run_dr_proteins)
    dr_protein_parser.add_argument("--feature_count_table", "-f", required=True)
    dr_protein_parser.add_argument("--feature_count_start_column", "-fc", required=True,
                                   type=int)
    dr_protein_parser.add_argument("--feature_count_end_column", "-fe", required=True,
                                   type=int)
    dr_protein_parser.add_argument("--dimension_reduction_algorithm",
                                   "-dm", required=True,
                                   help="Specify the dimension "
                                        "reduction algorithm. The user can choose "
                                        "between t-SNE and PCA ",
                                   choices=["t-SNE", "PCA", "UMAP"], default="t-SNE"
                                   )
    dr_protein_parser.add_argument("--perplexity", "-pp",
                                   required=False, type=int)
    dr_protein_parser.add_argument("--n_neighbors", "-n_neighbors",
                                   required=False, type=float,
                                   help="This parameter helps "
                                        "to balances local vs global "
                                        "structure in the data.",
                                   default=15)
    dr_protein_parser.add_argument("--min_dist", "-min_dist", required=False,
                                   type=float,
                                   help="This parameter controls how close "
                                        "are the points together."
                                        "Smaller values are useful if you "
                                        "want to use the UMAP to "
                                        "cluster data and larger "
                                        "values are good to preserve "
                                        "the overall structure",
                                   default=0.1)
    dr_protein_parser.add_argument("--output_colored_clusters", "-o",
                                   required=True,
                                   help="output colorized using "
                                        "clusters information")

    corr_specific_gene_parser = subparsers.add_parser("correlation_specific_gene",
                                                      help="This subcommand calculate "
                                                           "the Spearman or "
                                                           "Pearson "
                                                           "correlation of a "
                                                           "specific gene or protein against all")
    corr_specific_gene_parser.set_defaults(func=run_correlation_specific_gene)
    corr_specific_gene_parser.add_argument('--feature_count_table', '-f', required=True,
                                           help="Gene quantification table or Protein table")
    corr_specific_gene_parser.add_argument("--feature_count_start_column", "-fc", required=True,
                                           help="This parameter specify the number "
                                                "of the column with the first fraction")
    corr_specific_gene_parser.add_argument("--feature_count_end_column", "-fe", type=int,
                                           help="Specify the number of "
                                                "the last fraction we would like to consider in the"
                                                " analysis")
    corr_specific_gene_parser.add_argument("--name_column_with_genes_name", "-nc",
                                           required=True,
                                           help="This parameter allows the "
                                                "user to specify the name of the "
                                                "column where we want to search "
                                                "the gene or the proteins")
    corr_specific_gene_parser.add_argument("--name", "-name", required=True,
                                           help="Name of the gene or protein "
                                                "of your interest")
    corr_specific_gene_parser.add_argument("--correlation", "-corr", required=True,
                                           help="Choose if applying the Pearson or "
                                                "Spearman correlation",
                                           choices=["Pearson", "Spearman"])
    corr_specific_gene_parser.add_argument("--output_file", '-o',
                                           help="Table with correlation coefficients "
                                                "and p-values")

    inte_tsne_plot_parser = subparsers.add_parser("interactive_plots",
                                                  help="This subcommand is useful to visualize "
                                                       "interactive a plot after "
                                                       "a dimension reduction algorithm has "
                                                       "been applied.")
    inte_tsne_plot_parser.set_defaults(func=run_interactive_tsne_plot)
    inte_tsne_plot_parser.add_argument('--table_with_clusters', '-t', required=True,
                                       help="Gene quantification table or Protein table")
    inte_tsne_plot_parser.add_argument("--feature_count_start_column", "-fc", required=True,
                                       help="This parameter specify the number "
                                            "of the column with the first fraction")
    inte_tsne_plot_parser.add_argument("--feature_count_end_column", "-fe", required=True,
                                       type=int,
                                       help="Specify the number of "
                                            "the last fraction we would like to consider in the"
                                            " analysis")
    inte_tsne_plot_parser.add_argument("--dimension_reduction_algorithm",
                                       "-dm", required=True,
                                       help="Specify the dimension reduction "
                                            "algorithm. The user can choose "
                                            "between t-SNE and PCA ",
                                       choices=["t-SNE", "PCA"], default="t-SNE")
    inte_tsne_plot_parser.add_argument("--perplexity", "-pp",
                                       required=False, type=int,
                                       default=30,
                                       help="The perplexity is useful to"
                                            "balance the attention between "
                                            "the global and the  "
                                            "local aspects of data. It is better to select "
                                            " a value between 5 and 50."
                                            "This parameter is necessary "
                                            "only if you are plotting the t-SNE "
                                            "dimension reduction")
    inte_tsne_plot_parser.add_argument("--n_neighbors", "-n_neighbors",
                                       required=False, type=float,
                                       help="This parameter helps to "
                                            "balances local vs global "
                                            "structure in the data.",
                                       default=15)
    inte_tsne_plot_parser.add_argument("--min_dist", "-min_dist",
                                       required=False, type=float,
                                       help="This parameter controls "
                                            "how close are the points together."
                                            "Smaller values are useful "
                                            "if you want to use the UMAP to "
                                            "cluster data and larger "
                                            "values are good to preserve "
                                            "the overall structure",
                                       default=0.1)
    inte_tsne_plot_parser.add_argument("--url_link", "-url",
                                       required=False,
                                       default="https://www.ncbi.nlm.nih.gov/gene/?term=@gene",
                                       help="This parameter allows to "
                                            "choose the website"
                                            " you would like to open "
                                            "when clicking on a "
                                            "specific point in the html plot ")
    inte_tsne_plot_parser.add_argument("--output_file", '-o',
                                       help="Output plot")

    corr_replicates_parser = subparsers.add_parser("correlation_replicates",
                                                   help="This subcommand allows to see the "
                                                        "distribution of the correlation "
                                                        "coefficient between two "
                                                        "biological replicates")
    corr_replicates_parser.set_defaults(func=run_replicates_correlation_sequencing)
    corr_replicates_parser.add_argument('--table_replicate1', '-r1', required=True,
                                        help="Sequencing table first replicate ")
    corr_replicates_parser.add_argument("--table_replicate2", "-r2", required=True,
                                        help="Sequencing table second replicate ")
    corr_replicates_parser.add_argument('--table_start_column' "-fc", required=True,
                                        help="This parameter specify the number "
                                             "of the column with the first fraction")
    corr_replicates_parser.add_argument('--table_end_column' "-fe", required=True,
                                        help="Specify the number of "
                                             "the last fraction we would like to "
                                             "consider in the"
                                             " analysis")
    corr_replicates_parser.add_argument("--output_table", '-o',
                                        help="Output table "
                                             "containing"
                                             " both the replicates and correlation coefficients ")
    corr_replicates_parser.add_argument("--output_figure", '-f',
                                        help="Plot that show"
                                             " a histogram with the"
                                             "distribution of"
                                             "the correlation "
                                             "coefficient")

    find_complexes_parser = subparsers.add_parser("find_complexes",
                                                  help="With this subcommand we look "
                                                       "at how many of the know protein"
                                                       "complexes are actually present "
                                                       "in our specific data sets."
                                                       "It finds if all the subunit "
                                                       "of that "
                                                       "specific complexes"
                                                       " are present and calculate"
                                                       " the correlation")
    find_complexes_parser.set_defaults(func=run_find_complexes)
    find_complexes_parser.add_argument('--tables_containing_list_complexes',
                                       '-complexes', required=True,
                                       help="Table containing the list of known complexes")
    find_complexes_parser.add_argument("--protein_table", "-p",
                                       required=True,
                                       help="Protein table ")
    find_complexes_parser.add_argument('--table_start_column', "-pc", type=int,
                                       required=True,
                                       help="This parameter specify the number "
                                            "of the column with the first "
                                            "fraction in the protein table")
    find_complexes_parser.add_argument('--table_end_column', "-pe", required=True, type=int,
                                       help="Specify the number of "
                                            "the last fraction we would like to "
                                            "consider in the"
                                            " analysis in the protein table")
    find_complexes_parser.add_argument("--output_table", '-o',
                                       help="Output table containing the "
                                            "complete complexes "
                                            "with all the complex subunits "
                                            "and correlation coefficients")

    generate_html_page_parser = subparsers.add_parser("generate_html",
                                                      help="This subcommand give to the user the possibility"
                                                           "of creating an html page containing"
                                                           "all the RNAs and proteins kinetics."
                                                      )
    generate_html_page_parser.set_defaults(func=run_generate_html)
    generate_html_page_parser.add_argument('--html_folder',
                                           '-html_folder', required=True,
                                           help="This parameter is required and has to "
                                                "be used to specify the output folder "
                                                "path")
    generate_html_page_parser.add_argument("--html_folder_gene", "-html_folder_gene",
                                           required=False,
                                           help="You need to specify the folder where you want to save the"
                                                "RNAs plots")
    generate_html_page_parser.add_argument('--html_folder_protein', "-html_folder_protein",
                                           required=False,
                                           help="You need to specify the folder where you want to save the"
                                                "proteins plots")
    generate_html_page_parser.add_argument('--rna_seq_file', "-i", required=True,
                                           help="input file containing the normalized genes ")
    generate_html_page_parser.add_argument('--name_column_rna', "-name_rna", required=True,
                                           help="name with the column that contains the gene names")
    generate_html_page_parser.add_argument('--column_start_rna', "-fc", required=True, type=int,
                                           help="Specify the number of the column with the first value")
    generate_html_page_parser.add_argument('--column_end_rna', "-fe", required=True, type=int,
                                           help="Specify the number of the column with the last value")
    generate_html_page_parser.add_argument("--protein_file", '-p',
                                           help="input file containing the normalized proteins")
    generate_html_page_parser.add_argument('--name_column_protein', "-name_protein", required=True,
                                           help="")

    generate_html_page_parser.add_argument('--column_start_protein', "-pc", required=True, type=int,
                                           help="Specify the number of the column with the first value")
    generate_html_page_parser.add_argument('--column_end_protein', "-pe", required=True, type=int,
                                           help="Specify the number of the column with the first value")

    extract_columns_parser = subparsers.add_parser("extract_gene_columns",
                                                   help="")
    extract_columns_parser.set_defaults(func=run_extract_gene_columns)
    extract_columns_parser.add_argument('--feature_count_table',
                                        '-f', required=True,
                                        help="gene quantification table")
    extract_columns_parser.add_argument("--name_columns", "-names",
                                        nargs='+',
                                        required=True,
                                        help="this parameter allows the user to specify the fields you would like to "
                                             "extract from the attribute column")
    extract_columns_parser.add_argument('--output_table', "-o",
                                        required=True,
                                        help="output table")

    merge_attributes_parser = subparsers.add_parser("merge_attributes",
                                                    help="")
    merge_attributes_parser.set_defaults(func=run_merge_attributes)
    merge_attributes_parser.add_argument('--feature_count_table',
                                         '-f', required=True,
                                         help="gene quantification table")
    merge_attributes_parser.add_argument('--output_table', "-o",
                                         required=True,
                                         help="output table")

    version_parser = subparsers.add_parser("version", help="Print version")
    version_parser.set_defaults(func=print_version)
    
    args = parser.parse_args()
    if "func" in dir(args):
        args.func(args)
    else:
        parser.print_help()


def create_project(args):
    projectcreator.create_root_folder("GRADitude")
    projectcreator.create_subfolders("GRADitude", ["input", "output"])
    projectcreator.create_version_file("GRADitude/version.txt", __version__)
    projectcreator.create_root_folder("GRADitude/subCommand")
    projectcreator.create_subfolders("GRADitude/subCommand", ["input", "output"])


def filtering_tables(args):
    min_row_sum_ercc_table.filtering_ercc_table(
        args.ref_feature_count_table,
        args.min_row_sum,
        args.filtered_ref_feature_count_table)


def run_merge_attributes(args):
    merge_exctract_attributes.merge_exctracted_attributes \
        (args.feature_count_table,
         args.output_table)


def drop_column(args):
    dropping_specific_columns.dropping_column(args.feature_count_table, args.column_to_drop,
                                              args.output_file)


def normalize_table(args):
    normalize.normalized_count_table(
        args.feature_count_table, args.feature_count_start_column,
        args.feature_count_end_column,
        args.ref_feature_count_table, args.ref_feature_count_start_column,
        args.ref_feature_count_end_column,
        args.normalized_table, args.size_factor_table)


def run_correlation_gene_gene(args):
    correlation_between_genes.correlation(args.feature_count_table,
                                          args.feature_count_start_column,
                                          args.feature_count_end_column,
                                          args.correlation_type,
                                          args.output_table)


def plot_kinetics(args):
    visualizing_kinetics.plot_kinetics(
        args.feature_count_table, args.feature_count_start_column,
        args.feature_count_end_column, args.gene_name,
        args.output_format)


def select_specific_features(args):
    selecting_ncRNAs.selecting_specific_features(args.normalized_table,
                                                 args.feature_count_start_column,
                                                 args.feature_count_end_column,
                                                 args.features, args.output_file)


def generate_k_means_clustering_elbow(args):
    elbow_curve.k_means_clustering_elbow(args.feature_count_table,
                                         args.feature_count_start_column,
                                         args.feature_count_end_column,
                                         args.min_number_of_clusters,
                                         args.max_number_of_clusters,
                                         args.output_plots1,
                                         args.output_plots2)


def silhouette_analysis(args):
    silhouette.silhouette_analysis(args.feature_count_table,
                                   args.feature_count_start_column,
                                   args.feature_count_end_column,
                                   args.min_number_of_clusters,
                                   args.max_number_of_clusters)


def run_t_sne_colored_using_different_methods(args):
    t_sne_colored_list_clustering_features.t_sne(args.feature_count_table,
                                                 args.feature_count_start_column,
                                                 args.feature_count_end_column,
                                                 args.perplexity,
                                                 args.srna_list,
                                                 args.cluster_names,
                                                 args.url_link,
                                                 args.output_file1,
                                                 args.output_file2,
                                                 args.output_file3)


def run_umap(args):
    umap_analysis.umap_(args.feature_count_table,
                        args.feature_count_start_column,
                        args.feature_count_end_column,
                        args.srna_list,
                        args.cluster_names,
                        args.n_neighbors,
                        args.min_dist,
                        args.url_link,
                        args.output_file1,
                        args.output_file2,
                        args.output_file3)


def run_pca(args):
    pca_analysis.pca_(args.feature_count_table,
                      args.feature_count_start_column,
                      args.feature_count_end_column,
                      args.srna_list_files,
                      args.cluster_names,
                      args.url_link,
                      args.output_file_colorized_by_clusters,
                      args.output_file_colorized_by_rna_class,
                      args.output_file_colorized_by_lists)


def run_scaling(args):
    scaling.scaling_(args.feature_count_table,
                     args.feature_count_start_column, args.feature_count_end_column,
                     args.pseudo_count,
                     args.scaling_method,
                     args.scaled_table)


def run_move_columns(args):
    move_columns.move_columns_(args.feature_count_table,
                               args.number_of_columns, args.output_file)


def run_robust_regression(args):
    robust_regression.robust_regression(args.ref_feature_count_table,
                                        args.concentration_table,
                                        args.number_of_outliers,
                                        args.number_of_ercc_in_common,
                                        args.used_mix,
                                        args.output_table)


def run_clustering(args):
    clustering.clustering(args.feature_count_table,
                          args.feature_count_start_column,
                          args.feature_count_end_column,
                          args.number_of_clusters,
                          args.pseudo_count, args.clustering_methods,
                          args.epsilon, args.min_samples,
                          args.scaling_method,
                          args.output_file)


def find_min_rows(args):
    min_row_sum.exclude_the_min_row_sum(args.feature_count_table,
                                        args.feature_count_start_column,
                                        args.feature_count_end_column,
                                        args.min_row,
                                        args.output_file)


def correlation_rnas_protein(args):
    correlation_rna_protein.rna_protein_correlation(args.feature_count_table,
                                                    args.feature_count_start_column,
                                                    args.feature_count_end_column,
                                                    args.protein_table,
                                                    args.protein_count_start_column,
                                                    args.protein_count_end_column,
                                                    args.index_sequencing,
                                                    args.index_protein,
                                                    args.correlation_type,
                                                    args.output_file)


def correlation_distribution_graph(args):
    distribution_correlation.d_c_graph(args.table_with_correlation_coefficient,
                                       args.percentile, args.index_table,
                                       args.output_plot)


def plot_network_graph_parser_rna_protein(args):
    plot_network_graph.plot_network_graph_rna_protein(args.feature_count_table,
                                                      args.index_table,
                                                      args.threshold,
                                                      args.max_size,
                                                      args.output_plot)


def clustering_proteins_data(args):
    clustering_proteins.clustering(args.feature_count_table,
                                   args.feature_count_start_column,
                                   args.feature_count_end_column,
                                   args.number_of_clusters,
                                   args.clustering_methods,
                                   args.epsilon, args.min_samples,
                                   args.output_file)


def run_dr_proteins(args):
    dimension_reduction_proteins.dr_proteins(args.feature_count_table,
                                             args.feature_count_start_column,
                                             args.feature_count_end_column,
                                             args.dimension_reduction_algorithm,
                                             args.perplexity, args.n_neighbors,
                                             args.min_dist,
                                             args.output_colored_clusters)


def run_correlation_specific_gene(args):
    correlation_specific_gene.corr_specific_gene_vs_all(args.feature_count_table,
                                                        args.feature_count_start_column,
                                                        args.feature_count_end_column,
                                                        args.name_column_with_genes_name,
                                                        args.name, args.correlation,
                                                        args.output_file)


def run_interactive_tsne_plot(args):
    interactive_plots.interactive_plot(args.table_with_clusters,
                                       args.feature_count_start_column,
                                       args.feature_count_end_column,
                                       args.dimension_reduction_algorithm,
                                       args.perplexity,
                                       args.n_neighbors,
                                       args.min_dist,
                                       args.url_link,
                                       args.output_file)


def plot_heatmap(args):
    heatmap.plot_heatmap(args.feature_count_table,
                         args.feature_count_start_column,
                         args.feature_count_end_column,
                         args.y_label, args.output_file)


def run_replicates_correlation_sequencing(args):
    correlation_replicates_sequencing_data.correlation_replicates_sd(args.table_replicate1,
                                                                     args.table_replicate2,
                                                                     args.table_start_column,
                                                                     args.table_end_column,
                                                                     args.output_table,
                                                                     args.output_figure)


def run_find_complexes(args):
    finding_complexes_complete.find_complexes(args.tables_containing_list_complexes,
                                              args.protein_table,
                                              args.table_start_column,
                                              args.table_end_column,
                                              args.output_table)


def normalize_table_with_one_spikein(args):
    normalize_table_spikein.normalized_count_table_spike_in(args.feature_count_table,
                                                            args.feature_count_start_column,
                                                            args.feature_count_end_column,
                                                            args.size_factors_table,
                                                            args.name_column_with_values,
                                                            args.normalized_table)


def run_generate_html(args):
    generate_html.generate_html_page(args.html_folder, args.html_folder_gene,
                                     args.html_folder_protein, args.rna_seq_file,
                                     args.name_column_rna,
                                     args.column_start_rna,
                                     args.column_end_rna,
                                     args.protein_file, args.name_column_protein,
                                     args.column_start_protein,
                                     args.column_end_protein)


def run_extract_gene_columns(args):
    extract_attribute_column.extract_columns(args.feature_count_table,
                                             args.name_columns, args.output_table)


def run_merge_features(args):
    merge_features.merge_features_(args.feature_count_table,
                                   args.output_file)


def run_finder_spikein(args):
    size_factor.size_factor_extraction(args.ref_feature_count_table,
                                       args.size_factors_table)

def print_version(args):
    print(__version__)
    
main()
