#[repr(transparent)]
pub struct Proportion(_);
Expand description

An ancestry proportion.

This is a newtype wrapper for f64.

Interpretation

With respect to a deme in an offspring time step, a proportion is the fraction of ancsestry from a given parental deme.

Examples

In YAML input

Ancestral proportions of demes

let yaml = "
time_units: generations
description:
  An admixed deme appears 100 generations ago.
  Its initial ancestry is 90% from ancestor1
  and 10% from ancestor2.
demes:
 - name: ancestor1
   epochs:
    - start_size: 50
      end_time: 100
 - name: ancestor2
   epochs:
    - start_size: 50
      end_time: 100
 - name: admixed
   ancestors: [ancestor1, ancestor2]
   proportions: [0.9, 0.1]
   start_time: 100
   epochs:
    - start_size: 200
";
demes::loads(yaml).unwrap();

Pulse proportions

let yaml = "
time_units: generations
description:
   Two demes coexist without migration.
   Sixty three (63) generations ago,
   deme1 contributes 50% of ancestry
   to all individuals born in deme2.
demes:
 - name: deme1
   epochs:
    - start_size: 50
 - name: deme2
   epochs:
    - start_size: 50
pulses:
 - sources: [deme1]
   dest: deme2
   proportions: [0.5]
   time: 63
";
demes::loads(yaml).unwrap();

Using rust code

Normally, one only needs to create a Proportion when working with GraphBuilder.

let t = demes::Proportion::from(0.5);
assert_eq!(t, 0.5);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.