Hi there, glad to hear it worked! The shortest solution wasn't that much shorter anyway: ### ssrs3n.raw <- read.table([whatever]) ssrs3n.genind <- df2genind(ssrs3n.raw[,-1], sep="/", ncode=3, pop=ssrs3n.raw[,1],missing=NA, ploidy=3, type=“codom“) ###
Assuming the first column of ssrs3n.raw contains the population indication. Cheers Thibaut ________________________________________ From: [email protected] [[email protected]] on behalf of Vojtěch Zeisek [[email protected]] Sent: 02 June 2014 10:19 To: mailinglist R Subject: Re: [R-sig-phylo] Triploid microsatellites? Yes, it was easy, thank You for pointing me in the good direction. ssrs3n.table <- read.table("ssrs3n.txt", header=TRUE, sep="\t", quote=" ", dec=".", row.names=1) ssrs3n.populations <- read.table("populations.txt", header=TRUE) ssrs3n.pops <- ssrs3n.populations[,1] ssrs3n.genind <- df2genind(ssrs3n.table, sep="/", ncode=3, pop=ssrs3n.pops, missing=NA, ploidy=3, type=“codom“) That trick with populations is not probably the most elegant one, but it is easy and working fine. :-) Sincerely, Vojtěch Dne Pá 30. května 2014 10:13:27 jste napsal(a): > Hi there, > > yes, the formats you mention are not designed for triploid data, but reading > your data in should be easy. Just use read.table or read.csv to read your > file in, then use df2genind to convert your data into a genind object, with > sep="/" and ploidy=3. > > Cheers > Thibaut > ________________________________________ > From: [email protected] [[email protected]] > on behalf of Vojtěch Zeisek [[email protected]] Sent: 30 May 2014 10:17 > To: mailinglist R > Subject: Re: [R-sig-phylo] Triploid microsatellites? > > Hello, > thank You both. poppr looks interesting, I need to explore it more. > Adegenet is famous package. I didn't know it can also handle triploid data. > I found problem when importing data to it. Functions of import2genind group > (read.genetix, read.structure, read.fstat and read.genepop) are only for > diploid data. So I used read.loci. The input file was easy: first line with > names of markers etc, first row with names of samples, second row with > populations and from third row alleles. I coded alleles in this way > 123/234/345, so that each individual has 3 alleles. Missing alleles are > just NA. > ssrs3n.loci <- read.loci("ssrs3n.txt", header=TRUE, loci.sep="\t", > allele.sep="/", col.pop=2, col.loci=3:10, row.names=1) > ssrs3n.loci > Allelic data frame: 130 individuals > 8 loci > 1 additional variable > ssrs3n.genind <- loci2genind(ssrs3n.loci) > ssrs3n.genind > > ##################### > ### Genind object ### > ##################### > - genotypes of individuals - > > S4 class: genind > @call: df2genind(X = as.matrix(x[, attr(x, "locicol")]), sep = "/", > pop = pop) > > @tab: 130 x 115 matrix of genotypes > > @ind.names: vector of 130 individual names > @loc.names: vector of 8 locus names > @loc.nall: number of alleles per locus > @loc.fac: locus factor for the 115 columns of @tab > @all.names: list of 8 components yielding allele names for each locus > @ploidy: 2 > @type: codom > > Optional contents: > @pop: factor giving the population of each individual > @pop.names: factor giving the population of each individual > > @other: - empty - > > As You can see, it was imported as diploid and I haven't found way how > import it as triploid data. Imported data matrix seems to be wrong. When I > used input file formatted in the same way for diploids, it works > perfectly... Any ideas how to fix that? > Thank You in advance, > Vojtěch Zeisek > > Dne Pá 30. května 2014 03:34:49 jste napsal(a): > > Hi there, > > > > yes, adegenet handles any (constant) ploidy for most purposes. For input > > formats etc. please see the tutorial on basics, section 'documents' on: > > http://adegenet.r-forge.r-project.org/ > > > > Please feel free to use the adegenet forum for adegenet-related questions. > > Cheers > > Thibaut > > > > ________________________________________ > > From: [email protected] > > [[email protected]] > > on behalf of Gilles Benjamin Leduc [[email protected]] Sent: 29 May 2014 17:12 > > To: Vojtěch Zeisek > > Cc: mailinglist R > > Subject: Re: [R-sig-phylo] Triploid microsatellites? > > > > Hi, > > > > Yes it is possible in R, there is a package created for related purposes: > > poppr or something like that… The dev version on github should be > > preferred. I have seen several R work with polyploids and microsatelites, > > unfortunately… I work with ALFP :p Benjamin > > > > Le Jeudi 29 Mai 2014 13:40 GMT, Vojtěch Zeisek <[email protected]> a écrit: > > > Hello, > > > I wonder if it is possible to handle triploid microsatellite (yes, all > > > individuals are regular 3n) data in adegenet and another R packages. And > > > if so, how to enter the data. Any experiences and/or Ideas are very > > > welcomed. :-) Structure and BAPS are working well. > > > Yours sincerely, > > > Vojtěch Zeisek -- Vojtěch Zeisek http://trapa.cz/en/ Department of Botany, Faculty of Science Charles University in Prague Benátská 2, Prague, 12801, CZ http://botany.natur.cuni.cz/en/ Institute of Botany, Academy of Science Zámek 1, Průhonice, 25243, CZ http://www.ibot.cas.cz/en/ Czech Republic _______________________________________________ R-sig-phylo mailing list - [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/[email protected]/
