sugar._io.gff module

Generic feature format (GFF) and Gene transfer format (GTF) IO

For a review of the different versions of GFF and GTF, see here.

The readers in this module also support older versions of the GFF format.

sugar._io.gff.is_fts_gff(f, **kw)
sugar._io.gff.is_fts_gtf(f, **kw)[source]
sugar._io.gff.is_gff(f, **kw)[source]
sugar._io.gff.read_fts_gff(f, **kw)[source]

Read a GFF file and return FeatureList

Parameters:
  • filt (list) – Return only Features of given ftypes, default: all

  • filt_fast (str) – Read only lines which include this string

  • default_ftype (str) – default ftype for entries without type

  • comments (list) – comments inside the file are stored in the comments list (optional)

  • gff_version (str) – The GFF version of the file, one of '1', '2', '3', by default it is auto-detected from the header

Warning

This function should NOT be called directly, it registers via read_fts(), call this instead.

sugar._io.gff.read_fts_gtf(f, **kw)[source]

Read a GTF file and return FeatureList

Parameters:
  • filt (list) – Return only Features of given ftypes, default: all

  • filt_fast (str) – Read only lines which include this string

  • default_ftype (str) – default ftype for entries without type

  • comments (list) – comments inside the file are stored in the comments list (optional)

Note

The GTF reader is experimental. Alternatively, convert your file to GFF using AGAT and read that instead.

Warning

This function should NOT be called directly, it registers via read_fts(), call this instead.

sugar._io.gff.read_gff(f, **kw)[source]

Read sequences and their features from GFF file

Parameters:

**kw – All kwargs are passed to read_fts_gff()

Warning

This function should NOT be called directly, it registers via read() and iter_(), call this instead.

sugar._io.gff.write_fts_gff(fts, f, **kw)[source]

Write features to GFF file

Parameters:
  • header_sugar (bool) – Add a comment to the header with sugar version, default is True

  • header (str) – Optionally write additional header at the top of file

Warning

This function should NOT be called directly, it registers via FeatureList.write(), call this instead.

sugar._io.gff.write_fts_gtf(fts, f, **kw)[source]

Write features to GTF file

Parameters:
  • header_sugar (bool) – Add a comment to the header with sugar version, default is True

  • header (str) – Optionally write additional header at the top of file

Note

The GTF writer is experimental. For complicated files use the GFF format and convert with AGAT.

Warning

This function should NOT be called directly, it registers via FeatureList.write(), call this instead.

sugar._io.gff.write_gff(seqs, f, **kw)[source]

Write sequences and their features to GFF file using a FASTA directive

Parameters:

**kw – All kwargs are passed to write_fts_gff()

Warning

This function should NOT be called directly, it registers via BioBasket.write(), call this instead.