Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
CMChecker
https://github.com/whpress/cmchecker
Admin
The project description could not be extracted as the provided content is empty.
Tokens:
2,194
Snippets:
8
Trust Score:
4.4
Update:
11 months ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Build Genealogy Tree in C++ Source: https://context7.com/whpress/cmchecker/llms.txt This snippet demonstrates how to initialize a genealogy object, create individuals, define parent-child relationships to construct family trees, and set genome resolution for analysis. ```cpp #include "cMchecker_body.h" // Initialize genealogy with default 3000 genome bins Genealogy gg; // Create founding individuals (no parents specified) gg.newPerson("John"); gg.newPerson("Mary"); gg.newPerson("Robert"); gg.newPerson("Susan"); // Create children with both parents gg.newChild("Alice", "John", "Mary"); gg.newChild("Bob", "Robert", "Susan"); // Create child with one known parent (other parent anonymous) gg.newChild("Charlie", "Alice"); // Create descendant N generations removed gg.newChild("David", "John", 3); // great-grandchild of John // Change genome resolution (bins per genome) setresolution(5000); // higher resolution for more accuracy ``` -------------------------------- ### Process Genealogy Data from Input Files (C++) Source: https://context7.com/whpress/cmchecker/llms.txt This snippet demonstrates how to process genealogy and data from input files for batch analysis using the cMchecker command-line interface. It covers file handling, parsing commands, and executing operations on a Genealogy and DataSet object. Compilation instructions are provided. ```cpp // Input file format (example.txt): // # Comments start with hash // newPerson John // newPerson Mary // newChild Alice John Mary // personOfInterest Alice Bob Charlie // runTrials 10000 // newData Alice Bob 850.5 // showModel // showModelOmitting Bob // showModelMoving Alice Bob // permanentlyRemove Charlie // setError 0.05 // makeGED output.ged // done // Main program execution int main(int argc, char **argv) { Genealogy gg; DataSet dd(gg); FILE *INP = fopen(argv[1], "rb"); if (!INP) { printf("Cannot open file: %s\n", argv[1]); return 1; } // Parse and execute commands from file for (;;) { int result = parse(gg, dd, INP); if (result != 1) break; } fclose(INP); return 0; } // Compile and run // g++ cMchecker.cpp -o cMchecker // ./cMchecker input.txt ``` -------------------------------- ### Run Monte Carlo Simulations in C++ Source: https://context7.com/whpress/cmchecker/llms.txt This snippet shows how to execute Monte Carlo simulation trials to generate theoretical DNA sharing distributions. It covers specifying persons of interest, running trials with different parameter sets, and accessing the simulation results. ```cpp // Specify persons of interest for analysis char* persons[] = {"Alice", "Bob", "Charlie", "David", NULL}; // Run 10000 simulation trials TrialsOutput trials = gg.runtrials(10000, persons); // Alternative: run with separate candidate and match lists char* candidates[] = {"Alice", "Bob", NULL}; char* matches[] = {"Charlie", "David", NULL}; TrialsOutput trials2 = gg.runtrials(5000, candidates, matches); // Access simulation results int ntrials = trials[0].ncols(); int npeople = trials.size(); double simulated_cm = trials[0][1][500]; // person 0 vs 1, trial 500 // Display simulation summary printf("Ran %d trials for %d persons\n", ntrials, npeople); ``` -------------------------------- ### Statistical Model Evaluation in C++ Source: https://context7.com/whpress/cmchecker/llms.txt This code illustrates how to compare simulated DNA sharing distributions with measured data using a multivariate statistical model. It involves setting measurement error, creating a baseline model, displaying results, testing alternative hypotheses by omitting data, and comparing models via likelihood ratios and chi-square probabilities. ```cpp // Set measurement error (default 0.03, range ~0.01-0.10) Doub measerr = 0.03; // Create baseline statistical model MultivariateModel baseline(gg, trials, dd, measerr); // Display model results with chi-square and likelihood baseline.showmodel(); /* Example output: 0: (Alice Bob ) model=0.515+-0.045 (2200-2900 cM) data=0.512 (2250 cM) pct=0.480 tval=-0.7 1: (Alice Charlie ) model=0.708+-0.003 (6800-7200 cM) data=0.707 (6800 cM) pct=0.505 tval=-0.3 ... model ChiSquare = 8.52 (8.90) with DoF=12 ChiSquareProbability = 0.7435 */ // Test alternative hypothesis by omitting problematic person DataSet dd_test(dd); dd_test.omit("Bob"); MultivariateModel alt_model(gg, trials, dd_test, measerr); alt_model.showmodel(); // Compare models via likelihood ratios double likelihood_ratio = pow(10.0, alt_model.logprob - baseline.logprob); double chisq_ratio = alt_model.chisqprob / baseline.chisqprob; printf("Likelihood ratio: %.4g\n", likelihood_ratio); printf("Chi-square probability ratio: %.4g\n", chisq_ratio); ``` -------------------------------- ### Advanced Genome Analysis with Low-Level Structures (C++) Source: https://context7.com/whpress/cmchecker/llms.txt This snippet showcases advanced genome analysis capabilities in cMchecker, allowing access to low-level chromosome and haplotype structures. It covers initializing genomes, simulating mating, calculating DNA sharing, manipulating haploid structures, performing recombination, accessing run statistics, displaying genome representations, and exporting trees to GEDCOM format. ```cpp // Initialize with specific resolution setresolution(3000); // Create and manipulate genomes Genome person1, person2; person1.initgenome(0); // Initialize as founder person2.initgenome(1); // Simulate mating Genome child = person1.mate(person2); // Calculate shared DNA between genomes double shared_cm = person1.match(person2); printf("Shared DNA: %.1f cM\n", shared_cm); // Access haploid structures Haploid maternal = child.mo; Haploid paternal = child.fa; // Perform recombination Haploid recombined = maternal.recombine(paternal); // Get run statistics for ancestor tracking VecInt runs = child.fa.stats(2); // Track ancestor ID 2 int total_segments = child.fa.stats3(2); // Count segments // Display genome representation child.showgenome(); /* Output shows chromosome segments: (0+1) 0000000000|111111100000|... (father's chromosomes) 1111111111|000000011111|... (mother's chromosomes) */ // Export tree to GEDCOM format gg.makeGED("family_tree.ged"); ``` -------------------------------- ### Add Genetic Match Data in C++ Source: https://context7.com/whpress/cmchecker/llms.txt This code demonstrates adding measured DNA sharing values (in centiMorgans) between individuals to a dataset linked to a genealogy. It includes adding new pairs, updating existing data, marking zero matches, removing individuals, and moving data between names. ```cpp // Create dataset linked to genealogy DataSet dd(gg); // Add pairwise DNA sharing data (values in centiMorgans) dd.addpair("Alice", "Bob", 850.0); // Full siblings ~850 cM dd.addpair("Alice", "Charlie", 1700.0); // Parent-child ~1700 cM dd.addpair("Bob", "Charlie", 425.0); // Aunt-nephew ~425 cM dd.addpair("David", "Alice", 212.0); // Great-aunt ~212 cM // Mark person as zero-match with all others dd.addpair("Unknown", "Alice", 0.0); dd.addpair("Unknown", "Bob", 0.0); // Update existing data value dd.addpair("Alice", "Bob", 875.0); // Overwrites previous 850.0 // Remove person from dataset dd.omit("Unknown"); // Move one person's data to another dd.moveto("OldName", "NewName"); ```