Skip to contents

Package overview

pmotoolsr pmotoolsr-package
pmotoolsr: Toolkit for working with Portable Microhaplotype Objects (PMOs)

Reading & writing PMOs

Read and write Portable Microhaplotype Object files (plain or gzip / bzip2 / xz compressed), as R6 objects or as raw nested lists.

read_pmo()
Read a PMO object from a file
write_pmo()
Write a PMO object to a file
read_pmo_raw()
Read a PMO file as a raw nested list
write_pmo_raw()
Write a raw PMO nested list to a file
pmo_list_to_r6()
Convert a raw PMO list into a PortableMicrohaplotypeObject

Validation & schema

Validate a PMO against the JSON Schema and inspect schema versions and field requirements.

pmo_validate()
Validate a PMO (structural and, by default, schema)
pmo_validate_jsonschema()
Validate a PMO against the JSON Schema
pmo_check_required_base_fields()
Check that a PMO has all required top-level fields
pmo_required_fields_for_class()
Get the required fields for a PMO schema class
pmo_load_schema()
Load a bundled PMO JSON schema
pmo_load_schema_by_version()
Load a bundled PMO JSON schema by version
pmo_schema_version()
Default PMO schema version targeted by this package
pmo_has_section()
Test whether an optional PMO section is present and non-empty

Processing & querying

Look up names and indices, count entities, and subset / filter a PMO down to selected specimens, library samples, targets, metadata groups, or read depth.

pmo_get_specimen_names() pmo_get_sorted_specimen_names() pmo_get_library_sample_names() pmo_get_sorted_library_sample_names() pmo_get_target_names() pmo_get_sorted_target_names() pmo_get_panel_names() pmo_get_sorted_panel_names() pmo_get_bioinformatics_run_names() pmo_get_sorted_bioinformatics_run_names()
Get entity names from a PMO
pmo_index_key_specimen_names() pmo_index_key_library_sample_names() pmo_index_key_target_names() pmo_index_key_panel_names() pmo_index_key_bioinformatics_run_names()
Build a name-to-index lookup for PMO entities
pmo_index_key_target_in_representative_microhaplotypes()
Build a target-name to representative-microhaplotype-index lookup
pmo_index_of_specimen_names() pmo_index_of_library_sample_names() pmo_index_of_target_names() pmo_index_of_panel_names() pmo_index_of_bioinformatics_run_names() pmo_index_of_target_in_representative_microhaplotypes()
Resolve entity names to their 1-based PMO indices
pmo_library_ids_for_specimen_ids()
Get library sample ids for a set of specimen ids
pmo_count_library_samples_per_target()
Count the number of library samples a target is detected in
pmo_count_specimen_by_field_value()
Count specimens grouped by combinations of metadata field values
pmo_count_specimen_per_meta_fields()
Count how many specimens carry each metadata field
pmo_count_targets_per_library_sample()
Count the number of targets detected per library sample
pmo_count_targets_per_panel()
Count the number of unique targets in each panel
pmo_filter_by_library_sample_ids()
Filter a PMO down to selected library samples
pmo_filter_by_library_sample_names()
Filter a PMO down to selected library samples by name
pmo_filter_by_specimen_ids()
Filter a PMO down to selected specimens
pmo_filter_by_specimen_names()
Filter a PMO down to selected specimens by name
pmo_filter_by_target_ids()
Filter a PMO down to selected targets
pmo_filter_by_target_names()
Filter a PMO down to selected targets by name
pmo_extract_by_read_filter()
Filter detected microhaplotypes by a minimum read count
pmo_extract_samples_by_meta_groupings()
Extract specimens matching metadata groupings
pmo_extract_allele_counts_freq()
Extract allele (microhaplotype) counts and frequencies

Exporting tables

Flatten PMO sections into tibbles and export allele tables, BED files, and Excel workbooks.

