Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read.ms

Read data generated by Hudson ms program Read data generated by Hudson ms program, either as Haplotypes or as SNPs.


Description

With argument what="SNP", each site is read as a SNP, with the ancestral allele encoded as 0 and the alternate allele encoded as 1. If the ms output file contains several replicates, the different replicates will be collated together. Hence, the number of loci is the sum of all sites from all replicates.

Usage

read.ms(fname,what=c("SNP","Haplotype"))

Arguments

fname

file name containing ms output

what

whether to read ms output as SNPs or haplotypes

Details

With argument what="Haplotype", each different sequence from a replicate is read as a haplotype, by converting it first to a factor, and then to an integer. There will be as many loci as there are replicates, and the number of alleles per locus will be the number of different haplotypes in the corresponding replicate.

Value

alldat a data frame with nloc+1 columns, the first being the population to which the individual belongs and the next being the genotypes, one column per locus; and one row per (haploid) individual.

Author(s)

Jerome Goudet jerome.goudet@unil.ch

References

Examples

## Not run: 
  datH<-read.ms(system.file("extdata","2pops_asspop.txt",package="hierfstat"),what="Haplotype")
  dim(datH)
  head(datH[,1:10]
  datS<-read.ms(system.file("extdata","2pops_asspop.txt",package="hierfstat"),what="SNP")
  dim(datS)
  head(datS[,1:10])
  
## End(Not run)

hierfstat

Estimation and Tests of Hierarchical F-Statistics

v0.5-10
GPL (>= 2)
Authors
Jerome Goudet [aut, cre], Thibaut Jombart [aut], Zhian N. Kamvar [ctb], Eric Archer [ctb], Olivier Hardy [ctb]
Initial release
2021-11-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.