seer-pas-sdk 0.3.3__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/PKG-INFO +1 -1
  2. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/docs/index.qmd +103 -0
  3. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/core/sdk.py +36 -3
  4. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk.egg-info/PKG-INFO +1 -1
  5. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/.github/workflows/lint.yml +0 -0
  6. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/.github/workflows/publish.yml +0 -0
  7. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/.github/workflows/test.yml +0 -0
  8. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/.gitignore +0 -0
  9. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/.pre-commit-config.yaml +0 -0
  10. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/LICENSE.txt +0 -0
  11. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/README.md +0 -0
  12. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/docs/_quarto.yml +0 -0
  13. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/pyproject.toml +0 -0
  14. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/__init__.py +0 -0
  15. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/auth/__init__.py +0 -0
  16. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/auth/auth.py +0 -0
  17. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/common/__init__.py +0 -0
  18. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/common/errors.py +0 -0
  19. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/common/groupanalysis.py +0 -0
  20. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/core/__init__.py +0 -0
  21. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/core/unsupported.py +0 -0
  22. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/objects/__init__.py +0 -0
  23. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/objects/groupanalysis.py +0 -0
  24. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/objects/platemap.py +0 -0
  25. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk/objects/volcanoplot.py +0 -0
  26. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk.egg-info/SOURCES.txt +0 -0
  27. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk.egg-info/dependency_links.txt +0 -0
  28. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk.egg-info/requires.txt +0 -0
  29. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/seer_pas_sdk.egg-info/top_level.txt +0 -0
  30. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/setup.cfg +0 -0
  31. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/__init__.py +0 -0
  32. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/conftest.py +0 -0
  33. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/objects/__init__.py +0 -0
  34. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/objects/test_platemap.py +0 -0
  35. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/test_auth.py +0 -0
  36. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/test_common.py +0 -0
  37. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/test_objects.py +0 -0
  38. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/test_sdk.py +0 -0
  39. {seer_pas_sdk-0.3.3 → seer_pas_sdk-0.3.4}/tests/unsupported_platemap.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seer-pas-sdk
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: SDK for Seer Proteograph Analysis Suite (PAS)
5
5
  Author-email: Ryan Sun <rsun@seer.bio>
6
6
  License:
@@ -529,6 +529,10 @@ If the `analysis_id` is invalid or the search has not been completed, an error i
529
529
  ###### <u>Params</u>
530
530
  `analysis_id`: (`str`) Unique ID of the analysis for which the data is to be listed.
531
531
 
532
+ `folder`: (`str`, optional) Root folder key to list search result files from. Defaults to None and displays search output files from the top level.
533
+
534
+ `recursive`: (`bool`, optional) Whether to list files recursively from all subfolders. Defaults to False.
535
+
532
536
  ###### <u>Returns</u>
533
537
  `files`: (`list[str]`) A list of search output files for the given `analysis_id`.
534
538
 
@@ -538,9 +542,13 @@ If the `analysis_id` is invalid or the search has not been completed, an error i
538
542
  analysis_id = "ddff8c40-0493-11ee-bd19-a77197cd1a6b"
539
543
  search_output_files = sdk.list_search_output_files(analysis_id)
540
544
  print(search_output_files)
545
+ search_output_files = sdk.list_search_output_files(analysis_id, folder='rollup')
546
+ print(search_output_files)
541
547
  ```
542
548
  ```
543
549
  ['protein_group_np.tsv', 'protein_group_panel.tsv', 'peptide_np.tsv', 'peptide_panel.tsv', 'report.tsv', 'rollup/', 'rmbatch/']
550
+ ['rollup/seer_proteingroup.intensity.parquet', 'rollup/seer_proteingroup.median_normalized_intensity.parquet', 'rollup/seer_np_peptide.engine_normalized_intensity.parquet', 'rollup/seer_np_peptide.intensity.parquet', 'rollup/seer_np_peptide.median_normalized_intensity.parquet', 'rollup/seer_peptide.mediandense_normalized_intensity.parquet', 'rollup/seer_peptide.engine_normalized_intensity.parquet', 'rollup/seer_peptide.intensity.parquet', 'rollup/seer_peptide.median_normalized_intensity.parquet']
551
+
544
552
  ```
545
553
 
546
554
  <br>
@@ -657,6 +665,101 @@ Finished downloading AgamSDKTest2.raw
657
665
 
658
666
  <hr>
659
667
 
668
+ ### Protein Results Table
669
+ Returns the protein results table for given `analysis_id` or `analysis_name`.
670
+
671
+ #### <u>Params</u>
672
+ * `analysis_id`: (`str`, optional) The analysis ID, defaulted to None.
673
+ * `analysis_name`: (`str`, optional) The analysis name, defaulted to None.
674
+ * `grouping`: ('str', optional): group criteria of table result. Defaults to "condition".
675
+ * `as_df`: (`bool`, optional) Whether the result should be converted to a DataFrame, defaulted to False.
676
+
677
+ #### <u>Returns</u>
678
+ * res: (`list[dict]` or `DataFrame`) A list of dictionaries or DataFrame containing the protein results table.
679
+
680
+ #### <u>Example</u>
681
+ ```{python}
682
+ #| eval: false
683
+ analysis_id = "c4089c00-16ab-11ec-b589-634014ca2005"
684
+ print(sdk.get_protein_results_table(analysis_id))
685
+ print(sdk.get_protein_results_table(analysis_id, as_df=True))
686
+ ```
687
+ ```
688
+ [{'uniprot_id': 'Q9HD20',
689
+ 'gene_name': 'ATP13A1',
690
+ 'coverage': 0.04983388704318937,
691
+ 'n_samples': 20,
692
+ 'median': 5.2130235974326204,
693
+ 'fraction_samples': 1.0,
694
+ 'protein_name': 'Endoplasmic reticulum transmembrane helix translocase (EC 7.4.2.-) (Endoplasmic reticulum P5A-ATPase)',
695
+ 'biological_process': 'extraction of mislocalized protein from ER membrane [GO:0140569]; intracellular calcium ion homeostasis [GO:0006874]; monoatomic ion transmembrane transport [GO:0034220]; protein transport [GO:0015031]; transmembrane transport [GO:0055085]',
696
+ 'molecular_function': 'ABC-type manganese transporter activity [GO:0015410]; ATP binding [GO:0005524]; ATP hydrolysis activity [GO:0016887]; ATPase-coupled monoatomic cation transmembrane transporter activity [GO:0019829]; membrane protein dislocase activity [GO:0140567]; metal ion binding [GO:0046872]; P-type ion transporter activity [GO:0015662]',
697
+ 'cellular_component': 'endoplasmic reticulum membrane [GO:0005789]; membrane [GO:0016020]'},
698
+ {'uniprot_id': 'Q9UL25',
699
+ 'gene_name': 'RAB21',
700
+ 'coverage': 0.4,
701
+ 'n_samples': 20,
702
+ 'median': 5.455800694428291,
703
+ 'fraction_samples': 1.0,
704
+ 'protein_name': 'Ras-related protein Rab-21 (EC 3.6.5.2)',
705
+ 'biological_process': 'anterograde axonal transport [GO:0008089]; intracellular protein transport [GO:0006886]; positive regulation of dendrite morphogenesis [GO:0050775]; positive regulation of early endosome to late endosome transport [GO:2000643]; positive regulation of receptor-mediated endocytosis [GO:0048260]; protein stabilization [GO:0050821]; Rab protein signal transduction [GO:0032482]; regulation of axon extension [GO:0030516]; regulation of exocytosis [GO:0017157]',
706
+ 'molecular_function': 'GDP binding [GO:0019003]; GTP binding [GO:0005525]; GTPase activity [GO:0003924]',
707
+ 'cellular_component': 'axon cytoplasm [GO:1904115]; cleavage furrow [GO:0032154]; cytoplasmic side of early endosome membrane [GO:0098559]; cytoplasmic side of plasma membrane [GO:0009898]; cytosol [GO:0005829]; early endosome [GO:0005769]; early endosome membrane [GO:0031901]; endomembrane system [GO:0012505]; endoplasmic reticulum membrane [GO:0005789]; endosome [GO:0005768]; extracellular exosome [GO:0070062]; focal adhesion [GO:0005925]; Golgi cisterna membrane [GO:0032580]; Golgi membrane [GO:0000139]; synapse [GO:0045202]; trans-Golgi network [GO:0005802]; vesicle membrane [GO:0012506]'}]
708
+
709
+ uniprot_id gene_name coverage n_samples median fraction_samples protein_name biological_process molecular_function cellular_component
710
+ 0 Q9HD20 ATP13A1 0.049834 20 5.213024 1.0 Endoplasmic reticulum transmembrane helix translocase (EC 7.4.2.-) (Endoplasmic reticulum P5A-ATPase) extraction of mislocalized protein from ER membrane [GO:0140569]; intracellular calcium ion homeostasis [GO:0006874]; monoatomic ion transmembrane transport [GO:0034220]; protein transport [GO:0015031]; transmembrane transport [GO:0055085] ABC-type manganese transporter activity [GO:0015410]; ATP binding [GO:0005524]; ATP hydrolysis activity [GO:0016887]; ATPase-coupled monoatomic cation transmembrane transporter activity [GO:0019829]; membrane protein dislocase activity [GO:0140567]; metal ion binding [GO:0046872]; P-type ion transporter activity [GO:0015662] endoplasmic reticulum membrane [GO:0005789]; membrane [GO:0016020]
711
+ 1 Q9UL25 RAB21 0.400000 20 5.455801 1.0 Ras-related protein Rab-21 (EC 3.6.5.2) anterograde axonal transport [GO:0008089]; intracellular protein transport [GO:0006886]; positive regulation of dendrite morphogenesis [GO:0050775]; positive regulation of early endosome to late endosome transport [GO:2000643]; positive regulation of receptor-mediated endocytosis [GO:0048260]; protein stabilization [GO:0050821]; Rab protein signal transduction [GO:0032482]; regulation of axon extension [GO:0030516]; regulation of exocytosis [GO:0017157] GDP binding [GO:0019003]; GTP binding [GO:0005525]; GTPase activity [GO:0003924] axon cytoplasm [GO:1904115]; cleavage furrow [GO:0032154]; cytoplasmic side of early endosome membrane [GO:0098559]; cytoplasmic side of plasma membrane [GO:0009898]; cytosol [GO:0005829]; early endosome [GO:0005769]; early endosome membrane [GO:0031901]; endomembrane system [GO:0012505]; endoplasmic reticulum membrane [GO:0005789]; endosome [GO:0005768]; extracellular exosome [GO:0070062]; focal adhesion [GO:0005925]; Golgi cisterna membrane [GO:0032580]; Golgi membrane [GO:0000139]; synapse [GO:0045202]; trans-Golgi network [GO:0005802]; vesicle membrane [GO:0012506]
712
+
713
+ ```
714
+
715
+ <hr>
716
+
717
+ ### Get Peptide Results Table
718
+ Returns the peptide results table for given `analysis_id` or `analysis_name`.
719
+ #### <u>Params</u>
720
+ * `analysis_id`: (`str`, optional) The analysis ID, defaulted to None.
721
+ * `analysis_name`: (`str`, optional) The analysis name, defaulted to None.
722
+ * `grouping`: ('str', optional): group criteria of table result. Defaults to "condition".
723
+ * `as_df`: (`bool`, optional) Whether the result should be converted to a DataFrame, defaulted to False.
724
+ #### <u>Returns</u>
725
+ * res: (`list[dict]` or `DataFrame`) A list of dictionaries or DataFrame containing the peptide results table.
726
+ #### <u>Example</u>
727
+ ```{python}
728
+ #| eval: false
729
+ analysis_id = "c4089c00-16ab-11ec-b589-634014ca2005"
730
+ print(sdk.get_peptide_results_table(analysis_id))
731
+ print(sdk.get_peptide_results_table(analysis_id, as_df=True))
732
+ ```
733
+
734
+ ```
735
+ [{'peptide': 'DTEEEDFHVDQATTVK',
736
+ 'uniprot_id': 'A0A024R6I7;A0A0G2JRN3',
737
+ 'gene_name': 'SERPINA1;SERPINA1',
738
+ 'n_samples': 20,
739
+ 'median': 6.7500568241225345,
740
+ 'fraction_samples': 1.0,
741
+ 'protein_name': 'deleted;Serpin family A member 1',
742
+ 'biological_process': ';',
743
+ 'molecular_function': ';serine-type endopeptidase inhibitor activity [GO:0004867]',
744
+ 'cellular_component': ';extracellular space [GO:0005615]'},
745
+ {'peptide': 'EIVMTQSPPTLSLSPGER',
746
+ 'uniprot_id': 'A0A075B6H7',
747
+ 'gene_name': 'IGKV3',
748
+ 'n_samples': 20,
749
+ 'median': 6.257082970753563,
750
+ 'fraction_samples': 1.0,
751
+ 'protein_name': 'Probable non-functional immunoglobulin kappa variable 3-7',
752
+ 'biological_process': 'adaptive immune response [GO:0002250]; immune response [GO:0006955]',
753
+ 'molecular_function': '',
754
+ 'cellular_component': 'extracellular region [GO:0005576]; immunoglobulin complex [GO:0019814]; plasma membrane [GO:0005886]'}]
755
+
756
+ peptide uniprot_id gene_name n_samples median fraction_samples protein_name biological_process molecular_function cellular_component
757
+ 0 DTEEEDFHVDQATTVK A0A024R6I7;A0A0G2JRN3 SERPINA1;SERPINA1 20 6.750057 1.0 deleted;Serpin family A member 1 ; ;serine-type endopeptidase inhibitor activity [GO:0004867] ;extracellular space [GO:0005615]
758
+ 1 EIVMTQSPPTLSLSPGER A0A075B6H7 IGKV3 20 6.257083 1.0 Probable non-functional immunoglobulin kappa variable 3-7 adaptive immune response [GO:0002250]; immune response [GO:0006955] ; extracellular region [GO:0005576]; immunoglobulin complex [GO:0019814]; plasma membrane [GO:0005886]
759
+ ```
760
+
761
+
762
+
660
763
  ### Group Analysis Results
661
764
  Returns the group analysis data for given `analysis_id` (provided it is valid and the group analysis has been successful) and `box_plot` config info.
662
765
 
@@ -515,6 +515,8 @@ class SeerSDK:
515
515
  f"Failed to fetch sample data for plate ID: {plate_id}."
516
516
  )
517
517
  res = samples.json()["data"]
518
+ if not res:
519
+ return [] if not as_df else dict_to_df(res)
518
520
  res_df = dict_to_df(res)
519
521
 
520
522
  # API returns empty strings if not a control, replace with None for filtering purposes
@@ -1195,7 +1197,9 @@ class SeerSDK:
1195
1197
 
1196
1198
  return peptide_data
1197
1199
 
1198
- def list_search_result_files(self, analysis_id: str):
1200
+ def list_search_result_files(
1201
+ self, analysis_id: str, folder: str = None, recursive: bool = False
1202
+ ):
1199
1203
  """
1200
1204
  Given an analysis id, this function returns a list of files associated with the analysis.
1201
1205
 
@@ -1204,6 +1208,12 @@ class SeerSDK:
1204
1208
  analysis_id : str
1205
1209
  ID of the analysis for which the data is to be fetched.
1206
1210
 
1211
+ folder : str, optional
1212
+ Root folder key to list search result files from, defaulted to None.
1213
+
1214
+ recursive : bool, optional
1215
+ Whether to list files recursively from subfolders, defaulted to False.
1216
+
1207
1217
  Returns
1208
1218
  -------
1209
1219
  files: list[str]
@@ -1218,9 +1228,15 @@ class SeerSDK:
1218
1228
 
1219
1229
  if analysis_metadata.get("status") in ["Failed", None]:
1220
1230
  raise ValueError("Cannot find files for a failed analysis.")
1231
+
1232
+ params = {"all": "true"}
1233
+ if folder:
1234
+ params["folderKey"] = folder
1235
+
1221
1236
  with self._get_auth_session() as s:
1222
1237
  response = s.get(
1223
- f"{self._auth.url}api/v2/analysisResultFiles/{analysis_id}"
1238
+ f"{self._auth.url}api/v2/analysisResultFiles/{analysis_id}",
1239
+ params=params,
1224
1240
  )
1225
1241
  if response.status_code != 200:
1226
1242
  raise ServerError(
@@ -1228,8 +1244,25 @@ class SeerSDK:
1228
1244
  )
1229
1245
  response = response.json()
1230
1246
  files = []
1247
+ folders = []
1231
1248
  for row in response["data"]:
1232
- files.append(row["filename"])
1249
+ if folder:
1250
+ row["filename"] = f"{folder}/{row['filename']}"
1251
+ if row["isFolder"]:
1252
+ if recursive:
1253
+ folders.append(row["filename"])
1254
+ else:
1255
+ row["filename"] += "/"
1256
+ files.append(row["filename"])
1257
+ else:
1258
+ files.append(row["filename"])
1259
+
1260
+ if recursive:
1261
+ for subfolder in folders:
1262
+ files += self.list_search_result_files(
1263
+ analysis_id, folder=subfolder, recursive=recursive
1264
+ )
1265
+
1233
1266
  return files
1234
1267
 
1235
1268
  def get_search_result(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seer-pas-sdk
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: SDK for Seer Proteograph Analysis Suite (PAS)
5
5
  Author-email: Ryan Sun <rsun@seer.bio>
6
6
  License:
File without changes
File without changes
File without changes
File without changes