acidgenomes.make_granges_from_gff

acidgenomes.make_granges_from_gff(file: str | Path, *, level: Literal['genes', 'transcripts', 'exons'] = 'genes', ignore_version: bool = False, extra_mcols: bool = False) GenomicRanges

Parse a GFF3 or GTF file into a BiocPy GenomicRanges object.

Automatically detects the annotation provider (Ensembl, GENCODE, RefSeq, UCSC, FlyBase, WormBase) from directives and filename, then applies provider-specific extraction and post-processing.

Parameters:
  • file (str or Path) – Path to a GFF3 or GTF file (plain or gzip-compressed).

  • level ({"genes", "transcripts", "exons"}) – Feature level to extract.

  • ignore_version (bool) – If True, strip version suffixes from identifiers (e.g. ENSG00000000003.14ENSG00000000003). If False (default), the primary identifier column contains the versioned form and the unversioned form is stored in a *_no_version column.

  • extra_mcols (bool) – If True, add broad_class annotations and (for Ensembl/GENCODE) fetch additional metadata from Ensembl FTP.

Returns:

BiocPy GenomicRanges object with feature metadata in mcols and file metadata attached to the object’s metadata attribute.

Return type:

GenomicRanges

Raises:

ValueError – If the file is not a supported GFF format or provider cannot be detected.