Example #1
0
    def __init__(self, name, by="symbol"):
        super().__init__("gene")
        assert type(name) == str, "name must be string"

        if by not in ["name", "symbol", "entrez", "ensembl"]:
            raise ValueError(
                """by must be in ["name", "symbol", "entrez", "ensembl"] """)

        by_dict = {
            "name": "Approved name",
            "entrez": "ENTREZ ID",
            "ensembl": "Ensembl ID"
        }

        try:
            info = data.genes.loc[name]
        except (ValueError, KeyError):
            info = data.genes.loc[data.genes[by_dict[by]] == name].iloc[0]

        self.symbol = info.name
        self.name = info["Approved name"]
        self.entrez = info["ENTREZ ID"]
        self.ensembl = info["Ensembl ID"]
        self._grabber = grabber.Grabber("gene", self.symbol, self._axis)
        self._subset_handler = SubsetHandler()
Example #2
0
    def __init__(self, lines, all_except=False):
        super().__init__("canc")

        assert isinstance(lines, MutableSequence), "Must be list or array-like"

        if not all_except:
            try:
                info = data.cell_lines.loc[lines]
            except KeyError:
                info = data.cell_lines.loc[
                    data.cell_lines.cell_line_name.isin(lines), ]
            except KeyError:
                info = data.cell_lines.loc[
                    data.cell_lines.CCLE_Name.isin(lines), ]
            except IndexError:
                raise ValueError(
                    "Cannot Instantiate CellLine object with {}".format(lines))
        else:
            info = data.cell_lines[~lines]

        self.disease = info["lineage"].unique()
        self.subtypes = info["lineage_subtype"].unique()
        self.names = list(info.cell_line_name)
        self.ccle_names = list(info.CCLE_Name)
        self.depmap_ids = list(info.index)
        self.genders = info.sex.unique()
        self.sources = info.source.unique()
        self._info = info
        self._string_meth = lambda x, y: x[y]
        self._grabber = grabber.Grabber("canc", self.depmap_ids, self._axis)
        self._subset_handler = SubsetHandler()
Example #3
0
    def __init__(self,
                 disease,
                 subtype=None,
                 gender=None,
                 source=None,
                 all_except=False):
        super().__init__("canc")

        if subtype is None and all_except is False:
            info = data.cell_lines.loc[data.cell_lines["primary_disease"].isin(
                [disease])]
        elif subtype is None and all_except is True:
            info = data.cell_lines.loc[~data.cell_lines["primary_disease"].
                                       isin([disease])]
            disease = "All Except {}".format(disease)
        else:
            info = data.cell_lines.loc[data.cell_lines["lineage_subtype"] ==
                                       subtype, ]
        if gender:
            info = info.loc[info.sex == gender]
        if source:
            info = info.loc[info.source == source]

        self.disease = disease
        self.depmap_ids = list(info.index)
        self.names = list(info.cell_line_name)
        self.ccle_names = list(info.CCLE_Name)
        self.subtypes = info["Subtype"].unique()
        self.sexes = info.sex.unique()
        self.sources = info.source.unique()
        self._info = info
        self._string_meth = lambda x, y: x.loc[y]
        self._grabber = grabber.Grabber("canc", self.depmap_ids, self._axis)
        self._subset_handler = SubsetHandler()
Example #4
0
    def __init__(self, cellline):
        super().__init__("line")
        assert type(cellline) == str, "cellline must be string"

        try:
            info = data.cell_lines.loc[cellline]
        except KeyError:
            info = data.cell_lines.loc[data.cell_lines.cell_line_name ==
                                       cellline].iloc[0]
        except KeyError:
            info = data.cell_lines.loc[data.cell_lines.CCLE_Name ==
                                       cellline].iloc[0]
        except IndexError:
            raise ValueError(
                "Cannot Instantiate CellLine object with {}".format(cellline))

        self.depmap_id = info.name
        self.ccle_name = info.CCLE_Name
        self.name = info["stripped_cell_line_name"]
        self.tissue = info.lineage
        self.aliases = info.alias
        self.cosmic_id = info.COSMICID
        self.sanger_id = info["Sanger_Model_ID"]
        self.sex = info.sex
        self.source = info.source
        self.lineage = info["lineage"]
        self.subtype = info["lineage_subtype"]
        self._grabber = grabber.Grabber("line", self.depmap_id, self._axis)
        self._subset_handler = SubsetHandler()
Example #5
0
    def __init__(self, genes, name=None):
        super().__init__("org")

        self.genes = genes
        locs = data.locations.loc[data.locations.gene.isin(genes)]
        self._string_meth = lambda x, y: x[y]
        self.name = name
        self._grabber = grabber.Grabber("org", self.genes, self._axis)
        self._subset_handler = SubsetHandler()
Example #6
0
 def __init__(self, organelle, min_conf=3):
     super().__init__("org")
     self.location = organelle
     self.conf = min_conf
     locs = data.locations.loc[data.locations.location == organelle]
     self.genes_and_conf = locs.loc[locs.confidence >= min_conf, :].reindex(
         ["gene", "confidence"], axis=1)
     self.genes = list(self.genes_and_conf.gene)
     self._string_meth = lambda x, y: x[y]
     self._grabber = grabber.Grabber("org", self.genes, self._axis)
     self._subset_handler = SubsetHandler()