genomicSimulationC 0.2.6
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
sim-operations.h File Reference
#include "lib/rnd.h"
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <ctype.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  gsc_TableSize
 
struct  gsc_MarkerBlocks
 A struct used to store a set of blocks of markers. More...
 
struct  gsc_DecimalMatrix
 A row-major heap matrix that contains floating point numbers. More...
 
struct  gsc_PedigreeID
 A type representing a program-lifetime-unique identifier for a genotype, to be used in tracking pedigree. More...
 
struct  gsc_GroupNum
 A type representing the identifier of a group of genotypes. More...
 
struct  gsc_EffectID
 A type representing a particular loaded set of marker effects. More...
 
struct  gsc_LabelID
 A type representing a particular custom label. More...
 
struct  gsc_MapID
 A type representing a particular loaded recombination map. More...
 
struct  gsc_MultiIDSet
 Simple crate that stores a GroupNum, a MapID, and an EffectID. More...
 
struct  gsc_GenOptions
 A type that contains choices of settings for gsc_SimData functions that create a new gsc_AlleleMatrix/generation. More...
 
struct  gsc_SimpleLinkageGroup
 Parameters for simulating meiosis on a linkage group whose markers are stored contiguously in the simulation. More...
 
struct  gsc_ReorderedLinkageGroup
 Parameters for simulating meiosis on a linkage group whose markers are re-ordered compared to the first recombination map. More...
 
struct  gsc_LinkageGroup
 A generic store for a linkage group, used to simulate meiosis on a certain subset of markers. More...
 
struct  gsc_RecombinationMap
 A type that stores linkage groups and crossover probabilities for simulating meiosis. More...
 
struct  gsc_KnownGenome
 A type that stores the genome structure used in simulation. More...
 
struct  gsc_AlleleMatrix
 
struct  gsc_EffectMatrix
 A type that stores a matrix of effect values and their names. More...
 
struct  gsc_SimData
 Composite type that is used to run crossing simulations. More...
 
struct  gsc_TableFileReader
 Stream reader for files of some tabular format. More...
 
struct  gsc_TableFileCell
 Represent a cell read by a gsc_TableFileReader. More...
 
struct  gsc_MapfileUnit
 Unprocessed data for one marker (linkage group and position) loaded from a map file. More...
 
struct  gsc_GenotypeFile_MatrixFormat
 Variants in the format of a genotype matrix file. More...
 
struct  gsc_FileFormatSpec
 File format specifier for the genotype input file. More...
 
struct  gsc_GenoLocation
 An gsc_AlleleMatrix/gsc_AlleleMatrix index coordinate of a particular genotype in the simulation. More...
 
struct  gsc_ParentChoice
 
struct  gsc_BidirectionalIterator
 A structure to iterate forwards and backwards through all genotypes in a gsc_SimData or through only the members of a group. More...
 
struct  gsc_GappyIterator
 A structure to iterate forwards through all positions in the gsc_AlleleMatrix linked list in gsc_SimData. More...
 
struct  gsc_EmptyListNavigator
 A structure to hold an initially empty AlleleMatrix list whose genotypes can be accessed sequentially by storage order. More...
 
struct  gsc_RandomAccessIterator
 A structure to search and cache indexes of all genotypes in a gsc_SimData or of all the members of a group. More...
 

Macros

#define GSC_ID_T   unsigned int
 genomicSimulation's "ID" type More...
 
#define GSC_NA_ID   0
 For unique session IDs, the INVALID/UNINITIALISED value is 0. More...
 
#define GSC_NA_IDX   (GSC_ID_T)-1
 When accessing the current array index of a unique session ID, the "ID not found"/failure value is -1 (for signed types) or the maximum value of the type (for unsigned types). More...
 
#define GSC_GLOBALX_T   unsigned int
 genomicSimulation's "Candidate global index" type More...
 
#define GSC_NA_GLOBALX   (GSC_GLOBALX_T)-1
 For candidate global indexes, the INVALID/UNINITIALISED value is -1 (for signed types) or the maximum value of the type (for unsigned types). More...
 
#define GSC_LOCALX_T   unsigned int
 genomicSimulation's "Candidate local index" type More...
 
#define GSC_NA_LOCALX   (GSC_LOCALX_T)-1
 For candidate local indexes, the INVALID/UNINITIALISED value is -1 (for signed types) or the maximum value of the type (for unsigned types). More...
 
#define GSC_GENOLEN_T   unsigned int
 genomicSimulation's "Genotype length" type More...
 
#define GSC_NA_GENOLEN   (GSC_GENOLEN_T)-1
 For genetic marker indexes, the INVALID/UNINITIALISED value is -1 (for signed types) or the maximum value of the type (for unsigned types). More...
 
#define CONTIG_WIDTH   1000
 
#define NAME_LENGTH   45
 
#define GSC_MALLOC(size)   malloc(size)
 
#define GSC_FREE(ptr)   free(ptr)
 
#define GENOLEN_T   GSC_GENOLEN_T
 
#define LOCALX_T   GSC_LOCALX_T
 
#define GLOBALX_T   GSC_GLOBALX_T
 
#define ID_T   GSC_ID_T
 
#define LOGICVAL   GSC_LOGICVAL
 
#define NA_GENOLEN   GSC_NA_GENOLEN
 
#define NA_LOCALX   GSC_NA_LOCALX
 
#define NA_GLOBALX   GSC_NA_GLOBALX
 
#define NA_IDX   GSC_NA_IDX
 
#define TRUE   GSC_TRUE
 
#define FALSE   GSC_FALSE
 
#define NA   GSC_NA
 
#define PedigreeID   gsc_PedigreeID
 
#define NO_PEDIGREE   GSC_NO_PEDIGREE
 
#define GroupNum   gsc_GroupNum
 
#define NO_GROUP   GSC_NO_GROUP
 
#define EffectID   gsc_EffectID
 
#define NO_EFFECTSET   GSC_NO_EFFECTSET
 
#define LabelID   gsc_LabelID
 
#define NO_LABEL   GSC_NO_LABEL
 
#define MapID   gsc_MapID
 
#define NO_MAP   GSC_NO_MAP
 
#define MultiIDSet   gsc_MultiIDSet
 
#define TableSize   gsc_TableSize
 
#define DecimalMatrix   gsc_DecimalMatrix
 
#define GenOptions   gsc_GenOptions
 
#define BASIC_OPT   GSC_BASIC_OPT
 
#define MarkerBlocks   gsc_MarkerBlocks
 
#define KnownGenome   gsc_KnownGenome
 
#define RecombinationMap   gsc_RecombinationMap
 
#define AlleleMatrix   gsc_AlleleMatrix
 
#define EffectMatrix   gsc_EffectMatrix
 
