-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSNPer.R
More file actions
23 lines (13 loc) · 777 Bytes
/
SNPer.R
File metadata and controls
23 lines (13 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
setwd("D:/Phil/SNPs/data/")
annotation <- read.csv("GenomeWideSNP_6.na32.annot.csv",header=T,skip=21)
gene.info <- read.csv("SNP_regions.csv", header=TRUE)
colnames(annotation)
N <- nrow(gene.info)
for (i in 1:N){
annotation2 <- subset(annotation, subset = (Chromosome == gene.info$chromosome[i]))
SNP.data <- subset(annotation2, subset = (as.numeric(as.character(Physical.Position)) >= gene.info$left.coord.minus.100k[i] &
as.numeric(as.character(Physical.Position)) <= gene.info$right.coord.plus.100k[i]) )
gene <- as.character(gene.info$genes[i])
filename <- paste("D:/Phil/SNPs/output/SNP_Info/", gene, "_SNP_Info.csv", sep = "")
write.csv(SNP.data, filename, row.names=FALSE)
}