biocantor.io.gff3.writer

Functions for writing GFF3. Capable of writing GFF3 + FASTA.

Module Contents

Functions

collection_to_gff3(collections, gff3_handle[, ...])

Take an instantiated AnnotationCollection and produce a GFF3 file. Has the

biocantor.io.gff3.writer.collection_to_gff3(collections: Iterable[inscripta.biocantor.gene.collections.AnnotationCollection], gff3_handle: TextIO, add_sequences: Optional[bool] = False, ordered: Optional[bool] = True, chromosome_relative_coordinates: Optional[bool] = True, raise_on_reserved_attributes: Optional[bool] = True)

Take an instantiated AnnotationCollection and produce a GFF3 file. Has the capability to write GFF3+FASTA format, but the necessary information must be present.

Parameters
  • collections – Iterable of AnnotationCollections. If add_sequences is True, then the collection must have instantiated sequences.

  • gff3_handle – Open file handle to write GFF3 file to.

  • add_sequences – If set to True, the collections must have sequence information. The GFF3 written will have the FASTA sequence at the end of it.

  • ordered – If set to True, the output GFF3 will be sequence then position sorted.

  • chromosome_relative_coordinates – Output GFF in chromosome-relative coordinates? If add_sequences is True, will raise an exception because the full chromosome sequence is not known.

  • raise_on_reserved_attributes – If True, then GFF3 reserved attributes such as ID and Name present in the qualifiers will lead to an exception and not a warning.

Raises
  • GFF3ExportException – If chromosome_relative_coordinates and add_sequences are True, but one or more of the collections are in chunk-relative coordinates.

  • GFF3ExportException – If add_sequences is True but no sequences are associated with one or more collections.