SeerSDK

SeerSDK(self, username, password, instance='US')

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.
get_analysis Returns a list of analyses objects for the authenticated user. If no id is provided, returns all analyses for the authenticated user.
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_msdata Fetches MS data files for passed in sample_ids (provided they are valid and contain relevant files) for an authenticated user.
get_plate Fetches MS data files for a plate_id (provided that the plate_id is valid and has samples associated with it) for an authenticated user.
get_plate_metadata 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_project Fetches samples (and MS data files) for a project_id (provided that the project_id is valid and has samples associated with it) for an authenticated user.
get_project_metadata 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_sample_custom_fields Fetches a list of custom fields defined for the authenticated user.
get_spaces Fetches a list of spaces for the authenticated user.
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.

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

Type Description
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

Type Description
dict Contains the message whether the files were downloaded or not.

get_analysis

SeerSDK.get_analysis(analysis_id=None, folder_id=None, show_folders=True, analysis_only=True)

Returns a list of analyses objects for the authenticated user. If no id is provided, returns all analyses for the authenticated user.

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, 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

Returns

Type Description
dict Contains a list of analyses objects for the authenticated user.

Examples

>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_analysis()
>>> [
        {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", ...}]

get_analysis_protocols

SeerSDK.get_analysis_protocols(analysis_protocol_name=None, analysis_protocol_id=None)

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

Returns

Type Description
list 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='')

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 bool 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. ''

Returns

Type Description
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_ANALYSIS_ID_HERE", download_path="/Users/Downloads")
>>> { "status": "Download complete." }

get_msdata

SeerSDK.get_msdata(sample_ids, 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
df bool Boolean denoting whether the user wants the response back in JSON or a DataFrame object. False

Returns

Type Description
list 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_msdata(sample_ids)
>>> [
    {"id": "SAMPLE_ID_1_HERE" ... },
    {"id": "SAMPLE_ID_2_HERE" ... }
]
>>> seer_sdk.get_msdata(sample_ids, df=True)
>>>                                      id  ... gradient
    0  81c6a180-15e0-11ee-bdf1-bbaa73585acf  ...     None
    1  816a9ed0-15e0-11ee-bdf1-bbaa73585acf  ...     None
[2 rows x 26 columns]

get_plate

SeerSDK.get_plate(plate_id, df=False)

Fetches MS data files for a plate_id (provided that the plate_id is valid and has samples associated with it) 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
plate_id str ID of the plate for which samples are to be fetched, defaulted to None. required
df bool Boolean denoting whether the user wants the response back in JSON or a DataFrame object False

Returns

Type Description
list or DataFrame List/DataFrame of MS data file objects for the authenticated user.

Examples

>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> plate_id = "7ec8cad0-15e0-11ee-bdf1-bbaa73585acf"
>>> seer_sdk.get_plate(plate_id)
>>> [
    {"id": "PLATE_ID_1_HERE" ... },
    {"id": "PLATE_ID_2_HERE" ... }
]
>>> seer_sdk.get_plate(plate_id, df=True)
>>>                 id  ...   volume
    0  PLATE_ID_1_HERE  ...     None
    1  PLATE_ID_2_HERE  ...     None
[2 rows x 26 columns]

get_plate_metadata

SeerSDK.get_plate_metadata(plate_id=None, 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
df bool Boolean denoting whether the user wants the response back in JSON or a DataFrame object False

Returns

Type Description
list or DataFrame List/DataFrame of plate objects for the authenticated user.

Examples

>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> seer_sdk.get_plate_metadata()
>>> [
        { "id": ... },
        { "id": ... },
        ...
    ]
>>> seer_sdk.get_plate_metadata(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_project

SeerSDK.get_project(project_id, msdata=False, df=False)

Fetches samples (and MS data files) for a project_id (provided that the project_id is valid and has samples associated with it) for an authenticated user.

The function returns a DataFrame object if the df flag is passed in as True, otherwise a nested dict object is returned instead. If the both the df and msdata flags are passed in as True, then a nested DataFrame object is returned instead.

Parameters

Name Type Description Default
project_id str ID of the project for which samples are to be fetched. required
msdata bool Boolean flag denoting whether the user wants relevant MS data files associated with the samples. False
df bool Boolean denoting whether the user wants the response back in JSON or a DataFrame object. False

Returns

Type Description
list or DataFrame List/DataFrame of plate objects for the authenticated user.

Examples

>>> from seer_pas_sdk import SeerSDK
>>> seer_sdk = SeerSDK()
>>> project_id = "7e48e150-8a47-11ed-b382-bf440acece26"
>>> seer_sdk.get_project(project_id=project_id, msdata=False, df=False)
>>> {
    "project_samples": [
        {
            "id": "SAMPLE_ID_1_HERE",
            "sample_type": "Plasma",
            ...
            ...
        },
        {
            "id": "SAMPLE_ID_2_HERE",
            "sample_type": "Plasma",
            ...
            ...
        }
    ]
}
>>> seer_sdk.get_project(project_id=project_id, msdata=True, df=False)
>>> [
        {
            "id": "SAMPLE_ID_1_HERE",
            "sample_type": "Plasma",
            ...
            ...
            "ms_data_files": [
                {
                    "id": MS_DATA_FILE_ID_1_HERE,
                    "tenant_id": "TENANT_ID_HERE",
                    ...
                    ...
                },
                {
                    "id": MS_DATA_FILE_ID_1_HERE,
                    "tenant_id": "TENANT_ID_HERE",
                    ...
                    ...
                }
            ]
        },
        {
            "id": "SAMPLE_ID_2_HERE",
            "sample_type": "Plasma",
            ...
            ...
            "ms_data_files": [
                {
                    "id": MS_DATA_FILE_ID_2_HERE,
                    "tenant_id": "TENANT_ID_HERE",
                    ...
                    ...
                },
                {
                    "id": MS_DATA_FILE_ID_2_HERE,
                    "tenant_id": "TENANT_ID_HERE",
                    ...
                    ...
                }
            ]
        }
    ]
>>> seer_sdk.get_project(project_id=project_id, msdata=True, df=True)
>>> id  ...                                                                           ms_data_files
    0  829509f0-8a47-11ed-b382-bf440acece26  ...                                       id  ... g...
    1  828d41c0-8a47-11ed-b382-bf440acece26  ...                                       id  ... g...
    2  8294e2e0-8a47-11ed-b382-bf440acece26  ...                                       id  ... g...
    3  8285eec0-8a47-11ed-b382-bf440acece26  ...                                       id  ... g...
[4 rows x 60 columns]

get_project_metadata

SeerSDK.get_project_metadata(project_id=None, 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
df bool Boolean denoting whether the user wants the response back in JSON or a DataFrame object. False

Returns

Type Description
list 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_project_metadata()
>>> [
        { "project_name": ... },
        { "project_name": ... },
        ...
    ]
>>> seer_sdk.get_project_metadata(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_project_metadata(id="YOUR_PROJECT_ID_HERE")
>>> [{ "project_name": ... }]

get_sample_custom_fields

SeerSDK.get_sample_custom_fields()

Fetches a list of custom fields defined for the authenticated user.

get_spaces

SeerSDK.get_spaces()

Fetches a list of spaces for the authenticated user.

Returns

Type Description
list 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": ... },
        ...
    ]

group_analysis_results

SeerSDK.group_analysis_results(analysis_id, box_plot=None)

Returns the group analysis data for the given analysis id, provided it exists.

Parameters

Name Type Description Default
analysis_id str The analysis id. required
box_plot dict The box plot configuration needed for the analysis, defaulted to None. Contains feature_type (“protein” or “peptide”) and feature_ids (comma separated list of feature IDs) keys. None

Returns

Type Description
dict A dictionary containing the group analysis data.

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

Type Description
list 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"
]