Exemplo n.º 1
0
    def search(cls, **kwargs):
        """Retrieve a list of TranscriptomeIndex based on various filters

        Returns:
            list of TranscriptomeIndex

        Keyword Arguments:
            salmon_version (str): filter based on the TranscriptomeIndex's salmon version eg. salmon 0.13.1

            index_type (str): `TRANSCRIPTOME_LONG` or `TRANSCRIPTOME_SHORT`.
                              If the average read length of the RNA-Seq sample you want to process
                              is greater than 75 base pairs, use `TRANSCRIPTOME_LONG` otherwise use
                              `TRANSCRIPTOME_SHORT`

            ordering (str): which field to use when ordering the results.

            limit (int): number of results to return per page.

            offset (int): the initial index from which to return the results.

            organism__name (str): filter based on the name of the Organism associated
                                  with the TranscriptomeIndex

            length (str): short hand for index_type eg. `short` or `long`
                          see `index_type` for more information
        """
        response = get_by_endpoint("transcriptome_indices", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 2
0
    def search(cls, **kwargs):
        """Retrieve a list of Compendium results based on filters

        Returns:
            list of Compendium

        Keyword Arguments:
            primary_organism__name (str): filter based on the name of the primary Organism
                                          associated with the compendium

            compendium_version (int): filter based on the Compendium's version

            quant_sf_only (bool): true for RNA-seq Sample Compendium results or False
                                  for quantile normalized

            result__id (int): filter based on the id of the ComputationalResult associated
                              with the compendium

            ordering (str): which field to use when ordering the results

            limit (int): number of results to return per page

            offset (int): the initial index from which to return the results

            latest_version (bool): true will only return the highest
                                   compendium_version for each primary_organism
        """
        response = get_by_endpoint("compendia", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 3
0
    def search(cls):
        """Retrieve a list of Institutions

        Returns:
            list of Institution

        Since there are no filters, this method always gets all Institutions.
        """
        response = get_by_endpoint("institutions").json()
        return [Institution(**institution) for institution in response]
Exemplo n.º 4
0
    def search(cls, **kwargs):
        """Retrieve a list of Platforms

        Returns:
            list of Platform

        Since there are no filters, this method always returns all Platforms
        """
        response = get_by_endpoint("platforms", params=kwargs).json()
        return [Platform(**platform) for platform in response]
Exemplo n.º 5
0
    def search(cls, **kwargs):
        """Retrieve a list of Processors

        Returns:
            list of Processor

        Since there are no filters, this method always returns all Processors
        """
        response = get_by_endpoint("processors", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 6
0
    def get(cls, id):
        """Retrieve a specific Dataset based on id

        Returns:
            Dataset

        Parameters:
            id (str): the guid id for the computed file you want to get
        """
        response = get_by_endpoint("dataset/" + id).json()
        return Dataset(**response)
Exemplo n.º 7
0
    def get(cls, id):
        """Retrieve a computational result based on its id.

        Returns:
            ComputationalResult

        Parameters:
            id (int): The id for the computational result to be retrieved.
        """
        response = get_by_endpoint("computational_results/" + str(id)).json()
        return ComputationalResult(**response)
Exemplo n.º 8
0
    def get(cls, organism_name):
        """Retrieve a QNTarget based on organism name

        Returns:
            QNTarget

        Parameters:
            organism_name (str): the name of the organism for the QNTarget you want to get
        """
        response = get_by_endpoint("qn_targets/" + organism_name).json()
        return QNTarget(**response)
Exemplo n.º 9
0
    def get(cls, accession_code):
        """Retrieve an Experiment based on accession code

        Returns:
            Experiment

        Parameters:
            accession code (str): the accession code for the Experiment you want to get
        """
        response = get_by_endpoint("experiments/" + accession_code).json()
        return Experiment(**response)
Exemplo n.º 10
0
    def get(cls, id):
        """Retrieve a Processor based on id

        Returns:
            Processor

        Parameters:
            id (int): the id for the Processor you want to get
        """
        response = get_by_endpoint("processors/" + str(id)).json()
        return Processor(**response)
Exemplo n.º 11
0
    def get(cls, id):
        """Retrieve a specific ComputedFile based on id

        Returns:
            ComputedFile

        Parameters:
            id (int): the id for the ComputedFile you want to get
        """
        response = get_by_endpoint("computed_files/" + str(id)).json()
        return ComputedFile(**response)
Exemplo n.º 12
0
    def get(cls, id):
        """Retrieve a specific Compendium based on id

        Returns:
            Compendium

        Parameters:
            id (int): the id for the Compendium you want to get
        """
        response = get_by_endpoint("compendia/" + str(id)).json()
        return Compendium(**response)
Exemplo n.º 13
0
    def get(cls, id):
        """Retrieve a TranscriptomeIndex based on id

        Returns:
            TranscriptomeIndex

        Parameters:
            id (int): the id for the TranscriptomeIndex you want to get
        """
        response = get_by_endpoint("transcriptome_indices/" + str(id)).json()
        return TranscriptomeIndex(**response)
Exemplo n.º 14
0
    def get(cls, accession_code):
        """Retrieve a Sample based on its accession code.

        Returns:
            Sample

        Parameters:
            accession_code (str): The accession code for the Sample to be retrieved.
        """
        response = get_by_endpoint("samples/" + accession_code).json()
        return cls(**response)
Exemplo n.º 15
0
    def get(cls, id):
        """Retrieve an OriginalFile based on id

        Returns:
            OriginalFile

        Parameters:
            id (int): the id for the OriginalFile you want to get
        """

        response = get_by_endpoint("original_files/" + str(id)).json()
        return OriginalFile(**response)
Exemplo n.º 16
0
    def get(cls, name):
        """Retrieve an Organism based on name

        Returns:
            Organism

        Parameters:
            name (str): the name for the Organism you want to get
        """

        response = get_by_endpoint("organisms/" + name).json()
        return Organism(**response)
Exemplo n.º 17
0
    def search(cls, **kwargs):
        """Retrieve a list of Organisms that have available QNTargets

        Returns:
            list of Organism

        Since there are no filters, this method always returns all Organisms that have available QNTargets
        """
        response = get_by_endpoint("qn_targets", params=kwargs).json()
        return [
            prb_organism.Organism(**qn_organism) for qn_organism in response
        ]
Exemplo n.º 18
0
    def search(cls, **kwargs):
        """Retrieve a list of Organisms based on filters

        Returns:
            list of Organism

        Keyword Arguments:
            has_compendia (bool): filter based on if this Organism has a normalized Compendium
                                  associated with it

            has_quantfile_compendia (bool): filter based on if this Organism has an
                                            RNA-seq Sample Compendium associated with it
        """
        response = get_by_endpoint("organisms", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 19
0
    def search(cls, **kwargs):
        """Retrieve a list of computational results based on filters.

        Returns:
            list of ComputationalResult

        Keyword Arguments:
            processor__id (int): id of the Processor that processed the result

            limit (int): number of results to return per page

            offset (int): the initial index from which to return the results
        """
        response = get_by_endpoint("computational_results", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 20
0
    def search(cls, **kwargs):
        """Search for Experiments based on various filters

        Returns:
            list of Experiment

        Keyword Arguments:
            id (int): filter based on the id of the Experiment

            technology (str): filter based on the technology used for the Experiment
                              (microarray, rna-seq, etc) this filter can have multiple values.

            has_publication (bool): filter based on if the Experiment has associated publications

            accession_code (str): filter based on the Experiment's accession code
                                  this filter can have multiple values

            alternate_accession_code (str): filter based on the Experiment's alternate
                                            accession codes

            platform (str): filter based on  platform, this filter can have multiple values

            organism (str): filter based on Organism, this filter can have multiple values

            downloadable_organism (str): filter based on Organisms that have downloadable files,
                                         this filter can have multiple values

            num_processed_samples (number): filter based on the Experiment's number of processed samples

            num_downloadable_samples (int): filter based on the Experiment's number of downloadable samples

            sample_keywords (str): filter based on keywords associated with the Experiment's Samples

            ordering (str): which field from to use when ordering the results

            search (str): specify a keyword which will be applied to the Experiment's title, publication_authors,
                          sample_keywords, publication_title, submitter_institution, description, accession_code,
                          alternate_accession_code, publication_doi, pubmed_id, sample_metadata_fields, and
                          platform_names

            limit (int): number of results to return per page

            offset (int): the initial index from which to return the results
        """
        response = get_by_endpoint("search", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 21
0
    def search(cls, **kwargs):
        """Retrieve a list of a ComputedFiles based on filters

        Returns:
            list of ComputedFile

        Keyword Arguments:

            id (int): filter based on the id of the ComputedFile

            samples (str): filter based on the accession code for Samples related to the ComputedFile

            is_qn_target (bool): filter based on if the ComputedFile is a qn target

            is_smashable (bool): filter based on if the ComputedFile can be added to a normalized
                                 Dataset

            is_qc (bool): filter based on if the ComputedFile contains data about
                          the quality control of a result rather than data about the
                          result itself

            is_compendia (bool): filter based on if the ComputedFile is part of a compendium

            quant_sf_only (bool): filter based on if the Samples associated with the ComputedFile
                                  are RNA-seq only

            svd_algorithm (str): filter based on the SVD algorithm used for the ComputedFile

            compendium_version (int): filter based on the compendium version of the ComputedFile

            created_at (str): filter based on the time that the ComputedFile was created

            last_modified (str): filter based on the time that the ComputedFile was last modified

            result__id (int): filter based on the id of the ComputationalResult associated with the
                              ComputedFile

            ordering (str): which field to use when ordering the results

            limit (int): number of results to return per page

            offset (int): the initial index from which to return the results
        """
        response = get_by_endpoint("computed_files", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 22
0
    def search(cls, **kwargs):
        """Retrieve a list of OriginalFiles based on various filters

        Returns:
            list of OriginalFile

        Keyword Arguments:

            id (int): filter based on the id of the OriginalFile

            filename (str): filter based on the name of the OriginalFile

            samples (str): filter based on the Samples associated with the OriginalFile

            size_in_bytes (int): filter based on the OriginalFile's size

            sha1 (str): filter based on the OriginalFiles sha1 hash

            processor_jobs (str): filter based on the ProcessorJobs associated with the OriginalFile

            downloader_jobs (str): filter based on the DownloaderJobs associated with the OriginalFile

            source_url (str): filter based on the OriginalFile's source url

            is_archive (bool): filter based on if the OriginalFile is archived

            source_filename (str): filter based on the OriginalFile's source's filename

            has_raw (bool): filter based on if the OriginalFile had raw data available in the source
                            database

            created_at (str): filter based on the time when the OriginalFile was created

            last_modified (str): filter based on the time when the OriginalFile was last modified

            ordering (str): which field to use when ordering the results.

            limit (int): number of results to return per page.

            offset (int): the initial index from which to return the results.
        """

        response = get_by_endpoint("original_files", params=kwargs)
        return create_paginated_list(cls, response)
Exemplo n.º 23
0
    def save_token(self):
        """Saves a token to the config file.

        The default config file is ~/.refinebio.yaml, but
        you can use the environment variable `CONFIG_FILE` to change this path
        """
        try:
            response = get_by_endpoint("token/" + str(self.id)).json()
            if not response["is_activated"]:
                raise BadRequest(
                    "Token with id '" + str(self.id) + "' is not activated. "
                    "Please activate your token with `agree_to_terms_and_conditions()` before saving it."
                )
        except NotFound:
            raise BadRequest(
                "Token with id '" + str(self.id) +
                "' does not exist in refine.bio. "
                "Please create a new token using pyrefinebio.Token().")

        config.token = self.id
        config.save()
Exemplo n.º 24
0
    def search(cls, **kwargs):
        """Retrieve a list of Samples based on various filters

        Returns:
            list of Sample

        Keyword Arguments:
            ordering (str): which field to use when ordering the results

            title (str): filter based on the Sample's title

            organism__name (str): filter based on the Organism that the Sample was taken from

            organism__taxonomy_id (int): filter based on the Organism that the Sample was taken from

            source_database (str): filter based on the publically available repository
                                   that the Sample was taken from

            source_archive_url (str): filter based on Sample's source url

            has_raw (bool): filter based on if the Sample had raw data available in the source database

            platform_name (str): filter based on the name of the Platform that was used to assay the Sample

            technology (str): filter based on the technology that was used to assay the Sample

            manufacturer (str): filter based on the manufacturer of the technology that was used to assay the Sample

            sex (str): filter based on the sex information provided by the submitter

            age (number): filter based on the age information provided by the submitter

            specimen_part (str): filter based on the part of the specimen reported by the submitter

            genotype (str): filter based on the genotype of the subject that the Sample was taken from

            disease (str): filter based on the disease information provided by the submitter

            disease_stage (str): filter based on the disease stage information provided by the submitter

            cell_line (str): filter based on the cell line used for the sample

            treatment (str): filter based on the treatment information provided by the submitter

            race (str): filter based on the race information provided by the submitter

            subject (str): filter based on the subject identifier information provided by the submitter

            compound (str): filter based on the compound information provided by the submitter

            time (str): filter based on the time information provided by the submitter

            is_processed (bool): filter based on if the Sample has been processed

            limit (int): number of results to return per page.

            offset (int): the initial index from which to return the results.

            dataset_id (str): filter based on the Dataset ids that the Sample has been added to

            experiment_accession_code (str): filter based on the Experiments that are associated
                                             with the Sample

            accession_codes (str): filter based on multiple accession codes at once
        """
        response = get_by_endpoint("samples", params=kwargs)
        return create_paginated_list(cls, response)