#define SimData   gsc_SimData
 
#define GenoLocation   gsc_GenoLocation
 
#define INVALID_GENO_LOCATION   GSC_INVALID_GENO_LOCATION
 
#define IS_VALID_LOCATION   GSC_IS_VALID_LOCATION
 
#define BidirectionalIterator   gsc_BidirectionalIterator
 
#define RandomAccessIterator   gsc_RandomAccessIterator
 
#define create_new_label   gsc_create_new_label
 
#define change_label_default   gsc_change_label_default
 
#define change_label_to   gsc_change_label_to
 
#define change_label_by_amount   gsc_change_label_by_amount
 
#define change_label_to_values   gsc_change_label_to_values
 
#define change_names_to_values   gsc_change_names_to_values
 
#define change_allele_symbol   gsc_change_allele_symbol
 
#define create_empty_simdata   gsc_create_empty_simdata
 
#define clear_simdata   gsc_clear_simdata
 
#define load_mapfile   gsc_load_mapfile
 
#define load_effectfile   gsc_load_effectfile
 
#define load_genotypefile   gsc_load_genotypefile
 
#define load_data_files   gsc_load_data_files
 
#define DETECT_FILE_FORMAT   GSC_DETECT_FILE_FORMAT
 
#define FileFormatSpec   gsc_FileFormatSpec
 
#define define_matrix_format_details   gsc_define_matrix_format_details
 
#define create_bidirectional_iter   gsc_create_bidirectional_iter
 
#define create_randomaccess_iter   gsc_create_randomaccess_iter
 
#define set_bidirectional_iter_to_start   gsc_set_bidirectional_iter_to_start
 
#define set_bidirectional_iter_to_end   gsc_set_bidirectional_iter_to_end
 
#define next_forwards   gsc_next_forwards
 
#define next_backwards   gsc_next_backwards
 
#define next_get_nth   gsc_next_get_nth
 
#define get_name   gsc_get_name
 
#define set_name   gsc_set_name
 
#define get_alleles   gsc_get_alleles
 
#define get_first_parent   gsc_get_first_parent
 
#define get_second_parent   gsc_get_second_parent
 
#define get_id   gsc_get_id
 
#define get_group   gsc_get_group
 
#define set_group   gsc_set_group
 
#define get_label_value   gsc_get_label_value
 
#define get_index_of_label   gsc_get_index_of_label
 
#define get_index_of_eff_set   gsc_get_index_of_eff_set
 
#define get_index_of_map   gsc_get_index_of_map
 
#define get_index_of_genetic_marker   gsc_get_index_of_genetic_marker
 
#define get_existing_groups   gsc_get_existing_groups
 
#define get_existing_group_counts   gsc_get_existing_group_counts
 
#define get_group_size   gsc_get_group_size
 
#define get_group_names   gsc_get_group_names
 
#define get_group_ids   gsc_get_group_ids
 
#define get_group_indexes   gsc_get_group_indexes
 
#define get_group_genes   gsc_get_group_genes
 
#define get_group_bvs   gsc_get_group_bvs
 
#define get_group_parent_names   gsc_get_group_parent_names
 
#define get_group_parent_ids   gsc_get_group_parent_ids
 
#define get_group_pedigrees   gsc_get_group_pedigrees
 
#define combine_groups   gsc_combine_groups
 
#define make_group_from   gsc_make_group_from
 
#define split_by_label_value   gsc_split_by_label_value
 
#define split_by_label_range   gsc_split_by_label_range
 
#define split_into_individuals   gsc_split_into_individuals
 
#define split_into_families   gsc_split_into_families
 
#define split_into_halfsib_families   gsc_split_into_halfsib_families
 
#define split_evenly_into_two   gsc_split_evenly_into_two
 
#define split_evenly_into_n   gsc_split_evenly_into_n
 
#define split_into_buckets   gsc_split_into_buckets
 
#define split_randomly_into_two   gsc_split_randomly_into_two
 
#define split_randomly_into_n   gsc_split_randomly_into_n
 
#define split_by_probabilities   gsc_split_by_probabilities
 
#define generate_gamete   gsc_generate_gamete
 
#define generate_doubled_haploid   gsc_generate_doubled_haploid
 
#define generate_clone   gsc_generate_clone
 
#define make_random_crosses   gsc_make_random_crosses
 
#define make_random_crosses_between   gsc_make_random_crosses_between
 
#define make_targeted_crosses   gsc_make_targeted_crosses
 
#define self_n_times   gsc_self_n_times
 
#define make_doubled_haploids   gsc_make_doubled_haploids
 
#define make_clones   gsc_make_clones
 
#define make_all_unidirectional_crosses   gsc_make_all_unidirectional_crosses
 
#define make_crosses_from_file   gsc_make_crosses_from_file
 
#define make_double_crosses_from_file   gsc_make_double_crosses_from_file
 
#define split_by_bv   gsc_split_by_bv
 
#define calculate_bvs   gsc_calculate_bvs
 
#define calculate_allele_counts   gsc_calculate_allele_counts
 
#define create_evenlength_blocks_each_chr   gsc_create_evenlength_blocks_each_chr
 
#define load_blocks   gsc_load_blocks
 
#define calculate_group_local_bvs   gsc_calculate_group_local_bvs
 
#define calculate_local_bvs   gsc_calculate_local_bvs
 
#define calculate_optimal_haplotype   gsc_calculate_optimal_haplotype
 
#define calculate_optimal_possible_haplotype   gsc_calculate_optimal_possible_haplotype
 
#define calculate_optimal_bv   gsc_calculate_optimal_bv
 
#define calculate_optimal_possible_bv   gsc_calculate_optimal_possible_bv
 
#define calculate_minimal_bv   gsc_calculate_minimal_bv
 
#define delete_group   gsc_delete_group
 
#define delete_label   gsc_delete_label
 
#define delete_recombination_map   gsc_delete_recombination_map
 
#define delete_eff_set   gsc_delete_eff_set
 
#define delete_dmatrix   gsc_delete_dmatrix
 
#define delete_simdata   gsc_delete_simdata
 
#define delete_markerblocks   gsc_delete_markerblocks
 
#define delete_bidirectional_iter   gsc_delete_bidirectional_iter
 
#define delete_randomaccess_iter   gsc_delete_randomaccess_iter
 
#define save_markerblocks   gsc_save_markerblocks
 
#define save_genotypes   gsc_save_genotypes
 
#define save_allele_counts   gsc_save_allele_counts
 
#define save_pedigrees   gsc_save_pedigrees
 
#define save_bvs   gsc_save_bvs
 
#define GSC_CREATE_BUFFER(n, type, length)
 Macro to create a stretchy buffer of any type and some length. More...
 
