EricArcher/strataG

issue running df2gtypes with sequence data

bhartidk opened this issue · 2 comments

Hi Eric,

I am trying to create an Arlequin input file in strataG, where I first want to stratify my data while converting it into a gtype object. My sequence alignment (aln) is in the DNAbin format and the sequence labels are associated with strata names in a dataframe (seq.strata). I've checked that the labels in the alignment and ids mentioned in the dataframe indeed match and are in the same format.

image

When I run,
aln.g<-df2gtypes(seq.strata, id.col="id", strata.col="area", ploidy=1, sequences=aln)

I get the following error -
Error: the number of genes in 'sequences' is not equal to the number of loci

I am able to run the example files from the vignettes just fine. Wondering if I am missing something here. Any help would be appreciated.

Regards,
Bharti

in df2gtypes() you also have to specify the column name that contains the identifier of the sequences (in case individuals are represented by unique haplotypes). That argument is 'loc.col' and defaults to the second column. In your case, you probably want to the first column or "id" to it.
See ?df2gtypes

Thanks very much Eric! That worked.
I assumed loc.col pertained to microsatellite data since the documentation says it corresponds to the column number of the first allele. I should have looked at the example more closely.

Regards,
Bharti