Wiki
Clone wikiNuclear_Morphology / methods / Exporting raw data
Exporting data
Saving the charts or tables
Data from all charts and tables can be copied or saved by right clicking, and selecting either Copy data
or Export data
. In either case, the underlying data will be copied in tab separated format, suitable for pasting into Excel or other software.
The charts can be saved as images via right clicking and Save as...
. When it comes to making pretty figures for papers though, I usually recommend exporting the measurements and drawing your own.
Exporting all measurements
To export raw data for single or multiple datasets, select the datasets you want to export, and choose Dataset > Export...
There are several options available depending on what data you need. If a single dataset is selected, the measurements will be exported to a file of your choice. By default, the file will be in the dataset's folder:
e.g. if the dataset is saved to C:\folder\2017-04-11_12-00-00\Dataset.nmd
then the default output file will be C:\folder\2017-04-11_12-00-00\Dataset.txt
If multiple datasets are selected, the combined measurements will be exported to a file of your choice. By default, the file will be called Multiple_stats_export.txt
.
Columns are usually separated by tabs.
Option | Action |
---|---|
Nuclear measurements | The measured values for each nucleus, plus normalised profiles |
Full nuclear profiles | The non-normalised angle profile values for each nucleus. Since there are a different number of values in each nucleus, they are combined into a single column, separated by commas for later parsing |
Full nuclear outlines | The X and Y coordinates of each border point in the outline of each nucleus. Since there are a different number of values in each nucleus, they are combined into a single column. XY pairs are separated by commas for later parsing. Within each pair, X and Y values are separated by a pipe (| ) e.g. 12.4|3.6,12.9|4.0 . |
Nuclear signal measurements | The measured values for each nuclear signal |
Nuclear signal shells | The measured nuclear signal in each shell, following shell analysis |
Cell locations within images | The XY coordinates of nucleus centres-of-mass within their source image |
Consensus nuclei as SVG | The consensus nucleus outlines for all selected datasets in SVG so you can make custom figures |
Single cell images | Export each nucleus as a separate image to a folder in the same directory as the nmd file. You will be given the option to mask out background; if this is selected, any pixels not within the nucleus will be set to black. |
Dataset analysis options | The options used to analyse this dataset in XML format. This can be used directly to set up subsequent analyses |
Landmark rulesets | The rules used to detect landmarks, so you can modify them for custom nucleus types |
Running downstream analysis on exported data
Once you have exported the data, you can do whatever downstream analysis you wish. This demonstrates a simple example of how to run a tSNE in R, and perform a hierarchical clustering on the result, using the angle profiles from exported nuclear statistics.
# Demonstration of how to read a sample tsv of morphology data, extract the relevant # columns for the angle profile, run a tSNE, cluster, and display the result library(tidyverse) library(Rtsne) library(cluster) library(dendextend) # Read in the input data file data <- read.csv("Exported_data.tsv", sep="\t", header=T, stringsAsFactors = F) # Take just the angle profile columns profiles <- data %>% dplyr::select(one_of(paste0("Angle_profile_", seq(0,99,1)))) # Set the rownames of the data using the cell id and the strain for convenience rownames(profiles) <- data$CellID # Set the random number generator with a seed for reproducilble results set.seed(42) # Run a tSNE on the profile data - the Rtsne function requires a matrix # Perplexity should be tuned according to the number of samples you have; # a good starting point is 5% of your sample size rtsne_out <- Rtsne(as.matrix(profiles), perplexity=20, max_iter=1000) tsne.values <- as.data.frame(rtsne_out$Y) # Display the results as a scatter plot ggplot(tsne.values, aes(x=V1, y=V2))+ geom_point() # Cluster the tSNE values using hierarchical clustering # The agnes function is agglomerative nesting hc <- cluster::agnes(tsne.values, method = "ward") # Make a dendrogram (tree) from the cluster data dend <- as.dendrogram(hc) # Cut the dendrogram to get 4 separate groups clusters <- dendextend::cutree(dend, 4) # Assign the group names to the original data data$agnes <- clusters # Assign the group names to the tSNE results tsne.values$agnes <- clusters # Plot the tSNE results coloured by cluster ggplot(tsne.values, aes(x=V1, y=V2, col=agnes))+ geom_point()
This would also be suitable for generating a cluster map to import back into the program
Updated