#define GSC_BUFFER_ISHEAP(n)   n##cap >= sizeof(n##stack)/sizeof(n##stack[0])
 For debugging purposes. More...
 
#define GSC_FINALISE_BUFFER(n, as, nentries)
 Macro to convert a stretchy buffer to a solid heap vector. More...
 
#define GSC_DELETE_BUFFER(n)
 Macro to delete a stretchy buffer. More...
 
#define GSC_STRETCH_BUFFER(n, newlen)
 Macro to expand the capacity of a stretchy buffer. More...
 
#define GSC_NO_PEDIGREE   (gsc_PedigreeID){.id=GSC_NA_ID}
 Empty/null value for pedigree fields. More...
 
#define GSC_NO_GROUP   (gsc_GroupNum){.num=GSC_NA_ID}
 Empty/null value for group allocations. More...
 
#define GSC_NO_EFFECTSET   (gsc_EffectID){.id=GSC_NA_ID}
 Empty/null value for effect set identifiers. More...
 
#define GSC_NO_LABEL   (gsc_LabelID){.id=GSC_NA_ID}
 Empty/null value for custom label identifiers. More...
 
#define GSC_NO_MAP   (gsc_MapID){.id=GSC_NA_ID}
 Empty/null value for recombination map identifiers. More...
 
#define GSC_DETECT_FILE_FORMAT   ((gsc_FileFormatSpec){.filetype=GSC_GENOTYPEFILE_UNKNOWN})
 File format specifier to instruct genomicSimulation loaders to auto-detect all details of the file format. More...
 
#define GSC_INVALID_GENO_LOCATION   (gsc_GenoLocation){.localAM=0,.localPos=GSC_NA_LOCALX}
 Constant representing a nonexistent location in the simulation. More...
 
#define GSC_IS_VALID_LOCATION(g)   (g.localAM != 0 && g.localPos != GSC_NA_LOCALX)
 Check if a GenoLocation is INVALID_GENO_LOCATION. More...
 

Typedefs

typedef struct gsc_AlleleMatrix gsc_AlleleMatrix
 A linked list entry that stores a matrix of alleles for a set of SNP markers and genotypes. More...
 

Enumerations

enum  GSC_LOGICVAL { GSC_TRUE = 1 , GSC_FALSE = 0 , GSC_NA = -1 }
 genomicSimulation's "logical value" type More...
 
enum  gsc_TableFileCurrentStatus {
  GSC_TABLEFILE_NEWLINE , GSC_TABLEFILE_COLUMNGAP , GSC_TABLEFILE_CONTENTS , GSC_TABLEFILE_ERROR_EOF ,
  GSC_TABLEFILE_ERROR_EOBUF
}
 Represent possible states of the cursor of a gsc_TableFileReader. More...
 
enum  gsc_GenotypeFileCellStyle {
  GSC_GENOTYPECELLSTYLE_PAIR , GSC_GENOTYPECELLSTYLE_COUNT , GSC_GENOTYPECELLSTYLE_ENCODED , GSC_GENOTYPECELLSTYLE_SLASHPAIR ,
  GSC_GENOTYPECELLSTYLE_UNKNOWN
}
 Represent possible representations of alleles at a marker in a genotype file. More...
 
enum  gsc_GenotypeFileType {
  GSC_GENOTYPEFILE_UNKNOWN , GSC_GENOTYPEFILE_MATRIX , GSC_GENOTYPEFILE_BED , GSC_GENOTYPEFILE_PED ,
  GSC_GENOTYPEFILE_VCF
}
 Enumerate types of genotype files that the simulation knows how to load. More...
 

Functions

gsc_TableFileReader gsc_tablefilereader_create (const char *filename)
 Open a file for reading with gsc_TableFileReader. More...
 
void gsc_tablefilereader_close (gsc_TableFileReader *tbl)
 Close a gsc_TableFileReader's file pointer. More...
 
void gsc_helper_tablefilereader_refill_buffer (gsc_TableFileReader *tbl)
 Read another buffer's worth of characters from a gsc_TableFileReader's file. More...
 
enum gsc_TableFileCurrentStatus gsc_helper_tablefilereader_classify_char (gsc_TableFileReader *tbl)
 Classify the character under the cursor of a TableFileReader as cell contents or otherwise. More...
 
void gsc_tablefilecell_deep_copy (gsc_TableFileCell *c)
 Allocate memory to store a deep copy of a gsc_TableFileCell, if previously only a shallow copy. More...
 
gsc_TableFileCell gsc_tablefilereader_get_next_cell (gsc_TableFileReader *tbl)
 Read forwards in TableFileReader and return the next cell's contents, as well as how many column gaps and newlines preceeded it. More...
 
gsc_FileFormatSpec gsc_define_matrix_format_details (const GSC_LOGICVAL has_header, const GSC_LOGICVAL markers_as_rows, const enum gsc_GenotypeFileCellStyle cell_style)
 Give genomicSimulation hints on the format of a genotype matrix file to be loaded. More...
 
int gsc_randpoi (rnd_pcg_t *rng, double lambda)
 Generates randomly a number from the Poisson distribution with parameter lambda, using the Knuth approach. More...
 
gsc_DecimalMatrix gsc_generate_zero_dmatrix (const size_t r, const size_t c)
 Generates a matrix of c columns, r rows with all 0. More...
 
int gsc_add_matrixvector_product_to_dmatrix (gsc_DecimalMatrix *result, const gsc_DecimalMatrix *a, const double *b)
 Multiply a gsc_DecimalMatrix to a vector, and add that product to the first column of a provided gsc_DecimalMatrix. More...
 
int gsc_add_doublematrixvector_product_to_dmatrix (gsc_DecimalMatrix *result, const gsc_DecimalMatrix *amat, const double *avec, const gsc_DecimalMatrix *bmat, const double *bvec)
 Multiply two sets of a gsc_DecimalMatrix and vector, and add both products to the first column of a provided gsc_DecimalMatrix. More...
 
struct gsc_TableSize gsc_get_file_dimensions (const char *filename, const char sep)
 Opens a table file and reads the number of columns and rows (including headers) separated by sep into a gsc_TableSize struct that is returned. More...
 
unsigned int gsc_get_from_ordered_pedigree_list (const gsc_PedigreeID target, const unsigned int listLen, const gsc_PedigreeID *list)
 Binary search through list of unsigned integers. More...
 
size_t gsc_get_from_unordered_str_list (const char *target, const size_t listLen, const char **list)
 Linear search through a list of strings. More...
 
size_t gsc_get_from_ordered_str_list (const char *target, const size_t listLen, const char **list)
 Binary search through a list of strings. More...
 
