Unwanted landmark mirroring after GPA

180 views
Skip to first unread message

agne89

unread,
Nov 20, 2021, 11:46:09 AM11/20/21
to geomorph R package
Hi,

I am doing a 3D analysis of symmetry in dolphin skulls using landVR.
To do this, I need to create a new shape array where half of the skull landmarks (single points only) are mirrored to the otehr half of the skull, to be comprared with the real data I manually placed on both halves of the skulls.

The mirrored dataset construted with the "mirrorfill" function in paleomorph looks ok, but after GPA in geomorph the landmark order in the aligned coordinates has changed, with the two halves beign flipped (waht wa son the left was on the right and vice versa).
This of course makes using landVR impossible. The GPA fucntion in Morpho (procSym) doesn't have this problem.
Is there a setting I can change to avoid this? 

I attach some code and pictures to demonstrate the problem.
Thank you, best wishes
Agnese

#Mirror left on right
shape_array_LM_mirror <- mirrorfill(A = mirror_array,  l1 = as.integer(midline), l2 = bilat.landmarks) # the NA rows are now filled so that the numbers are the same on both

#Plot mirrored landmarks
mirror_plot <- c(#left red
                 spheres3d(shape_array_LM_mirror[landpairs_L,,23], col = mypalette_paired[6], radius = 1.5),
                 #right blue
                 spheres3d(shape_array_LM_mirror[landpairs_R,,23], col = mypalette_paired[2], radius = 1.5),
                 #midline dark gray
                 spheres3d(shape_array_LM_mirror[midline,,23], col = "gray10", radius = 1.5))

mirror_LMs.png 

#GPA mirrored landmarks
#Geomorph - problem reflection landmarks
gpa_mirror <- gpagen(shape_array_LM_mirror)

#Check LMs
mirror_plot_gpa <- c(#left red
                     spheres3d(gpa_mirror$coords [landpairs_L,,23], col = mypalette_paired[6], radius = 0.003),
                     #right blue
                     spheres3d(gpa_mirror$coords[landpairs_R,,23], col = mypalette_paired[2], radius = 0.003),
                     #midline dark gray
                     spheres3d(coords_mirror[midline,,23], col = "gray10", radius = 0.003))
mirror_LMs_gpa.png


#Morpho - ok
gpa_mirror_morpho <- procSym(shape_array_LM_mirror)

#Check LMs
mirror_plot_gpa_morpho <- c(#left red
  spheres3d(gpa_mirror_morpho$rotated[landpairs_L,,23], col = mypalette_paired[6], radius = 0.003),
  #right blue
  spheres3d(gpa_mirror_morpho$rotated[landpairs_R,,23], col = mypalette_paired[2], radius = 0.003),
  #midline dark gray
  spheres3d(gpa_mirror_morpho$rotated[midline,,23], col = "gray10", radius = 0.003))

mirror_LMs_morpho.png

Mike Collyer

unread,
Nov 20, 2021, 12:55:32 PM11/20/21
to geomorph-...@googlegroups.com
Agnese,

It’s a good bet that this is the arbitrary flipping of PC axes, as you aligned configurations to principal axes (PCs) in both the geomorph and Morpho cases, by choosing the default options.  (Small procedural note: Morpho uses the PCs of the first specimen; geomorph uses the PCs of the reference [mean] configuration.)

You can tell by the black points that the vertical axis (PC 2) is flipped rather than left becoming right and right becoming left.

This eigen-analysis artifact poses no consequence for your data.  If it is aesthetically troubling, you can use (geomorph) rotate.coords to flip the axes as you like.

Mike

On Nov 20, 2021, at 11:46 AM, agne89 <agnese....@hotmail.it> wrote:

Hi,

I am doing a 3D analysis of symmetry in dolphin skulls using landVR.
To do this, I need to create a new shape array where half of the skull landmarks (single points only) are mirrored to the otehr half of the skull, to be comprared with the real data I manually placed on both halves of the skulls.

The mirrored dataset construted with the "mirrorfill" function in paleomorph looks ok, but after GPA in geomorph the landmark order in the aligned coordinates has changed, with the two halves beign flipped (waht wa son the left was on the right and vice versa).
This of course makes using landVR impossible. The GPA fucntion in Morpho (procSym) doesn't have this problem.
Is there a setting I can change to avoid this? 

I attach some code and pictures to demonstrate the problem.
Thank you, best wishes
Agnese

#Mirror left on right
shape_array_LM_mirror <- mirrorfill(A = mirror_array,  l1 = as.integer(midline), l2 = bilat.landmarks) # the NA rows are now filled so that the numbers are the same on both

#Plot mirrored landmarks
mirror_plot <- c(#left red
                 spheres3d(shape_array_LM_mirror[landpairs_L,,23], col = mypalette_paired[6], radius = 1.5),
                 #right blue
                 spheres3d(shape_array_LM_mirror[landpairs_R,,23], col = mypalette_paired[2], radius = 1.5),
                 #midline dark gray
                 spheres3d(shape_array_LM_mirror[midline,,23], col = "gray10", radius = 1.5))

