serialization

This module is a technical module where we can find the different way to serialize the results:

  • the Systems found

  • The best solutions (best combination of systems)

  • The rejected candidates

SystemSerializer

class macsypy.serialization.SystemSerializer[source]

handle the different way to serialize a system

__weakref__

list of weak references to the object (if defined)

TsvSystemSerializer

class macsypy.serialization.TsvSystemSerializer[source]

Handle System serialization in tsv format

serialize(system: System, hit_system_tracker: HitSystemTracker) str[source]

:param macsypy.system.System system: The system to serialize. :param hit_system_tracker: The hit_system_tracker which allow to know for each hit

in which system it is implied.

Returns:

a serialisation of this system in tabulated separated value format each line represent a hit and have the following structure:

replicon\thit_id\tgene_name\thit_pos\tmodel_fqn\tsys_id\tsys_loci\tlocus_num\tsys_wholeness\tsys_score
\tsys_occ\thit_gene_ref.alternate_of\thit_status\thit_seq_len\thit_i_eval\thit_score\thit_profile_cov
\thit_seq_cov\tit_begin_match\thit_end_match\tcounterpart\tused_in_systems
Return type:

str

TsvSolutionSerializer

class macsypy.serialization.TsvSolutionSerializer[source]

Handle Solution (list of Systems) serialization in tsv format

__weakref__

list of weak references to the object (if defined)

serialize(solution: Solution, sol_id: int, hit_system_tracker: HitSystemTracker) str[source]
Parameters:
  • solution – the solution to serialize

  • sol_id – the solution identifier

  • hit_system_tracker

Returns:

a serialisation of this solution (a list of systems) in tabulated separated value format each line represent a hit and have the same structure as system serialization macsypy.serialization.TsvSystemSerializer.serialize() but with an extra column sol_id which is a technical id to identify the different solutions.

TsvLikelySystemSerializer

class macsypy.serialization.TsvLikelySystemSerializer[source]

Handle potential System from unordered replicon serialization in tsv format

serialize(system: LikelySystem, hit_system_tracker: HitSystemTracker) str[source]
Parameters:
  • system – The likely system to serialize. Used only for unordered db-type

  • hit_system_tracker – The hit_system_tracker which allow to know for each hit in which system it is implied.

Returns:

a serialisation of this system in tabulated separated value format each line represent a hit and have the following structure:

replicon\thit_id\tgene_name\thit_pos\tmodel_fqn\tsys_id\tsys_wholeness
\thit_gene_ref.alternate_of\thit_status\thit_seq_len\thit_i_eval\thit_score\thit_profile_cov
\thit_seq_cov\tit_begin_match\thit_end_match\t$used_in_systems
Return type:

str

TsvRejectedCandidatesSerializer

class macsypy.serialization.TsvRejectedCandidatesSerializer[source]

Serialize Rejected Cluster in tsv format

__weakref__

list of weak references to the object (if defined)

serialize(candidates: list[RejectedCandidate]) str[source]
Parameters:

candidates – list of rejected candidates to serialize

TsvSpecialHitSerializer

class macsypy.serialization.TsvSpecialHitSerializer[source]

Serialize special hits: macsypy.hit.Loner and macsypy.hit.MultiSystem in tsv format

__weakref__

list of weak references to the object (if defined)

serialize(best_hits: Iterable[Loner] | Iterable[MultiSystem])[source]
Parameters:

best_hits (sequence of macsypy.hit.Loner or macsypy.hit.MultiSystem objects) – the special hits to serialized

TxtSystemSerializer

class macsypy.serialization.TxtSystemSerializer[source]

Handle System serialization in text

serialize(system: System, hit_system_tracker: HitSystemTracker) str[source]
Returns:

a string representation of system readable by human

TxtLikelySystemSerializer

class macsypy.serialization.TxtLikelySystemSerializer[source]

Handle System serialization in text

serialize(system: LikelySystem, hit_system_tracker: HitSystemTracker)[source]
Parameters:
  • system – The likely system to serialize. Used only for unordered db-type

  • hit_system_tracker – The hit_system_tracker which allow to know for each hit in which system it is implied.

Returns:

a string representation of system readable by human

TxtUnikelySystemSerializer

class macsypy.serialization.TxtUnikelySystemSerializer[source]

Handle System serialization in text

serialize(system: UnlikelySystem) str[source]
Parameters:

system – The unlikely system to serialize. (used only if db-type is “unordered_replicon”)

Returns:

a string representation of system readable by human