Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- head (sap_ids)
- snp_id chr pos
- Chr01__15043 1 15043
- Chr01__15079 1 15079
- Chr01__15139 1 15139
- Chr01__15165 1 15165
- ...
- ...
- ...
- Chr17__214708424 17 214708424 14314
- Chr17__214708451 17 214708451 14314
- Chr17__214708484 17 214708484 14314
- Chr17__214708508 17 214708508 14314
- Chr17__214708574 17 214708574 14314
- win_size<-c(15000,30000,50000,100000)
- res<- cbind(snp_ids,
- data.frame(lapply(setNames(win_size, paste("window",win_size, sep = "_")),
- function(x)as.numeric(ceiling(snp_ids$pos/x)))))
- for instance, as I you see in the example below in window 4 I get SNPs from chromosomes 1,3 and 5
- snp_id chrom poistion window
- Chr01__58332 1 58332 4
- Chr01__58335 1 58335 4
- Chr01__58341 1 58341 4
- Chr01__58450 1 58450 4
- Chr01__58471 1 58471 4
- Chr01__58530 1 58530 4
- Chr01__58542 1 58542 4
- Chr01__58641 1 58641 4
- Chr03__45457 3 45457 4
- Chr03__45604 3 45604 4
- Chr04__56873 4 56873 4
- Chr04__57387 4 57387 4
- Chr04__57399 4 57399 4
- Chr04__57528 4 57528 4
- Chr04__58419 4 58419 4
- Chr04__59670 4 59670 4
- Chr04__59704 4 59704 4
Add Comment
Please, Sign In to add comment