<mirror_LMs.png> 

#GPA mirrored landmarks
#Geomorph - problem reflection landmarks
gpa_mirror <- gpagen(shape_array_LM_mirror)

#Check LMs
mirror_plot_gpa <- c(#left red
                     spheres3d(gpa_mirror$coords [landpairs_L,,23], col = mypalette_paired[6], radius = 0.003),
                     #right blue
                     spheres3d(gpa_mirror$coords[landpairs_R,,23], col = mypalette_paired[2], radius = 0.003),
                     #midline dark gray
                     spheres3d(coords_mirror[midline,,23], col = "gray10", radius = 0.003))
<mirror_LMs_gpa.png>


#Morpho - ok
gpa_mirror_morpho <- procSym(shape_array_LM_mirror)

#Check LMs
mirror_plot_gpa_morpho <- c(#left red
  spheres3d(gpa_mirror_morpho$rotated[landpairs_L,,23], col = mypalette_paired[6], radius = 0.003),
  #right blue
  spheres3d(gpa_mirror_morpho$rotated[landpairs_R,,23], col = mypalette_paired[2], radius = 0.003),
  #midline dark gray
  spheres3d(gpa_mirror_morpho$rotated[midline,,23], col = "gray10", radius = 0.003))

<mirror_LMs_morpho.png>


--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/3d7b95c6-5a20-477f-9770-67b2a06a0539n%40googlegroups.com.
<mirror_LMs.png><mirror_LMs_gpa.png><mirror_LMs_morpho.png>

agne89

unread,
Nov 20, 2021, 1:54:32 PM11/20/21
to geomorph R package

Hi Michael,

thanks a lot for your answer and explanation.
I think though it is not just a plotting problem, or at least it's a problem when trying to use landVR. This package measures the differences between 2 sets of landmarks, one mirrored and one manually placed. They are aligned separately.
As the axes are flipped in the mirror one, this creates artifically inflated differences with the manually placed data that don't get flipped (likely because of the strong differences between the 2 sides of the skull).
 
I attach the landVR visualization of procustes distances between landmarks of the same set of specimens. The first one was done with the flipped dataset from geomorph, and the vectors are pretty extreme. The other one is the correct one done with the Morpho-aligned coordinates.

image.pngradii_diff_phoc1.png
Would apply rotate.coords fix this? I read on the help file that it only works on 2D landarmarks and I have 3D data.

Thank you, best wishes
Agnese

Mike Collyer

unread,
Nov 20, 2021, 2:14:21 PM11/20/21
to geomorph-...@googlegroups.com
Agnese,

Which version of geomorph are you using?  There was an issue like this that resulted from a bug that we fixed many versions ago.  I am trying to understand if this could be the same issue.

Thanks!
Mike

On Nov 20, 2021, at 1:54 PM, agne89 <agnese....@hotmail.it> wrote:


Hi Michael,

thanks a lot for your answer and explanation.
I think though it is not just a plotting problem, or at least it's a problem when trying to use landVR. This package measures the differences between 2 sets of landmarks, one mirrored and one manually placed. They are aligned separately.
As the axes are flipped in the mirror one, this creates artifically inflated differences with the manually placed data that don't get flipped (likely because of the strong differences between the 2 sides of the skull).
 
I attach the landVR visualization of procustes distances between landmarks of the same set of specimens. The first one was done with the flipped dataset from geomorph, and the vectors are pretty extreme. The other one is the correct one done with the Morpho-aligned coordinates.

<image.png><radii_diff_phoc1.png>
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/daa848e5-926c-4e00-ba46-b242d38571edn%40googlegroups.com.
<image.png><radii_diff_phoc1.png>

Agnese Lanzetti

unread,
Nov 20, 2021, 2:18:35 PM11/20/21
to geomorph-...@googlegroups.com

Hi Mike,

 

I am using 4.0.1 which I think it’s the most up to date version on CRAN.

 

Thank you, best

Agnese

--
You received this message because you are subscribed to a topic in the Google Groups "geomorph R package" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geomorph-r-package/JIlV_9ZbrGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/7198310E-6817-40CB-B4CA-AAD197FC29A5%40gmail.com.

 

Mike Collyer

unread,
Nov 20, 2021, 2:31:28 PM11/20/21
to geomorph R package
OK.  Unfortunately, I do not have any familiarity with landVR, paleomorph, or the function, mirrorfill.  Maybe another user in this group has some experience using these functions along with geomorph and might have some ideas.  

Good luck!
Mike



Mike Collyer

unread,
Nov 20, 2021, 3:22:08 PM11/20/21
to geomorph R package
One other thing came to mind that maybe could be an issue.  In your analyses, is it possible that you have configurations that are reflections?  For example, are you mirroring the right side on some and the left side on others?  The procSym function has an option to reflect configurations (default is TRUE), but gpagen does not.  

