SeerSDK
SeerSDK(username, password, instance='US', tenant=None)Object exposing SDK methods. Requires a username and password; the optional instance param denotes the instance of PAS (defaults to “US”).
Examples
>>> from seer_pas_sdk import SeerSDK
>>> USERNAME = "test"
>>> PASSWORD = "test-password"
>>> INSTANCE = "EU"
>>> seer_sdk = SeerSDK(USERNAME, PASSWORD, INSTANCE)Methods
| Name | Description |
|---|---|
| analysis_complete | Returns the status of the analysis with the given id. |
| download_ms_data_files | Downloads all MS data files for paths passed in the params to the specified download path. |
| download_search_output_file | Given an analysis id and a analysis result filename, this function downloads the file to the specified path. |
| get_active_tenant | Fetches the active tenant for the authenticated user. |
| get_active_tenant_id | Fetches the active tenant ID for the authenticated user. |
| get_active_tenant_name | Fetches the active tenant name for the authenticated user. |
| get_all_volcano_plot_data | Get all volcano plot data for a given analysis. |
| get_analyses | Returns a list of analyses objects for the authenticated user. If no id is provided, returns all analyses for the authenticated user. |
| get_analysis_hierarchical_clustering | Get hierarchical clustering data for given analyses and samples. |
| get_analysis_pca_data | Get PCA data for given analyses and samples formatted in a DataFrame or a dictionary. |
| get_analysis_protocol_fasta | |
| get_analysis_protocols | Fetches a list of analysis protocols for the authenticated user. If no analysis_protocol_id is provided, returns all analysis protocols for the authenticated user. If analysis_protocol_name (and no analysis_protocol_id) is provided, returns the analysis protocol with the given name, provided it exists. |
| get_analysis_result | Given an analysis_id, this function returns all relevant analysis data files in form of downloadable content, if applicable. |
| get_analysis_result_files | Given an analysis id and a list of file names, this function returns the file in form of downloadable content, if applicable. |
| get_analysis_result_peptide_data | Given an analysis id, this function returns the peptide data for the analysis. |
| get_analysis_result_protein_data | Given an analysis id, this function returns the protein data for the analysis. |
| get_box_plot_data | Get box plot data for given analyses and samples formatted in a DataFrame or a dictionary. |
| get_cluster_heatmap_data | Get cluster heatmap data for the given analysis. |
| get_enrichment_plot | Get enrichment plot data for a given analysis ID. |
| get_group_analysis | Returns the list of group analysis objects for the given analysis id, provided they exist. |
| get_msruns | Fetches MS data files for passed in sample_ids (provided they are valid and contain relevant files) for an authenticated user. |
| get_peptide_results_table | Fetches the peptide results table for a given analysis ID or analysis name. |
| get_plates | Fetches a list of plates for the authenticated user. If no plate_id is provided, returns all plates for the authenticated user. If plate_id is provided, returns the plate with the given plate_id, provided it exists. |
| get_ppi_network_data | Get PPI network data for given significant protein groups. |
| get_projects | Fetches a list of projects for the authenticated user. If no project_id is provided, returns all projects for the authenticated user. If project_id is provided, returns the project with the given project_id, provided it exists. |
| get_protein_results_table | Fetches the protein results table for a given analysis ID or analysis name. |
| get_samples | Fetches a list of samples for the authenticated user with relation to a specified plate, project, or analysis. If no parameters are provided, returns all samples for the authenticated user. If plate_id or project_id is provided, returns samples associated with that plate or project. If analysis_id or analysis_name is provided, returns samples associated with that analysis. |
| get_search_result | Load one of the files available via the “Download result files” button on the PAS UI. |
| get_search_result_file_url | Given an analysis id and a analysis result filename, this function returns the signed URL for the file. |
| get_spaces | Fetches a list of spaces for the authenticated user. |
| get_user_tenant | Fetches the tenant metadata for the authenticated user. |
| get_volcano_plot_data | Get volcano plot data for a given analysis ID. |
| group_analysis_results | Returns the group analysis data for the given analysis id, provided it exists. |
| list_ms_data_files | Lists all the MS data files in the given folder as long as the folder path passed in the params is valid. |
| list_search_result_files | Given an analysis id, this function returns a list of files associated with the analysis. |
| list_tenants | Lists the institution names and the tenant ids for the authenticated user. |
| switch_tenant | Switches the tenant for the authenticated user. |
analysis_complete
SeerSDK.analysis_complete(analysis_id)Returns the status of the analysis with the given id.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | The analysis id. | required |
Returns
| Name | Type | Description |
|---|---|---|
| res | dict | A dictionary containing the status of the analysis. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.analysis_complete("YOUR_ANALYSIS_ID_HERE")
>>> {
"status": "SUCCEEDED"
}download_ms_data_files
SeerSDK.download_ms_data_files(paths, download_path, space=None)Downloads all MS data files for paths passed in the params to the specified download path.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| paths | list[str] | List of paths to download. | required |
| download_path | str | Path to download the files to. | required |
| space | str | ID of the user group to which the files belongs, defaulted to None. | None |
Returns
| Name | Type | Description |
|---|---|---|
| message | dict[str, str] | Contains the ‘message’ whether the files were downloaded or not. |
download_search_output_file
SeerSDK.download_search_output_file(analysis_id, filename, download_path='')Given an analysis id and a analysis result filename, this function downloads the file to the specified path.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| filename | str | Name of the file to be fetched. Files can be case insensitive and without file extensions. | required |
| download_path | str | String flag denoting where the user wants the files downloaded. Can be local or absolute as long as the path is valid. | '' |
Returns
| Name | Type | Description |
|---|---|---|
| None | Downloads the file to the specified path. |
get_active_tenant
SeerSDK.get_active_tenant()Fetches the active tenant for the authenticated user.
Returns
| Name | Type | Description |
|---|---|---|
| tenant | dict[str, str] | Tenant metadata for the authenticated user containing “institution” and “tenantId” keys. |
get_active_tenant_id
SeerSDK.get_active_tenant_id()Fetches the active tenant ID for the authenticated user.
Returns
| Name | Type | Description |
|---|---|---|
| tenant_id | str | Tenant ID for the authenticated user. |
get_active_tenant_name
SeerSDK.get_active_tenant_name()Fetches the active tenant name for the authenticated user.
Returns
| Name | Type | Description |
|---|---|---|
| tenant | str | Tenant name for the authenticated user. |
get_all_volcano_plot_data
SeerSDK.get_all_volcano_plot_data(analysis_id, box_plot=False)Get all volcano plot data for a given analysis.
Args: analysis_id (str): ID of the analysis. box_plot (bool, optional): Mark true to include box plot data in the return object. Defaults to False.
Returns: dict[str, pd.DataFrame]: A dictionary containing the volcano plot and optionally box plot data for each group analysis.
get_analyses
SeerSDK.get_analyses(
analysis_id=None,
folder_id=None,
show_folders=True,
analysis_only=True,
project_id=None,
plate_name=None,
as_df=False,
**kwargs,
)Returns a list of analyses objects for the authenticated user. If no id is provided, returns all analyses for the authenticated user. Search parameters may be passed in as keyword arguments to filter the results. Acceptable values are ‘analysis_name’, ‘folder_name’, ‘description’, ‘notes’, or ‘number_msdatafile’. Only search on a single field is supported.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis to be fetched, defaulted to None. | None |
| folder_id | str | ID of the folder to be fetched, defaulted to None. | None |
| show_folders | bool | Mark True if folder contents are to be returned in the response, i.e. recursive search, defaulted to True. Will be disabled if an analysis id is provided. | True |
| analysis_only | bool | Mark True if only analyses objects are to be returned in the response, defaulted to True. If marked false, folder objects will also be included in the response. | True |
| project_id | str | ID of the project to be fetched, defaulted to None. | None |
| plate_name | str | Name of the plate to be fetched, defaulted to None. | None |
| as_df | bool | whether the result should be converted to a DataFrame, defaulted to False. | False |
| **kwargs | dict | Search keyword parameters to be passed in. Acceptable values are ‘analysis_name’, ‘folder_name’, ‘analysis_protocol_name’, ‘description’, ‘notes’, or ‘number_msdatafile’. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| analyses | list[dict] | Contains a list of analyses objects for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_analyses()
>>> [
{id: "YOUR_ANALYSIS_ID_HERE", ...},
{id: "YOUR_ANALYSIS_ID_HERE", ...},
{id: "YOUR_ANALYSIS_ID_HERE", ...}
]>>> seer_sdk.get_analyses("YOUR_ANALYSIS_ID_HERE")
>>> [{ id: "YOUR_ANALYSIS_ID_HERE", ...}]>>> seer_sdk.get_analyses(folder_name="YOUR_FOLDER_NAME_HERE")
>>> [{ id: "YOUR_ANALYSIS_ID_HERE", ...}]>>> seer_sdk.get_analyses(analysis_name="YOUR_ANALYSIS")
>>> [{ id: "YOUR_ANALYSIS_ID_HERE", ...}]>>> seer_sdk.get_analyses(description="YOUR_DESCRIPTION")
>>> [{ id: "YOUR_ANALYSIS_ID_HERE", ...}]get_analysis_hierarchical_clustering
SeerSDK.get_analysis_hierarchical_clustering(
analysis_ids,
sample_ids=[],
hide_control=False,
)Get hierarchical clustering data for given analyses and samples. Args: analysis_ids (list[str]): IDs of the analyses. sample_ids (list[str], optional): IDs of the samples. hide_control (bool, optional): Mark true if controls are to be excluded. Defaults to False. raw_data (bool, optional): Mark true if raw data should be returned. Defaults to True. Raises: ValueError: No analysis IDs provided. ValueError: No sample IDs provided. ValueError: Response status code is not 200. Returns: dict Hierarchical clustering data returned by the API.
get_analysis_pca_data
SeerSDK.get_analysis_pca_data(
analysis_ids,
type,
sample_ids=[],
hide_control=False,
as_df=False,
)Get PCA data for given analyses and samples formatted in a DataFrame or a dictionary. Args: analysis_ids (list[str]): IDs of the analyses of interest. type (str): Type of data to be fetched. Must be either ‘protein’ or ‘peptide’. sample_ids (list[str], optional): IDs of the samples of interest. hide_control (bool, optional): Mark true if controls are to be excluded. Defaults to False. as_df (bool, optional): whether the result should be converted to a DataFrame. Defaults to False. Raises: ValueError: No analysis IDs provided. ValueError: No sample IDs provided. ValueError: Invalid type parameter provided. ServerError: Could not fetch PCA data. Returns: A dictionary with the following keys: - x_contribution_ratio (float): Proportion of variance explained by the x-axis. - y_contribution_ratio (float): Proportion of variance explained by the y-axis. - data (list[dict] | pd.DataFrame): A list of dictionaries or a dataframe with each row containing the following keys/columns: - sample_name (str): Name of the sample. - plate_name (str): Name of the plate. - sample_id (int): ID of the sample. - condition (str): Condition. - PC1 (float): X-value of the PCA point. - PC2 (float): Y-value of the PCA point. - custom_* (str): Custom fields. Included if meaningful, i.e., not null, in the data.
Examples
>>> from seer_pas_sdk import *
>>> sdk = SeerSDK()
>>> sdk.get_analysis_pca_data(
analysis_ids=["analysis_id"],
sample_ids=["sample_id"],
type="protein",
hide_control=False
)get_analysis_protocol_fasta
SeerSDK.get_analysis_protocol_fasta(analysis_id, download_path=None)get_analysis_protocols
SeerSDK.get_analysis_protocols(
analysis_protocol_name=None,
analysis_protocol_id=None,
as_df=False,
)Fetches a list of analysis protocols for the authenticated user. If no analysis_protocol_id is provided, returns all analysis protocols for the authenticated user. If analysis_protocol_name (and no analysis_protocol_id) is provided, returns the analysis protocol with the given name, provided it exists.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_protocol_id | str | ID of the analysis protocol to be fetched, defaulted to None. | None |
| analysis_protocol_name | str | Name of the analysis protocol to be fetched, defaulted to None. | None |
| as_df | bool | whether the result should be converted to a DataFrame, defaulted to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| protocols | list[dict] | List of analysis protocol objects for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_analysis_protocols()
>>> [
{ "id": ..., "analysis_protocol_name": ... },
{ "id": ..., "analysis_protocol_name": ... },
...
]>>> seer_sdk.get_analysis_protocols(name="YOUR_ANALYSIS_PROTOCOL_NAME_HERE")
>>> [{ "id": ..., "analysis_protocol_name": ... }]>>> seer_sdk.get_analysis_protocols(id="YOUR_ANALYSIS_PROTOCOL_ID_HERE")
>>> [{ "id": ..., "analysis_protocol_name": ... }]>>> seer_sdk.get_analysis_protocols(id="YOUR_ANALYSIS_PROTOCOL_ID_HERE", name="YOUR_ANALYSIS_PROTOCOL_NAME_HERE")>>> [{ "id": ..., "analysis_protocol_name": ... }] # in this case the id would supersede the inputted name.get_analysis_result
SeerSDK.get_analysis_result(analysis_id, download_path='', diann_report=False)Given an analysis_id, this function returns all relevant analysis data files in form of downloadable content, if applicable.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| download_path | str | String flag denoting where the user wants the files downloaded. Can be local or absolute as long as the path is valid. Defaults to an empty string. | '' |
| diann_report | bool | Boolean flag denoting whether the user wants the DIANN report to be included in the response. Defaults to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| links | dict | Contains dataframe objects for the analysis_id, given that the analysis has been complete. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()>>> seer_sdk.get_analysis_result("YOUR_ANALYSIS_ID_HERE")
>>> {
"peptide_np": <peptide_np dataframe object>,
"peptide_panel": <peptide_panel dataframe object>,
"protein_np": <protein_np dataframe object>,
"protein_panel": <protein_panel dataframe object>
}>>> seer_sdk.get_analysis_result("YOUR_DIANN_ANALYSIS_ID_HERE")
>>> {
"peptide_np": <peptide_np dataframe object>,
"peptide_panel": <peptide_panel dataframe object>,
"protein_np": <protein_np dataframe object>,
"protein_panel": <protein_panel dataframe object>,
"diann_report": <report.tsv dataframe object>
}>>> seer_sdk.get_analysis_result("YOUR_ANALYSIS_ID_HERE", download_path="/Users/Downloads")
>>> { "status": "Download complete." }get_analysis_result_files
SeerSDK.get_analysis_result_files(
analysis_id,
filenames,
download_path='',
protein_all=False,
peptide_all=False,
)Given an analysis id and a list of file names, this function returns the file in form of downloadable content, if applicable.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| filenames | list | List of filenames to be fetched. Only csv and tsv files are supported. | required |
| download_path | str | String flag denoting where the user wants the files downloaded. Can be local or absolute as long as the path is valid. Defaults to an empty string. | '' |
| protein_all | bool | Boolean flag denoting whether the user wants the default protein data. Defaults to False. | False |
| peptide_all | bool | Boolean flag denoting whether the user wants the default peptide data. Defaults to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| links | dict[str, pd.DataFrame] | Contains dataframe objects for the requested files. If a filename is not found, it is skipped. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> analysis_id = "YOUR_ANALYSIS_ID_HERE"
>>> filenames = ["protein_np.tsv", "peptide_np.tsv"]
>>> seer_sdk.get_analysis_result_files(analysis_id, filenames)
{
"protein_np.tsv": <protein_np dataframe object>,
"peptide_np.tsv": <peptide_np dataframe object>
}
>>> seer_sdk.get_analysis_result_files(analysis_id, [], protein_all=True, peptide_all=True)
{
"protein_np.tsv": <protein_np dataframe object>,
"protein_panel.tsv": <protein_panel dataframe object>,
"peptide_np.tsv": <peptide_np dataframe object>,
"peptide_panel.tsv": <peptide_panel dataframe object>
}
>>> seer_sdk.get_analysis_result_files(analysis_id, ["report.tsv"], download_path="/Users/Downloads")
{ "report.tsv": <report.tsv dataframe object> }get_analysis_result_peptide_data
SeerSDK.get_analysis_result_peptide_data(analysis_id, link=False, peptide=None)Given an analysis id, this function returns the peptide data for the analysis.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| link | bool | Boolean flag denoting whether the user wants the default peptide data. Defaults to False. | False |
| peptide | str | Peptide sequence to filter dataframe results. Defaults to None. | None |
get_analysis_result_protein_data
SeerSDK.get_analysis_result_protein_data(analysis_id, link=False, pg=None)Given an analysis id, this function returns the protein data for the analysis.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| link | bool | Boolean flag denoting whether the user wants the default protein data. Defaults to False. | False |
| pg | str | Protein group ID to filter dataframe results. Defaults to None. | None |
get_box_plot_data
SeerSDK.get_box_plot_data(
analysis_id,
group_analysis_id=None,
feature_ids=[],
show_significant_only=False,
as_df=False,
volcano_plot=False,
cached=False,
)Get box plot data for given analyses and samples formatted in a DataFrame or a dictionary.
Args: analysis_id (str): ID of the analysis. feature_ids (list[str], optional): Filter result object to a set of ids. Defaults to []. show_significant_only (bool, optional): Mark true if only significant results are to be returned. Defaults to False. as_df (bool, optional): whether the result should be converted to a DataFrame. Defaults to False. volcano_plot (bool, optional): Mark true to include the volcano plot data in the return object. Defaults to False. cached (bool, optional): Mark true to return volcano plot data as a VolcanoPlotBuilder object. No effect if volcano_plot flag is marked false. Defaults to False.
Raises: ValueError: Invalid feature type. Must be either ‘protein’ or ‘peptide’. ServerError: Could not fetch box plot data.
Returns: list[dict] | pd.DataFrame : A list of dictionaries or a dataframe with each row containing the following keys/columns: ‘proteinId’, ‘intensity’, ‘sampleName’, ‘sampleId’, ‘condition’,‘gene’
get_cluster_heatmap_data
SeerSDK.get_cluster_heatmap_data(
analysis_id,
grouping,
groups,
contrasts,
stat_test,
feature_type,
significant_pgs=[],
)Get cluster heatmap data for the given analysis.
Args: analysis_id (str): ID of the analysis grouping (str): Category of sample groups groups (_List[str]): sample groups contrasts (_List[_Tuple[int, …]]): Indicate which groups are compared against each other. e.g. [(0, 1, -1, 0), (1, 0, 0, -1)] stat_test (str): Statistical test to be used feature_type (str): Type of feature to be used, either proteingroup or peptide significant_pgs (_List[str], optional): significant protein group IDs. Defaults to [].
Raises: ValueError: “Feature type must be either ‘proteingroup’ or ‘peptide’.” ValueError: “Stat test must be either ‘ttest’ or ‘wilcoxon’.” ValueError: Invalid contrast value. ValueError: Server error
Returns: dict: the response object clusterProtein: List of protein clusters clusters: indexes: list[int], List of indexes height: int, Height of the cluster children: list[dict] | None, Children of the cluster clusterSample: List of sample clusters clusters: indexes: list[int], List of indexes height: int, Height of the cluster children: list[dict] | None, Children of the cluster data: List of data
get_enrichment_plot
SeerSDK.get_enrichment_plot(
analysis_id,
significant_pgs,
summarize_output=False,
exclude_singleton=False,
cutoff=None,
species=None,
)Get enrichment plot data for a given analysis ID.
Args: analysis_id (str): ID of the analysis. significant_pgs (_List[str]): List of significant protein/peptide groups. summarize_output (bool, optional): Summarize the output. Defaults to False. exclude_singleton (bool, optional): Exclude singleton values. Defaults to False. cutoff (float, optional): Cutoff value for the p-value to determine significance. Defaults to None. species (str, optional): Species to filter the data by. Defaults to None.
Raises: ServerError - could not fetch enrichment plot data.
Returns: dict: A dictionary containing the enrichment plot data.
get_group_analysis
SeerSDK.get_group_analysis(analysis_id, group_analysis_id=None, **kwargs)Returns the list of group analysis objects for the given analysis id, provided they exist.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | The analysis id. | required |
| group_analysis_id | str | The group analysis id, defaulted to None. If provided, the function will return the group analysis object for the given group analysis id. | None |
| **kwargs | dict | Search keyword parameters to be passed in. Acceptable values are ‘name’ or ‘description’. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| res | list[dict] | A list of dictionaries containing the group analysis objects. |
get_msruns
SeerSDK.get_msruns(sample_ids, as_df=False)Fetches MS data files for passed in sample_ids (provided they are valid and contain relevant files) for an authenticated user.
The function returns a dict containing DataFrame objects if the df flag is passed in as True, otherwise a nested dict object is returned instead.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| sample_ids | list | List of unique sample IDs. | required |
| as_df | bool | whether the result should be converted to a DataFrame, defaulted to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| res | list[dict] or DataFrame | List/DataFrame of plate objects for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> sample_ids = ["812139c0-15e0-11ee-bdf1-bbaa73585acf", "803e05b0-15e0-11ee-bdf1-bbaa73585acf"]>>> seer_sdk.get_msruns(sample_ids)
>>> [
{"id": "SAMPLE_ID_1_HERE" ... },
{"id": "SAMPLE_ID_2_HERE" ... }
]>>> seer_sdk.get_msruns(sample_ids, as_df=True)
>>> id ... gradient
0 81c6a180-15e0-11ee-bdf1-bbaa73585acf ... None
1 816a9ed0-15e0-11ee-bdf1-bbaa73585acf ... None[2 rows x 26 columns]
get_peptide_results_table
SeerSDK.get_peptide_results_table(
analysis_id=None,
analysis_name=None,
grouping='condition',
as_df=False,
)Fetches the peptide results table for a given analysis ID or analysis name.
Args: analysis_id (str, optional): id of the analysis. Defaults to None. analysis_name (str, optional): name of the analysis. Defaults to None. grouping (str, optional): group criteria of table results. Defaults to “condition”. as_df (bool, optional): whether the result should be converted to a DataFrame, defaulted to False.
Raises: ValueError: neither name or id were provided for an analysis. ServerError: the request to the server was not successful.
Returns: list[dict] | pd.DataFrame: data from the peptide results table.
get_plates
SeerSDK.get_plates(plate_id=None, plate_name=None, as_df=False)Fetches a list of plates for the authenticated user. If no plate_id is provided, returns all plates for the authenticated user. If plate_id is provided, returns the plate with the given plate_id, provided it exists.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| plate_id | str | ID of the plate to be fetched, defaulted to None. | None |
| as_df | bool | whether the result should be converted to a DataFrame, defaulted to None. | False |
Returns
| Name | Type | Description |
|---|---|---|
| plates | list[dict] or DataFrame | List/DataFrame of plate objects for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_plates()
>>> [
{ "id": ... },
{ "id": ... },
...
]
>>> seer_sdk.get_plates(as_df=True)
>>> id ... user_group
0 a7c12190-15da-11ee-bdf1-bbaa73585acf ... None
1 8c3b1480-15da-11ee-bdf1-bbaa73585acf ... None
2 6f158840-15da-11ee-bdf1-bbaa73585acf ... None
3 1a8a2920-15da-11ee-bdf1-bbaa73585acf ... None
4 7ab47f40-15d9-11ee-bdf1-bbaa73585acf ... None
.. ... ... ...
935 8fa91c00-6621-11ea-96e3-d5a4dab4ebf6 ... None
936 53180b20-6621-11ea-96e3-d5a4dab4ebf6 ... None
937 5c31fe90-6618-11ea-96e3-d5a4dab4ebf6 ... None
938 5b05d440-6610-11ea-96e3-d5a4dab4ebf6 ... None
939 9872e3f0-544e-11ea-ad9e-1991e0725494 ... None>>> seer_sdk.get_plate_metadata(id="YOUR_PLATE_ID_HERE")
>>> [{ "id": ... }]get_ppi_network_data
SeerSDK.get_ppi_network_data(significant_pgs, species=None)Get PPI network data for given significant protein groups. Args: significant_pgs (_List[str]): Significant protein groups. species (str, optional): Species of interest. Defaults to None. Raises: ValueError: No significant protein groups provided. ValueError: Response status code is not 200. Returns: dict Response returned by the API.
get_projects
SeerSDK.get_projects(project_id=None, project_name=None, as_df=False)Fetches a list of projects for the authenticated user. If no project_id is provided, returns all projects for the authenticated user. If project_id is provided, returns the project with the given project_id, provided it exists.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| project_id | str | Project ID of the project to be fetched, defaulted to None. | None |
| as_df | bool | whether the result should be converted to a DataFrame, defaulted to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| projects | list[dict] or DataFrame | DataFrame or list of project objects for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_projects()
>>> [
{ "project_name": ... },
{ "project_name": ... },
...
]>>> seer_sdk.get_projects(as_df=True)
>>> id ... user_group
0 a7c12190-15da-11ee-bdf1-bbaa73585acf ... None
1 8c3b1480-15da-11ee-bdf1-bbaa73585acf ... None
2 6f158840-15da-11ee-bdf1-bbaa73585acf ... None
3 1a8a2920-15da-11ee-bdf1-bbaa73585acf ... None
4 7ab47f40-15d9-11ee-bdf1-bbaa73585acf ... None
.. ... ... ...
935 8fa91c00-6621-11ea-96e3-d5a4dab4ebf6 ... None
936 53180b20-6621-11ea-96e3-d5a4dab4ebf6 ... None
937 5c31fe90-6618-11ea-96e3-d5a4dab4ebf6 ... None
938 5b05d440-6610-11ea-96e3-d5a4dab4ebf6 ... None
939 9872e3f0-544e-11ea-ad9e-1991e0725494 ... None>>> seer_sdk.get_projects(id="YOUR_PROJECT_ID_HERE")
>>> [{ "project_name": ... }]get_protein_results_table
SeerSDK.get_protein_results_table(
analysis_id=None,
analysis_name=None,
grouping='condition',
as_df=False,
)Fetches the protein results table for a given analysis ID or analysis name.
Args: analysis_id (str, optional): id of the analysis. Defaults to None. analysis_name (str, optional): name of the analysis. Defaults to None. grouping (str, optional): group criteria of table result. Defaults to “condition”. as_df (bool, optional): . Defaults to False.
Raises: ValueError: neither name or id were provided for an analysis. ServerError: the request to the server was not successful.
Returns: list[dict] | pd.DataFrame: data from the protein results table.
get_samples
SeerSDK.get_samples(
plate_id=None,
project_id=None,
analysis_id=None,
analysis_name=None,
as_df=False,
)Fetches a list of samples for the authenticated user with relation to a specified plate, project, or analysis. If no parameters are provided, returns all samples for the authenticated user. If plate_id or project_id is provided, returns samples associated with that plate or project. If analysis_id or analysis_name is provided, returns samples associated with that analysis.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| plate_id | str | ID of the plate for which samples are to be fetched, defaulted to None. | None |
| project_id | str | ID of the project for which samples are to be fetched, defaulted to None. | None |
| analysis_id | str | ID of the analysis for which samples are to be fetched, defaulted to None. | None |
| analysis_name | str | Name of the analysis for which samples are to be fetched, defaulted to None. | None |
| as_df | bool | whether the result should be converted to a DataFrame, defaulted to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| samples | list[dict] or DataFrame | List/DataFrame of samples for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()>>> seer_sdk.get_samples(plate_id="7ec8cad0-15e0-11ee-bdf1-bbaa73585acf")
>>> [
{ "id": ... },
{ "id": ... },
...
]>>> seer_sdk.get_samples(as_df=True)
>>> id ... control
0 812139c0-15e0-11ee-bdf1-bbaa73585acf ...
1 803e05b0-15e0-11ee-bdf1-bbaa73585acf ... MPE Control
2 a9b26a40-15da-11ee-bdf1-bbaa73585acf ...
3 a8fc87c0-15da-11ee-bdf1-bbaa73585acf ... MPE Control
4 8e322990-15da-11ee-bdf1-bbaa73585acf ...
... ... ... ...
3624 907e1f40-6621-11ea-96e3-d5a4dab4ebf6 ... C132
3625 53e59450-6621-11ea-96e3-d5a4dab4ebf6 ... C132
3626 5d11b030-6618-11ea-96e3-d5a4dab4ebf6 ... C132
3627 5bdf9270-6610-11ea-96e3-d5a4dab4ebf6 ... C132
3628 dd607ef0-654c-11ea-8eb2-25a1cfd1163c ... C132get_search_result
SeerSDK.get_search_result(analysis_id, analyte_type, rollup)Load one of the files available via the “Download result files” button on the PAS UI.
Args: analysis_id (str): id of the analysis analyte_type (str): type of the data. Acceptable options are one of [‘protein’, ‘peptide’, ‘precursor’]. rollup (str): the desired file. Acceptable options are one of [‘np’, ‘panel’]. Returns: pd.DataFrame: the requested file as a pandas DataFrame
get_search_result_file_url
SeerSDK.get_search_result_file_url(analysis_id, filename)Given an analysis id and a analysis result filename, this function returns the signed URL for the file.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| filename | str | Name of the file to be fetched. | required |
Returns
| Name | Type | Description |
|---|---|---|
| file_url | dict[str, str] | Dictionary containing the ‘url’ and ‘filename’ of the file. |
get_spaces
SeerSDK.get_spaces()Fetches a list of spaces for the authenticated user.
Returns
| Name | Type | Description |
|---|---|---|
| spaces | list[dict] | List of space objects for the authenticated user. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_spaces()
>>> [
{ "usergroup_name": ... },
{ "usergroup_name": ... },
...
]get_user_tenant
SeerSDK.get_user_tenant(index=True)Fetches the tenant metadata for the authenticated user.
Returns
| Name | Type | Description |
|---|---|---|
| response | list[dict] | A list of tenant objects pertaining to the user. |
get_volcano_plot_data
SeerSDK.get_volcano_plot_data(
analysis_id,
group_analysis_id=None,
significance_threshold=0.05,
fold_change_threshold=1,
label_by='fold_change',
cached=False,
as_df=False,
)Get volcano plot data for a given analysis ID.
Args: analysis_id (str): ID of the analysis. significance_threshold (float, optional): Cutoff value for the p-value to determine significance. Defaults to 0.05. fold_change_threshold (float, optional): Cutoff value for the fold change to determine significance. Defaults to 1. label_by (str, optional): Metric to sort result data. Defaults to “fold_change”. cached (bool, optional): Return a VolcanoPlotBuilder object for calculation reuse. Defaults to False. as_df (bool, optional): whether the result should be converted to a DataFrame. Defaults to False.
Raises: ServerError - could not fetch group analysis results. Returns: list[dict] | pd.DataFrame | VolcanoPlotBuilder: A list of dictionaries, a DataFrame, or a VolcanoPlotBuilder object containing the volcano plot data. Object contains the following columns: ‘logFD’, ‘negativeLog10P’, ‘dataIndex’, ‘rowID’, ‘gene’, ‘protein’, ‘group’, ‘significant’, ‘euclideanDistance’
group_analysis_results
SeerSDK.group_analysis_results(analysis_id, group_analysis_id=None)Returns the group analysis data for the given analysis id, provided it exists.
If no group analysis id is provided, the function will return the most recent group analysis data for the given analysis id.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | The analysis id. | required |
| group_analysis_id | str | The group analysis id, defaulted to None. | None |
Returns
| Name | Type | Description |
|---|---|---|
| res | dict | A dictionary containing the group analysis object. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.group_analysis_results("YOUR_ANALYSIS_ID_HERE")
>>> {
"pre": {
"protein": [],
"peptide": [],
},
"post": {
"protein": {},
"protein_url": {
"protein_processed_file_url": "",
"protein_processed_long_form_file_url": "",
},
"peptide": {},
"peptide_url": {
"peptide_processed_file_url": "",
"peptide_processed_long_form_file_url": "",
},
},
"box_plot": []
}list_ms_data_files
SeerSDK.list_ms_data_files(folder='', space=None)Lists all the MS data files in the given folder as long as the folder path passed in the params is valid.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| folder | str | Folder path to list the files from. Defaults to an empty string and displays all files for the user. | '' |
| space | str | ID of the user group to which the files belong, defaulted to None. | None |
Returns
| Name | Type | Description |
|---|---|---|
| list[str] | Contains the list of files in the folder. |
Examples
>>> from seer_pas_sdk import SeerSDK
>>> sdk = SeerSDK()
>>> folder_path = "test-may-2/"
>>> sdk.list_ms_data_files(folder_path)
>>> [
"test-may-2/EXP20028/EXP20028_2020ms0096X10_A.raw",
"test-may-2/agilent/05_C2_19ug-r001.d.zip",
"test-may-2/agilent/08_BC_24ug-r001.d.zip",
"test-may-2/d.zip/EXP22023_2022ms0143bX10_A_GA2_1_6681.d/EXP22023_2022ms0143bX10_A_GA2_1_6681.d.zip",
"test-may-2/DIA/EXP20002_2020ms0142X10_A.wiff",
"test-may-2/DIA/EXP20002_2020ms0142X10_A.wiff.scan",
"test-may-2/DIA/EXP20002_2020ms0142X17_A.wiff",
"test-may-2/DIA/EXP20002_2020ms0142X17_A.wiff.scan",
"test-may-2/DIA/EXP20002_2020ms0142X18_A.wiff",
"test-may-2/DIA/EXP20002_2020ms0142X18_A.wiff.scan"
]list_search_result_files
SeerSDK.list_search_result_files(analysis_id, folder=None, recursive=False)Given an analysis id, this function returns a list of files associated with the analysis.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| analysis_id | str | ID of the analysis for which the data is to be fetched. | required |
| folder | str | Root folder key to list search result files from, defaulted to None. | None |
| recursive | bool | Whether to list files recursively from subfolders, defaulted to False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| files | list[str] | List of files associated with the analysis. |
list_tenants
SeerSDK.list_tenants(reverse=False)Lists the institution names and the tenant ids for the authenticated user.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| reverse | Boolean denoting whether the user wants the result dictionary indexed by tenant id (True) or institution name (False). | False |
Returns
| Name | Type | Description |
|---|---|---|
| tenants | dict[str, str] | A dictionary containing the institution names and tenant ids for the authenticated user. |
switch_tenant
SeerSDK.switch_tenant(identifier)Switches the tenant for the authenticated user.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| identifier | str | Tenant ID or organization name to switch to. | required |
Returns
| Name | Type | Description |
|---|---|---|
| tenant_id | str | Returns the value of the active tenant id after the operation. |