dnatracing
- class topostats.dnatracing.dnaTrace(full_image_data, gwyddion_grains, afm_image_name, pixel_size, number_of_columns, number_of_rows)[source]
This class gets all the useful functions from the old tracing code and staples them together to create an object that contains the traces for each DNA molecule in an image and functions to calculate stats from those traces.
The traces are stored in dictionaries labelled by their gwyddion defined grain number and are represented as numpy arrays.
The object also keeps track of the skeletonised plots and other intermediates in case these are useful for other things in the future.
- determineLinearOrCircular(traces)[source]
Determines whether each molecule is circular or linear based on the local environment of each pixel from the trace
This function is sensitive to branches from the skeleton so might need to implement a function to remove them
- getDisorderedTrace()[source]
Function to make a skeleton for each of the grains in the image
Uses my own skeletonisation function from tracingfuncs module. I will eventually get round to editing this function to try to reduce the branching and to try to better trace from looped molecules
- getFittedTraces()[source]
Creates self.fitted_traces dictonary which contains trace coordinates (for each identified molecule) that are adjusted to lie along the highest points of each traced molecule
- Parameters
self.ordered_traces – the unadjusted skeleton traces
self.gauss_image – gaussian filtered AFM image of the original molecules
index_width – 1/2th the width of the height profile indexed from self.gauss_image at each coordinate (e.g. 2*index_width pixels are indexed)
- Returns
no direct output but instance variable self.fitted_traces is populated with adjusted x,y coordinates
- getNumpyArraysfromGwyddion()[source]
Function to get each grain as a numpy array which is stored in a dictionary
Currently the grains are unnecessarily large (the full image) as I don’t know how to handle the cropped versions
I find using the gwyddion objects clunky and not helpful once the grains have been found
There is some kind of discrepency between the ordering of arrays from gwyddion and how they’re usually handled in np arrays meaning you need to be careful when indexing from gwyddion derived numpy arrays
- getSplinedTraces()[source]
Gets a splined version of the fitted trace - useful for finding the radius of gyration etc
This function actually calculates the average of several splines which is important for getting a good fit on the lower res data