alphagenes / alphapart Goto Github PK
View Code? Open in Web Editor NEWAlphaPart implements a method for partitioning genetic trends to quantify the sources of genetic gain in breeding programmes
Home Page: https://alphagenes.github.io/AlphaPart/
AlphaPart implements a method for partitioning genetic trends to quantify the sources of genetic gain in breeding programmes
Home Page: https://alphagenes.github.io/AlphaPart/
We had previous report that we are not handling genetic groups correctly. @Prof-ThiagoOliveira has supposedly fixed this, but I lost track of that change. What exactly was done and how does it work?
Describe the bug
AlphaPart
stops/aborts when data input belongs to the tbl_df class. Any data manipulated by using tidyverse
collection of packages can't be read by the AlphaPart
.
Screenshots
R Session aborted - R encountered a fatal error and was terminated.
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
A possible improvement to the Rcpp functions.
Describe the solution you'd like
#include "AlphaPartDrop.h"
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List AlphaPartDrop(double c1, double c2, int nI, int nP, int nT, NumericMatrix ped, IntegerVector P, IntegerVector Px) {
// --- Outputs ---
NumericMatrix pa(nI+1, nT); // parent average
NumericMatrix w(nI+1, nT); // Mendelian sampling
NumericMatrix xa(nI+1, nP*nT); // Parts
// --- Compute ---
for(int i = 1; i < nI+1; i++) {
for(int t = 0; t < nT; t++) {
// Parent average (PA)
pa(i, t) = c1 * ped(i-1, 3+t) + c2 * ped(i-1, 3+nT+t);
// Mendelian sampling (MS)
w(i, t) = ped(i-1, 3+t) - pa(i, t);
// Parts
// ... for the MS part
int j = Px[t] + P[i];
xa(i, j) = w(i, t);
// ... for the PA parts
for(int p = 0; p < nP; p++) {
j = Px[t] + p;
xa(i, j) += c1 * xa(ped(i-1, 3), j) + c2 * xa(ped(i-1, 3+nT), j);
}
}
}
// --- Return ---
return List::create(Named("pa") = pa, Named("w") = w, Named("xa") = xa);
}
Changes:
for
loop counters as integers instead of integers for better performance.ped(i, j)
to ped(i-1, j)
because NumericMatrix
indexing in Rcpp starts at 0.List::create
function. (reason on page 6 - https://mran.microsoft.com/snapshot/2016-08-12/web/packages/Rcpp/vignettes/Rcpp-modules.pdf)Same for AlphaPartDropGroup
:
#include "AlphaPartDropGroup.h"
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericMatrix AlphaPartDropGroup(double c1, double c2, int nI, int nP, int nT, int nG,
NumericMatrix ped, IntegerVector P, IntegerVector Px, IntegerVector g) {
// --- Outputs ---
NumericMatrix pa(nI+1, nT); // parent average
NumericMatrix w(nI+1, nT); // Mendelian sampling
NumericMatrix xa(nI+1, nP*nT); // Parts
NumericMatrix xg(nG+1, nP*nT); // Parts for groups
// --- Compute ---
for (int i = 1; i < nI+1; i++) {
for (int t = 0; t < nT; t++) {
// Parent average (PA)
pa(i, t) = c1 * ped(ped(i, 1), 3+t) + c2 * ped(ped(i, 2), 3+t);
// Mendelian sampling (MS)
w(i, t) = ped(i, 3+t) - pa(i, t);
// Parts
int j = Px[t] + P[i];
// ... for the MS part
xa(i, j) = w(i, t);
// ... for the PA parts
for (int p = 0; p < nP; p++) {
j = Px[t] + p;
xa(i, j) += c1 * xa(ped(i, 1), j) + c2 * xa(ped(i, 2), j);
// Accumulate parts by group
xg(g(i), j) += xa(i, j);
}
}
}
// --- Return ---
return xg;
}
@Prof-ThiagoOliveira we seem to have diverged branches - I see this for the AlphaPart_variance
branch versus the main - what do you propose we do to squash this problem?
This branch is 13 commits ahead, 49 commits behind main.
How do we determine in the AlphaPart() function which column contains the year of birth? Should we add this as an argument?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.