r脚本计算rg4的起始位点

r脚本计算rg4的起始位点
比如:根据Sequence计算start和end

V2.1	V2.1	V1.1	V1.1	Sequence	G4Hscore	Type1	Type2	length	start	end
TraesCS1A03G0141400.1	TraesCS1A03G0141400	TraesCS1A02G058400.1	TraesCS1A02G058400	GGGACTGAGGCGGCGGCGG	1.16	G2	G2L6G2L4G2L1G2	355	246	264
library(stringr)
library(tidyverse)
a<-read.csv("liji1016output1.txt",header = T,sep="\t")
strings<-a$sequence
pattern<-a$pattern

# 2.定位
# str_locate,从strings中检测能否和pattern匹配,返回匹配的起止位置
str_locate(strings, pattern)

你可能感兴趣的:(R)