pmo_export_bioinformatics_methods_info_meta_table()
Export bioinformatics methods info metadata
pmo_export_bioinformatics_run_info_meta_table()
Export bioinformatics run info metadata
pmo_export_library_sample_meta_table()
Export library sample metadata
pmo_export_panel_info_meta_table()
Export panel info metadata
pmo_export_pmo_header_table()
Export PMO header metadata
pmo_export_project_info_meta_table()
Export project info metadata
pmo_export_sequencing_info_meta_table()
Export sequencing info metadata
pmo_export_specimen_meta_table()
Export specimen metadata
pmo_export_specimen_travel_meta_table()
Export specimen travel metadata
pmo_export_target_info_meta_table()
Export target info metadata
pmo_export_targeted_genomes_meta_table()
Export targeted genomes metadata
pmo_export_to_excel()
Export a PMO to a multi-sheet Excel workbook
pmo_extract_alleles_per_sample_table()
Extract a per-sample allele table
pmo_list_library_samples_per_specimen()
List library sample names per specimen
pmo_extract_targets_insert_bed()
Extract target insert locations as BED rows
pmo_extract_panels_insert_bed()
Extract panel insert locations as BED rows
pmo_write_bed()
Write BED rows to a file

Building & combining PMOs

Assemble PMOs from tabular inputs, merge components into a single object, update metadata, and combine multiple PMOs.

pmo_library_sample_info_table_to_pmo()
Convert a library-sample metadata table into PMO library_sample_info
pmo_mhap_table_to_pmo()
Convert a microhaplotype calls table into PMO microhaplotype structures
pmo_panel_info_table_to_pmo()
Convert a panel/target table into PMO target_info + panel_info
pmo_read_count_by_stage_table_to_pmo()
Convert read-count tables into the PMO read_counts_by_stage structure
pmo_specimen_info_table_to_pmo()
Convert a specimen metadata table into PMO specimen_info
pmo_minimum_library_specimen_from_mhap_table()
Build minimal library/specimen info from a detected-microhaplotypes structure
pmo_merge_panel_info_dicts()
Merge multiple panel_info dictionaries
pmo_merge_to_pmo()
Merge name-based PMO components into a complete PMO
pmo_combine_pmos()
Combine multiple PMOs into a single PMO
pmo_update_specimen_with_traveler_info()
Add travel history to a PMO's specimens
pmo_merge_dicts_by_key()
Merge two lists of dicts by a shared key field

PMO classes

Auto-generated R6 classes mirroring the PMO schema. Most users interact with these through read_pmo() / write_pmo() rather than constructing them directly.

PortableMicrohaplotypeObject
PortableMicrohaplotypeObject
BioMethod
BioMethod
BioinformaticsMethodInfo
BioinformaticsMethodInfo
BioinformaticsRunInfo
BioinformaticsRunInfo
DetectedMicrohaplotypes
DetectedMicrohaplotypes
DetectedMicrohaplotypesForSample
DetectedMicrohaplotypesForSample
DetectedMicrohaplotypesForTarget
DetectedMicrohaplotypesForTarget
GenomeInfo
GenomeInfo
GenomicLocation
GenomicLocation
LibrarySampleInfo
LibrarySampleInfo
MarkerOfInterest
MarkerOfInterest
MaskingInfo
MaskingInfo
MicrohaplotypeForTarget
MicrohaplotypeForTarget
PanelInfo
PanelInfo
ParasiteDensity
ParasiteDensity
PlateInfo
PlateInfo
PmoGenerationMethod
PmoGenerationMethod
PmoHeader
PmoHeader
PrimerInfo
PrimerInfo
ProjectInfo
ProjectInfo
ProteinVariant
ProteinVariant
Pseudocigar
Pseudocigar
ReactionInfo
ReactionInfo
ReadCountsByStage
ReadCountsByStage
ReadCountsByStageForLibrarySample
ReadCountsByStageForLibrarySample
ReadCountsByStageForTarget
ReadCountsByStageForTarget
RepresentativeMicrohaplotype
RepresentativeMicrohaplotype
RepresentativeMicrohaplotypes
RepresentativeMicrohaplotypes
RepresentativeMicrohaplotypesForTarget
RepresentativeMicrohaplotypesForTarget
SequencingInfo
SequencingInfo
SpecimenInfo
SpecimenInfo
StageReadCounts
StageReadCounts
TargetInfo
TargetInfo
TravelInfo
TravelInfo