Sample Core Using Both Genotypes and Phenotypes

163 views
Skip to first unread message

Pietro Delfino

unread,
Aug 8, 2017, 9:29:19 AM8/8/17
to Core Hunter Users
Dear Core Hunter developers,

As in the object above, is it possible to select a core collection using genotypes and phenotypes simultaneously?
If not at the same time, what would be the best option to do this in different steps?

I have SSR genotypic data and data from a single phentoype;  in my core collection I'd like to maximize both genetic and phenotypic diversity.

Thanks

Herman De Beukelaer

unread,
Aug 8, 2017, 9:59:08 AM8/8/17
to Core Hunter Users
Hi Pietro,

Yes it is possible to optimize both simultaneously in Core Hunter. Just load both data sources with 

> my.data <- coreHunterData(genotypes = genotypes(...), phenotypes = phenotypes(...))

and then optimize a weighted index containing both genetic and phenotypic diversity. By default, Core Hunter will
maximize the entry-to-nearest-entry distance for both, with equal weight, using Modified Roger's distance for the
genotypes and Gower's distance for the phenotypes. If you want you can specify a different combination of objective
functions, and play with the weights. The argument obj of sampleCore can be a list containing any number of
objectives, and you can set a weight for each objective using the weight argument of the function objective.

This call would use the same objectives as the default:

> sampleCore(my.data, obj = list(
    objective("EN", "MR", weight = 1),
    objective("EN", "GD", weight = 1)
))

Note that the weights need not sum to one, they are relative.

Given that you have only one phenotype and a bunch of SSR markers, you might want to consider decreasing the weight of the phenotypic diversity?

Good luck!
Herman


Pietro Delfino

unread,
Aug 9, 2017, 11:26:53 AM8/9/17
to Core Hunter Users
Dear Herman,

Thanks for the quick and explanatory answer.
Unfortunately I have some problems in loading the files with the command coreHunterData.
Here is my code:

> my.data <- coreHunterData(genotypes(file="genotypes.csv",format = "default",
                          phenotypes(file="phenotypes.csv")))

The error I get is:

Error in genotypes(file = "genotypes.csv", format = "default",  : 
  Please specify either data or file, not both.

Both the .csv files are in the current working directory.
If I only load the genotypic file with the same command it works.

I am using R version 3.3.3 on Linux machine. Core Hunter is the development version 3.1.0.9000.

Thanks for the help

--
Pietro

Herman De Beukelaer

unread,
Aug 9, 2017, 11:41:23 AM8/9/17
to Core Hunter Users
Hi Pietro,

You have a bracket in the wrong place, the command should be

> my.data <- coreHunterData(genotypes(file="genotypes.csv",format = "default"),
                            phenotypes(file="phenotypes.csv"))

As you wrote it, the results of phenotypes(...) is taken as a third argument of genotypes(...), hence the error.

Herman

Pietro Delfino

unread,
Aug 10, 2017, 5:42:44 AM8/10/17
to Core Hunter Users
Dear Herman,

Thank you very much, you saved my day!
I think I am almost there thanks to your very kind help, but I have to report a new error.
Again, when I call the command:

> my.data <- coreHunterData(genotypes(file="genotypes.csv",format = "default"),
                            phenotypes(file="phenotypes.csv"))


I get:

Error in 1:ncol(data) : argument of length 0

Here is a snapshot of my phenotypes file, that I have formatted according to yours:

"phenotypes.csv" :

ID,NAME,VB
TYPE,,RD
1,ABBUOTO,220.8181818
2,ABRUSCO,222.8181818
3,AGLIANICO,226.8181818
4,ALBANA,214.0909091
5,ALBANELLO,226.3636364
6,ALBAROSSA,216.75
7,UVA_MELONA,228.0
8,ALBARANZEULI_BIANCO,220.5
9,ALEATICO,217.0
10,ALICANTE_BOUSCHET,210.5

Thanks again!

Pietro

Herman De Beukelaer

unread,
Aug 10, 2017, 7:20:02 AM8/10/17
to Core Hunter Users
Hi Pietro,

I get the same error when trying to load your sample data. It should work so I will check what goes wrong. This is probably a bug, perhaps related to the fact that you have only one phenotype.

Thanks for reporting this!

Herman

Herman De Beukelaer

unread,
Aug 10, 2017, 7:48:58 AM8/10/17
to Core Hunter Users
Hi Pietro,

Turns out I was right: there was a bug in our code when reading phenotype data with a single trait. The issue should now be resolved.
So if you reinstall the latest dev version, you should be able to load your data.

Thanks again for letting us know!

Herman


Op donderdag 10 augustus 2017 13:20:02 UTC+2 schreef Herman De Beukelaer:
Reply all
Reply to author
Forward
0 new messages