gffutils.interface.FeatureDB.bed12

FeatureDB.bed12(feature, block_featuretype=['exon'], thick_featuretype=['CDS'], thin_featuretype=None, name_field='ID', color=None)[source]

Converts feature into a BED12 format.

GFF and GTF files do not necessarily define genes consistently, so this method provides flexiblity in specifying what to call a “transcript”.

Parameters:
  • feature (str or Feature instance) – In most cases, this feature should be a transcript rather than a gene.

  • block_featuretype (str or list) –

    Which featuretype to use as the exons. These are represented as blocks in the BED12 format. Typically ‘exon’.

    Use the thick_featuretype and thin_featuretype arguments to control the display of CDS as thicker blocks and UTRs as thinner blocks.

    Note that the features for thick or thin are not automatically included in the blocks; if you do want them included, then those featuretypes should be added to this block_features list.

    If no child features of type block_featuretype are found, then the full feature is returned in BED12 format as if it had a single exon.

  • thick_featuretype (str or list) –

    Child featuretype(s) to use in order to determine the boundaries of the “thick” blocks. In BED12 format, these represent coding sequences; typically this would be set to “CDS”. This argument is mutually exclusive with thin_featuretype.

    Specifically, the BED12 thickStart will be the start coord of the first thick item and the thickEnd will be the stop coord of the last thick item.

  • thin_featuretype (str or list) –

    Child featuretype(s) to use in order to determine the boundaries of the “thin” blocks. In BED12 format, these represent untranslated regions. Typically “utr” or [‘three_prime_UTR’, ‘five_prime_UTR’]. Mutually exclusive with thick_featuretype.

    Specifically, the BED12 thickStart field will be the stop coord of the first thin item and the thickEnd field will be the start coord of the last thin item.

  • name_field (str) – Which attribute of feature to use as the feature’s name. If this field is not present, a “.” placeholder will be used instead.

  • color (None or str) – If None, then use black (0,0,0) as the RGB color; otherwise this should be a comma-separated string of R,G,B values each of which are integers in the range 0-255.