| shapeR {shapeR} | R Documentation |
shapeR
Description
Collection and analysis of otolith shape data
a shapeR class
Usage
shapeR(project.path, info.file, ...)
Arguments
project.path |
The base project path where the images are stored |
info.file |
The information file which store the information on the fish and otoliths. This is the base for the master.list |
... |
Additional parameters to be passed to 'read.csv' for reading the info.file |
Value
a shapeR object
Slots
project.pathPath to the project where the images are stored
info.fileInfo file containing fish and otolith information
master.list.orgThe contents of the
info.filemaster.listThe contents of the
info.filewith added shape parameters and descriptorsoutline.list.orgA list of all the original otolith outlines
outline.listA list of all the otolith outlines. It returns a list of smoothed if contour smoothing (using
smoothout) has been conducted.filterA logical vector selecting the otoliths used for analysis
wavelet.coef.rawThe wavelet coefficients for all the otolith outlines
wavelet.coefThe wavelet coefficients after aligning with the
info.file. The data is generated when enrich.master.list is runwavelet.coef.stdThe standardized wavelet coefficients. The data is generated when stdCoefs is run
wavelet.coef.std.removedThe index of the removed wavelet coefficients after standardization. The data is generated when stdCoefs is run
fourier.coef.rawThe Fourier coefficients for all the otolith outlines
fourier.coefThe Fourier coefficients for after aligning with the info file. The data is generated when enrich.master.list is run
fourier.coef.stdThe standardized Fourier coefficients. The data is generated when stdCoefs is run
fourier.coef.std.removedThe index of the removed Fourier coefficents after standardization. The data is generated when stdCoefs is run
shape.coef.rawThe uncalibrated shape measurements for all the otoliths. The shape parameters are: otolith.area, otolith.length, otolith.width, otolith.perimeter
shape.coefThe shape measurements for after aligning with the info file. The shape parameters have been calibrated using the calibration parameter as registered in the datafile as the column 'cal'.
shape.stdThe standardized shape measurements. The data is generated when stdCoefs is run
shape.std.removedThe index of the removed shape measurements after standardization. The data is generated when stdCoefs is run
Author(s)
Lisa Anne Libungan & Snaebjorn Palsson
References
Libungan LA and Palsson S (2015) ShapeR: An R Package to Study Otolith Shape Variation among Fish Populations. PLoS ONE 10(3): e0121102. https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0121102
See Also
https://github.com/lisalibungan/shapeR
Examples
## Not run:
# This example has two sections: (1) Demonstration of how a shapeR object
# is analyzed and (2) How to create a shapeR object from an archive of
# image files.
#-----------------------------------------
# Section 1: Analyzing a shapeR object
data(shape)
#Standardize coefficients
shape = stdCoefs(shape,"pop","length_cm")
#Visualize Wavelet and Fourier coefficients
plotWavelet(shape,level=5,class.name= "pop",useStdcoef=TRUE)
plotFourier(shape,class.name= "pop",useStdcoef=TRUE)
#Examine the mean shapes
plotWaveletShape(shape, "pop",show.angle = TRUE,lwd=2,lty=1)
plotFourierShape(shape, "pop",show.angle = TRUE,lwd=2,lty=1)
#Canonical analysis
library(vegan)
cap.res = capscale(getStdWavelet(shape) ~ getMasterlist(shape)$pop)
anova(cap.res)
#Visualize the canonical scores
eig=eigenvals(cap.res,constrained=TRUE)
eig.ratio = eig/sum(eig)
cluster.plot(scores(cap.res)$sites[,1:2],getMasterlist(shape)$pop
,plotCI=TRUE
,xlab=paste("CAP1 (",round(eig.ratio[1]*100,1),"%)",sep="")
,ylab=paste("CAP2 (",round(eig.ratio[2]*100,1),"%)",sep="")
,main="Canonical clustering"
)
#Only analyze Icelandic and Norwegian samples
shape = setFilter(shape, getMasterlist(shape, useFilter = FALSE)$pop %in% c("NO","IC"))
#Classifier on standardized wavelet
lda.res.w = lda(getStdWavelet(shape),getMasterlist(shape)$pop,CV=TRUE)
ct.w = table(getMasterlist(shape)$pop,lda.res.w$class)
diag(prop.table(ct.w, 1))
# Total percent correct
sum(diag(prop.table(ct.w)))
cap.res = capscale(getStdWavelet(shape) ~ getMasterlist(shape)$pop)
anova(cap.res)
#Classifier on canoncial values
lda.res.w = lda(scores(cap.res)$sites,getMasterlist(shape)$pop,CV=TRUE)
ct.w = table(getMasterlist(shape)$pop,lda.res.w$class)
diag(prop.table(ct.w, 1))
# Total percent correct
sum(diag(prop.table(ct.w)))
#-----------------------------------------
# Section 2: Creating a shapeR object from image files
# The following example requires the user to download an archive of JPEG
# files from https://github.com/lisalibungan/shapeR/
# place the ShapeAnalysis directory inside the working directory.
shape = shapeR("~/ShapeAnalysis/","FISH.csv")
shape = detect.outline(shape,write.outline.w.org = TRUE)
shape = generateShapeCoefficients(shape)
shape = enrich.master.list(shape)
## End(Not run)