kb_python.gtf

Module Contents

Classes

GTF

Utility class to easily read and parse GTF files.

kb_python.gtf.logger
class kb_python.gtf.GTF(gtf_path)

Utility class to easily read and parse GTF files.

Parameters

gtf_path (str) – path to GTF file

PARSER
GROUP_PARSER
static parse_entry(line)

Parse a single GTF entry.

Parameters

line (str) – a line in the GTF file

Returns

parsed GTF information

Return type

dict

entries(self)

Generator that yields one GTF entry at a time.

Returns

a generator that yields a dict of the GTF entry

Return type

generator

sort(self, out_path)

Sort the GTF file by chromosome, start position, line number.

Parameters

out_path (str) – path to generate the sorted GTF

Returns

path to sorted GTF file, set of chromosomes in GTF file

Return type

tuple