void gsc_shuffle_up_to (rnd_pcg_t *rng, void *sequence, const size_t item_size, const size_t total_n, const size_t n_to_shuffle)
 Produce a random ordering of the first n elements in an array using a (partial) Fisher-Yates shuffle. More...
 
unsigned int gsc_randomdraw_replacementrules (gsc_SimData *d, unsigned int max, unsigned int cap, unsigned int *member_uses, unsigned int noCollision)
 Randomly pick a number in a range, optionally with a cap on how many times a number can be picked, and optionally required to be different to the last pick. More...
 
gsc_LabelID gsc_create_new_label (gsc_SimData *d, const int setTo)
 Initialises a new custom label. More...
 
void gsc_change_label_default (gsc_SimData *d, const gsc_LabelID whichLabel, const int newDefault)
 Set the default value of a custom label. More...
 
void gsc_change_label_to (gsc_SimData *d, const gsc_GroupNum whichGroup, const gsc_LabelID whichLabel, const int setTo)
 Set the values of a custom label. More...
 
void gsc_change_label_by_amount (gsc_SimData *d, const gsc_GroupNum whichGroup, const gsc_LabelID whichLabel, const int byValue)
 Increment the values of a custom label. More...
 
void gsc_change_label_to_values (gsc_SimData *d, const gsc_GroupNum whichGroup, const unsigned int startIndex, const gsc_LabelID whichLabel, const size_t n_values, const int *values)
 Copy a vector of integers into a custom label. More...
 
void gsc_change_names_to_values (gsc_SimData *d, const gsc_GroupNum whichGroup, const unsigned int startIndex, const size_t n_values, const char **values)
 Copy a vector of strings into the genotype name field. More...
 
void gsc_change_allele_symbol (gsc_SimData *d, const char *which_marker, const char from, const char to)
 Replace all occurences of a given allele with a different symbol representation. More...
 
int gsc_get_integer_digits (const int i)
 Count and return the number of digits in i. More...
 
unsigned int gsc_get_index_of_label (const gsc_SimData *d, const gsc_LabelID label)
 Function to identify the label lookup index of a label identifier. More...
 
unsigned int gsc_get_index_of_eff_set (const gsc_SimData *d, const gsc_EffectID eff_set_id)
 Function to identify the lookup index of a marker effect set identifier. More...
 
unsigned int gsc_get_index_of_map (const gsc_SimData *d, const gsc_MapID map)
 Function to identify the lookup index of a recombination map identifier. More...
 
_Bool gsc_get_index_of_genetic_marker (const char *target, gsc_KnownGenome g, unsigned int *out)
 Return whether or not a marker name is present in the tracked markers, and at what index. More...
 
gsc_LabelID gsc_get_new_label_id (const gsc_SimData *d)
 Function to identify the next sequential integer that is not already allocated to a label in the simulation. More...
 
gsc_EffectID gsc_get_new_eff_set_id (const gsc_SimData *d)
 Function to identify the next sequential integer that is not already allocated to a marker effect set ID in the simulation. More...
 
gsc_MapID gsc_get_new_map_id (const gsc_SimData *d)
 Function to identify the next sequential integer that is not already allocated to a map ID in the simulation. More...
 
gsc_GroupNum gsc_get_next_free_group_num (const size_t n_existing_groups, const gsc_GroupNum *existing_groups, size_t *cursor, gsc_GroupNum previous)
 Iterator to get the next currently-free group number. More...
 
gsc_GroupNum gsc_get_new_group_num (gsc_SimData *d)
 Function to identify the next sequential integer that does not identify a group that currently has member(s). More...
 
void gsc_get_n_new_group_nums (gsc_SimData *d, const size_t n, gsc_GroupNum *result)
 Function to identify the next n sequential integers that do not identify a group that currently has member(s). More...
 
void gsc_condense_allele_matrix (gsc_SimData *d)
 A function to tidy the internal storage of genotypes after addition or deletion of genotypes in the gsc_SimData. More...
 
gsc_AlleleMatrixgsc_create_empty_allelematrix (const unsigned int n_markers, const unsigned int n_labels, const int *labelDefaults, const unsigned int n_genotypes)
 Creator for an empty gsc_AlleleMatrix object of a given size. More...
 
gsc_SimDatagsc_create_empty_simdata (unsigned int RNGseed)
 Creator for an empty gsc_SimData object on the heap. More...
 
void gsc_clear_simdata (gsc_SimData *d)
 Clear a gsc_SimData object on the heap. More...
 
gsc_GroupNum gsc_load_genotypefile (gsc_SimData *d, const char *filename, const gsc_FileFormatSpec format)
 Load a set of genotypes to a gsc_SimData object. More...
 
gsc_MapID gsc_load_mapfile (gsc_SimData *d, const char *filename)
 Load a genetic map to a gsc_SimData object. More...
 
gsc_MapID gsc_create_recombmap_from_markerlist (gsc_SimData *d, unsigned int n_markers, struct gsc_MapfileUnit *markerlist)
 Parse a list of markers/chrs/positions into a gsc_RecombinationMap and save to SimData. More...
 
gsc_MapID gsc_create_uniformspaced_recombmap (gsc_SimData *d, unsigned int n_markers, char **markernames, double expected_n_recombinations)
 Create a uniformly-spaced gsc_RecombinationMap from a list of marker names and save to SimData. More...
 
gsc_EffectID gsc_load_effectfile (gsc_SimData *d, const char *filename)
 Populates a gsc_SimData combination with effect values. More...
 
struct gsc_MultiIDSet gsc_load_data_files (gsc_SimData *d, const char *data_file, const char *map_file, const char *effect_file, const gsc_FileFormatSpec format)
 Populates a gsc_SimData object with marker allele data, a genetic map, and (optionally) marker effect values. More...
 
static int gsc_isValidLocation (const gsc_GenoLocation g)
 Identify whether a gsc_GenoLocation is INVALID_GENO_LOCATION. More...
 
gsc_BidirectionalIterator gsc_create_bidirectional_iter (gsc_SimData *d, const gsc_GroupNum group)
 Create a bidirectional iterator. More...
 
gsc_BidirectionalIterator gsc_create_bidirectional_iter_fromAM (gsc_AlleleMatrix *am, const gsc_GroupNum group)
 
gsc_RandomAccessIterator gsc_create_randomaccess_iter (gsc_SimData *d, const gsc_GroupNum group)
 Create a Random Access Iterator. More...
 
gsc_AlleleMatrixgsc_get_nth_AlleleMatrix (gsc_AlleleMatrix *listStart, const unsigned int n)
 Get an gsc_AlleleMatrix by index in the linked list. More...
 
gsc_GenoLocation gsc_set_bidirectional_iter_to_start (gsc_BidirectionalIterator *it)
 Initialise a Bidirectional iterator to the start of its sequence. More...
 
