## Not run:
# # calculate scoring matrix
# # bring in some mushroom body neurons
# library(nat)
# data(kcs20)
# # convert the (connected) tracings into dotprops (point and vector)
# # representation, resampling at 1 micron intervals along neuron
# fctraces20.dps=dotprops(fctraces20, resample=1)
# # we will use both all kcs vs all fctraces20 and fctraces20 vs fctraces20
# # as random_pairs to make the null distribution
# random_pairs=rbind(neuron_pairs(fctraces20), neuron_pairs(nat::kcs20, fctraces20))
# smat=create_scoringmatrix(kcs20, c(kcs20, fctraces20.dps),
# non_matching_subset=random_pairs, .progress='text')
#
# # now plot the scoring matrix
# distbreaks=attr(smat,'distbreaks')
# distbreaks=distbreaks[-length(distbreaks)]
# dotprodbreaks=attr(smat,'dotprodbreaks')[-1]
# # Create a function interpolating colors in the range of specified colors
# jet.colors <- colorRampPalette( c("blue", "green", "yellow", "red") )
# # 2d filled contour plot of scoring matrix. Notice that the there is a region
# # at small distances and large abs dot product with the highest log odds ratio
# # i.e. most indicative of a match rather than non-match
# filled.contour(x=distbreaks, y=dotprodbreaks, z=smat, col=jet.colors(20),
# main='smat: log odds ratio', xlab='distance /um', ylab='abs dot product')
#
# # 3d perspective plot of the scoring matrix
# persp3d(x=distbreaks, y=dotprodbreaks, z=smat, col=jet.colors(20)[cut(smat,20)],
# xlab='distance /um', ylab='abs dot product', zlab='log odds ratio')
# ## End(Not run)
Run the code above in your browser using DataLab