plot.poppr.msn is not giving the same MLG assignments as mlg.id MLL table.

19 views
Skip to first unread message

Alicia Farmer

unread,
May 16, 2023, 9:39:04 AM5/16/23
to poppr

Hi everyone, 

Apologies in advance I’ve only recently started to use poppr and don’t know what level this error is on so I'll try and describe it the best I can.

 

The problem:

Essentially, I want to get the mlg.id function produced MLG's to match with the MSN ones, and they are not. I don't know how to resolve this as I am assuming it’s an input error caused by ignorance or stupidity on my part but after trying several different inputs (more than shown here) I have reached a point where I don’t know what to do or where the error is stemming from.  

 

How I noticed:

I followed the poppr guide website and have contracted my dataset from 103 MLG's to 95 MLGs using mlg.filter with bruvos distance, and subsequently made an MLL table and an ID list on the contracted dataset. I checked the MLL tables length for both “original” and “contracted” which has shown a difference in length to see if this worked.  

Then I viewed my contracted dataset into imsn() and found that my output did not reflect the contracted mlg.id() table results. MLGs which have one sample in the ID table output were being assigned to 40+ samples in the imsn output, and the MLGs that had the 40+ samples nestled with them in the id table were assigned a smaller node.

 

How I tried to fix it:

So I took the code from imsn() from the command tab, and have played around with it as I thought it was an input error with the bruvo.msn () resulting in different MLG groupings. According to the bruvo.msn guide if you input a value for the clustering algorithm and threshold it will overwrite what you already have. From my understanding I would need to set them to NULL to prevent this, which I did with:

min_span_net <- bruvo.msn(mydata, replen = c(reps), add = TRUE, loss = TRUE, mlg.compute = "contracted", showplot = FALSE, include.ties = TRUE, clustering.algorithm =NULL, threshold = NULL)

 

plot_poppr_msn(mydata,

+                min_span_net,

+                inds = "ALL",

+                mlg = TRUE,

+                gadj = 6,

+                nodescale = 5,

+                palette = MSNcol,

+                cutoff = NULL,

+                quantiles = FALSE,

+                beforecut = TRUE,

+                pop.leg = TRUE,

+                size.leg = TRUE,

+                scale.leg = TRUE,

+                layfun = igraph::layout_as_tree)

 

This did not work. I then tried to play uno reverse by going with the “original” data and re-inputting the mlg.filters with the bruvo.msn, which was then input to the same plot.poppr.msn code as above:

min_span_net <- bruvo.msn(mydata, replen = c(reps), add = TRUE, loss = TRUE, mlg.compute = "original", showplot = FALSE, include.ties = TRUE, clustering.algorithm ="average_threshold", threshold = mydata_a_thresh )

I got the same tree output from the plot_poppr_msn function. Which made me think something may have been wrong with my inputs for the plotting function. I had a look at the inds argument but wasn’t sure how to sort that out as only “ALL” gave actual labels from the inputs I used. Exploration with just the plots of bruvo.msn were too confusing to truly understand what was going on relative to the plot.poppr.msn ones.

I've searched this google group to see if people had similar issues and I can't find any. I don't know what I'm doing wrong or misunderstanding here or what level this mismatch MLG assignments is on i.e. with bruvo.msn or the plotting of it? Any clue on what can be done to fix this so my mlg.id() MLG's match with the MSN plotted ones?

All the best,

Alicia

Reply all
Reply to author
Forward
0 new messages