''' For this exercise, you can use the following documentation: https://docs.python.org/3/tutorial/datastructures.html#sets # Sets A set is a variable that, like a tuple, is immutable. Furthermore, it is not ordered (so you cannot retrieve items based on their index), and there can not be any duplicates in a set. In this exercise, we will explore some of the applications of sets. First consider the following list with all individual types of cells found in a (very small) patient sample of a tumour. ''' tumor_cells = ['T cell', 'Dendritic cell', 'T cell', 'Dendritic cell', 'Cancer cell', 'B cell', 'Macrophage', 'Cancer cell', 'Cancer cell', 'Macrophage', 'B cell', 'Fibroblast', 'T cell', 'T cell', 'Cancer cell', 'Macrophage', 'Dendritic cell', 'Tumor-infiltrating lymphocyte', 'Tumor-infiltrating lymphocyte', 'Macrophage', 'Cancer cell', 'Endothelial cell', 'Cancer cell', 'Fibroblast', 'Dendritic cell', 'Endothelial cell', 'B cell', 'Cancer cell', 'Tumor-infiltrating lymphocyte', 'Fibroblast', 'T cell', 'Endothelial cell', 'T cell', 'Macrophage', 'Endothelial cell', 'Macrophage', 'B cell', 'Cancer cell', 'Cancer cell', 'T cell', 'Cancer cell'] ''' First check how many items there are in this list by using the built-in function `len()`. ''' number_of_cells = # Put your code here ''' Then, check how many cancer cells there are in the sample using `count()`, and what percentage of all cells is made up by cancer cells. ''' # Your code here ''' Now, to get a better overview of the cells that are actually present, we would like to remove all duplicates. The easiest way to do this is by turning the list into a set using `set()`. Print the result. ''' unique_cell_types = set(tumor_cells) ''' From this list of cell types, we see three categories: immune cells (T cell, B cell, Macrophage, Tumor-infiltrating lymphocyte, Dendritic cell), stromal cells (Endothelial cell, Fibroblast) and cancer cells. Create a dictionary with the category as key and a list of the corresponding cell types as value. ''' categories_of_cells = ''' You receive a second sample of cells. You want to figure out whether there are any types that are in the first sample (from now on referred to as sample A) but not in the second sample (sample B). Fortunately, you can apply set theory in Python on sets, meaning that you can find their difference (using `-`), but also their intersection (using `&`), their union (using `|`), their difference (using `^`) and more. Find the cell types that differ between sample A and sample B. ''' tumor_cells_sample_B = ['Neutrophil', 'Dendritic cell', 'T cell', 'Dendritic cell', 'Cancer cell', 'Neutrophil', 'Pericytes', 'Cancer cell', 'Cancer cell', 'Pericytes', 'Neutrophil', 'Fibroblast', 'T cell', 'T cell', 'Cancer cell', 'Pericytes', 'Dendritic cell', 'Tumor-infiltrating lymphocyte', 'Tumor-infiltrating lymphocyte', 'Pericytes', 'Neutrophil', 'Endothelial cell', 'Cancer cell', 'Fibroblast', 'Dendritic cell', 'Neutrophil', 'B cell', 'Cancer cell', 'Tumor-infiltrating lymphocyte', 'Fibroblast', 'Neutrophil', 'Endothelial cell', 'T cell', 'Pericytes', 'Endothelial cell', 'Pericytes', 'B cell', 'Cancer cell', 'Cancer cell', 'T cell', 'Neutrophil'] # Put your code here ''' Finally, going back to our set of unique cell types in sample A, we note that we're not terribly interested in the stromal cells (i.e. the fibroblasts and the endothelial cells). Remove these from the cell types. HINT: remember, sets are immutable! To change the items in this variable, you'll have to change it back to something that is mutable. ''' # Put your code here