rnalysis.filtering.FoldChangeFilter.annotate_from_gtf

FoldChangeFilter.annotate_from_gtf(gtf_path: str | Path, attribute: Literal['gene_biotype', 'transcript_biotype', 'biotype', 'gene_name', 'gene_id', 'transcript_id', 'chromosome', 'source', 'strand'] | str = 'gene_biotype', feature_type: Literal['gene', 'transcript'] = 'gene', column_name: str | None = None, inplace: bool = True)

Adds a new column to the table, annotating each feature with the value of a GTF/GFF attribute (for example: the biotype, chromosome, strand, or source of each gene). Features that are not found in the annotation file are annotated with a missing value.

Parameters:
  • gtf_path (str or Path) – Path to your GTF/GFF annotation file. The file should match the type of gene names/IDs you use in your table.

  • attribute (str (default='gene_biotype')) – name of the attribute to annotate with. Standard column-9 attributes (such as ‘gene_biotype’, ‘gene_name’, or any custom key in your file) are supported, as well as the reserved names ‘chromosome’, ‘source’ and ‘strand’, which are read from the fixed columns of the annotation file.

  • feature_type ('gene' or 'transcript' (default='gene')) – determines whether the features/rows in your data table describe individual genes or transcripts.

  • column_name (str or None (default=None)) – the name of the new annotation column. If not specified, the attribute name is used. If a column with this name already exists in the table, it will be overwritten.

  • inplace (bool (default=True)) – If True (default), the annotation column will be added to the current Filter object. If False, the function will return a new Filter instance and the current instance will not be affected.

Returns:

If ‘inplace’ is False, returns a new and annotated instance of the Filter object.