lifeomic / phc-sdk-py

The phc-sdk-py is a developer kit for interfacing with the PHC API on Python 3.8 and above.
https://lifeomic.github.io/phc-sdk-py/index.html
MIT License
1 stars 2 forks source link

Add API ShortVariant options #119

Closed rcdilorenzo closed 3 years ago

rcdilorenzo commented 3 years ago

Example from fake data:

phc.GenomicShortVariant.get_data_frame(
    patient_id="2c8660b4-1e63-403e-b52b-55c290072a66",
    chromosome=[phc.Option.Chromosome.CHR_19],
    gene_class=[phc.Option.GeneClass.PROTEIN_CODING],
    zygosity=[phc.Option.Zygosity.HETEROZYGOUS],
    rs_id=["rs11324363", "rs36247", "rs77134098"],
    min_allele_frequency="0.2-1",
    log=True,
    all_results=True
)

Log output:

{
    "path": "genomics/projects/6f37463d-60b5-4c67-b06e-ffc87c8d780f/tests",
    "method": "GET",
    "params": {
        "patientId": "2c8660b4-1e63-403e-b52b-55c290072a66",
        "status": "ACTIVE",
        "type": "shortVariant"
    }
}
[CACHE] Loading from "/home/jovyan/Downloads/phc/api-cache/genomics_projects_tests_711a406c.csv"
{
    "path": "genomics/variants",
    "method": "GET",
    "params": {
        "variantSetIds": "2293c69b-78a5-4012-8080-e1c20d6934d3,60775dcc-c15a-4f0b-8cb9-264838848be4,de80dbe0-4ae9-4baa-ae95-8f785b958893",
        "include": "vcf",
        "rsid": "rs11324363,rs36247,rs77134098",
        "chromosome": "chr19",
        "biotype": "protein coding,nonsense mediated decay",
        "minAlleleFrequency": "0.2-1",
        "zygosity": "heterozygous"
    }
}
100%
2/2 [00:00<00:00, 29.60it/s]
Loading data frame from "/home/jovyan/Downloads/phc/api-cache/genomics_variants_fe0333c5.csv"

Result (frame info):

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2 entries, 0 to 1
Data columns (total 77 columns):
 #   Column                                                                                                               Non-Null Count  Dtype              