gsc_GenoLocation gsc_set_bidirectional_iter_to_end (gsc_BidirectionalIterator *it)
 Initialise a Bidirectional iterator to the end of its sequence. More...
 
gsc_GenoLocation gsc_next_forwards (gsc_BidirectionalIterator *it)
 Get the next location from a bidirectional iterator. More...
 
gsc_GenoLocation gsc_next_backwards (gsc_BidirectionalIterator *it)
 Get the previous location from a bidirectional iterator. More...
 
gsc_GenoLocation gsc_next_get_nth (gsc_RandomAccessIterator *it, const unsigned int n)
 Get a location by index using a gsc_RandomAccessIterator. More...
 
static char * gsc_get_name (const gsc_GenoLocation loc)
 Get the name of a genotype. More...
 
static void gsc_set_name (const gsc_GenoLocation loc, char *name)
 Set the name of a genotype. More...
 
static char * gsc_get_alleles (const gsc_GenoLocation loc)
 Get the alleles of a genotype. More...
 
static gsc_PedigreeID gsc_get_first_parent (const gsc_GenoLocation loc)
 Get the first/left parent of a genotype. More...
 
static gsc_PedigreeID gsc_get_second_parent (const gsc_GenoLocation loc)
 Get the second/right parent of a genotype. More...
 
static gsc_PedigreeID gsc_get_id (const gsc_GenoLocation loc)
 Get the persistent id of a genotype. More...
 
static gsc_GroupNum gsc_get_group (const gsc_GenoLocation loc)
 Get the current group membership of a genotype. More...
 
static void gsc_set_group (const gsc_GenoLocation loc, const gsc_GroupNum group)
 Set the current group membership of a genotype. More...
 
static int gsc_get_label_value (const gsc_GenoLocation loc, const int labelIndex)
 Get the value of a specific label of a genotype. More...
 
char * gsc_get_name_of_id (const gsc_AlleleMatrix *start, const gsc_PedigreeID id)
 Returns the name of the genotype with a given id. More...
 
int gsc_get_parents_of_id (const gsc_AlleleMatrix *start, const gsc_PedigreeID id, gsc_PedigreeID output[static 2])
 Saves the ids of the parents of a genotype with a particular id to the output array output. More...
 
void gsc_get_ids_of_names (const gsc_AlleleMatrix *start, const size_t n_names, const char **names, gsc_PedigreeID *output)
 Search for genotypes with certain names in a linked list of gsc_AlleleMatrix and save the ids of those names. More...
 
unsigned int gsc_get_index_of_child (const gsc_AlleleMatrix *start, const gsc_PedigreeID parent1id, const gsc_PedigreeID parent2id)
 Search for a genotype with parentage matching two given parent ids in a linked list of gsc_AlleleMatrix, and return its index. More...
 
unsigned int gsc_get_index_of_name (const gsc_AlleleMatrix *start, const char *name)
 Search for a genotype with a particular name in a linked list of gsc_AlleleMatrix, and return its global index in the list. More...
 
gsc_PedigreeID gsc_get_id_of_index (const gsc_AlleleMatrix *start, const unsigned int index)
 Get the id of a genotype by its index. More...
 
char * gsc_get_genes_of_index (const gsc_AlleleMatrix *start, const unsigned int index)
 Get the alleles of a genotype by its index. More...
 
unsigned int gsc_get_group_size (const gsc_SimData *d, const gsc_GroupNum group_id)
 Function to count the number of genotypes that currently belong to the specified group. More...
 
unsigned int gsc_get_group_genes (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, char **output)
 Gets a shallow copy of the genes/alleles of each member of the group. More...
 
unsigned int gsc_get_group_names (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, char **output)
 Gets a shallow copy of the names of each member of the group. More...
 
unsigned int gsc_get_group_ids (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, gsc_PedigreeID *output)
 Gets the ids of each member of the group. More...
 
unsigned int gsc_get_group_indexes (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, unsigned int *output)
 Gets the 0-based global indexes of each member of the group. More...
 
unsigned int gsc_get_group_bvs (const gsc_SimData *d, const gsc_GroupNum group_id, const gsc_EffectID effID, unsigned int group_size, double *output)
 Gets the breeding values/breeding values/fitnesses of each member of the group. More...
 
unsigned int gsc_get_group_parent_ids (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, const int whichParent, gsc_PedigreeID *output)
 Gets the ids of either the first or second parent of each member of the group. More...
 
unsigned int gsc_get_group_parent_names (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, const int whichParent, char **output)
 Gets the names of either the first or second parent of each member of the group. More...
 
unsigned int gsc_get_group_pedigrees (const gsc_SimData *d, const gsc_GroupNum group_id, unsigned int group_size, char **output)
 Gets the full pedigree string (as per gsc_save_group_full_pedigree() ) of each member of the group. More...
 
size_t gsc_get_existing_groups (gsc_SimData *d, gsc_GroupNum *output)
 Identify group numbers that currently have members. More...
 
size_t gsc_get_existing_group_counts (gsc_SimData *d, gsc_GroupNum *out_groups, unsigned int *out_sizes)
 Identify group numbers that currently have members, and how many members they have. More...
 
gsc_GroupNum gsc_combine_groups (gsc_SimData *d, const size_t list_len, const gsc_GroupNum *grouplist)
 Combine a set of groups into one group. More...
 
gsc_GroupNum gsc_make_group_from (gsc_SimData *d, const size_t index_list_len, const unsigned int *genotype_indexes)
 Take a list of indexes and allocate the genotypes at those indexes to a new group. More...
 
gsc_GroupNum gsc_split_by_label_value (gsc_SimData *d, const gsc_GroupNum group, const gsc_LabelID whichLabel, const int valueToSplit)
 Allocates the genotypes with a particular value of a label to a new group. More...
 
gsc_GroupNum gsc_split_by_label_range (gsc_SimData *d, const gsc_GroupNum group, const gsc_LabelID whichLabel, const int valueLowBound, const int valueHighBound)
 Allocates the genotypes with values of a label in a particular range to a new group. More...
 
size_t gsc_scaffold_split_by_somequality (gsc_SimData *d, const gsc_GroupNum group_id, void *somequality_data, gsc_GroupNum(*somequality_tester)(gsc_GenoLocation, void *, size_t, size_t, gsc_GroupNum *), size_t maxentries_results, gsc_GroupNum *results)
 Split by some quality (generic function) More...
 
size_t gsc_split_into_individuals (gsc_SimData *d, const gsc_GroupNum group_id, size_t maxentries_results, gsc_GroupNum *results)
 Split a group into n one-member groups. More...
 
