Portable Microhaplotype Object (PMO)
  • Home
  • Format Info
    • Development of Format
    • PMO fields overview
    • PMO Examples
    • Format Overview For Developers
  • Tools Installation
    • pmotools-python installation
  • pmotools-python usages
    • Command line interface

    • pmotools-runner.py
    • Command line interface to pmotools-python with pmotools-runner.py
    • Extracting out of PMO
    • Extracting allele tables using pmotools-python
    • Subset PMO
    • Subsetting from a PMO using pmotools-python
    • Getting sub info from PMO
    • Getting basic info out of PMO using pmotools-python
    • Getting panel info out of PMO using pmotools-python
    • Handling Multiple PMOs
    • Handling multiple PMOs pmotools-python

    • Python interface
    • Getting basic info out of a PMO
    • Creating a PMO File
  • Resources
    • References

Contents

  • Getting sample counts per target
  • Getting target counts per sample

Getting basic info out of a PMO

  • Show All Code
  • Hide All Code
Code
from pmotools.pmo_utils.PMOExtractor import PMOExtractor
from pmotools.pmo_utils.PMOReader import PMOReader
from pmotools.utils.small_utils import Utils


pmo = PMOReader.read_in_pmo("../format/moz2018_PMO.json.gz")

Getting sample counts per target

Code
# get counts of the samples per target
counts_df = PMOExtractor.count_samples_per_target(pmo)

print(counts_df)
   tar_amp_bioinformatics_info_id target_id sample_number
0         Mozambique2018-SeekDeep        t1           119
0         Mozambique2018-SeekDeep       t10           117
0         Mozambique2018-SeekDeep      t100           124
0         Mozambique2018-SeekDeep       t11           120
0         Mozambique2018-SeekDeep       t12           119
..                            ...       ...           ...
0         Mozambique2018-SeekDeep       t96           119
0         Mozambique2018-SeekDeep       t97           122
0         Mozambique2018-SeekDeep       t98           122
0         Mozambique2018-SeekDeep       t99           120
0         Mozambique2018-SeekDeep       t76            32

[100 rows x 3 columns]

Getting target counts per sample

Code
# get counts of the samples per target
target_counts_df = PMOExtractor.count_targets_per_sample(pmo)
print(target_counts_df)
   tar_amp_bioinformatics_info_id experiment_sample_id target_number
0         Mozambique2018-SeekDeep           8025874217            99
0         Mozambique2018-SeekDeep           8025874231            99
0         Mozambique2018-SeekDeep           8025874234            97
0         Mozambique2018-SeekDeep           8025874237            99
0         Mozambique2018-SeekDeep           8025874250            98
..                            ...                  ...           ...
0         Mozambique2018-SeekDeep           SS1-10K-C1            98
0         Mozambique2018-SeekDeep           SS2-10K-C1            98
0         Mozambique2018-SeekDeep           SS3-10K-C1            98
0         Mozambique2018-SeekDeep           SS4-10K-C1            99
0         Mozambique2018-SeekDeep           SS5-10K-C1            97

[124 rows x 3 columns]