panorama package#
Subpackages#
- panorama.alignment package
- Submodules
- panorama.alignment.align module
AlignmentConfigAlignmentErrorAlignmentValidationError_execute_alignment()_validate_alignment_parameters()_validate_directory_access()align_db()align_pangenomes()align_pangenomes_pair()all_against_all_align()check_align_parameters()check_pangenome_align()inter_pangenome_align()launch()launch_pangenomes_alignment()merge_aln_res()parser_align()parser_mmseqs2_align()subparser()write_alignment()
- panorama.alignment.cluster module
ClusteringConfigClusteringErrorClusteringMethodClusteringValidationError_execute_cluster()_execute_clustering_command()_execute_linclust()_prepare_mmseqs2_options()_validate_clustering_parameters()_validate_directory_access()check_cluster_parameters()check_pangenome_cluster()cluster_gene_families()cluster_launcher()create_tsv()launch()linclust_launcher()parser_cluster()parser_mmseqs2_cluster()subparser()write_clustering()
- panorama.alignment.utils module
- Module contents
- panorama.annotate package
- Submodules
- panorama.annotate.annotate module
annot_pangenomes()annot_pangenomes_with_hmm()check_annotate_args()check_pangenome_annotation()get_k_best_hit()keep_best_hit()launch()parser_annot()parser_annot_hmm()read_families_metadata()read_families_metadata_mp()remove_redundant_annotation()subparser()write_annotations_to_pangenome()write_annotations_to_pangenomes()
- panorama.annotate.hmm_search module
- Module contents
- panorama.compare package
- Submodules
- panorama.compare.context module
check_context_comparison()clean_context_objects()compare_gene_contexts_graph_mp()compare_gene_contexts_on_cluster_families()compare_pair_of_context_graphs()compare_pair_of_contexts()compute_CCC()context_comparison()create_metanodes()get_connected_components()get_conserved_genomics_contexts()get_contexts_from_result()get_gene_contexts_from_results_mp()get_multigraph_edges()get_shortest_path_edges_cc_strategy()launch()launch_compare_pair_of_context_graphs()launch_context_comparison()launch_ppanggolin_context()make_gene_context_from_context_graph()make_gene_context_from_context_table()parse_context_results()parser_comparison_context()pass_graph_attribute_to_multigraph()subparser()write_context_summary()
- panorama.compare.spots module
add_systems_info()check_compare_spots_args()check_pangenome_cs()compare_spots()compute_gfrr_edges()create_pangenome_spots_graph()create_pangenome_system_graph()create_spots_graph()create_systems_graph()graph_systems_link_with_conserved_spots()launch()parser_comparison_spots()subparser()write_conserved_spots()
- panorama.compare.systems module
SystemsComparisonErroradd_system_metadata_to_graph()check_compare_systems_args()compare_systems()compute_gfrr_edges()create_pangenome_system_graph()create_pangenome_systems_heatmaps()create_systems_graph()generate_heatmap()get_pangenomes_to_systems_data()launch()parser_comparison_systems()subparser()write_conserved_systems()
- panorama.compare.utils module
- Module contents
- panorama.format package
- Submodules
- panorama.format.read_binaries module
- panorama.format.write_binaries module
- panorama.format.write_flat module
- panorama.format.write_proksee module
- Module contents
- panorama.info package
- Submodules
- panorama.info.info module
HTMLExporterHTMLExporter.__init__()HTMLExporter._create_boolean_filters()HTMLExporter._create_column_visibility_control()HTMLExporter._create_download_button()HTMLExporter._create_filter_button()HTMLExporter._create_range_sliders()HTMLExporter._layout_content_components()HTMLExporter._load_js_file()HTMLExporter._rename_content_columns()HTMLExporter._reorder_content_columns()HTMLExporter._save_html()HTMLExporter._setup_slider_callbacks()HTMLExporter._unpack_content_dict()HTMLExporter._validate_js_files()HTMLExporter.export_content()HTMLExporter.export_status()
PangenomeInfoExtractorcheck_info_args()export_info()launch()parser_info()subparser()
- Module contents
- panorama.systems package
- Submodules
- panorama.systems.detection module
check_detection_args()check_for_forbidden_unit()check_for_needed_units()check_pangenome_detection()get_functional_unit_gene_families()get_subcombinations()get_system_unit_combinations()launch()parser_detection()search_for_system()search_system()search_system_units()search_systems()search_systems_in_pangenomes()search_unit_in_cc()search_unit_in_combination()search_unit_in_context()subparser()write_systems_to_pangenome()write_systems_to_pangenomes()
- panorama.systems.dictionary_validation_utils module
- panorama.systems.models module
FamilyFuncUnitFuncUnit.nameFuncUnit.presenceFuncUnit.mandatoryFuncUnit.accessoryFuncUnit.forbiddenFuncUnit.neutralFuncUnit.min_mandatoryFuncUnit.min_totalFuncUnit.same_strandFuncUnit.transitivityFuncUnit.windowFuncUnit.duplicateFuncUnit.exchangeableFuncUnit.multi_systemFuncUnit.multi_modelFuncUnit.__init__()FuncUnit.add()FuncUnit.check_func_unit()FuncUnit.duplicate_fam()FuncUnit.familiesFuncUnit.families_names()FuncUnit.get()FuncUnit.modelFuncUnit.read()FuncUnit.size
ModelModel.nameModel.mandatoryModel.accessoryModel.forbiddenModel.neutralModel.min_mandatoryModel.min_totalModel.transitivityModel.windowModel.same_strandModel.canonicalModel.__init__()Model.add()Model.check_model()Model.duplicate_fu()Model.familiesModel.func_unitsModel.func_units_names()Model.get()Model.read()Model.read_model()Model.size
Models_BasicFeatures_FuFamFeatures_ModFuFeatures_ModFuFeatures.mandatory_ModFuFeatures.min_mandatory_ModFuFeatures.accessory_ModFuFeatures.min_total_ModFuFeatures.forbidden_ModFuFeatures.neutral_ModFuFeatures.same_strand_ModFuFeatures.__init__()_ModFuFeatures._check()_ModFuFeatures._child_names()_ModFuFeatures._duplicate()_ModFuFeatures._mk_child_getter()_ModFuFeatures.add()_ModFuFeatures.child_type_ModFuFeatures.get()
check_dict()check_key()check_parameters()
- panorama.systems.parameter_validation_utils module
- panorama.systems.system module
ClusterSystemsSystemSystem.IDSystem.modelSystem.sourceSystem.canonicalSystem.pangenomeSystem.cluster_idSystem.__delitem__()System.__eq__()System.__getitem__()System.__hash__()System.__init__()System.__len__()System.__repr__()System.__setitem__()System._mk_fam2unit()System.add_canonical()System.add_unit()System.annotation_sources()System.canonical_models()System.familiesSystem.get_metainfo()System.get_module()System.get_region()System.get_spot()System.get_unit()System.intersection()System.is_subset()System.is_superset()System.merge()System.model_familiesSystem.model_organismsSystem.modulesSystem.nameSystem.number_of_familiesSystem.number_of_model_gene_familiesSystem.organismsSystem.regionsSystem.spotsSystem.units
SystemUnitSystemUnit.IDSystemUnit.sourceSystemUnit.__eq__()SystemUnit.__getitem__()SystemUnit.__hash__()SystemUnit.__init__()SystemUnit.__len__()SystemUnit.__repr__()SystemUnit.__setitem__()SystemUnit._asso_modules()SystemUnit._get_model_families()SystemUnit._make_spot_getter()SystemUnit.add_family()SystemUnit.add_module()SystemUnit.add_region()SystemUnit.add_spot()SystemUnit.annotation_sources()SystemUnit.difference()SystemUnit.familiesSystemUnit.functional_unitSystemUnit.get_metainfo()SystemUnit.get_module()SystemUnit.get_region()SystemUnit.get_spot()SystemUnit.hash_content()SystemUnit.intersection()SystemUnit.is_subset()SystemUnit.is_superset()SystemUnit.merge()SystemUnit.modelSystemUnit.model_familiesSystemUnit.model_organismsSystemUnit.modulesSystemUnit.nameSystemUnit.nb_model_familiesSystemUnit.nb_organismsSystemUnit.organismsSystemUnit.regionsSystemUnit.spotsSystemUnit.symmetric_difference()SystemUnit.system
check_instance_of_system()check_instance_of_system_unit()
- panorama.systems.systems_association module
AssociationVisualizationBuilderAssociationVisualizationBuilder.associationAssociationVisualizationBuilder.__init__()AssociationVisualizationBuilder._configure_plot_style()AssociationVisualizationBuilder._create_metric_plot()AssociationVisualizationBuilder.create_bar_plots()AssociationVisualizationBuilder.create_color_bar()AssociationVisualizationBuilder.create_color_palette()AssociationVisualizationBuilder.create_coverage_plot()AssociationVisualizationBuilder.create_frequency_plot()AssociationVisualizationBuilder.create_main_figure()AssociationVisualizationBuilder.plot()
_get_element_frequency()_get_region_frequency()create_coverage_dataframe()create_pangenome_system_associations()get_association_dataframes()preprocess_association_data()process_system()write_correlation_matrix_visualization()
- panorama.systems.systems_partitions module
SystemsPartitionVisualizerSystemsPartitionVisualizer.partitionsSystemsPartitionVisualizer.partition2colorSystemsPartitionVisualizer.mapperSystemsPartitionVisualizer.__init__()SystemsPartitionVisualizer.create_bar_plots()SystemsPartitionVisualizer.create_color_bar()SystemsPartitionVisualizer.create_left_bar()SystemsPartitionVisualizer.create_main_figure()SystemsPartitionVisualizer.plot()
preprocess_data()preprocess_partition_data()systems_partition()
- panorama.systems.systems_projection module
_custom_agg()compute_gene_components()compute_genes_graph()custom_agg()custom_agg_unique()eliminate_empty()eliminate_systems()extract_numeric_for_sorting()get_org_df()get_org_df_one_unit_per_fam()get_partition()has_short_path()project_pangenome_systems()project_unit_on_organisms()system_projection()unit_projection()write_projection_systems()
- panorama.systems.utils module
VisualizationBuilderVisualizationBuilder.BELOW_HEIGHTVisualizationBuilder.CENTER_WIDTHVisualizationBuilder.DEFAULT_FORMATVisualizationBuilder.LEFT_WIDTHVisualizationBuilder.MIDDLE_HEIGHTVisualizationBuilder.OUTPUT_FORMATSVisualizationBuilder.PNG_EXPORT_HEIGHTVisualizationBuilder.PNG_EXPORT_WIDTHVisualizationBuilder.RIGHT_WIDTHVisualizationBuilder.TOP_HEIGHTVisualizationBuilder.TOTAL_HEIGHTVisualizationBuilder.TOTAL_WIDTHVisualizationBuilder.__init__()VisualizationBuilder._configure_bar_plot_style()VisualizationBuilder._configure_minimal_plot()VisualizationBuilder._configure_plot_style()VisualizationBuilder._create_main_figure()VisualizationBuilder._save_figure()VisualizationBuilder.color_barVisualizationBuilder.create_left_bar_plot()VisualizationBuilder.create_main_figure()VisualizationBuilder.create_top_bar_plot()VisualizationBuilder.glyphVisualizationBuilder.glyph_rendererVisualizationBuilder.left_barVisualizationBuilder.main_plotVisualizationBuilder.plot()VisualizationBuilder.top_bar
check_for_families()check_needed_families()conciliate_partition()dict_families_context()filter_global_context()filter_local_context()filter_local_context_old()get_gfs_matrix_combination()get_metadata_to_families()
- panorama.systems.write_systems module
- Module contents
- panorama.utility package
- panorama.workflow package
Submodules#
panorama.geneFamily module#
This module provides classes to represent gene families and study them
- class panorama.geneFamily.Akin(identifier: int, reference: GeneFamily, *gene_families: GeneFamily)#
Bases:
objectRepresents a group of gene families that are similar across multiple pangenomes.
- ID#
The identifier of the Akin instance.
- Type:
int
- reference#
The reference gene family name.
- Type:
str
- _families#
A dictionary of gene families in the Akin group.
- Type:
dict
- __getitem__(name: str) GeneFamily#
Retrieves a GeneFamily from the Akin group by name.
- Parameters:
name (str) – The name of the GeneFamily to retrieve.
- Returns:
GeneFamily – The GeneFamily instance with the specified name.
- Raises:
KeyError – If the GeneFamily with the given name does not exist in the Akin group.
- __init__(identifier: int, reference: GeneFamily, *gene_families: GeneFamily) None#
Initializes an Akin instance.
- Parameters:
identifier (int) – The identifier of the Akin instance.
reference (GeneFamily) – The reference GeneFamily instance.
*gene_families (GeneFamily) – Additional GeneFamily instances to add.
- __setitem__(name: str, family: GeneFamily)#
Adds a GeneFamily to the Akin group.
- Parameters:
name (str) – The name of the GeneFamily.
family (GeneFamily) – The GeneFamily instance to add.
- Raises:
KeyError – If the GeneFamily with the given name already exists in the Akin group.
- add(family: GeneFamily)#
Adds a GeneFamily to the Akin group.
- Parameters:
family (GeneFamily) – The GeneFamily instance to add.
- Raises:
AssertionError – If the provided family is not a GeneFamily instance.
- get(name: str) GeneFamily#
Retrieves a GeneFamily from the Akin group by name.
- Parameters:
name (str) – The name of the GeneFamily to retrieve.
- Returns:
GeneFamily – The GeneFamily instance with the specified name.
- class panorama.geneFamily.GeneFamily(family_id: int, name: str)#
Bases:
GeneFamilyRepresents a single gene family. It is a node in the pangenome graph and is aware of its genes and edges.
- name#
The name of the gene family to be printed in output files.
- Type:
str
- _hmm#
The HMM associated with the gene family.
- Type:
HMM, optional
- profile#
The profile associated with the gene family.
- Type:
optional
- optimized_profile#
The optimized profile for the gene family.
- Type:
optional
- _units_getter#
A dictionary to retrieve system units.
- Type:
dict
- _systems_getter#
A dictionary to retrieve systems.
- Type:
dict
- property HMM: HMM#
Gets the HMM associated with the GeneFamily.
- Returns:
HMM – The HMM associated with the GeneFamily.
- __eq__(other: GeneFamily) bool#
Checks if two GeneFamily instances are equal based on their genes.
- Parameters:
other (GeneFamily) – Another GeneFamily instance to compare.
- Returns:
bool – True if the GeneFamily instances are equal, False otherwise.
- Raises:
TypeError – If the other object is not a GeneFamily instance.
- __hash__() int#
Returns the hash of the GeneFamily instance.
- Returns:
int – The hash value of the GeneFamily instance.
- __init__(family_id: int, name: str)#
Initializes a GeneFamily instance.
- Parameters:
family_id (int) – The internal identifier of the gene family.
name (str) – The name of the gene family.
- __ne__(other: GeneFamily) bool#
Checks if two GeneFamily instances are not equal.
- Parameters:
other (GeneFamily) – Another GeneFamily instance to compare.
- Returns:
bool – True if the GeneFamily instances are not equal, False otherwise.
- __repr__() str#
Returns a string representation of the GeneFamily instance.
- Returns:
str – The string representation of the GeneFamily instance.
- _getattr_from_ppanggolin(family: GeneFamily)#
Copies attributes from a PPanGGOLiN GeneFamily instance to a PANORAMA GeneFamily instance.
- Parameters:
family (Fam) – A PPanGGOLiN GeneFamily instance.
- property akin: Akin#
Gets the akin families associated with other pangenomes.
- Returns:
Akin – The akin families.
- Raises:
KeyError – If no akin families are assigned.
- is_multigenic() bool#
Checks whether the GeneFamily is multigenic.
- Returns:
bool – True if the GeneFamily is multigenic, False otherwise.
- is_multigenic_in_org(organism: Organism) bool#
Checks whether the GeneFamily is multigenic in a specific organism.
- Parameters:
organism (Organism) – The organism to check.
- Returns:
bool – True if the GeneFamily is multigenic in the organism, False otherwise.
- property module#
Return module belonging to the family
- Returns:
panorama.region.Module – module belonging to the family
- static recast(family: GeneFamily) GeneFamily#
Recasts a PPanGGOLiN GeneFamily into a PANORAMA GeneFamily.
- Parameters:
family (Fam) – A PPanGGOLiN GeneFamily instance.
- Returns:
GeneFamily – The recast PANORAMA GeneFamily instance.
panorama.main module#
The script serves as the entry point for the Panorama software, a bioinformatics tool for analyzing pangenomes. It provides a command-line interface for various functionalities such as annotation, system detection, alignment, comparison, formatting, and utility workflows.
The script constructs a comprehensive command-line utility with subcommands and their corresponding options, encompassing bioinformatic tools ranging from annotations to workflows. A help system is embedded to guide users through the available subcommands and their usage.
- members:
- undoc-members:
- show-inheritance:
panorama.pangenomes module#
This module provides classes to represent a pangenome or a set of pangenomes
- class panorama.pangenomes.Pangenome(name, taxid: int = None)#
Bases:
PangenomeThis is a class representing pangenome based on PPanGGOLLiN class. It is used as a basic unit for all the analysis to access to the different elements of your pangenome, such as organisms, contigs, genes or gene families. This class provides some more methods needed to analyze pangenome.
- Parameters:
name – Name of the pangenome
- __init__(name, taxid: int = None)#
Constructor method.
- _create_gene_family(name: str) GeneFamily#
Creates a gene family object with the given
name- Parameters:
name – The name to give to the gene family. Must not exist already.
- Returns:
GeneFamily – The created GeneFamily object
- add_file(pangenome_file: Path, check_version: bool = True)#
Links an HDF5 file to the pan.
If needed elements will be loaded from this file, and anything that is computed will be saved to this file when
ppanggolin.formats.writeBinaries.writePangenome()is called.- Parameters:
pangenome_file – A string representing the filepath to the hdf5 pan file to be either used or created
check_version – Check ppanggolin version of the pangenome file to be compatible with the current version of ppanggolin being used.
- Raises:
AssertionError – If the
pangenome_fileis not an instance of the Path classTypeError – If the
pangenome_fileis not a HDF5 format file
- add_gene_family(family: GeneFamily | GeneFamily)#
Adds a gene family to the pangenome
- Parameters:
family (Union[GeneFamily, Fam]) – GeneFamily object to add
- add_spot(spot: Spot)#
Adds the given iterable of spots to the pangenome.
- Parameters:
spot – Spot which should be added
- Raises:
AssertionError – Error if spot is not a Spot object
KeyError – Error if another Spot exist in pangenome with the same identifier
- add_system(system: System)#
Add a detected system to the pangenome.
- Parameters:
system (System) – Detected system to be added.
- property gene_families: Generator[GeneFamily, None, None]#
Returns all the gene families in the pangenome
- Returns:
Generator[GeneFamily, None, None] – Generator of gene families
- get_gene_family(name: str) GeneFamily | None#
Get the gene family by its name in the pangenome
- Parameters:
name – Name of the gene family to get
- Returns:
Union[GeneFamily, None] – The desired gene family
- get_system(system_id: str) System#
Get a system by its ID in the pangenome
- Parameters:
system_id – ID of the system to get
- Returns:
System – The desired system
- Raises:
KeyError – If the system doesn’t exist in the pangenome
- get_system_by_source(source: str) Generator[System, None, None]#
Retrieve systems by their source.
- Parameters:
source (str) – Source identifier.
- Yields:
Generator[System, None, None] – Systems with the given source.
- number_of_systems(source: str = None, with_canonical: bool = True) int#
Get the number of systems in the pangenome.
- Parameters:
source (str, optional) – Source identifier. Defaults to None.
with_canonical (bool, optional) – Include canonical systems. Defaults to True.
- Returns:
int – Number of systems.
- property systems: Generator[System, None, None]#
Get all systems in the pangenome
- Yields:
Generator[System, None, None] – Generator of systems
- property systems_sources: Set[str]#
Get sources of all systems in the pangenome
- Returns:
Set[str] – Set of system sources
- systems_sources_to_metadata_source() Dict[str, Set[str]]#
Get metadata sources related to system sources
- Returns:
Dict[str, Set[str]] – System source as key linked to their metadata sources as value
- class panorama.pangenomes.Pangenomes#
Bases:
objectA collection of pangenome objects.
- __init__()#
Initialize an empty collection of pangenomes.
- __len__()#
Get the number of pangenomes in the collection.
- add(pangenome: Pangenome)#
Add a pangenome object to the collection.
- Parameters:
pangenome (Pangenome) – The pangenome object to add.
- add_cluster(cluster: Akin) None#
Add a cluster of similar gene families between pangenomes
- Parameters:
cluster – A set of akin gene families
- Raises:
KeyError – If there is already an Akin object with this ID
- add_cluster_systems(cluster_systems: ClusterSystems)#
Add a set of conserved spots between pangenomes
- Parameters:
cluster_systems – Conserved spots object
- Raises:
KeyError – if cluster_systems identifier already exist in pangenomes.
- add_conserved_spots(conserved_spots: ConservedSpots)#
Add a conserved spots between pangenomes
- Parameters:
conserved_spots – Conserved spots object
- Raises:
KeyError – if conserved_spots identifier already exist in pangenomes.
- property cluster_systems: Generator[ClusterSystems, None, None]#
Generator of conserved spots between pangenomes
- Yields:
ConservedSpots – a set of spots conserved between pangenomes
- property conserved_spots: Generator[ConservedSpots, None, None]#
Generator of conserved spots between pangenomes
- Yields:
ConservedSpots – a set of spots conserved between pangenomes
- get(name: str)#
Retrieve a pangenome object from the collection by its name.
- Parameters:
name (str) – The name of the pangenome to retrieve.
- Returns:
Pangenome – The pangenome object with the specified name.
- get_cluster_systems(cs_id: str)#
Get a cluster systems by its ID
- Parameters:
cs_id – Cluster systems ID
- Raises:
KeyError – if conserved_spots identifier does not exist in pangenomes.
- get_conserved_spots(cs_id: int)#
Get a conserved spots by its ID
- Parameters:
cs_id – Conserved spots ID
- Raises:
KeyError – if conserved_spots does not exist in pangenomes.
- get_family(name: str, check_duplicate_names: bool = True) GeneFamily#
Get a family in the pangenomes
- Parameters:
name – name of the gene family
check_duplicate_names – Flag to raise an error if duplicate family names between pangenomes.
- Returns:
The gene family with the given name
- items() Generator[Tuple[str, Pangenome], None, None]#
Generator of pangenome name as key and pangenome object as value
- mk_families_to_pangenome(check_duplicate_names: bool = True)#
Fill the families2pangenome dictionary to know from which pangenome the family belongs to
- Parameters:
check_duplicate_names – Flag to return an error if families name is duplicated between pangenome.
- Raises:
KeyError – If there is a duplicate family names
- property number_of_cluster_systems: int#
Get the number of conserved spots
- Returns:
Number of conserved spots
- property number_of_conserved_spots: int#
Get the number of conserved spots
- Returns:
Number of conserved spots
- read_clustering(clustering: Path | DataFrame, disable_bar: bool = False)#
Read clustering result from panorama
- Parameters:
clustering – Clustering result
disable_bar – Flag to disable progress bar (default: False)
panorama.region module#
This module contains classes to represent regions, spots, conserved spots, and modules in a pangenome.
- class panorama.region.ConservedSpots(identifier: int, *spots: Spot)#
Bases:
objectRepresents a set of conserved spots across multiple pangenomes.
- __init__(identifier: int, *spots: Spot)#
Constructor method.
- Parameters:
identifier (int) – The identifier of the conserved spots set.
*spots (Spot) – The spots to add to the conserved set.
- add(spot: Spot) None#
Add a spot to the conserved set of spots.
- Parameters:
spot (Spot) – The spot to add to the object.
- Raises:
AssertionError – If the spot is not an instance of the Spot class.
KeyError – If the spot already exists in the conserved spots with the same ID.
- get(spot_id: int, pangenome_name: str) Spot#
Get a spot from the conserved set of spots.
- Parameters:
spot_id (int) – The identifier of the spot.
pangenome_name (str) – The name of the pangenome from which the spot belongs.
- Returns:
Spot – The spot with the given id and pangenome.
- Raises:
AssertionError – If the spot id is not an integer.
KeyError – If the spot is not in the conserved set of spots.
- pangenomes() List[str]#
Get the list of pangenomes where the conserved spot belongs.
- Returns:
List[str] – The list of pangenome names.
- class panorama.region.GeneContext(pangenome, gc_id: int, families: Set[GeneFamily], families_of_interest: Set[GeneFamily])#
Bases:
GeneContextA class used to represent a gene context
- __init__(pangenome, gc_id: int, families: Set[GeneFamily], families_of_interest: Set[GeneFamily])#
:param gc_id : identifier of the Gene context :param families: Gene families included in the GeneContext
- summarize() dict#
Summarize gene context information in a dict
- Returns:
dict with gene context info.
- class panorama.region.Module(module_id: int, families: set = None)#
Bases:
ModuleRepresents a module in a pangenome.
- Parameters:
module_id (int) – The identifier of the module.
families (set, optional) – The set of families that define the module.
- __init__(module_id: int, families: set = None)#
Constructor method.
- Parameters:
module_id (int) – The identifier of the module.
families (set, optional) – The set of families that define the module. Defaults to None.
- add_unit(unit)#
Add a system to the module.
- Parameters:
unit (System) – The system to add to the module.
- Raises:
Exception – If a system with the same ID but different name or
gene families is already associated with the module.
- property gene_families: Generator[GeneFamily, None, None]#
Get the set of gene families that define the module.
- Returns:
GeneFamily – The set of gene families.
- get_unit(identifier: int)#
Get a unit associated with the module.
- Parameters:
identifier (int) – The identifier of the unit.
- Returns:
System – The unit with the given identifier.
- Raises:
KeyError – If the unit is not associated with the module.
- property number_of_organisms#
Get the number of organisms that contain the module.
- Returns:
int – The number of organisms.
- property organisms#
Get the set of organisms that contain the module.
- Returns:
set – The set of organisms.
- property systems#
Generator of the systems associated with the module.
- Yields:
System – The next system associated with the module.
- property units#
Generator of the systems associated with the module.
- Yields:
Generator[SystemUnit] – The next system associated with the module.
- class panorama.region.Region(name: str)#
Bases:
RegionRepresents a region in a pangenome.
- Parameters:
name (str) – The name of the region.
- __init__(name: str)#
Constructor method.
- Parameters:
name (str) – The name of the region.
- class panorama.region.Spot(spot_id: int)#
Bases:
SpotRepresents a spot in a pangenome.
- __init__(spot_id: int)#
Constructor method.
- Parameters:
spot_id (int) – The identifier of the spot.
- property conserved: bool#
Check if the spot is conserved between pangenomes.
- Returns:
bool – True if the spot is conserved, False otherwise.
- property number_of_organisms#
Get the number of organisms that contain the spot.
- Returns:
int – The number of organisms.
- property organisms: Generator[Organism, None, None]#
Generator of the organisms that contain the spot.
- Yields:
Organism – The next organism that contains the spot.
panorama.utils module#
This module contains functions for managing files and directories, and checking the sanity of a TSV file.
- class panorama.utils.RawTextArgumentDefaultsHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)#
Bases:
ArgumentDefaultsHelpFormatter,RawDescriptionHelpFormatter
- panorama.utils.add_common_arguments(subparser: ArgumentParser) None#
Add common argument to the input subparser.
- Parameters:
subparser – A subparser object from any subcommand.
- panorama.utils.check_log(name: str) TextIO#
Check if the output log is writable
- Parameters:
name – Path to the log output
- Returns:
file object to write log
- panorama.utils.check_tsv_sanity(tsv_path: Path) Dict[str, Dict[str, int | str | Path]]#
Check if the given TSV file is readable for the next PANORAMA step.
- Parameters:
tsv_path (Path) – The path to the TSV file with the list of pangenomes.
- Returns:
Dict[str, Dict[str, Union[int, str, Path]]] – A dictionary with pangenome name as key and a dictionary with path and taxid as values.
- Raises:
SyntaxError – If the TSV file has less than 2 columns.
ValueError – If there is a line with no value in pangenome name or if the pangenome names contain spaces.
FileNotFoundError – If unable to locate one or more pangenomes in the TSV file.
- panorama.utils.init_lock(lock: Lock = None)#
Initialize the loading lock.
- Parameters:
lock (Lock, optional) – The lock object to be assigned to
loading_lock. Defaults to None.- Returns:
Lock – The lock object assigned to
loading_lock.
- panorama.utils.is_empty(filepath)#
Checks if a file is empty.
- Parameters:
filepath (str) – The path to the file to check.
- Returns:
bool – True if the file is empty, False otherwise.
- panorama.utils.is_true_value(value: str | int | bool) bool#
Check if a value represents a true condition.
True conditions are: 1, “True” or True
- Parameters:
value – Value to check
- Returns:
True if value represents a true condition
- panorama.utils.mkdir(output: Path, force: bool = False, erase: bool = False) Path#
Create a directory at the given path.
- Parameters:
output (Path) – The path to the output directory
force (bool, optional) – Whether to raise an exception if the directory already exists. Defaults to False
erase (bool, optional) – Whether to erase the directory if it already exists and force is True. Defaults to False
- Returns:
Path – The path to the output directory.
- Raises:
FileExistsError – If the directory already exists and force is False.
Exception – If an unexpected error occurs.
- panorama.utils.pop_specific_action_grp(sub: ArgumentParser, title: str) _SubParsersAction#
- panorama.utils.set_verbosity_level(args: Namespace) None#
Set the verbosity level
- Parameters:
args – argument pass by command line