model {
    ## Likelihood
    ## Single cell
    for( j in 1:C ) {                                   # for each cell line K
        for ( i in 1:G ) {                             # for each gene j 
            ## Likelihood 
            ## generative distribution of the observed data 
            gexp[i, j] ~ dnorm(mu.1[j], tau.1[j])
        }
        
        ## mu and tau are Fixed Effects dependent on the cluster/state assignment 
        ## result in cluster specific means and precision
        ## gamma is group specific Random Effect 
        
        mu.1[j] <-  mu[1] * (equals(epsilon[j], 1 )) +
                    mu[2] * (equals(epsilon[j], 2 )) +
                    mu[3] * (equals(epsilon[j], 3 )) +
                    mu[4] * (equals(epsilon[j], 4 )) +
                    mu[5] * (equals(epsilon[j], 5 )) +
                    mu[6] * (equals(epsilon[j], 6 )) 

        tau.1[j] <- sig[1] * (equals( epsilon[j], 1 )) +
                    sig[2] * (equals( epsilon[j], 2 )) +
                    sig[3] * (equals( epsilon[j], 3 )) +
                    sig[4] * (equals( epsilon[j], 4 )) +
                    sig[5] * (equals( epsilon[j], 5 )) +
                    sig[6] * (equals( epsilon[j], 6 ))
        
    # PRIOR
    ##     Epsilons hold our cluster/state assignment 
    ##     theta are the mixture probabilities for states 
    ##      cell specific 
     
        epsilon[j] ~ dcat(theta[])    
    }


    # HYPERPARAMETERS 
    ## hyperparameter for for gamma, a flat gamma distribution 
    sigma ~ dgamma(1,1)

    #      dirchlet with equal probabilities for each state, equals to a uniform 
    #      provides the probabilities distribution of states 
    #      alpha can be 1 or (1/nubmer of states)

   
    ## Hyperparameter for epsilon, 
    ## This is the mixing property!

    theta[1:6] ~ ddirich(alpha[])

    # HYPERHYPERPARAMETER

    for(i in 1:6){
        alpha[i] <- 1
    }
}