Ejemplo n.º 1
0
class AddThree(IrisCommand):
    title = "add three numbers {x} {y} {z}"
    examples = ["add three"]
    argument_types = {"x":t.Int("first int"),"y":t.Int("second int"),"z":t.Int("third int")}
    def command(self, x, y, z):
        return x + y + z
    def explanation(self, result):
        return result
Ejemplo n.º 2
0
class Equals(IrisCommand):
    title = "{x} equals {y}"
    examples = ["eq {x} {y}", "equal {x} {y}"]
    argument_types = {
        "x": t.Int("What is the first number?"),
        "y": t.Int("What is the second number?")
    }

    def command(self, x, y):
        return x == y

    def explanation(self, result):
        return result
Ejemplo n.º 3
0
class GotermEnrichment(IrisCommand):
    title = "compute GO term enrichment on {gene_list}"
    examples = [ "compute GO term enrichment on a list of gene symbols" , "describe the function of a list of genes"]
    help_text = [
        "Gene Ontology (GO) Consortium contains functional and structure annotations for genes. Given a set of genes that are up-regulated under certain conditions, an enrichment analysis will find which GO terms are over-represented using annotations for a list of genes. \nCurrenlty, Iris takes in Gene Symbols (e.g. CTSK) and corrects p-values with FDR"
    ]
    argument_types = {
        "gene_list": t.List("What is the list of gene symbols (e.g. CTSK) you want to analyze?"),
        "n_top": t.Int("How many top results you want to see?")
    }
    argument_help = {
        "gene_list": "A list of gene symbols of interest",
        "n_top": "Number of the top enrichment GO terms you want to see",
    }
    def command(self, gene_list, n_top):
        from gprofiler import GProfiler
        import numpy as np
        gp = GProfiler("")
        r0 = gp.gprofile(gene_list,correction_method=GProfiler.THR_FDR,ordered=True)
        r0 = np.array(r0)
        r0 = r0[r0[:,9]=='MF']
        name_out = r0[0:n_top,-3]
        p_out = r0[0:n_top,2]
        data = np.array([x for x in zip(name_out, p_out)])
        dataframe = pd.DataFrame(data=data, columns=["Name", "p-values"])

        return dataframe

    def explanation(self, results):

        iris_df = iris_objects.IrisDataframe(data=results)

        return [ "These are the enriched molecular function GO terms with corrected p-values", iris_df]
Ejemplo n.º 4
0
class Identity(IrisCommand):
    title = "identity function {x}"
    examples = []
    argument_types = {"x":t.Int("What value?")}
    def command(self, x):
        return x
    def explanation(self, result):
        return result
Ejemplo n.º 5
0
class AddTwo(IrisCommand):
    title = "add two to {x}"
    examples = []
    argument_types = {"x": t.Int("Add two?")}

    def command(self, x):
        return x + 2

    def explanation(self, result):
        return result
Ejemplo n.º 6
0
class GenerateArray(IrisCommand):
    title = "generate a random array of {n} numbers"
    examples = ["generate numpy array of size {n}"]
    argument_types = {"n": t.Int("Please enter size of array:")}

    def command(self, n):
        import numpy
        return numpy.random.randint(100, size=n)

    def explanation(self, result):
        return ["Here are the numbers", result]
Ejemplo n.º 7
0
class Take_A_Break(IrisCommand):
    title = "take {x} second break"
    examples = [
        "pause for {x} seconds", "rest for {x} seconds",
        "wait for {x} seconds", "nap for {x} seconds"
    ]
    argument_types = {
        "x": t.Int("How long of a break you want to take (in second)?")
    }

    def command(self, x):
        #pause for x second
        import time
        time.sleep(x)
        return str(x)

    def explanation(self, result):
        return 'Iris just took {} seconds nap'.format(result)