This step involves refinement of the spatial component dictionary from Step 1. We eliminate redundancy in the spatial component dictionary by clustering together preliminary dictionary elements that represent the same neuron, based on spatial and temporal information.
scalpelStep2(step1Output, cutoff = 0.18, omega = 0.2, maxSizeToCluster = 3000)
An object of class scalpel
or scalpelStep1
, which result from running the
scalpel
or scalpelStep1
functions, respectively.
A value in [0,1] indicating where to cut the dendrogram that results from hierarchical clustering of the preliminary dictionary elements. The default value is 0.18.
A value in [0,1] indicating how to weight spatial vs. temporal information in the dissimilarity metric
used for clustering. If omega=1
, only spatial information is used. The default value is 0.2.
Optional advanced user argument: The maximum number of preliminary dictionary elements to cluster at once. We attempt to cluster each
overlapping set of preliminary dictionary elements, but if one of these sets is very large (e.g., >10,000), memory issues may
result. Thus we perform a two-stage clustering in which we first cluster together random sets of size
approximately equaling maxSizeToCluster
and then cluster together the representatives from the first stage.
Finally, we recalculate the representatives using all of the preliminary dictionary elements in the final clusters. The default value is 3000.
If maxSizeToCluster
is set to NULL
, single-stage clustering is done, regardless of the size of the overlapping sets.
Memory issues may result when using this option to force single-stage clustering if the size of
the largest overlapping set of preliminary dictionary elements is very large (e.g., >10,000).
An object of class scalpelStep2
, which can be summarized using summary
, used to run SCALPEL Step 3 using scalpelStep3
,
or can be used with the plotting functions plotCluster
and plotSpatial
.
A
: A matrix containing the dictionary elements, where the ith column of A
is a vector of 1's and 0's, indicating whether each pixel is contained in the ith dictionary element.
repComps
: A vector where the ith element indicates which preliminary dictionary element is the ith representive
component. That is, A[,i]=step1Output$Azero[,repComps[i]]
.
clusterID
: A vector whose ith element indicates which of the dictionary elements in A
is the
representative for the ith preliminary dictionary element.
overlapSetID
: A vector indicating which preliminary dictionary elements overlap, with the ith element
giving the group index for the ith preliminary dictionary element.
treeList
: A list of length max(overlapSetID)
with the ith element containing an object of class protoclust
corresponding
to prototype clustering for the preliminary dictionary elements with overlapSetID=i
. If two-stage clustering was done for a
particular set, then the element will be NULL
.
Other elements: As specified by the user or returned from a previous step.
Several files containing data from this step and a summary of the step are saved in the folder
"outputFolder/Step1_version/Step2_omega_omega_cutoff_cutoff" where version
is a 5-digit unique
identifier that is automatically generated in Step 1 and omega
and cutoff
are the user-supplied parameters.
The entire SCALPEL pipeline can be implemented using the scalpel
function. The
other steps in the pipeline can be run using the scalpelStep0
, scalpelStep1
, scalpelStep3
functions.
Results from this step can be summarized using summary
, loaded at a later time using getScalpelStep2
, and plotted using
plotCluster
and plotSpatial
.
# NOT RUN {
### many of the functions in this package are interconnected so the
### easiest way to learn to use the package is by working through the vignette,
### which is available at ajpete.com/software
#assumes you have run the example for the "scalpelStep1" function
#run Step 2 of SCALPEL
Step2Out = scalpelStep2(step1Output = Step1Out)
summary(Step2Out)
# }
Run the code above in your browser using DataLab