size_t gsc_split_into_families (gsc_SimData *d, const gsc_GroupNum group_id, size_t maxentries_results, gsc_GroupNum *results)
 Split a group into families by their pedigrees. More...
 
size_t gsc_split_into_halfsib_families (gsc_SimData *d, const gsc_GroupNum group_id, const int parent, size_t maxentries_results, gsc_GroupNum *results)
 Split a group into families of half-siblings by shared first or second parent. More...
 
size_t gsc_scaffold_split_by_someallocation (gsc_SimData *d, const gsc_GroupNum group_id, void *someallocator_data, gsc_GroupNum(*someallocator)(gsc_GenoLocation, gsc_SimData *, void *, size_t, size_t *, gsc_GroupNum *), size_t n_outgroups, gsc_GroupNum *outgroups)
 Split by some allocator (generic function) More...
 
gsc_GroupNum gsc_split_evenly_into_two (gsc_SimData *d, const gsc_GroupNum group_id)
 Split a group into two groups of equal size (or size differing only by one, if the original group had an odd number of members) using a random permutation of the group members to determine which goes where. More...
 
size_t gsc_split_evenly_into_n (gsc_SimData *d, const gsc_GroupNum group_id, const size_t n, gsc_GroupNum *results)
 Split a group into n groups of equal size (or size differing only by one, if n does not perfectly divide the group size.), using a random permutation of the group members to determine which goes where. More...
 
size_t gsc_split_into_buckets (gsc_SimData *d, const gsc_GroupNum group_id, const size_t n, const unsigned int *counts, gsc_GroupNum *results)
 Split a group into n groups of equal size (or size differing only by one, if n does not perfectly divide the group size), using a random permutation of the group members to determine which goes where. More...
 
gsc_GroupNum gsc_split_randomly_into_two (gsc_SimData *d, const gsc_GroupNum group_id)
 Flip a coin for each member of the group to decide if it should be moved to the new group. More...
 
size_t gsc_split_randomly_into_n (gsc_SimData *d, const gsc_GroupNum group_id, const size_t n, gsc_GroupNum *results)
 Allocate each member of the group to one of n groups with equal probability. More...
 
size_t gsc_split_by_probabilities (gsc_SimData *d, const gsc_GroupNum group_id, const size_t n, const double *probs, gsc_GroupNum *results)
 Allocate each member of the group to one of n groups with custom probabilities for each group. More...
 
void gsc_generate_gamete (gsc_SimData *d, const char *parent_genome, char *output, const unsigned int mapindex)
 Fills a char* with the simulated result of meiosis (reduction and recombination) from the marker alleles of a given parent. More...
 
void gsc_generate_doubled_haploid (gsc_SimData *d, const char *parent_genome, char *output, const unsigned int mapindex)
 Get the alleles of the outcome of producing a doubled haploid from a gamete from a given parent. More...
 
void gsc_generate_clone (gsc_SimData *d, const char *parent_genome, char *output)
 Get an identical copy of a given genotype. More...
 
gsc_GroupNum gsc_scaffold_make_new_genotypes (gsc_SimData *d, const gsc_GenOptions g, void *parentIterator, union gsc_datastore_make_genotypes *datastore, int(*parentChooser)(void *, union gsc_datastore_make_genotypes *, unsigned int *, gsc_ParentChoice[static 2]), void(*offspringGenerator)(gsc_SimData *, union gsc_datastore_make_genotypes *, gsc_ParentChoice[static 2], gsc_GenoLocation))
 Make new genotypes (generic function) More...
 
gsc_GroupNum gsc_make_random_crosses (gsc_SimData *d, const gsc_GroupNum from_group, const unsigned int n_crosses, const unsigned int cap, const gsc_MapID which_map, const gsc_GenOptions g)
 Performs random crosses among members of a group. More...
 
gsc_GroupNum gsc_make_random_crosses_between (gsc_SimData *d, const gsc_GroupNum group1, const gsc_GroupNum group2, const unsigned int n_crosses, const unsigned int cap1, const unsigned int cap2, const gsc_MapID map1, const gsc_MapID map2, const gsc_GenOptions g)
 Performs random crosses where the first parent comes from one group and the second from another. More...
 
gsc_GroupNum gsc_make_targeted_crosses (gsc_SimData *d, const size_t n_combinations, const unsigned int *firstParents, const unsigned int *secondParents, const gsc_MapID map1, const gsc_MapID map2, const gsc_GenOptions g)
 Performs the crosses of pairs of parents whose indexes are provided in an array. More...
 
gsc_GroupNum gsc_self_n_times (gsc_SimData *d, const unsigned int n, const gsc_GroupNum group, const gsc_MapID which_map, const gsc_GenOptions g)
 Selfs each member of a group for a certain number of generations. More...
 
gsc_GroupNum gsc_make_doubled_haploids (gsc_SimData *d, const gsc_GroupNum group, const gsc_MapID which_map, const gsc_GenOptions g)
 Creates a doubled haploid from each member of a group. More...
 
gsc_GroupNum gsc_make_clones (gsc_SimData *d, const gsc_GroupNum group, const _Bool inherit_names, const gsc_GenOptions g)
 Creates an identical copy of each member of a group. More...
 
gsc_GroupNum gsc_make_all_unidirectional_crosses (gsc_SimData *d, const gsc_GroupNum from_group, const gsc_MapID mapID, const gsc_GenOptions g)
 Perform crosses between all pairs of parents in the group from_group and allocates the resulting offspring to a new group. More...
 
gsc_GroupNum gsc_make_crosses_from_file (gsc_SimData *d, const char *input_file, const gsc_MapID map1, const gsc_MapID map2, const gsc_GenOptions g)
 Perform crosses between pairs of parents identified by name in a file and allocate the resulting offspring to a new group. More...
 
gsc_GroupNum gsc_make_double_crosses_from_file (gsc_SimData *d, const char *input_file, const gsc_MapID map1, const gsc_MapID map2, const gsc_GenOptions g)
 Perform crosses between previously-generated offspring of pairs of parents identified by name in a file. More...
 
gsc_GroupNum gsc_split_by_bv (gsc_SimData *d, const gsc_GroupNum group, const gsc_EffectID effID, const unsigned int top_n, const _Bool lowIsBest)
 Takes the top_n individuals in the group with the best breeding values/fitnesses and puts them in a new group. More...
 
gsc_DecimalMatrix gsc_calculate_bvs (const gsc_SimData *d, const gsc_GroupNum group, const gsc_EffectID effID)
 Calculate the fitness metric/breeding value for every genotype in the simulation or every genotype in a certain group. More...
 
gsc_DecimalMatrix gsc_calculate_utility_bvs (gsc_BidirectionalIterator *targets, const gsc_EffectMatrix *effset)
 Calculate the fitness metric/breeding value for a set of genotypes. More...
 
