haplohh2sweepfinder: Translate object of 'haplohh-class' into SweepFinder format

Description Usage Arguments Details Value References See Also Examples

View source: R/haplohh2sweepfinder.R

Description

Extract allele frequencies of an object of class haplohh-class and returns a table in SweepFinder input format.

Usage

1
haplohh2sweepfinder(haplohh, polarized = TRUE, verbose = TRUE)

Arguments

haplohh

object of class haplohh-class.

polarized

logical. If TRUE (default), flag "folded" is set to 0, otherwise to 1.

verbose

logical. If TRUE (default), prints filter statements.

Details

SweepFinder and SweeD are two stand-alone programs which implement the same method to detect selective sweeps using the allele frequency at each site. This function calculates these frequencies from a haplohh-class and returns a table which can be saved into a file (with tabs as separators, without row names and quotes) that can be used as input for the two programs.

Sites with less than two haplotypes genotyped or with more than two alleles are removed. If polarized, sites monomorphic for the ancestral allele are removed, too.

Value

A dataframe with four columns:

References

DeGiorgio, M., and, Huber, CD and Hubisz, MJ and, Hellmann, I. and Nielsen, R. (2016) SweepFinder2: increased robustness and flexibility. Bioinformatics 32:1895-1897

Pavlidis, P., D. Zivkovic, A. Stamatakis, and N. Alachiotis, (2013) SweeD: likelihood-based detection of selective sweeps in thousands of genomes. Molecular Biology and Evolution 30: 2224-34.

See Also

haplohh-class, data2haplohh

Examples

1
2
3
4
5
6
#example
# sweepfinder example from vignette
make.example.files()
hh <- data2haplohh("example_sweep_with_recombination.vcf")
haplohh2sweepfinder(hh)
remove.example.files()

Example output

* Reading input file(s) *
Using package 'data.table' to read vcf.
Extracting map information.
Extracting ancestral allele from info field of vcf file.
Extracting haplotypes.
Number of individuals which are 
Haploid Diploid Triploid, ... : 
1 2 
0 4 
Polarizing variants.
11 markers have been polarized.
0 unpolarized markers have been removed.
* Filtering data *
Discard markers genotyped on less than 100 % of haplotypes.
No marker discarded.
Data consists of 8 haplotypes and 11 markers.
Number of mono-, bi-, multi-allelic markers:
1 2 
0 11 
* Filtering data *
Discard markers genotyped on less than 25 % of haplotypes.
No marker discarded.
Discard markers with more than 2 different alleles.
No marker discarded.
Data consists of 8 haplotypes and 11 markers.
Number of mono-, bi-, multi-allelic markers:
1 2 
0 11 
    position x n folded
s1     10000 1 8      0
s2     20000 4 8      0
s3     30000 1 8      0
s4     40000 5 8      0
s5     50000 1 8      0
s6     60000 7 8      0
s7     70000 6 8      0
s8     80000 1 8      0
s9     90000 4 8      0
s10   100000 1 8      0
s11   110000 2 8      0

rehh documentation built on Sept. 15, 2021, 5:06 p.m.