Function PGAGetBinaryAllele

Function Documentation

int PGAGetBinaryAllele(PGAContext *ctx, int p, int pop, int i)

Return the value of a (binary) allele.

Description

Applies to the binary data type, set with parameter PGA_DATATYPE_BINARY of PGACreate().

Example

Copies the alleles from member p in PGA_OLDPOP to member q PGA_NEWPOP. Assumes the strings are of the same length.

PGAContext *ctx;
int p, q, i;

...
for (i=PGAGetStringLength (ctx)-1; i>=0; i--) {
    int a = PGAGetBinaryAllele (ctx, p, PGA_OLDPOP, i);
    PGASetBinaryAllele (ctx, q, PGA_NEWPOP, i, a);
}

Parameters
  • ctx – context variable

  • p – string index

  • pop – symbolic constant of the population the string is in

  • i – allele index

Returns

The value of the ith allele of string p in population pop