gsc_DecimalMatrix gsc_calculate_allele_counts (const gsc_SimData *d, const gsc_GroupNum group, const char allele)
 Calculates the number of times at each marker that a particular allele appears. More...
 
void gsc_calculate_utility_allele_counts (const unsigned int n_markers, const unsigned int n_genotypes, const char **const genotypes, const char allele, gsc_DecimalMatrix *counts)
 Calculates the number of times at each marker that a particular allele appears. More...
 
void gsc_calculate_utility_allele_counts_pair (const unsigned int n_markers, const unsigned int n_genotypes, const char **const genotypes, const char allele, gsc_DecimalMatrix *counts, const char allele2, gsc_DecimalMatrix *counts2)
 Calculates the number of times at each marker that two particular alleles appear. More...
 
gsc_MarkerBlocks gsc_create_evenlength_blocks_each_chr (const gsc_SimData *d, const gsc_MapID mapid, const unsigned int n)
 Divide the genotype into blocks where each block contains all markers within a 1/n length section of each chromosome in the map, and return the resulting blocks in a struct. More...
 
gsc_MarkerBlocks gsc_load_blocks (const gsc_SimData *d, const char *block_file)
 Given a file containing definitions of blocks of markers, process that file and return a struct containing the definitions of those blocks. More...
 
void gsc_calculate_group_local_bvs (const gsc_SimData *d, const gsc_MarkerBlocks b, const gsc_EffectID effID, const char *output_file, const gsc_GroupNum group)
 Given a set of blocks of markers in a file, for each genotype in a group, calculate the local fitness metric/breeding value for the first allele at each marker in the block, and the local fitness metric/breeding value for the second allele at each marker in the block, then save the result to a file. More...
 
void gsc_calculate_local_bvs (const gsc_SimData *d, const gsc_MarkerBlocks b, const gsc_EffectID effID, const char *output_file)
 Given a set of blocks of markers in a file, for each genotype saved, calculate the local BV for the first allele at each marker in the block, and the local BV for the second allele at each marker in the block, then save the result to a file. More...
 
char * gsc_calculate_optimal_haplotype (const gsc_SimData *d, const gsc_EffectID effID)
 Takes a look at the currently-loaded effect values and creates a string containing the allele with the highest effect value for each marker as ordered in the gsc_SimData. More...
 
char * gsc_calculate_optimal_possible_haplotype (const gsc_SimData *d, const gsc_GroupNum group, const gsc_EffectID effID)
 Calculates the highest-breeding-value haplotype that can be created from the alleles present in a given group. More...
 
double gsc_calculate_optimal_bv (const gsc_SimData *d, const gsc_EffectID effID)
 Takes a look at the currently-loaded effect values and returns the highest possible breeding value any (diploid) genotype could have using those effect values. More...
 
double gsc_calculate_optimal_possible_bv (const gsc_SimData *d, const gsc_GroupNum group, const gsc_EffectID effID)
 Calculates the breeding value of the highest breeding-value genotype that can be created from the alleles present in a given group. More...
 
double gsc_calculate_minimal_bv (const gsc_SimData *d, const gsc_EffectID effID)
 Takes a look at the currently-loaded effect values and returns the lowest possible breeding value any (diploid) genotype could score using those effect values. More...
 
void gsc_delete_group (gsc_SimData *d, const gsc_GroupNum group_id)
 Deletes all genotypes belonging to a particular group. More...
 
void gsc_delete_label (gsc_SimData *d, const gsc_LabelID whichLabel)
 Clears memory of this label from the simulation and all its genotypes. More...
 
void gsc_delete_genome (gsc_KnownGenome *g)
 Deletes and clears the memory of a gsc_KnownGenome object and its children. More...
 
void gsc_delete_recombination_map (gsc_SimData *d, const gsc_MapID whichMap)
 Deletes a particular recombination map from memory. More...
 
void gsc_delete_recombination_map_nointegrity (gsc_RecombinationMap *m)
 Deletes and clears the memory of a gsc_RecombinationMap struct. More...
 
void gsc_delete_allele_matrix (gsc_AlleleMatrix *m)
 Delete the gsc_AlleleMatrix linked list from m onwards and frees its memory. More...
 
void gsc_delete_effect_matrix (gsc_EffectMatrix *m)
 Deletes an gsc_EffectMatrix object and frees its memory. More...
 
void gsc_delete_eff_set (gsc_SimData *d, gsc_EffectID whichID)
 Deletes a particular set of marker effects from memory. More...
 
void gsc_delete_simdata (gsc_SimData *m)
 Deletes a gsc_SimData object and frees its memory. More...
 
void gsc_delete_markerblocks (gsc_MarkerBlocks *b)
 Delete a gsc_MarkerBlocks struct. More...
 
void gsc_delete_dmatrix (gsc_DecimalMatrix *m)
 Deletes a gsc_DecimalMatrix and frees its memory. More...
 
void gsc_delete_bidirectional_iter (gsc_BidirectionalIterator *it)
 Deletes a gsc_BidirectionalIterator object. More...
 
void gsc_delete_randomaccess_iter (gsc_RandomAccessIterator *it)
 Deletes a gsc_RandomAccessIterator object and frees its memory. More...
 
void gsc_move_genotype (gsc_GenoLocation from, gsc_GenoLocation to, int *label_defaults)
 Move all details of the genotype at one gsc_GenoLocation to another gsc_GenoLocation. More...
 
void gsc_save_markerblocks (const char *fname, const gsc_SimData *d, const gsc_MarkerBlocks b, const gsc_MapID labelMapID)
 Prints the markers contained in a set of blocks to a file. More...
 
void gsc_save_genotypes (const char *fname, const gsc_SimData *d, const gsc_GroupNum groupID, const _Bool markers_as_rows)
 Prints genotypes from the simulation to a file. More...
 
void gsc_save_allele_counts (const char *fname, const gsc_SimData *d, const gsc_GroupNum groupID, const char allele, const _Bool markers_as_rows)
 Prints allele counts of genotypes from the simulation to a file. More...
 
void gsc_save_pedigrees (const char *fname, const gsc_SimData *d, const gsc_GroupNum groupID, const _Bool full_pedigree)
 Prints pedigrees of genotypes in the simulation to a file. More...
 
void gsc_save_bvs (const char *fname, const gsc_SimData *d, const gsc_GroupNum groupID, const gsc_EffectID effID)
 Prints breeding values of genotypes in the simulation to a file. More...
 
void gsc_save_utility_markerblocks (FILE *f, const gsc_MarkerBlocks b, const unsigned int n_markers, char **const marker_names, const gsc_RecombinationMap *map)
 Prints the markers contained in a set of blocks to a file. More...
 
