-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvar_extra.R
More file actions
31 lines (22 loc) · 741 Bytes
/
var_extra.R
File metadata and controls
31 lines (22 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#library(parallel)
library(VariantAnnotation)
#path='.'
path='/home/shared_data/gnomad/gnomAD/vcf/genomes'
files=dir(path,pattern='\\.vcf.gz$',full.names=TRUE)
extra<- function(file){
cat('Reading...',file,'\n')
vcf<- readVcf(file,'hg19');
rgs=as.data.frame(ranges(vcf));
chr=as.data.frame(seqnames(vcf));
content=data.frame(chr,rgs$start,rgs$end);
cat('uniquing...\n')
unq_itv=unique(content);
cat('writing...\n')
write.table(unq_itv,file=gsub('vcf.gz','csv',file),quote=F,sep=',',row.names=F,col.names=F);
cat('File',file,'done.\n');
}
fs=files[!file.exists(gsub('vcf.gz','csv',files))];
#cl <- makeCluster(9,outfile='debug.txt');
#parLapply(cl,fs,extra);
lapply(fs,extra);
#stopCluster(cl)