I have this small piece of code in my script which is calculating several annotation for peak regions. The code below is bottleneck for speed and takes several hours as I have around 100,000 regions for which I need to run this to calculate CpG count. Is there a way to speed it up? 

```
for (i in 1:nrow(dataMtx)){
peakCord<-gsub("chr", "", peakCord)
peakSeq<-system(sprintf("samtools faidx genome.fa %s", peakCord[i]), intern=T)
peakSeq<-gsub(">.*$", "", peakSeq)
peakSeq<-paste(peakSeq, collapse='')
dataMtx$CpGCount[i] <-  sum(str_count(peakSeq, "CG"))
print(i)
}

```