---  ------                                                                                                               --------------  -----              
 0   id                                                                                                                   2 non-null      object             
 1   variant_set_id                                                                                                       2 non-null      object             
 2   chromosome                                                                                                           2 non-null      object             
 3   reference                                                                                                            2 non-null      object             
 4   alternate                                                                                                            2 non-null      object             
 5   position                                                                                                             2 non-null      int64              
 6   minimumAlleleFrequency                                                                                               2 non-null      float64            
 7   maximumAlleleFrequency                                                                                               2 non-null      float64            
 8   gnomadAlleleFrequency                                                                                                2 non-null      float64            
 9   gnomadHomozygous                                                                                                     2 non-null      int64              
 10  exacAlleleFrequency                                                                                                  2 non-null      float64            
 11  exacHomozygous                                                                                                       2 non-null      int64              
 12  rsid                                                                                                                 2 non-null      object             
 13  zygosity                                                                                                             2 non-null      object             
 14  clinvar.nearVariant                                                                                                  2 non-null      int64              
 15  cosmic.cosmicId                                                                                                      2 non-null      object             
 16  cosmic.status                                                                                                        2 non-null      object             
 17  cosmic.histology                                                                                                     2 non-null      object             
 18  cosmic.tumorSite                                                                                                     2 non-null      object             
 19  cosmic.sampleCount                                                                                                   2 non-null      int64              
 20  cosmic.nearVariant                                                                                                   2 non-null      int64              
 21  ensemblCanon.class                                                                                                   2 non-null      object             
 22  ensemblCanon.group                                                                                                   2 non-null      object             
 23  ensemblCanon.impact                                                                                                  2 non-null      object             
 24  ensemblCanon.gene                                                                                                    2 non-null      object             
 25  ensemblCanon.geneId                                                                                                  2 non-null      object             
 26  ensemblCanon.transcriptId                                                                                            2 non-null      object             
 27  ensemblCanon.biotype                                                                                                 2 non-null      object             
 28  ensemblCanon.exonIntronRank                                                                                          2 non-null      object             
 29  ensemblCanon.nucleotideChange                                                                                        2 non-null      object             
 30  ensemblCanon.aminoAcidChange                                                                                         1 non-null      object             
 31  ensemblCanon.hgvsAminoAcidChange                                                                                     1 non-null      object             
 32  dbnsfp.siftPred                                                                                                      0 non-null      float64            
 33  dbnsfp.mutationTasterPred                                                                                            0 non-null      float64            
 34  dbnsfp.fathmmPred                                                                                                    0 non-null      float64            
 35  vcf.quality                                                                                                          2 non-null      float64            
 36  vcf.filter                                                                                                           2 non-null      object             
 37  vcf.variantAllelicFrequency                                                                                          2 non-null      float64            
 38  vcf.coverage                                                                                                         2 non-null      object             
 39  gene                                                                                                                 2 non-null      object             
 40  status                                                                                                               2 non-null      object             
 41  sequenceType                                                                                                         2 non-null      object             
 42  setType                                                                                                              2 non-null      object             
 43  fileId                                                                                                               2 non-null      object             
 44  sequenceId                                                                                                           2 non-null      object             
 45  name                                                                                                                 2 non-null      object             
 46  tasks                                                                                                                2 non-null      object             
 47  id.test                                                                                                              2 non-null      object             
 48  datasetId                                                                                                            2 non-null      object             
 49  name.test                                                                                                            2 non-null      object             
 50  reportFileId                                                                                                         2 non-null      object             
 51  indexedDate                                                                                                          2 non-null      object             
 52  testType                                                                                                             2 non-null      object             
 53  referenceSetId                                                                                                       2 non-null      object             
 54  status.test                                                                                                          2 non-null      object             
 55  createdDate                                                                                                          2 non-null      datetime64[ns, UTC]
 56  sourceFileId                                                                                                         2 non-null      object             
 57  sourceFile.id                                                                                                        2 non-null      object             
 58  sourceFile.name                                                                                                      2 non-null      object             
 59  sourceFile.datasetId                                                                                                 2 non-null      object             
 60  sourceFile.size                                                                                                      2 non-null      int64              
 61  sourceFile.contentType                                                                                               2 non-null      object             
 62  sourceFile.lastModified                                                                                              2 non-null      datetime64[ns, UTC]
 63  sourceFile.userId                                                                                                    2 non-null      object             
 64  sourceFile.lrn                                                                                                       2 non-null      object             
 65  patientId                                                                                                            2 non-null      object             
 66  patient.name_text                                                                                                    2 non-null      object             
 67  patient.name_family                                                                                                  2 non-null      object             
 68  patient.name_given                                                                                                   2 non-null      object             
 69  patient.identifier_system__urn:oid:1.3.6.1.4.1.12009.1.2.1__type_coding_system__hl7.org/fhir/v2/0203__code           2 non-null      object             
 70  patient.identifier_system__urn:oid:1.3.6.1.4.1.12009.1.2.1__value                                                    2 non-null      int64              
 71  patient.identifier_system__lifeomic.com/unknown/genomics/subject-id__type_coding_system__hl7.org/fhir/v2/0203__code  2 non-null      object             
 72  patient.identifier_system__lifeomic.com/unknown/genomics/subject-id__value                                           2 non-null      int64              
 73  patient.id                                                                                                           2 non-null      object             
 74  patient.resourceType                                                                                                 2 non-null      object             
 75  bodySite.system__lifeomic.com/fhir__code                                                                             2 non-null      object             
 76  bodySite.system__lifeomic.com/fhir__display                                                                          2 non-null      object             
dtypes: datetime64[ns, UTC](2), float64(9), int64(9), object(57)
memory usage: 1.3+ KB