Skip to content

Instantly share code, notes, and snippets.

@kbroman
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save kbroman/8d5cc0d44ae62a855592 to your computer and use it in GitHub Desktop.

Select an option

Save kbroman/8d5cc0d44ae62a855592 to your computer and use it in GitHub Desktop.
Read genetic map from file and convert to map object to use with sim.cross
## simulate a cross, using genetic map from a CSV file
# read map.csv
maptab <- read.csv("map.csv")
# convert to map object
pos <- maptab[,3]
names(pos) <- maptab[,1]
chr <- maptab[,2]
map <- split(pos, chr)
# load R/qtl
library(qtl)
# simulate cross with that as the genetic map
x <- sim.cross(map, n.ind=100, type="bc")
marker chr pos
D1Mit296 1 3.3
D1Mit123 1 19.7000000001
D1Mit156 1 32.8000000002
D1Mit178 1 35.0000000003
D1Mit19 1 37.2000000004
D1Mit7 1 41.5000000005
D1Mit46 1 43.7000000006
D1Mit132 1 43.7000000007
D1Mit334 1 49.2000000008
D1Mit305 1 54.6000000009
D1Mit26 1 64.500000001
D1Mit94 1 67.8000000011
D1Mit218 1 69.9000000012
D1Mit100 1 74.3000000013
D1Mit102 1 75.4000000014
D1Mit14 1 82.0000000015
D1Mit105 1 82.0000000016
D1Mit159 1 82.0000000017
D1Mit267 1 82.0000000018
D1Mit15 1 86.3000000019
D1Mit456 1 94.000000002
D1Mit155 1 115.8000000021
D4Mit149 4 0
D4Mit41 4 14.2000000001
D4Mit108 4 16.4000000002
D4Mit237 4 17.5000000003
D4Mit286 4 18.6000000004
D4Mit214 4 21.9000000005
D4Mit53 4 23.0000000006
D4Mit89 4 23.0000000007
D4Mit111 4 25.1000000008
D4Mit288 4 28.4000000009
D4Mit164 4 29.500000001
D4Mit178 4 30.6000000011
D4Mit80 4 31.7000000012
D4Mit81 4 31.7000000013
D4Mit276 4 32.8000000014
D4Mit152 4 33.9000000015
D4Mit302 4 35.0000000016
D4Mit175 4 47.0000000017
D4Mit16 4 56.8000000018
D4Mit14 4 74.3000000019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment