Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write vignette on how to modify runMacs() and how to use other simulators for founders #165

Open
gregorgorjanc opened this issue Nov 6, 2023 · 3 comments

Comments

@gregorgorjanc
Copy link
Contributor

gregorgorjanc commented Nov 6, 2023

Essentially turn this script into

https://github.com/gaynorr/AlphaSimR_Examples/blob/master/misc/ManualMaCS.R

https://github.com/gaynorr/AlphaSimR_Examples/blob/master/misc/msprime.R

and show how to bring in stdpopsim results and SlendR results too

@gaynorr
Copy link
Owner

gaynorr commented Nov 6, 2023

The msprime example predates importHaplo, so it uses newMapPop with its list arguments. The importHaplo functions uses data.frames / matrices for arguments which are probably easier for most to grasp.

Here is an old example using importHaplo to read in down sampled data. Note that it shows the use of the optional raw format for haplotype data.

library(AlphaSimR)

# Create a large population
founderPop = quickHaplo(nInd=100, nChr=10, segSites=1e5)

# Extract the genetic map and select a subset of sites
genMap = getGenMap(founderPop)
take = sample(nrow(genMap), 10000)
take = sort(take) # Not required, but preserves chromosome order later
genMap = genMap[take,]

# Extract selected marker haplotypes
# Use "raw" format to reduce memory usage
haplo = pullMarkerHaplo(founderPop, genMap$id, asRaw=TRUE)

# Create a new founder population with reduced set of markers
newFounderPop = importHaplo(haplo, genMap)

@gaynorr
Copy link
Owner

gaynorr commented Nov 6, 2023

@gregorgorjanc
Copy link
Contributor Author

@hannesbecher can you help with this so we clearly document & demonstrate how to use MaCS (less relevant going forward) and msprime/stdpopsim (more relevant going forward) with AlphaSimR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants