getSampleHistsByCluster {phemd} | R Documentation

## Gets cell subtype frequency histograms for each sample by cluster ID

### Description

Gets relative frequency ("weights") of cell subtypes ("bins" or "signatures") in each single-cell sample

### Usage

    getSampleHistsByCluster(
      myobj,
      cluster_assignments,
      cell_model = c("monocle2", "seurat")
    )

### Arguments

`myobj` | phemdObj object containing cell subtype relative frequency in @data_cluster_weights slot
`cluster_assignments` | Vector containing group assignments for each sample in myobj
`cell_model` | Method by which cell state was modeled (either "monocle2" or "seurat")

### Details

`groupSamples` must be called before calling this function. Saves plots in directory called "individual_inhibs"

### Value

List of lists, with outer list representing sample cluster ID and inner list representing cell subtype frequencies of given sample

### Examples

    my_phemdObj <- createDataObj(all_expn_data, all_genes, as.character(snames_data))
    my_phemdObj_lg <- removeTinySamples(my_phemdObj, 10)
    my_phemdObj_lg <- aggregateSamples(my_phemdObj_lg, max_cells=1000)
    my_phemdObj_monocle <- embedCells(my_phemdObj_lg, data_model = 'gaussianff', sigma=0.02, maxIter=2)
    my_phemdObj_monocle <- orderCellsMonocle(my_phemdObj_monocle)
    my_phemdObj_final <- clusterIndividualSamples(my_phemdObj_monocle)
    my_phemdObj_final <- generateGDM(my_phemdObj_final)
    my_EMD_mat <- compareSamples(my_phemdObj_final)
    cluster_assignments <- groupSamples(my_EMD_mat, distfun = 'hclust', ncluster=4)
    weights_by_cluster <- getSampleHistsByCluster(my_phemdObj_final, cluster_assignments)

[Package phemd version 1.10.0 Index]