Q: Admixture coefficients from a snmf run

Description Usage Arguments Value Author(s) See Also Examples

Description

Return the snmf output matrix of admixture coefficients for the chosen run with K ancestral populations. For an example, see snmf.

Usage

1
Q(object, K, run)

Arguments

object

A snmfProject object.

K

The number of ancestral populations.

run

A chosen run.

Value

res

A matrix containing the admixture coefficients for the chosen run with K ancestral populations.

Author(s)

Eric Frichot

See Also

geno snmf G cross.entropy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
### Example of analysis using snmf ###

# Creation of the genotype file: genotypes.geno.
# The data contain 400 SNPs for 50 individuals.
data("tutorial")
write.geno(tutorial.R, "genotypes.geno")

################
# running snmf #
################

project.snmf <- snmf("genotypes.geno", 
                K = 3, 
                repetitions = 2, 
                project = "new")

# get the ancestry coefficients for the 2nd run for K = 3. 
Q.3 <- Q( project.snmf, K = 3, run = 2)

# cluster assignment for each individual
cluster <- apply( Q.3, 1, which.max)
table(cluster)

Example output

[1] "genotypes.geno"
The project is saved into :
 genotypes.snmfProject 

To load the project, use:
 project = load.snmfProject("genotypes.snmfProject")

To remove the project, use:
 remove.snmfProject("genotypes.snmfProject")

[1] "*************************************"
[1] "* sNMF K = 3  repetition 1      *"
[1] "*************************************"
summary of the options:

        -n (number of individuals)             50
        -L (number of loci)                    400
        -K (number of ancestral pops)          3
        -x (input file)                        /work/tmp/genotypes.geno
        -q (individual admixture file)         /work/tmp/genotypes.snmf/K3/run1/genotypes_r1.3.Q
        -g (ancestral frequencies file)        /work/tmp/genotypes.snmf/K3/run1/genotypes_r1.3.G
        -i (number max of iterations)          200
        -a (regularization parameter)          10
        -s (seed random init)                  938928368
        -e (tolerance error)                   1E-05
        -p (number of processes)               1
        - diploid

Read genotype file /work/tmp/genotypes.geno:		OK.


Main algorithm:
	[                                                                           ]
	[===============================]
Number of iterations: 82

Least-square error: 5655.566941
Write individual ancestry coefficient file /work/tmp/genotypes.snmf/K3/run1/genotypes_r1.3.Q:		OK.
Write ancestral allele frequency coefficient file /work/tmp/genotypes.snmf/K3/run1/genotypes_r1.3.G:	OK.

The project is saved into :
 genotypes.snmfProject 

To load the project, use:
 project = load.snmfProject("genotypes.snmfProject")

To remove the project, use:
 remove.snmfProject("genotypes.snmfProject")

[1] "*************************************"
[1] "* sNMF K = 3  repetition 2      *"
[1] "*************************************"
summary of the options:

        -n (number of individuals)             50
        -L (number of loci)                    400
        -K (number of ancestral pops)          3
        -x (input file)                        /work/tmp/genotypes.geno
        -q (individual admixture file)         /work/tmp/genotypes.snmf/K3/run2/genotypes_r2.3.Q
        -g (ancestral frequencies file)        /work/tmp/genotypes.snmf/K3/run2/genotypes_r2.3.G
        -i (number max of iterations)          200
        -a (regularization parameter)          10
        -s (seed random init)                  782306264
        -e (tolerance error)                   1E-05
        -p (number of processes)               1
        - diploid

Read genotype file /work/tmp/genotypes.geno:		OK.


Main algorithm:
	[                                                                           ]
	[================================]
Number of iterations: 86

Least-square error: 5655.573163
Write individual ancestry coefficient file /work/tmp/genotypes.snmf/K3/run2/genotypes_r2.3.Q:		OK.
Write ancestral allele frequency coefficient file /work/tmp/genotypes.snmf/K3/run2/genotypes_r2.3.G:	OK.

The project is saved into :
 genotypes.snmfProject 

To load the project, use:
 project = load.snmfProject("genotypes.snmfProject")

To remove the project, use:
 remove.snmfProject("genotypes.snmfProject")

cluster
 1  2  3 
16 17 17 

LEA documentation built on Nov. 8, 2020, 8:19 p.m.