void gsc_save_utility_genotypes (FILE *f, gsc_BidirectionalIterator *targets, const unsigned int n_markers, char **const marker_names, const _Bool markers_as_rows)
 Prints simulated genotypes to a file. More...
 
void gsc_save_utility_allele_counts (FILE *f, gsc_BidirectionalIterator *targets, const unsigned int n_markers, char **const marker_names, const _Bool markers_as_rows, const char allele)
 Prints allele counts of simulated genotypes to a file. More...
 
void gsc_save_utility_pedigrees (FILE *f, gsc_BidirectionalIterator *targets, const _Bool full_pedigree, const gsc_AlleleMatrix *parent_pedigree_store)
 Prints pedigrees to a file. More...
 
void gsc_save_utility_bvs (FILE *f, gsc_BidirectionalIterator *targets, const gsc_EffectMatrix *eff)
 Calculate and print breeding values to a file. More...
 
int * gsc_calculate_min_recombinations_fw1 (gsc_SimData *d, gsc_MapID mapid, char *parent1, unsigned int p1num, char *parent2, unsigned int p2num, char *offspring, int certain)
 Identify markers in the genotype of offspring where recombination from its parents occured. More...
 
int * gsc_calculate_min_recombinations_fwn (gsc_SimData *d, gsc_MapID mapid, char *parent1, unsigned int p1num, char *parent2, unsigned int p2num, char *offspring, int window_size, int certain)
 Identify markers in the genotype of offspring where recombination from its parents occured, as judged by the marker itself and a short window around it. More...
 
static int gsc_has_same_alleles (const char *p1, const char *p2, const size_t i)
 Simple operator to determine if at marker i, two genotypes share at least one allele. More...
 
static int gsc_has_same_alleles_window (const char *g1, const char *g2, const size_t start, const size_t w)
 Simple operator to determine if at markers with indexes i to i+w inclusive, two genotypes share at least one allele. More...
 
int gsc_calculate_recombinations_from_file (gsc_SimData *d, const char *input_file, const char *output_file, int window_len, int certain)
 Provides guesses as to the location of recombination events that led to the creation of certain genotypes from certain other genotypes. More...
 

Variables

const gsc_GenOptions GSC_BASIC_OPT
 Default parameter values for GenOptions, to help with quick scripts and prototypes. More...
 

Macro Definition Documentation

◆ CONTIG_WIDTH

#define CONTIG_WIDTH   1000

Definition at line 179 of file sim-operations.h.

◆ GSC_FREE

#define GSC_FREE (   ptr)    free(ptr)

Definition at line 204 of file sim-operations.h.

◆ GSC_GENOLEN_T

#define GSC_GENOLEN_T   unsigned int

genomicSimulation's "Genotype length" type

A type representing the maximum number of genetic markers tracked by the simulation, or the index of a particular genetic marker inside the map of markers in the simulation.

Can be redefined to another unsigned or signed integer type.

Definition at line 172 of file sim-operations.h.

◆ GSC_GLOBALX_T

#define GSC_GLOBALX_T   unsigned int

genomicSimulation's "Candidate global index" type

A type representing the maximum number of candidates stored in simulation.

It is used to represent the maximum number of candidates that could exist or be produced in the simulation, and to represent "global" candidate indexes counted cumulatively from the first AlleleMatrix in the SimData linked list.

This type should be the same size as, or larger than, GSC_LOCALX_T.

Can be redefined to another unsigned or signed integer type.

Definition at line 139 of file sim-operations.h.

◆ GSC_ID_T

#define GSC_ID_T   unsigned int

genomicSimulation's "ID" type

A type representing the maximum number of unique session IDs.

It is used by the various ID types (PedigreeID, MapID, LabelID, etc.) as well as being used as the type to represent the index of the stored map/label/effect set, because the maximum potential size of these values is pinned to the size of the corresponding ID type.

Can be redefined to another unsigned or signed integer type.

Definition at line 112 of file sim-operations.h.

◆ GSC_LOCALX_T

#define GSC_LOCALX_T   unsigned int

genomicSimulation's "Candidate local index" type

A type at least large enough to store the number of candidates in a single AlleleMatrix (i.e., a type whose maximum value is greater than or equal to CONTIG_WIDTH).

It is used to represent the index of a candidate within its current AlleleMatrix.

Can be redefined to another unsigned or signed integer type. This type should have a maximum value less than CONTIG_WIDTH.

Definition at line 157 of file sim-operations.h.

◆ GSC_MALLOC

#define GSC_MALLOC (   size)    malloc(size)

Definition at line 203 of file sim-operations.h.

◆ GSC_NA_GENOLEN

#define GSC_NA_GENOLEN   (GSC_GENOLEN_T)-1

For genetic marker indexes, the INVALID/UNINITIALISED value is -1 (for signed types) or the maximum value of the type (for unsigned types).

Definition at line 176 of file sim-operations.h.

◆ GSC_NA_GLOBALX

#define GSC_NA_GLOBALX   (GSC_GLOBALX_T)-1

For candidate global indexes, the INVALID/UNINITIALISED value is -1 (for signed types) or the maximum value of the type (for unsigned types).

Definition at line 143 of file sim-operations.h.

◆ GSC_NA_ID

#define GSC_NA_ID   0

For unique session IDs, the INVALID/UNINITIALISED value is 0.

Definition at line 115 of file sim-operations.h.

◆ GSC_NA_IDX

#define GSC_NA_IDX   (GSC_ID_T)-1

When accessing the current array index of a unique session ID, the "ID not found"/failure value is -1 (for signed types) or the maximum value of the type (for unsigned types).

i.e. if GSC_ID_T is an unsigned type, the .id field of a GroupNum, PedigreeID, MapID, etc., could hold this value, but it is the failure/NA value for an index into a list of GroupNums, PedigreeIDs, etc.

Definition at line 123 of file sim-operations.h.

◆ GSC_NA_LOCALX

#define GSC_NA_LOCALX   (GSC_LOCALX_T)-1

For candidate local indexes, the INVALID/UNINITIALISED value is -1 (for signed types) or the maximum value of the type (for unsigned types).

Definition at line 161 of file sim-operations.h.

◆ NAME_LENGTH

#define NAME_LENGTH   45

Definition at line 196 of file sim-operations.h.

Enumeration Type Documentation

◆ GSC_LOGICVAL

genomicSimulation's "logical value" type

A type representing one of three possible states: true, false, or invalid/uninitialised. This type is only used when the invalid/uninitialised value is needed: otherwise, use _Bool

Enumerator
GSC_TRUE 
GSC_FALSE 
GSC_NA 

Definition at line 94 of file sim-operations.h.