This is just a guess, as it is not clear without knowing how the function works.

Best,
Mike

Agnese Lanzetti

unread,
Nov 20, 2021, 3:31:45 PM11/20/21
to geomorph-r-package
Hi Mike, 

No it's always the left side mirrored to the right. 
For now I'll align the landmarks with Morpho for landVR to be safe. 

Thank you, best regards 
Agnese 


On Nov 20, 2021 at 8:22 PM, Mike Collyer <mlco...@gmail.com> wrote:

One other thing came to mind that maybe could be an issue.  In your analyses, is it possible that you have configurations that are reflections?  For example, are you mirroring the right side on some and the left side on others?  The procSym function has an option to reflect configurations (default is TRUE), but gpagen does not.  

This is just a guess, as it is not clear without knowing how the function works.

Best,
Mike

On Nov 20, 2021, at 2:31 PM, Mike Collyer <mlco...@gmail.com> wrote:

agne89

unread,
Nov 23, 2021, 4:59:21 AM11/23/21
to geomorph R package
Hi Mike,

I just have a quick follow up question, as I'm trying to somewhat replicate the results of the bilat.symmetry function in landVR. 
When I plot the bilat.symmetry obejct, what shapes are the gray and black dots based on for directional asymmetry?
They are clearly not the same between the directional and fluctuating asymmetry plot, but I don't know what the ones in the DA plot are.
I attach an example.

Thank you, best
Agnese

Screenshot 2021-11-23 005210.jpg

Adams, Dean [EEOB]

unread,
Nov 23, 2021, 10:14:40 AM11/23/21
to geomorph-...@googlegroups.com

Agnese,

 

The plots from bilat.symmetry are shunted through plotRefToTarget.

 

In that function, the gray dots are the data, and the black dots the overall reference. For bilat.symmetry plots, the gray dots show the directional and fluctuating components respectively in the L/R plot panels.

 

Dean

 

Dr. Dean C. Adams (he/him)

Distinguished Professor of Evolutionary Biology

Director of Graduate Education, EEB Program

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

https://faculty.sites.iastate.edu/dcadams/

phone: 515-294-3834

Agnese Lanzetti

unread,
Nov 23, 2021, 12:02:00 PM11/23/21
to geomorph-r-package
Hi Dean, 

Thank you for your answer. 
So the gray dots are the DA component for each side? As the function produces two sets of mean shape coordinates for DA for each side. 
The black dots instead are the mean symmetric shape I assume? 

Thank you, best regards 
Agnese 


On Nov 23, 2021 at 3:14 PM, Adams, Dean [EEOB] <dca...@iastate.edu> wrote:

Agnese,

 

The plots from bilat.symmetry are shunted through plotRefToTarget.

 

In that function, the gray dots are the data, and the black dots the overall reference. For bilat.symmetry plots, the gray dots show the directional and fluctuating components respectively in the L/R plot panels.

 

Dean

 

Dr. Dean C. Adams (he/him)

Distinguished Professor of Evolutionary Biology

Director of Graduate Education, EEB Program

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

https://faculty.sites.iastate.edu/dcadams/

phone: 515-294-3834

 

From: geomorph-...@googlegroups.com <geomorph-...@googlegroups.com> On Behalf Of agne89
Sent: Tuesday, November 23, 2021 3:59 AM

--
You received this message because you are subscribed to a topic in the Google Groups "geomorph R package" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geomorph-r-package/JIlV_9ZbrGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geomorph-r-pack...@googlegroups.com.

Adams, Dean [EEOB]

unread,
Nov 23, 2021, 12:17:52 PM11/23/21
to geomorph-...@googlegroups.com

Yes. See examples in the help file

 

Dr. Dean C. Adams (he/him)

Distinguished Professor of Evolutionary Biology

Director of Graduate Education, EEB Program

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

https://faculty.sites.iastate.edu/dcadams/

phone: 515-294-3834

 

Agnese Lanzetti

unread,
Nov 23, 2021, 12:52:01 PM11/23/21
to geomorph-r-package
Hi Dean, 

Thank you for clarifying this. 
Best, 
Agnese 


On Nov 23, 2021 at 5:18 PM, Adams, Dean [EEOB] <dca...@iastate.edu> wrote:

Yes. See examples in the help file

 

Dr. Dean C. Adams (he/him)

Distinguished Professor of Evolutionary Biology

Director of Graduate Education, EEB Program

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

https://faculty.sites.iastate.edu/dcadams/

phone: 515-294-3834

 


Sent: Tuesday, November 23, 2021 11:02 AM

--
You received this message because you are subscribed to a topic in the Google Groups "geomorph R package" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geomorph-r-package/JIlV_9ZbrGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geomorph-r-pack...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages