seer-pas-sdk 0.1.2__tar.gz → 0.1.3__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 (31) hide show
  1. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/PKG-INFO +2 -2
  2. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/README.md +1 -1
  3. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/docs/index.qmd +4 -269
  4. seer_pas_sdk-0.1.3/seer_pas_sdk/auth/__init__.py +1 -0
  5. seer_pas_sdk-0.1.3/seer_pas_sdk/core/__init__.py +1 -0
  6. seer_pas_sdk-0.1.2/seer_pas_sdk/core/__init__.py → seer_pas_sdk-0.1.3/seer_pas_sdk/core/sdk.py +29 -86
  7. seer_pas_sdk-0.1.3/seer_pas_sdk/objects/__init__.py +1 -0
  8. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk.egg-info/PKG-INFO +2 -2
  9. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk.egg-info/SOURCES.txt +3 -0
  10. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/.github/workflows/lint.yml +0 -0
  11. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/.github/workflows/publish.yml +0 -0
  12. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/.github/workflows/test.yml +0 -0
  13. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/.gitignore +0 -0
  14. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/.pre-commit-config.yaml +0 -0
  15. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/LICENSE.txt +0 -0
  16. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/docs/_quarto.yml +0 -0
  17. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/pyproject.toml +0 -0
  18. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk/__init__.py +0 -0
  19. /seer_pas_sdk-0.1.2/seer_pas_sdk/auth/__init__.py → /seer_pas_sdk-0.1.3/seer_pas_sdk/auth/auth.py +0 -0
  20. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk/common/__init__.py +0 -0
  21. /seer_pas_sdk-0.1.2/seer_pas_sdk/objects/__init__.py → /seer_pas_sdk-0.1.3/seer_pas_sdk/objects/platemap.py +0 -0
  22. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk.egg-info/dependency_links.txt +0 -0
  23. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk.egg-info/requires.txt +0 -0
  24. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/seer_pas_sdk.egg-info/top_level.txt +0 -0
  25. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/setup.cfg +0 -0
  26. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/tests/__init__.py +0 -0
  27. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/tests/conftest.py +0 -0
  28. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/tests/test_auth.py +0 -0
  29. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/tests/test_common.py +0 -0
  30. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/tests/test_objects.py +0 -0
  31. {seer_pas_sdk-0.1.2 → seer_pas_sdk-0.1.3}/tests/test_sdk.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seer-pas-sdk
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: SDK for Seer Proteograph Analysis Suite (PAS)
5
5
  Home-page: https://github.com/seerbio/seer-pas-sdk
6
6
  Author: Agam Jolly
@@ -45,6 +45,6 @@ from seer_pas_sdk import SeerSDK
45
45
  sdk = SeerSDK(USERNAME, PASSWORD)
46
46
  ```
47
47
 
48
- You can then use the SDK's functions to create, query, or retrieve projects, plates, samples, and analyses.
48
+ You can then use the SDK's methods to create, query, or retrieve projects, plates, samples, and analyses.
49
49
 
50
50
  For complete documentation of this SDK, visit [https://seerbio.github.io/seer-pas-sdk/](https://seerbio.github.io/seer-pas-sdk/ "Documentation").
@@ -22,6 +22,6 @@ from seer_pas_sdk import SeerSDK
22
22
  sdk = SeerSDK(USERNAME, PASSWORD)
23
23
  ```
24
24
 
25
- You can then use the SDK's functions to create, query, or retrieve projects, plates, samples, and analyses.
25
+ You can then use the SDK's methods to create, query, or retrieve projects, plates, samples, and analyses.
26
26
 
27
27
  For complete documentation of this SDK, visit [https://seerbio.github.io/seer-pas-sdk/](https://seerbio.github.io/seer-pas-sdk/ "Documentation").
@@ -49,11 +49,13 @@ sdk = SeerSDK(USERNAME, PASSWORD, INSTANCE)
49
49
  #| output: true
50
50
  print(f"User '{USERNAME}' logged in.")
51
51
  ```
52
-
52
+ You can then use the SDK's methods to create, query, or retrieve projects, plates, samples, and analyses.
53
+ Full documentation can be found [here](https://seerbio.github.io/seer-pas-sdk/reference/SeerSDK.html).
54
+ Additional information and examples can also be found below.
53
55
 
54
56
  ### `PlateMap` Object
55
57
 
56
- The PAS Python SDK would allow users to make plate maps file from within the SDK using the `PlateMap` object located in the `objects` module. This module is imported by default within the SDK. The interface of the plate map file contains the following parameters, all of which need to be passed in as lists:
58
+ The PAS Python SDK would allow users to make plate maps file from within the SDK using the `PlateMap` class. The interface of the plate map file contains the following parameters, all of which need to be passed in as lists:
57
59
 
58
60
  * MS file name as `ms_file_name`
59
61
  * Sample name as `sample_name`
@@ -540,33 +542,6 @@ The file will be stored in `downloads/` in the user-specified path under the uni
540
542
  <hr>
541
543
 
542
544
 
543
- ### Add Project
544
- Creates a new project with a given `project_name` and a list containing `project_id` strings.
545
-
546
- ###### <u>Params</u>
547
- * `project_name`: (`str`) Name of the project.
548
- * `plate_ids`: (`list[str]`) List of the plate ids to be added to the project.
549
- * `description`: (`str`, optional) Description of the project.
550
- * `notes`: (`str`, optional) Notes for the project.
551
- * `space`: (`str`, optional) Space where the object is contained. Defaults to the space of the user who is creating the project (or `None`).
552
- <br>
553
-
554
- ###### <u>Returns</u>
555
- `res`: (`dict`) A dictionary containing the status of the request if succeeded.
556
-
557
- ###### <u>Example</u>
558
- ```{python}
559
- #| eval: false
560
- project_name = "test_project"
561
- plate_ids = ["9872e3f0-544e-11ea-ad9e-1991e0725494", "5b05d440-6610-11ea-96e3-d5a4dab4ebf6"]
562
- log(sdk.add_project(project_name, plate_ids))
563
- ```
564
- ```
565
- {'status': 'Project started with id = 12a987d0-87d8-11ee-b03f-27a54e8c1798'}
566
- ```
567
-
568
- <hr>
569
-
570
545
  ### Analysis Complete
571
546
  Returns the status of the analysis with the given `analysis_id`.
572
547
 
@@ -588,218 +563,6 @@ log(sdk.analysis_complete(analysis_id))
588
563
 
589
564
  <hr>
590
565
 
591
- ### Add Plate
592
- Add a plate given a list of `ms_data_files`, `plate_map_file`, `plate_id`, `plate_name`, `sample_description_file` and `space`.
593
-
594
- ###### <u>Params</u>
595
- * `ms_data_files`: (`list[str]`) List of MS Data files.
596
- * `plate_map_file`: (`str` or `PlateMap` object) The plate map file path or `PlateMap` object.
597
- * `plate_id`: (`str`) The plate ID. Must be unique.
598
- * `plate_name`: (`str`) The plate name.
599
- * `sample_description_file`: (`str`, optional) Path to the sample description file which adds more detail to samples.
600
- * `space`: (`str`, optional) Space where the plate is contained. Defaults to the space of the user who is creating the project (or `None`).
601
- <br>
602
-
603
- ###### <u>Returns</u>
604
- `res`: (`dict`) A dictionary containing the status of the request if succeeded.
605
-
606
- ###### <u>Example</u>
607
- ```{python}
608
- #| eval: false
609
- data_file_locations = ["testing/AgamSDKTest1.raw", "testing/AgamSDKTest2.raw"]
610
- plate_map_location = "testing/AgamSDKPlateMapATest.csv"
611
- sample_plate_id= "unique223id"
612
- sample_plate_name = "some_plate_name"
613
-
614
- log(sdk.add_plate(data_file_locations, plate_map_location, sample_plate_id, sample_plate_name))
615
- ```
616
- ```
617
- {'message': "Plate generated with id: '147a7740-87d8-11ee-b03f-27a54e8c1798'"}
618
- ```
619
-
620
- Alternatively, instead of the `plate_map_location`, we could use the `PlateMap` object:
621
-
622
- ```{python}
623
- #| eval: false
624
- generated_plate_map_file = PlateMap(
625
- ms_file_name =["AgamSDKTest1.raw", "AgamSDKTest2.raw"],
626
- sample_name = ["A111", "A112"],
627
- sample_id = ["A111", "A112"],
628
- well_location = ["C11", "D11"],
629
- nanoparticle = ["NONE"],
630
- nanoparticle_id = ["NONE"],
631
- control = ["MPE Control"],
632
- control_id = ["MPE Control"],
633
- sample_volume = [20],
634
- peptide_concentration = [59.514],
635
- peptide_mass_sample = [8.57],
636
- dilution_factor = [1],
637
- plate_id = ["A11", "A11"],
638
- plate_name = ["A11", "A11"]
639
- )
640
-
641
- log(sdk.add_plate(data_file_locations, generated_plate_map_file, sample_plate_id, sample_plate_name))
642
- ```
643
- ```
644
- {'message': "Plate generated with id: '1f40cc10-87d8-11ee-b03f-27a54e8c1798'"}
645
- ```
646
-
647
- Similarly, you could specify a `sample_description_file` that would specify more parameters for all samples uploaded.
648
-
649
- ```{python}
650
- #| eval: false
651
- data_file_locations = ["testing/AgamSDKTest1.raw", "testing/AgamSDKTest2.raw"]
652
- plate_map_location = "testing/AgamSDKPlateMapATest.csv"
653
- sample_description_file = "testing/AgamSDKSampleDesc.csv"
654
- sample_plate_id= "unique2123id"
655
- sample_plate_name = "some_plate_name"
656
-
657
- log(sdk.add_plate(data_file_locations, plate_map_location, sample_plate_id, sample_plate_name, sample_description_file))
658
- ```
659
- ```
660
- {'message': "Plate generated with id: '147a7740-87d8-11ee-b03f-27a54e8c1798'"}
661
- ```
662
- <hr>
663
-
664
- ### Upload MS Data Files
665
- Upload MS data files to the PAS backend.
666
-
667
- ###### <u>Params</u>
668
- * `ms_data_files`: (`list[str]`) List of MS Data files.
669
- * `path`: (`str`, optional) Path to upload the files to in the S3, defaulted to an empty string. Should <b>not</b> contain trailing slashes.
670
- * `space`: (`str`, optional) ID of the user group to which the files belongs, defaulted to None.
671
- <br>
672
-
673
- ###### <u>Returns</u>
674
- `res`: (`dict`) Contains message whether the files were uploaded or not.
675
-
676
- ###### <u>Example</u>
677
- ```{python}
678
- #| eval: false
679
- data_file_locations = ["testing/AgamSDKTest1.raw", "testing/AgamSDKTest2.raw"]
680
-
681
- log(sdk.upload_ms_data_files(data_file_locations))
682
- ```
683
- ```
684
- {'message': 'Files uploaded successfully.'}
685
- ```
686
-
687
- <hr>
688
-
689
- ### Download Analysis Files
690
- Download a specific analysis file from the backend given an `analysis_id` to the specified `download_path`.
691
-
692
- If no `download_path` is specified or the `download_path` is invalid, the file will be downloaded to the current working directory.
693
-
694
- If no `file_name` is specified, all files for the analysis will be downloaded.
695
-
696
- ###### <u>Params</u>
697
- * `analysis_id` : (`str`) ID of the analysis to download.
698
- * `download_path` : (`str`, optional) Path to download the analysis file to, defaulted to current working directory.
699
- * file_name : (`str`, optional) Name of the analysis file to download, defaulted to None.
700
-
701
- ###### <u>Returns</u>
702
- (`dict`) Message containing whether the file was downloaded or not.
703
-
704
- ###### <u>Example</u>
705
- ```{python}
706
- #| eval: false
707
- analysis_id = "dd4314d0-22b5-11ee-b604-61b98afbb084"
708
- download_path = "agamjolly/something"
709
-
710
- log(sdk.download_analysis_files(analysis_id, download_path=download_path))
711
- ```
712
- ```
713
- The path "agamjolly/something" you specified does not exist, was either invalid or not absolute.
714
-
715
- Downloading files to "/Users/ajolly/Desktop/seer-sdk/downloads/dd4314d0-22b5-11ee-b604-61b98afbb084"
716
-
717
- Downloading 0714-diann181-libfree-mbr.json
718
- Finished downloading 0714-diann181-libfree-mbr.json
719
-
720
- Downloading diann.log
721
- Finished downloading diann.log
722
-
723
- Downloading lib.tsv.predicted.speclib
724
- Finished downloading lib.tsv.predicted.speclib
725
-
726
- Downloading DIANN.unique_genes_matrix.tsv
727
- Finished downloading DIANN.unique_genes_matrix.tsv
728
-
729
- Downloading lib.tsv.20230714213654
730
- Finished downloading lib.tsv.20230714213654
731
-
732
- Downloading lib.tsv.20230714213654.speclib
733
- Finished downloading lib.tsv.20230714213654.speclib
734
-
735
- Downloading DIANN-first-pass.unique_genes_matrix.tsv
736
- Finished downloading DIANN-first-pass.unique_genes_matrix.tsv
737
-
738
- Downloading DIANN.gg_matrix.tsv
739
- Finished downloading DIANN.gg_matrix.tsv
740
-
741
- Downloading DIANN.log.txt
742
- Finished downloading DIANN.log.txt
743
-
744
- Downloading DIANN.pg_matrix.tsv
745
- Finished downloading DIANN.pg_matrix.tsv
746
-
747
- Downloading DIANN.pr_matrix.tsv
748
- Finished downloading DIANN.pr_matrix.tsv
749
-
750
- Downloading DIANN.stats.tsv
751
- Finished downloading DIANN.stats.tsv
752
-
753
- Downloading DIANN.tsv
754
- Finished downloading DIANN.tsv
755
-
756
- Downloading DIANN-first-pass.gg_matrix.tsv
757
- Finished downloading DIANN-first-pass.gg_matrix.tsv
758
-
759
- Downloading DIANN-first-pass.pg_matrix.tsv
760
- Finished downloading DIANN-first-pass.pg_matrix.tsv
761
-
762
- Downloading DIANN-first-pass.pr_matrix.tsv
763
- Finished downloading DIANN-first-pass.pr_matrix.tsv
764
-
765
- Downloading DIANN-first-pass.stats.tsv
766
- Finished downloading DIANN-first-pass.stats.tsv
767
-
768
- Downloading DIANN-first-pass.tsv
769
- Finished downloading DIANN-first-pass.tsv
770
-
771
- Downloading EXP22006_2022ms0031bX26_B_BB4_1_4772.d.quant
772
- Finished downloading EXP22006_2022ms0031bX26_B_BB4_1_4772.d.quant
773
-
774
- Downloading EXP22006_2022ms0031bX26_B_BB4_1_4772/0714-diann181-libfree-mbr.json
775
- Finished downloading 0714-diann181-libfree-mbr.json
776
-
777
- Downloading EXP22006_2022ms0031bX26_B_BB4_1_4772/diann.log
778
- Finished downloading diann.log
779
-
780
- Downloading EXP22006_2022ms0031bX25_B_BA4_1_4768.d.quant
781
- Finished downloading EXP22006_2022ms0031bX25_B_BA4_1_4768.d.quant
782
-
783
- Downloading EXP22006_2022ms0031bX25_B_BA4_1_4768/0714-diann181-libfree-mbr.json
784
- Finished downloading 0714-diann181-libfree-mbr.json
785
-
786
- Downloading EXP22006_2022ms0031bX25_B_BA4_1_4768/diann.log
787
- Finished downloading diann.log
788
-
789
- Downloading EXP20004_2020ms0007X11_A.mzML.quant
790
- Finished downloading EXP20004_2020ms0007X11_A.mzML.quant
791
-
792
- Downloading EXP20004_2020ms0007X11_A/0714-diann181-libfree-mbr.json
793
- Finished downloading 0714-diann181-libfree-mbr.json
794
-
795
- Downloading EXP20004_2020ms0007X11_A/diann.log
796
- Finished downloading diann.log
797
-
798
- {'message': 'Files downloaded successfully to /Users/ajolly/Desktop/seer-sdk/downloads/dd4314d0-22b5-11ee-b604-61b98afbb084'}
799
- ```
800
-
801
- <hr>
802
-
803
566
  ### List MS Data Files
804
567
  Lists all the MS data files in the given folder as long as the folder path passed in the params is valid.
805
568
 
@@ -866,34 +629,6 @@ Finished downloading AgamSDKTest2.raw
866
629
 
867
630
  <hr>
868
631
 
869
- ### Link Plate
870
- Links existing MS data files to user uploaded files to create a new plate. Functionally, this acts the same way as `add_plate`, except this takes in files that already exist on the backend.
871
-
872
- ###### <u>Params</u>
873
- * `ms_data_files`: (`list[str]`) Path to MS data files on the PAS backend or the S3 bucket.
874
- * `plate_map_file`: (`str` or `PlateMap` object) Path to the plate map file, or `PlateMap` object to be linked.
875
- * `plate_id`: (`str`) The plate ID. Must be unique.
876
- * `plate_name`: (`str`) The plate name.
877
- * `sample_description_file`: (`str`, optional) Path to the sample description file which adds more detail to samples.
878
- * `space`: (`str`, optional) Space where the plate is contained. Defaults to the space of the user who is creating the project (or `None`).
879
- <br>
880
-
881
- ###### <u>Returns</u>
882
- (`dict`) Contains the message whether the plate was linked or not.
883
-
884
- ###### <u>Example</u>
885
- ```{python}
886
- #| eval: false
887
- ms_data_file_locations = ["147a7740-87d8-11ee-b03f-27a54e8c1798/20231120190742420/AgamSDKTest1.raw", "147a7740-87d8-11ee-b03f-27a54e8c1798/20231120190742420/AgamSDKTest2.raw"]
888
- plate_map_location = "testing/AgamSDKPlateMapATest.csv"
889
- sample_plate_id= "some_unique_id23"
890
- sample_plate_name = "linked_plate_name"
891
-
892
- log(sdk.link_plate(ms_data_file_locations, plate_map_location, sample_plate_id, sample_plate_name))
893
- ```
894
-
895
- <hr>
896
-
897
632
  ### Group Analysis Results
898
633
  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.
899
634
 
@@ -0,0 +1 @@
1
+ from .auth import Auth
@@ -0,0 +1 @@
1
+ from .sdk import SeerSDK
@@ -40,6 +40,20 @@ class SeerSDK:
40
40
  "Could not log in.\nPlease check your credentials and/or instance."
41
41
  )
42
42
 
43
+ def _get_auth_headers(self):
44
+ id_token, access_token = self._auth.get_token()
45
+ return {
46
+ "Authorization": id_token,
47
+ "access-token": access_token,
48
+ }
49
+
50
+ def _get_auth_session(self):
51
+ sess = requests.Session()
52
+
53
+ sess.headers.update(self._get_auth_headers())
54
+
55
+ return sess
56
+
43
57
  def get_spaces(self):
44
58
  """
45
59
  Fetches a list of spaces for the authenticated user.
@@ -61,16 +75,9 @@ class SeerSDK:
61
75
  ]
62
76
  """
63
77
 
64
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
65
- HEADERS = {
66
- "Authorization": f"{ID_TOKEN}",
67
- "access-token": f"{ACCESS_TOKEN}",
68
- }
69
78
  URL = f"{self._auth.url}api/v1/usergroups"
70
79
 
71
- with requests.Session() as s:
72
- s.headers.update(HEADERS)
73
-
80
+ with self._get_auth_session() as s:
74
81
  spaces = s.get(URL)
75
82
 
76
83
  if spaces.status_code != 200:
@@ -123,16 +130,10 @@ class SeerSDK:
123
130
  >>> [{ "id": ... }]
124
131
  """
125
132
 
126
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
127
- HEADERS = {
128
- "Authorization": f"{ID_TOKEN}",
129
- "access-token": f"{ACCESS_TOKEN}",
130
- }
131
133
  URL = f"{self._auth.url}api/v1/plates"
132
134
  res = []
133
135
 
134
- with requests.Session() as s:
135
- s.headers.update(HEADERS)
136
+ with self._get_auth_session() as s:
136
137
 
137
138
  plates = s.get(
138
139
  f"{URL}/{plate_id}" if plate_id else URL,
@@ -197,11 +198,6 @@ class SeerSDK:
197
198
  >>> [{ "project_name": ... }]
198
199
  """
199
200
 
200
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
201
- HEADERS = {
202
- "Authorization": f"{ID_TOKEN}",
203
- "access-token": f"{ACCESS_TOKEN}",
204
- }
205
201
  URL = (
206
202
  f"{self._auth.url}api/v1/projects"
207
203
  if not project_id
@@ -209,8 +205,7 @@ class SeerSDK:
209
205
  )
210
206
  res = []
211
207
 
212
- with requests.Session() as s:
213
- s.headers.update(HEADERS)
208
+ with self._get_auth_session() as s:
214
209
 
215
210
  projects = s.get(URL, params={"all": "true"})
216
211
  if projects.status_code != 200:
@@ -292,16 +287,10 @@ class SeerSDK:
292
287
  raise ValueError("You must pass in plate ID or project ID.")
293
288
 
294
289
  res = []
295
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
296
- HEADERS = {
297
- "Authorization": f"{ID_TOKEN}",
298
- "access-token": f"{ACCESS_TOKEN}",
299
- }
300
290
  URL = f"{self._auth.url}api/v1/samples"
301
291
  sample_params = {"all": "true"}
302
292
 
303
- with requests.Session() as s:
304
- s.headers.update(HEADERS)
293
+ with self._get_auth_session() as s:
305
294
 
306
295
  if plate_id:
307
296
  try:
@@ -351,15 +340,9 @@ class SeerSDK:
351
340
  """
352
341
  Fetches a list of custom fields defined for the authenticated user.
353
342
  """
354
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
355
- HEADERS = {
356
- "Authorization": f"{ID_TOKEN}",
357
- "access-token": f"{ACCESS_TOKEN}",
358
- }
359
343
  URL = f"{self._auth.url}api/v1/samplefields"
360
344
 
361
- with requests.Session() as s:
362
- s.headers.update(HEADERS)
345
+ with self._get_auth_session() as s:
363
346
 
364
347
  fields = s.get(URL)
365
348
 
@@ -410,17 +393,13 @@ class SeerSDK:
410
393
 
411
394
  [2 rows x 26 columns]
412
395
  """
396
+
397
+ URL = f"{self._auth.url}api/v1/msdatas/items"
398
+
413
399
  res = []
414
400
  for sample_id in sample_ids:
415
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
416
- HEADERS = {
417
- "Authorization": f"{ID_TOKEN}",
418
- "access-token": f"{ACCESS_TOKEN}",
419
- }
420
- URL = f"{self._auth.url}api/v1/msdatas/items"
421
401
 
422
- with requests.Session() as s:
423
- s.headers.update(HEADERS)
402
+ with self._get_auth_session() as s:
424
403
 
425
404
  msdatas = s.post(URL, json={"sampleId": sample_id})
426
405
 
@@ -669,11 +648,6 @@ class SeerSDK:
669
648
  >>> [{ "id": ..., "analysis_protocol_name": ... }] # in this case the id would supersede the inputted name.
670
649
  """
671
650
 
672
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
673
- HEADERS = {
674
- "Authorization": f"{ID_TOKEN}",
675
- "access-token": f"{ACCESS_TOKEN}",
676
- }
677
651
  URL = (
678
652
  f"{self._auth.url}api/v1/analysisProtocols"
679
653
  if not analysis_protocol_id
@@ -681,8 +655,7 @@ class SeerSDK:
681
655
  )
682
656
  res = []
683
657
 
684
- with requests.Session() as s:
685
- s.headers.update(HEADERS)
658
+ with self._get_auth_session() as s:
686
659
 
687
660
  protocols = s.get(URL, params={"all": "true"})
688
661
  if protocols.status_code != 200:
@@ -763,16 +736,10 @@ class SeerSDK:
763
736
  >>> [{ id: "YOUR_ANALYSIS_ID_HERE", ...}]
764
737
  """
765
738
 
766
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
767
- HEADERS = {
768
- "Authorization": f"{ID_TOKEN}",
769
- "access-token": f"{ACCESS_TOKEN}",
770
- }
771
739
  URL = f"{self._auth.url}api/v1/analyses"
772
740
  res = []
773
741
 
774
- with requests.Session() as s:
775
- s.headers.update(HEADERS)
742
+ with self._get_auth_session() as s:
776
743
 
777
744
  params = {"all": "true"}
778
745
  if folder_id:
@@ -868,15 +835,9 @@ class SeerSDK:
868
835
  "Cannot generate links for failed or null analyses."
869
836
  )
870
837
 
871
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
872
- HEADERS = {
873
- "Authorization": f"{ID_TOKEN}",
874
- "access-token": f"{ACCESS_TOKEN}",
875
- }
876
838
  URL = f"{self._auth.url}api/v1/data"
877
839
 
878
- with requests.Session() as s:
879
- s.headers.update(HEADERS)
840
+ with self._get_auth_session() as s:
880
841
 
881
842
  protein_data = s.get(
882
843
  f"{URL}/protein?analysisId={analysis_id}&retry=false"
@@ -994,18 +955,12 @@ class SeerSDK:
994
955
  ]
995
956
  """
996
957
 
997
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
998
- HEADERS = {
999
- "Authorization": f"{ID_TOKEN}",
1000
- "access-token": f"{ACCESS_TOKEN}",
1001
- }
1002
958
  URL = (
1003
959
  f"{self._auth.url}api/v1/msdataindex/filesinfolder?folder={folder}"
1004
960
  if not space
1005
961
  else f"{self._auth.url}api/v1/msdataindex/filesinfolder?folder={folder}&userGroupId={space}"
1006
962
  )
1007
- with requests.Session() as s:
1008
- s.headers.update(HEADERS)
963
+ with self._get_auth_session() as s:
1009
964
 
1010
965
  files = s.get(URL)
1011
966
 
@@ -1057,19 +1012,13 @@ class SeerSDK:
1057
1012
 
1058
1013
  print(f'Downloading files to "{name}"\n')
1059
1014
 
1060
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
1061
- HEADERS = {
1062
- "Authorization": f"{ID_TOKEN}",
1063
- "access-token": f"{ACCESS_TOKEN}",
1064
- }
1065
1015
  URL = f"{self._auth.url}api/v1/msdataindex/download/getUrl"
1066
1016
  tenant_id = jwt.decode(ID_TOKEN, options={"verify_signature": False})[
1067
1017
  "custom:tenantId"
1068
1018
  ]
1069
1019
 
1070
1020
  for path in paths:
1071
- with requests.Session() as s:
1072
- s.headers.update(HEADERS)
1021
+ with self._get_auth_session() as s:
1073
1022
 
1074
1023
  download_url = s.post(
1075
1024
  URL,
@@ -1174,11 +1123,6 @@ class SeerSDK:
1174
1123
  if not analysis_id:
1175
1124
  raise ValueError("Analysis ID cannot be empty.")
1176
1125
 
1177
- ID_TOKEN, ACCESS_TOKEN = self._auth.get_token()
1178
- HEADERS = {
1179
- "Authorization": f"{ID_TOKEN}",
1180
- "access-token": f"{ACCESS_TOKEN}",
1181
- }
1182
1126
  URL = f"{self._auth.url}"
1183
1127
 
1184
1128
  res = {
@@ -1202,8 +1146,7 @@ class SeerSDK:
1202
1146
  }
1203
1147
 
1204
1148
  # Pre-GA data call
1205
- with requests.Session() as s:
1206
- s.headers.update(HEADERS)
1149
+ with self._get_auth_session() as s:
1207
1150
 
1208
1151
  protein_pre_data = s.post(
1209
1152
  url=f"{URL}api/v2/groupanalysis/protein",
@@ -0,0 +1 @@
1
+ from .platemap import PlateMap
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seer-pas-sdk
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: SDK for Seer Proteograph Analysis Suite (PAS)
5
5
  Home-page: https://github.com/seerbio/seer-pas-sdk
6
6
  Author: Agam Jolly
@@ -45,6 +45,6 @@ from seer_pas_sdk import SeerSDK
45
45
  sdk = SeerSDK(USERNAME, PASSWORD)
46
46
  ```
47
47
 
48
- You can then use the SDK's functions to create, query, or retrieve projects, plates, samples, and analyses.
48
+ You can then use the SDK's methods to create, query, or retrieve projects, plates, samples, and analyses.
49
49
 
50
50
  For complete documentation of this SDK, visit [https://seerbio.github.io/seer-pas-sdk/](https://seerbio.github.io/seer-pas-sdk/ "Documentation").
@@ -16,9 +16,12 @@ seer_pas_sdk.egg-info/dependency_links.txt
16
16
  seer_pas_sdk.egg-info/requires.txt
17
17
  seer_pas_sdk.egg-info/top_level.txt
18
18
  seer_pas_sdk/auth/__init__.py
19
+ seer_pas_sdk/auth/auth.py
19
20
  seer_pas_sdk/common/__init__.py
20
21
  seer_pas_sdk/core/__init__.py
22
+ seer_pas_sdk/core/sdk.py
21
23
  seer_pas_sdk/objects/__init__.py
24
+ seer_pas_sdk/objects/platemap.py
22
25
  tests/__init__.py
23
26
  tests/conftest.py
24
27
  tests/test_auth.py
File without changes
File without changes
File without changes