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
TsvSystemSerializer
- class macsypy.serialization.TsvSystemSerializer[source]
Handle System serialization in tsv format
- serialize(system, hit_system_tracker)[source]
:param
macsypy.system.System
system: The system to serialize. :param hit_system_tracker: The hit_system_tracker which allow to know for each hitin 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, sol_id, hit_system_tracker)[source]
- Parameters:
solution (list of
macsypy.system.System
object) – the solution to serializesol_id (int) – the solution identifier
hit_system_tracker (
macsypy.system.HitSystemTracker
object) –
- 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 identified the different solutions.
TsvLikelySystemSerializer
- class macsypy.serialization.TsvLikelySystemSerializer[source]
Handle potential System from unordered replicon serialization in tsv format
- serialize(system, hit_system_tracker)[source]
- :param
macsypy.system.LikelySystem
system: The likely system to serialize. Use only for unordered db-type
- Parameters:
hit_system_tracker (
macsypy.system.HitSystemTracker
object) – 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
- :param
TsvRejectedCandidatesSerializer
- class macsypy.serialization.TsvRejectedCandidatesSerializer[source]
Serialize Rejected Cluster in tsv format
- __weakref__
list of weak references to the object (if defined)
- serialize(candidates)[source]
- Parameters:
candidates ([
macsypy.system.RejectedCandidate
object, …]) – list of rejected candidates to serialize
TsvSpecialHitSerializer
- class macsypy.serialization.TsvSpecialHitSerializer[source]
Serialize special hits:
macsypy.hit.Loner
andmacsypy.hit.MultiSystem
in tsv format- __weakref__
list of weak references to the object (if defined)
- serialize(best_hits)[source]
- Parameters:
best_hits (sequence of
macsypy.hit.Loner
ormacsypy.hit.MultiSystem
objects) – the special hits to serialized
TxtSystemSerializer
TxtLikelySystemSerializer
- class macsypy.serialization.TxtLikelySystemSerializer[source]
Handle System serialization in text
- serialize(system, hit_system_tracker)[source]
- :param
macsypy.system.LikelySystem
system: The likely system to serialize. Use only for unordered db-type
- Parameters:
hit_system_tracker (
macsypy.system.HitSystemTracker
object) – 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
- :param
TxtUnikelySystemSerializer
- class macsypy.serialization.TxtUnikelySystemSerializer[source]
Handle System serialization in text
- serialize(system)[source]
- Parameters:
system (
macsypy.system.UnlikelySystem
object) – The unlikely system to serialize. (used only if db-type is “unordered_replicon”)- Returns:
a string representation of system readable by human