Comments (2)
This can already be done: The colorBy
parameter is intended for exactly this purpose.
Example with full siblings:
library(ibdsim2)
#> Loading required package: pedtools
# Simulate sibs
x = nuclearPed(2)
s = ibdsim(x, sims=1, verbose = F)[[1]]
# Summarise IBD segments in a data.frame
a = as.data.frame(alleleSummary(s, 3:4))
# Logical vectors with mat/pat IBD status
pat = a$`3:p` == a$`4:p`
mat = a$`3:m` == a$`4:m`
# Add column with mat/pat IBD status
status = rep("", nrow(a))
status[!mat & !pat] = "No IBD"
status[mat & !pat] = "Maternal"
status[!mat & pat] = "Paternal"
status[mat & pat] = "Mat & pat"
a$status = status
# Convert to factor to enforce level ordering
a$status = factor(a$status, levels = c("No IBD", "Maternal", "Paternal", "Mat & pat"))
# Plot karyogram using "status" to control color
karyo_haploid(a, colorBy = "status", alpha = 0.8,
color = c("No IBD" = "white",
Maternal = "brown1",
Paternal = "cornflowerblue",
"Mat & pat" = "darkolivegreen"))
from ibdsim2.
Great, nice figure, thanks!
from ibdsim2.
Related Issues (13)
- Implement alleleSummary() for X chromosomal simulations HOT 2
- Problems installing ibdsim2 HOT 2
- Error when running `profileSimIBD()` HOT 2
- estimateTwoLocusKappa HOT 1
- haploDraw HOT 1
- karyo_diploid HOT 1
- ibdsim and founder_inbreeding HOT 1
- plot_ibd1
- Export `uniformMap()`
- plot_ibd1 HOT 1
- plot_ibd1 HOT 1
- plot_ibd1() and summary statistics HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ibdsim2.