g2gtools.g2g module

class g2gtools.g2g.G2GFormatter(fmt='[g2gtools] %(msg)s')[source]

Bases: logging.Formatter

dbg_fmt = '[g2gtools debug] %(msg)s'
err_fmt = '[g2gtools] %(msg)s'
format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

info_fmt = '[g2gtools] %(msg)s'
class g2gtools.g2g.Region(seq_id, start=None, end=None, strand='+', name=None, original_base=0)[source]

Bases: object

end
get_start()[source]
start
str()[source]
strand
g2gtools.g2g.configure_logging(level)[source]
Parameters:level – 0=ERROR, 1=INFO, 2+=DEBUG
g2gtools.g2g.exit(message='', parser=None)[source]

Print message, help, and exit.

Parameters:
  • message – The message to print
  • parser – the argument parser
g2gtools.g2g.get_logger()[source]

Get the logger :return: logger object

g2gtools.g2g.get_multiplier(factor)[source]

Convert the factor into a number.

Parameters:factor – the string ‘mb’, ‘m’, or ‘k’
Returns:10000000, 1000000, 1000 or 1
g2gtools.g2g.parse_region(location_str, base=0, name=None)[source]

Parse a string and return a location.

Format expected is seqid|start|end, where | is some sort of delimiter.

If end is None, 1 based was requested.

Parameters:
  • location_str – a string representing a genomic location
  • base – a number 0 or 1
Returns:

a Region