strataG (version 2.4.905)

gtypes-class: gtypes Class

Description

An S4 class storing multi-allelic locus or sequence data along with a current stratification and option stratification schemes.

Arguments

Slots

data

a data.table where the first column contains the sample ID (ids). The second column contains the sample stratification (strata). The third column to the end contains the allelic data as one column per locus. Alleles are on multiple rows per column with sample IDs duplicated for all alleles. Column names are unique locus names.

sequences

a '>multidna object.

ploidy

integer representing the ploidy of the data. There are ploidy * the number of individuals rows in 'data'.

schemes

a data.frame with stratification schemes in each column. The rownames are individual names and must match the 'id' column of the 'data' slot. Each column is a factor.

description

a label for the object (optional).

other

a slot to carry other related information - currently unused in analyses (optional).

See Also

df2gtypes, sequence2gtypes, gtypes.accessors, gtypes.initialize

Examples

Run this code
# NOT RUN {
#--- create a diploid (microsatellite) gtypes object
data(dolph.msats)
data(dolph.strata)
strata.schemes <- dolph.strata[, c("broad", "fine")]
rownames(strata.schemes) <- dolph.strata$id
msats.g <- new("gtypes", gen.data = dolph.msats[, -1], ploidy = 2,
               ind.names = dolph.msats[, 1], schemes = strata.schemes)
msats.g

#--- create a haploid sequence (mtDNA) gtypes object and label haplotypes
data(dolph.seqs)
dloop.haps <- cbind(dLoop = dolph.strata$id)
rownames(dloop.haps) <- dolph.strata$id
dloop.g <- new("gtypes", gen.data = dloop.haps, ploidy = 1, 
               schemes = strata.schemes, sequences = dolph.seqs, 
               strata = "fine")
dloop.g
labelHaplotypes(dloop.g, "Hap.")

# }

Run the code above in your browser using DataCamp Workspace