def _build_option_parser(): defaults = LogoOptions() parser = DeOptionParser( usage="%prog [options] < sequence_data.fa > sequence_logo.eps", description=description, version=release_description, add_verbose_options=False) io_grp = OptionGroup( parser, "Input/Output Options", ) data_grp = OptionGroup( parser, "Logo Data Options", ) trans_grp = OptionGroup(parser, "Transformations", "Optional transformations of the sequence data.") format_grp = OptionGroup( parser, "Logo Format Options", "These options control the format and display of the logo.") color_grp = OptionGroup( parser, "Color Options", "Colors can be specified using CSS2 syntax. e.g. 'red', '#FF0000', etc." ) advanced_grp = OptionGroup( parser, "Advanced Format Options", "These options provide fine control over the display of the logo. ") server_grp = OptionGroup(parser, "WebLogo Server", "Run a standalone webserver on a local port.") parser.add_option_group(io_grp) parser.add_option_group(data_grp) parser.add_option_group(trans_grp) parser.add_option_group(format_grp) parser.add_option_group(color_grp) parser.add_option_group(advanced_grp) parser.add_option_group(server_grp) # ========================== IO OPTIONS ========================== io_grp.add_option("-f", "--fin", dest="fin", action="store", type="file_in", default=None, help="Sequence input file (default: stdin)", metavar="FILENAME") # Add position weight matrix formats to input parsers by hand fin_choices = dict(seq_io.format_names()) fin_choices['transfac'] = 'transfac' io_grp.add_option( "-D", "--datatype", dest="input_parser", action="store", type="dict", default=seq_io, choices=fin_choices, # seq_io.format_names(), help= "Type of multiple sequence alignment or position weight matrix file: (%s, transfac)" % ', '.join([f.names[0] for f in seq_io.formats]), metavar="FORMAT") io_grp.add_option("-o", "--fout", dest="fout", type="file_out", default=sys.stdout, help="Output file (default: stdout)", metavar="FILENAME") io_grp.add_option( "-F", "--format", dest="formatter", action="store", type="dict", choices=formatters, metavar="FORMAT", help= "Format of output: eps (default), png, png_print, pdf, jpeg, svg, logodata", default=default_formatter) # ========================== Data OPTIONS ========================== data_grp.add_option( "-A", "--sequence-type", dest="alphabet", action="store", type="dict", choices=std_alphabets, help="The type of sequence data: 'protein', 'rna' or 'dna'.", metavar="TYPE") data_grp.add_option( "-a", "--alphabet", dest="alphabet", action="store", help="The set of symbols to count, e.g. 'AGTC'. " "All characters not in the alphabet are ignored. " "If neither the alphabet nor sequence-type are specified then weblogo will examine the input data and make an educated guess. " "See also --sequence-type, --ignore-lower-case") data_grp.add_option( "-U", "--units", dest="unit_name", action="store", choices=std_units.keys(), type="choice", default=defaults.unit_name, help= "A unit of entropy ('bits' (default), 'nats', 'digits'), or a unit of free energy ('kT', 'kJ/mol', 'kcal/mol'), or 'probability' for probabilities", metavar="NUMBER") data_grp.add_option( "", "--composition", dest="composition", action="store", type="string", default="auto", help= "The expected composition of the sequences: 'auto' (default), 'equiprobable', 'none' (do not perform any compositional adjustment), a CG percentage, a species name (e.g. 'E. coli', 'H. sapiens'), or an explicit distribution (e.g. \"{'A':10, 'C':40, 'G':40, 'T':10}\"). The automatic option uses a typical distribution for proteins and equiprobable distribution for everything else. ", metavar="COMP.") data_grp.add_option( "", "--weight", dest="weight", action="store", type="float", default=None, help="The weight of prior data. Default depends on alphabet length", metavar="NUMBER") data_grp.add_option( "-i", "--first-index", dest="first_index", action="store", type="int", default=1, help="Index of first position in sequence data (default: 1)", metavar="INDEX") data_grp.add_option("-l", "--lower", dest="logo_start", action="store", type="int", help="Lower bound of sequence to display", metavar="INDEX") data_grp.add_option("-u", "--upper", dest="logo_end", action="store", type="int", help="Upper bound of sequence to display", metavar="INDEX") # ========================== Transformation OPTIONS ========================== # FIXME Add test? trans_grp.add_option( "", "--ignore-lower-case", dest="ignore_lower_case", action="store_true", default=False, help= "Disregard lower case letters and only count upper case letters in sequences." ) trans_grp.add_option( "", "--reverse", dest="reverse", action="store_true", default=False, help="reverse sequences", ) trans_grp.add_option( "", "--complement", dest="complement", action="store_true", default=False, help="complement DNA sequences", ) # ========================== FORMAT OPTIONS ========================== format_grp.add_option( "-s", "--size", dest="stack_width", action="store", type="dict", choices=std_sizes, metavar="LOGOSIZE", default=defaults.stack_width, help="Specify a standard logo size (small, medium (default), large)") format_grp.add_option( "-n", "--stacks-per-line", dest="stacks_per_line", action="store", type="int", help="Maximum number of logo stacks per logo line. (default: %default)", default=defaults.stacks_per_line, metavar="COUNT") format_grp.add_option("-t", "--title", dest="logo_title", action="store", type="string", help="Logo title text.", default=defaults.logo_title, metavar="TEXT") format_grp.add_option("", "--label", dest="logo_label", action="store", type="string", help="A figure label, e.g. '2a'", default=defaults.logo_label, metavar="TEXT") format_grp.add_option( "-X", "--show-xaxis", action="store", type="boolean", default=defaults.show_xaxis, metavar="YES/NO", help="Display sequence numbers along x-axis? (default: %default)") format_grp.add_option("-x", "--xlabel", dest="xaxis_label", action="store", type="string", default=defaults.xaxis_label, help="X-axis label", metavar="TEXT") format_grp.add_option( "", "--annotate", dest="annotate", action="store", type="string", default=None, help= "A comma separated list of custom stack annotations, e.g. '1,3,4,5,6,7'. Annotation list must be same length as sequences.", metavar="TEXT") format_grp.add_option( "-S", "--yaxis", dest="yaxis_scale", action="store", type="float", help= "Height of yaxis in units. (Default: Maximum value with uninformative prior.)", metavar="UNIT") format_grp.add_option( "-Y", "--show-yaxis", action="store", type="boolean", dest="show_yaxis", default=defaults.show_yaxis, metavar="YES/NO", help="Display entropy scale along y-axis? (default: %default)") format_grp.add_option( "-y", "--ylabel", dest="yaxis_label", action="store", type="string", help="Y-axis label (default depends on plot type and units)", metavar="TEXT") format_grp.add_option( "-E", "--show-ends", action="store", type="boolean", default=defaults.show_ends, metavar="YES/NO", help="Label the ends of the sequence? (default: %default)") format_grp.add_option("-P", "--fineprint", dest="fineprint", action="store", type="string", default=defaults.fineprint, help="The fine print (default: weblogo version)", metavar="TEXT") format_grp.add_option("", "--ticmarks", dest="yaxis_tic_interval", action="store", type="float", default=defaults.yaxis_tic_interval, help="Distance between ticmarks (default: %default)", metavar="NUMBER") format_grp.add_option("", "--errorbars", dest="show_errorbars", action="store", type="boolean", default=defaults.show_errorbars, metavar="YES/NO", help="Display error bars? (default: %default)") format_grp.add_option( "", "--reverse-stacks", dest="reverse_stacks", action="store", type="boolean", default=defaults.show_errorbars, metavar="YES/NO", help="Draw stacks with largest letters on top? (default: %default)") # ========================== Color OPTIONS ========================== # TODO: Future Feature # color_grp.add_option( "-K", "--color-key", # dest= "show_color_key", # action="store", # type = "boolean", # default= defaults.show_color_key, # metavar = "YES/NO", # help="Display a color key (default: %default)") color_scheme_choices = std_color_schemes.keys() color_scheme_choices.sort() color_grp.add_option( "-c", "--color-scheme", dest="color_scheme", action="store", type ="dict", choices = std_color_schemes, metavar = "SCHEME", default = None, # Auto help="Specify a standard color scheme (%s)" % \ ", ".join(color_scheme_choices) ) color_grp.add_option( "-C", "--color", dest="colors", action="append", metavar="COLOR SYMBOLS DESCRIPTION ", nargs=3, default=[], help= "Specify symbol colors, e.g. --color black AG 'Purine' --color red TC 'Pyrimidine' " ) color_grp.add_option("", "--default-color", dest="default_color", action="store", metavar="COLOR", default=defaults.default_color, help="Symbol color if not otherwise specified.") # ========================== Advanced options ========================= advanced_grp.add_option("-W", "--stack-width", dest="stack_width", action="store", type="float", default=defaults.stack_width, help="Width of a logo stack (default: %s)" % defaults.stack_width, metavar="POINTS") advanced_grp.add_option( "", "--aspect-ratio", dest="stack_aspect_ratio", action="store", type="float", default=defaults.stack_aspect_ratio, help="Ratio of stack height to width (default: %s)" % defaults.stack_aspect_ratio, metavar="POINTS") advanced_grp.add_option("", "--box", dest="show_boxes", action="store", type="boolean", default=False, metavar="YES/NO", help="Draw boxes around symbols? (default: no)") advanced_grp.add_option( "", "--resolution", dest="resolution", action="store", type="float", default=96, help= "Bitmap resolution in dots per inch (DPI). (Default: 96 DPI, except png_print, 600 DPI) Low resolution bitmaps (DPI<300) are antialiased.", metavar="DPI") advanced_grp.add_option( "", "--scale-width", dest="scale_width", action="store", type="boolean", default=True, metavar="YES/NO", help= "Scale the visible stack width by the fraction of symbols in the column? (I.e. columns with many gaps of unknowns are narrow.) (Default: yes)" ) advanced_grp.add_option( "", "--debug", action="store", type="boolean", default=defaults.debug, metavar="YES/NO", help="Output additional diagnostic information. (Default: %default)") # ========================== Server options ========================= server_grp.add_option( "", "--serve", dest="serve", action="store_true", default=False, help="Start a standalone WebLogo server for creating sequence logos.") server_grp.add_option( "", "--port", dest="port", action="store", type="int", default=8080, help="Listen to this local port. (Default: %default)", metavar="PORT") return parser
def _build_option_parser() : defaults = LogoOptions() parser = DeOptionParser(usage="%prog [options] < sequence_data.fa > sequence_logo.eps", description = description, version = release_description, add_verbose_options = False ) io_grp = OptionGroup(parser, "Input/Output Options",) data_grp = OptionGroup(parser, "Logo Data Options",) trans_grp = OptionGroup(parser, "Transformations", "Optional transformations of the sequence data.") format_grp = OptionGroup(parser, "Logo Format Options", "These options control the format and display of the logo.") color_grp = OptionGroup(parser, "Color Options", "Colors can be specified using CSS2 syntax. e.g. 'red', '#FF0000', etc.") advanced_grp = OptionGroup(parser, "Advanced Format Options", "These options provide fine control over the display of the logo. ") server_grp = OptionGroup(parser, "WebLogo Server", "Run a standalone webserver on a local port.") parser.add_option_group(io_grp) parser.add_option_group(data_grp) parser.add_option_group(trans_grp) parser.add_option_group(format_grp) parser.add_option_group(color_grp) parser.add_option_group(advanced_grp) parser.add_option_group(server_grp) # ========================== IO OPTIONS ========================== io_grp.add_option( "-f", "--fin", dest="fin", action="store", type="file_in", default=None, help="Sequence input file (default: stdin)", metavar="FILENAME") # Add position weight matrix formats to input parsers by hand fin_choices = dict(seq_io.format_names()) fin_choices['transfac'] = 'transfac' io_grp.add_option("-D", "--datatype", dest="input_parser", action="store", type ="dict", default = seq_io, choices = fin_choices, # seq_io.format_names(), help="Type of multiple sequence alignment or position weight matrix file: (%s, transfac)" % ', '.join([ f.names[0] for f in seq_io.formats]), metavar="FORMAT") io_grp.add_option("-o", "--fout", dest="fout", type="file_out", default=sys.stdout, help="Output file (default: stdout)", metavar="FILENAME") io_grp.add_option( "-F", "--format", dest="formatter", action="store", type="dict", choices = formatters, metavar= "FORMAT", help="Format of output: eps (default), png, png_print, pdf, jpeg, svg, logodata", default = default_formatter) # ========================== Data OPTIONS ========================== data_grp.add_option( "-A", "--sequence-type", dest="alphabet", action="store", type="dict", choices = std_alphabets, help="The type of sequence data: 'protein', 'rna' or 'dna'.", metavar="TYPE") data_grp.add_option( "-a", "--alphabet", dest="alphabet", action="store", help="The set of symbols to count, e.g. 'AGTC'. " "All characters not in the alphabet are ignored. " "If neither the alphabet nor sequence-type are specified then weblogo will examine the input data and make an educated guess. " "See also --sequence-type, --ignore-lower-case" ) data_grp.add_option( "-U", "--units", dest="unit_name", action="store", choices = std_units.keys(), type="choice", default = defaults.unit_name, help="A unit of entropy ('bits' (default), 'nats', 'digits'), or a unit of free energy ('kT', 'kJ/mol', 'kcal/mol'), or 'probability' for probabilities", metavar = "NUMBER") data_grp.add_option( "", "--composition", dest="composition", action="store", type="string", default = "auto", help="The expected composition of the sequences: 'auto' (default), 'equiprobable', 'none' (do not perform any compositional adjustment), a CG percentage, a species name (e.g. 'E. coli', 'H. sapiens'), or an explicit distribution (e.g. \"{'A':10, 'C':40, 'G':40, 'T':10}\"). The automatic option uses a typical distribution for proteins and equiprobable distribution for everything else. ", metavar="COMP.") data_grp.add_option( "", "--weight", dest="weight", action="store", type="float", default = None, help="The weight of prior data. Default depends on alphabet length", metavar="NUMBER") data_grp.add_option( "-i", "--first-index", dest="first_index", action="store", type="int", default = 1, help="Index of first position in sequence data (default: 1)", metavar="INDEX") data_grp.add_option( "-l", "--lower", dest="logo_start", action="store", type="int", help="Lower bound of sequence to display", metavar="INDEX") data_grp.add_option( "-u", "--upper", dest="logo_end", action="store", type="int", help="Upper bound of sequence to display", metavar="INDEX") # ========================== Transformation OPTIONS ========================== # FIXME Add test? trans_grp.add_option( "", "--ignore-lower-case", dest="ignore_lower_case", action="store_true", default=False, help="Disregard lower case letters and only count upper case letters in sequences." ) trans_grp.add_option( "", "--reverse", dest="reverse", action="store_true", default=False, help="reverse sequences", ) trans_grp.add_option( "", "--complement", dest="complement", action="store_true", default=False, help="complement DNA sequences", ) # ========================== FORMAT OPTIONS ========================== format_grp.add_option( "-s", "--size", dest="stack_width", action="store", type ="dict", choices = std_sizes, metavar = "LOGOSIZE", default = defaults.stack_width, help="Specify a standard logo size (small, medium (default), large)" ) format_grp.add_option( "-n", "--stacks-per-line", dest="stacks_per_line", action="store", type="int", help="Maximum number of logo stacks per logo line. (default: %default)", default = defaults.stacks_per_line, metavar="COUNT") format_grp.add_option( "-t", "--title", dest="logo_title", action="store", type="string", help="Logo title text.", default = defaults.logo_title, metavar="TEXT") format_grp.add_option( "", "--label", dest="logo_label", action="store", type="string", help="A figure label, e.g. '2a'", default = defaults.logo_label, metavar="TEXT") format_grp.add_option( "-X", "--show-xaxis", action="store", type = "boolean", default= defaults.show_xaxis, metavar = "YES/NO", help="Display sequence numbers along x-axis? (default: %default)") format_grp.add_option( "-x", "--xlabel", dest="xaxis_label", action="store", type="string", default = defaults.xaxis_label, help="X-axis label", metavar="TEXT") format_grp.add_option( "", "--annotate", dest="annotate", action="store", type="string", default = None, help="A comma separated list of custom stack annotations, e.g. '1,3,4,5,6,7'. Annotation list must be same length as sequences.", metavar="TEXT") format_grp.add_option( "-S", "--yaxis", dest="yaxis_scale", action="store", type="float", help="Height of yaxis in units. (Default: Maximum value with uninformative prior.)", metavar = "UNIT") format_grp.add_option( "-Y", "--show-yaxis", action="store", type = "boolean", dest = "show_yaxis", default= defaults.show_yaxis, metavar = "YES/NO", help="Display entropy scale along y-axis? (default: %default)") format_grp.add_option( "-y", "--ylabel", dest="yaxis_label", action="store", type="string", help="Y-axis label (default depends on plot type and units)", metavar="TEXT") format_grp.add_option( "-E", "--show-ends", action="store", type = "boolean", default= defaults.show_ends, metavar = "YES/NO", help="Label the ends of the sequence? (default: %default)") format_grp.add_option( "-P", "--fineprint", dest="fineprint", action="store", type="string", default= defaults.fineprint, help="The fine print (default: weblogo version)", metavar="TEXT") format_grp.add_option( "", "--ticmarks", dest="yaxis_tic_interval", action="store", type="float", default= defaults.yaxis_tic_interval, help="Distance between ticmarks (default: %default)", metavar = "NUMBER") format_grp.add_option( "", "--errorbars", dest = "show_errorbars", action="store", type = "boolean", default= defaults.show_errorbars, metavar = "YES/NO", help="Display error bars? (default: %default)") format_grp.add_option( "", "--reverse-stacks", dest = "reverse_stacks", action="store", type = "boolean", default= defaults.show_errorbars, metavar = "YES/NO", help="Draw stacks with largest letters on top? (default: %default)") # ========================== Color OPTIONS ========================== # TODO: Future Feature # color_grp.add_option( "-K", "--color-key", # dest= "show_color_key", # action="store", # type = "boolean", # default= defaults.show_color_key, # metavar = "YES/NO", # help="Display a color key (default: %default)") color_scheme_choices = std_color_schemes.keys() color_scheme_choices.sort() color_grp.add_option( "-c", "--color-scheme", dest="color_scheme", action="store", type ="dict", choices = std_color_schemes, metavar = "SCHEME", default = None, # Auto help="Specify a standard color scheme (%s)" % \ ", ".join(color_scheme_choices) ) color_grp.add_option( "-C", "--color", dest="colors", action="append", metavar="COLOR SYMBOLS DESCRIPTION ", nargs = 3, default=[], help="Specify symbol colors, e.g. --color black AG 'Purine' --color red TC 'Pyrimidine' ") color_grp.add_option( "", "--default-color", dest="default_color", action="store", metavar="COLOR", default= defaults.default_color, help="Symbol color if not otherwise specified.") # ========================== Advanced options ========================= advanced_grp.add_option( "-W", "--stack-width", dest="stack_width", action="store", type="float", default= defaults.stack_width, help="Width of a logo stack (default: %s)"% defaults.stack_width, metavar="POINTS" ) advanced_grp.add_option( "", "--aspect-ratio", dest="stack_aspect_ratio", action="store", type="float", default= defaults.stack_aspect_ratio , help="Ratio of stack height to width (default: %s)"%defaults.stack_aspect_ratio, metavar="POINTS" ) advanced_grp.add_option( "", "--box", dest="show_boxes", action="store", type = "boolean", default=False, metavar = "YES/NO", help="Draw boxes around symbols? (default: no)") advanced_grp.add_option( "", "--resolution", dest="resolution", action="store", type="float", default=96, help="Bitmap resolution in dots per inch (DPI). (Default: 96 DPI, except png_print, 600 DPI) Low resolution bitmaps (DPI<300) are antialiased.", metavar="DPI") advanced_grp.add_option( "", "--scale-width", dest="scale_width", action="store", type = "boolean", default= True, metavar = "YES/NO", help="Scale the visible stack width by the fraction of symbols in the column? (I.e. columns with many gaps of unknowns are narrow.) (Default: yes)") advanced_grp.add_option( "", "--debug", action="store", type = "boolean", default= defaults.debug, metavar = "YES/NO", help="Output additional diagnostic information. (Default: %default)") # Additional options by Omar Wagih advanced_grp.add_option( "", "--rotate-numbers", dest="rotate_numbers", action="store", type = "boolean", default= False, metavar = "YES/NO", help="Rotate numbers on xaxis? (default: no)") advanced_grp.add_option( "", "--tic-length", dest="tic_length", action="store", type="float", default= 5, help="Length of tics (default: 5)", metavar = "NUMBER") # ========================== Server options ========================= server_grp.add_option( "", "--serve", dest="serve", action="store_true", default= False, help="Start a standalone WebLogo server for creating sequence logos.") server_grp.add_option( "", "--port", dest="port", action="store", type="int", default= 8080, help="Listen to this local port. (Default: %default)", metavar="PORT") return parser
def _build_option_parser(): defaults = LogoOptions() parser = DeOptionParser( usage="%prog [options] < sequence_data.fa > sequence_logo.eps", description=description, version=release_description, add_verbose_options=False, ) io_grp = OptionGroup(parser, "Input/Output Options") data_grp = OptionGroup(parser, "Logo Data Options") heat_grp = OptionGroup( parser, "Heat Map Options", "These options affect the format of the sequence logo in the heat map mode (See also Color Options).", ) color_grp = OptionGroup( parser, "Color Options", "Colors can be specified using CSS2 syntax. e.g. 'red', '#FF0000', etc (See also Heat Map Options).", ) trans_grp = OptionGroup(parser, "Transformations", "Optional transformations of the sequence data.") format_grp = OptionGroup( parser, "Logo Format Options", "These options control the format and display of the sequence logo." ) advanced_grp = OptionGroup( parser, "Advanced Format Options", "These options provide fine control over the display of the sequence logo." ) server_grp = OptionGroup(parser, "HeatLogo Server", "Run a standalone webserver on a local port.") parser.add_option_group(io_grp) parser.add_option_group(data_grp) parser.add_option_group(heat_grp) parser.add_option_group(color_grp) parser.add_option_group(trans_grp) parser.add_option_group(format_grp) parser.add_option_group(advanced_grp) parser.add_option_group(server_grp) # ========================== IO OPTIONS ========================== io_grp.add_option( "-i", "--input", dest="fin", action="store", type="file_in", default=None, help="Sequence input file (default: stdin)", metavar="FILENAME", ) # Add position weight matrix formats to input parsers by hand fin_choices = dict(seq_io.format_names()) fin_choices["transfac"] = "transfac" formatters_string = formatters.keys() io_grp.add_option( "-f", "--input-format", dest="input_parser", action="store", type="dict", default=seq_io, choices=fin_choices, # seq_io.format_names(), help="Type of multiple sequence alignment or position weight matrix file: (%s, transfac)" % ", ".join([f.names[0] for f in seq_io.formats]), metavar="FORMAT", ) io_grp.add_option( "-o", "--output", dest="fout", type="file_out", default=sys.stdout, help="Output file (default: stdout)", metavar="FILENAME", ) io_grp.add_option( "-F", "--output-format", dest="formatter", action="store", type="dict", metavar="FORMAT", choices=formatters, help="Format of output: eps (default), png, png_print, pdf, jpeg, svg, logodata", default=default_formatter, ) io_grp.add_option( "", "--pwm-prob", dest="pwm_prob", action="store", type="string", metavar="FILENAME", default=None, help="Output position weight matrix composed of logarithmic probabilities", ) io_grp.add_option( "", "--pwm-pval", dest="pwm_pval", action="store", type="string", metavar="FILENAME", default=None, help="Output position weight matrix of P-values", ) # ========================== Data OPTIONS ========================== data_grp.add_option( "-A", "--sequence-type", dest="alphabet", action="store", type="dict", choices=std_alphabets, help="The type of sequence data: 'protein', 'rna', 'dna', or 'codon' (See also: --codon-frame).", metavar="TYPE", ) data_grp.add_option( "-a", "--alphabet", dest="alphabet", action="store", help="The set of symbols to count, e.g. 'AGTC'. All characters not in the alphabet are ignored. If neither the alphabet nor sequence-type are specified then heatlogo will examine the input data and make an educated guess. (See also: --sequence-type, --ignore-lower-case)", ) data_grp.add_option( "-R", "--codon-frame", dest="codon_frame", action="store", type="int", default=defaults.codon_frame, help="Codon reading frame (default: +1): [+1, +2, +3] indicate the forward strand frame, and [-1, -2, -3] indicate the reverse strand frame", metavar="NUMBER", ) data_grp.add_option( "-b", "--composition", dest="composition", action="store", type="string", default="auto", help="The expected composition of the sequences. HeatLogo accepts four types of formats: (1) String: 'auto' (default), 'equiprobable', or 'none' (do not perform any compositional adjustment, Heatmap: off). The automatic option uses a typical distribution for proteins and equiprobable distribution for everything else. (2) CG percentage. (3) Explicit distribution of bases, amino acids, or codons (format: \"{'A':10, 'C':40, 'G':40, 'T':10}\"). (4) Tab-delimited file containing each symbol and its expected composition in each line.", metavar="COMP.", ) data_grp.add_option( "-w", "--weight", dest="weight", action="store", type="float", default=None, help="The weight of prior data. Default depends on alphabet length", metavar="NUMBER", ) data_grp.add_option( "-N", "--second-data", dest="second_data", action="store", type="file_in", default=None, help="Second dataset file to compare with the input. HeatLogo measures statistical significance at each column by comparing the number of symbols appered in input and second datasets. Accepted formats: %s." % ", ".join([f.names[0] for f in seq_io.formats]), metavar="FILENAME", ) data_grp.add_option( "-B", "--second-composition", dest="second_composition", action="store", type="string", default="auto", help="The expected composition of the second sample sequences. The supported formats are the same as those of '--composition'.", metavar="2nd-COMP.", ) data_grp.add_option( "-W", "--second-weight", dest="second_weight", action="store", type="float", default=None, help="The prior weight for the second dataset. Default depends on alphabet length", metavar="NUMBER", ) data_grp.add_option( "-U", "--units", dest="unit_name", action="store", choices=std_units.keys(), type="choice", default=defaults.unit_name, help="A unit of entropy ('bits' (default), 'nats', 'digits'), or a unit of free energy ('kT', 'kJ/mol', 'kcal/mol'), or 'probability' for probabilities", metavar="NUMBER", ) # ======================== Heat Map OPTIONS ========================= stats_choices = stats_tests.keys() stats_choices.sort() heat_grp.add_option( "-S", "--stats-test", dest="stats_func", action="store", type="dict", choices=stats_tests, metavar="TEST", default=defaults.stats_func, help="Specify a statistical test to calculate p-values: %s (default: t-test)" % ", ".join(stats_choices), ) heat_color_choices = heat_color_schemes.keys() heat_color_choices.sort() heat_grp.add_option( "-H", "--heat-scheme", dest="heat_scheme", action="store", type="dict", choices=heat_color_schemes, metavar="SCHEME", default=defaults.heat_scheme, help="Specify a heatmap color scheme (%s) (See also: '--p-color')" % ", ".join(heat_color_choices), ) heat_grp.add_option( "", "--p-color", dest="p_colors", action="append", metavar="COLOR PVALUE", nargs=2, default=[], help="Specify a color for a p-value (p-value range: -1 < p < 1), e.g. --p-color blue 0.5 --p-color red 0.25", ) heat_grp.add_option( "", "--hide-colorkey", dest="show_colorkey", action="store_false", default=True, help="Toggle switch to hide a heatmap color key on the right side of a sequence logo (default: off)", ) # ========================== Color OPTIONS ========================== color_scheme_choices = std_color_schemes.keys() color_scheme_choices.sort() color_grp.add_option( "-C", "--color-scheme", dest="color_scheme", action="store", type="dict", choices=std_color_schemes, metavar="SCHEME", default=None, # Auto help="Specify a standard color scheme (%s) (Heatmap: off)" % ", ".join(color_scheme_choices), ) color_grp.add_option( "", "--c-color", dest="colors", action="append", metavar="COLOR SYMBOLS DESCRIPTION ", nargs=3, default=[], help="Specify symbol colors, e.g. --c-color black AG 'Purine' --c-color red TC 'Pyrimidine', (Heatmap: off)", ) color_grp.add_option( "", "--default-color", dest="default_color", action="store", metavar="COLOR", default=defaults.default_color, help="Symbol color if not otherwise specified.", ) # ========================== Transformation OPTIONS ========================== # FIXME Add test? trans_grp.add_option( "", "--ignore-lower-case", dest="ignore_lower_case", action="store_true", default=False, help="Disregard lower case letters and only count upper case letters in sequences.", ) trans_grp.add_option("", "--reverse", dest="reverse", action="store_true", default=False, help="reverse sequences") trans_grp.add_option( "", "--complement", dest="complement", action="store_true", default=False, help="complement DNA sequences" ) # ========================== FORMAT OPTIONS ========================== format_grp.add_option( "-I", "--first-index", dest="first_index", action="store", type="int", default=1, help="Index of first position in sequence data (default: 1)", metavar="INDEX", ) format_grp.add_option( "-s", "--start", dest="logo_start", action="store", type="int", help="Lower bound (i.e. start position) of sequence to display", metavar="INDEX", ) format_grp.add_option( "-e", "--end", dest="logo_end", action="store", type="int", help="Upper bound (i.e. end position) of sequence to display", metavar="INDEX", ) format_grp.add_option( "-L", "--size", dest="stack_width", action="store", type="dict", choices=std_sizes, metavar="LOGOSIZE", default=defaults.stack_width, help="Specify a standard logo size (small, medium (default), large)", ) format_grp.add_option( "-n", "--stacks-per-line", dest="stacks_per_line", action="store", type="int", help="Maximum number of logo stacks per logo line. (default: %default)", default=defaults.stacks_per_line, metavar="COUNT", ) format_grp.add_option( "-t", "--title", dest="logo_title", action="store", type="string", help="Logo title text.", default=defaults.logo_title, metavar="TEXT", ) format_grp.add_option( "-l", "--label", dest="logo_label", action="store", type="string", help="A figure label, e.g. '2a'", default=defaults.logo_label, metavar="TEXT", ) format_grp.add_option( "-X", "--show-xaxis", action="store", type="boolean", default=defaults.show_xaxis, metavar="YES/NO", help="Display sequence numbers along x-axis? (default: %default)", ) format_grp.add_option( "-x", "--xlabel", dest="xaxis_label", action="store", type="string", default=defaults.xaxis_label, help="X-axis label", metavar="TEXT", ) format_grp.add_option( "", "--annotate", dest="annotate", action="store", type="string", default=None, help="A comma separated list of custom stack annotations, e.g. '1,3,4,5,6,7'. Annotation list must be same length as sequences.", metavar="TEXT", ) format_grp.add_option( "-M", "--yaxis", dest="yaxis_scale", action="store", type="float", help="Height of yaxis in units. (Default: Maximum value with uninformative prior.)", metavar="UNIT", ) format_grp.add_option( "-Y", "--show-yaxis", action="store", type="boolean", dest="show_yaxis", default=defaults.show_yaxis, metavar="YES/NO", help="Display entropy scale along y-axis? (default: %default)", ) format_grp.add_option( "-y", "--ylabel", dest="yaxis_label", action="store", type="string", help="Y-axis label (default depends on plot type and units)", metavar="TEXT", ) format_grp.add_option( "-E", "--show-ends", action="store", type="boolean", default=defaults.show_ends, metavar="YES/NO", help="Label the ends of the sequence? (default: %default)", ) format_grp.add_option( "-P", "--fineprint", dest="fineprint", action="store", type="string", default=defaults.fineprint, help="The fine print (default: heatlogo version)", metavar="TEXT", ) format_grp.add_option( "", "--ticmarks", dest="yaxis_tic_interval", action="store", type="float", default=defaults.yaxis_tic_interval, help="Distance between ticmarks (default: %default)", metavar="NUMBER", ) format_grp.add_option( "", "--errorbars", dest="show_errorbars", action="store", type="boolean", default=defaults.show_errorbars, metavar="YES/NO", help="Display error bars? (default: %default)", ) format_grp.add_option( "", "--reverse-stacks", dest="reverse_stacks", action="store", type="boolean", default=defaults.show_errorbars, metavar="YES/NO", help="Draw stacks with largest letters on top? (default: %default)", ) # ========================== Advanced options ========================= advanced_grp.add_option( "-k", "--stack-width", dest="stack_width", action="store", type="float", default=defaults.stack_width, help="Width of a logo stack (default: %s)" % defaults.stack_width, metavar="POINTS", ) advanced_grp.add_option( "", "--aspect-ratio", dest="stack_aspect_ratio", action="store", type="float", default=defaults.stack_aspect_ratio, help="Ratio of stack height to width (default: %s)" % defaults.stack_aspect_ratio, metavar="POINTS", ) advanced_grp.add_option( "", "--box", dest="show_boxes", action="store", type="boolean", default=False, metavar="YES/NO", help="Draw boxes around symbols? (default: no)", ) advanced_grp.add_option( "", "--resolution", dest="resolution", action="store", type="float", default=96, help="Bitmap resolution in dots per inch (DPI). (Default: 96 DPI, except png_print, 600 DPI) Low resolution bitmaps (DPI<300) are antialiased.", metavar="DPI", ) advanced_grp.add_option( "", "--scale-width", dest="scale_width", action="store", type="boolean", default=True, metavar="YES/NO", help="Scale the visible stack width by the fraction of symbols in the column? (i.e. columns with many gaps of unknowns are narrow.) (Default: yes)", ) # ========================== Server options ========================= server_grp.add_option( "", "--serve", dest="serve", action="store_true", default=False, help="Start a standalone HeatLogo server for creating sequence logos.", ) server_grp.add_option( "", "--port", dest="port", action="store", type="int", default=8080, help="Listen to this local port. (Default: %default)", metavar="PORT", ) return parser