pandaspgs.cohort.Cohort

An object that stores data of type Cohort. To understand the significance of each column of the DataFrame. Please visit "Cohort_extended" in PGS Catalog Documentation for details.

Attributes:
  • raw_data

    list. Convert from obtained JSON data

  • cohorts

    DataFrame. It only exists if the parameter mode of constructor is Fat.

  • associated_pgs_ids

    DataFrame. It only exists if the parameter mode of constructor is Fat.

  • mode

    Fat or Thin. Specifies the mode of the returned object.

from pandaspgs.get_cohort import get_cohorts

ch = get_cohorts(cohort_symbol='ABCFS')
ch
ch.raw_data
ch.mode
ch.cohorts
ch.associated_pgs_ids

Subset object s by either identifier or position

all_df = get_cohorts()
all_df[0].cohorts
all_df[0:3].cohorts
all_df['100-plus'].cohorts
all_df[('100-plus','23andMe','2SISTER')].cohorts

Objects can be manipulated like sets in the mathematical sense.

one = get_cohorts(cohort_symbol='100-plus')
two = get_cohorts(cohort_symbol='23andMe')
three = get_cohorts(cohort_symbol='2SISTER')
one_and_two = one+two
two_and_three = two+three
only_one = one_and_two - two_and_three
only_two = one_and_two & two_and_three
one_and_two_and_three = one_and_two | two_and_three
one_and_three = one_and_two ^ two_and_three

__init__

__init__(data: list = [], mode: str = 'Fat')
Parameters:
  • data (list, default: [] ) –

    Raw JSON data.

  • mode (str, default: 'Fat' ) –

    Fat or Thin. Specifies the mode of the object.