I am trying to find strings which are at most two mistakes 'away' from the original pattern string (i.e. they differ by at most two letters).
However, the following code isn't working as I would expect, at least not from my understanding of fuzzy regex:
import regex
res = regex.findall("(ATAGGAGAAGATGATGTATA){e<=2}", "ATAGAGCAAGATGATGTATA", overlapped=True)
print res
>> ['ATAGAGCAAGATGATGTATA'] # the second string
Run Code Online (Sandbox Code Playgroud)
As you can see, the two strings differ on three letters rather than at most two:
the first has: ATAG …
尝试使用其中一个javascript插件进行传单 - 特别是热图功能 - https://github.com/Leaflet/Leaflet.heat 事情是 - 我想把它融入Shiny,但R的传单似乎没有这个插件默认包含在内,所以我不得不以某种方式手动包含这个JS.最接近我弄清楚如何做到这一点是通过rCharts上的帖子显示:
server.R.
HeatMap$addAssets(jshead = c("http://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"))
HeatMap$setTemplate(afterScript = sprintf("<script>
var addressPoints = %s
var heat = L.heatLayer(addressPoints).addTo(map)
</script>",
rjson::toJSON(dt)))
Run Code Online (Sandbox Code Playgroud)
(摘自:https://github.com/ramnathv/rCharts/issues/498)
但是对于JS不太熟悉,以及传单的新功能仍然不太清楚它是如何从头到尾合并的 - 即从github获取这个JS并最终使用在数据集'quakes'上使用传单创建的热图.
我的服务器端代码如下所示:
library(leaflet)
output$mymap <- renderLeaflet({
leaflet() %>%
addProviderTiles("OpenMapSurfer.Roads",
options = providerTileOptions(noWrap = TRUE))
%>% addMarkers(clusterOptions = markerClusterOptions(), data = quakes))
Run Code Online (Sandbox Code Playgroud)
而不是clusterOptions我想添加一个地震震级的热图(数据集'quakes'包含在R中,所以你可以自己看到它).
任何有关解决这个问题的帮助将非常感谢!:)