R Doplot() 坐标定位器() [英] R Doplot() coordinates locator()

查看:51
本文介绍了R Doplot() 坐标定位器()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绘制了 2 个 fasta 序列的点图(使用 seqinr 包中的 dotPlot()),我需要从图中提取一些值 (x,y).Dotplot() 输出是一个图像一个通用的点图可能就是这个

I drew a dotplot (using dotPlot() from seqinr package) of 2 fasta sequences and I need to extract some values (x,y) from the plot. The Dotplot() output is an image A generic dotplot maybe be this one

例如,我需要 start & 的值.紫色线表示的局部对齐结束所以这里有一个例子

l=30
seq1 <- paste(sample(c("A","G","T","C"), l, repl=TRUE)) 
seq2 <- paste(sample(c("A","G","T","C"), l, repl=TRUE)) 

dotPlot(seq1,seq2, wsize = 2, wstep = 1, nmatch = 2, col = c("white", "green"), xlab = deparse(substitute(seq1)), ylab = deparse(substitute(seq2)))

  locator(n=2, type="p")
$x
[1] 27.18720 31.23263

$y
[1] 20.45222 24.65726

所以我想要两个圆圈点的位置,正如你所看到的 locator() 给出十进制值.我可能会使用 ceiling()round() 但我可能会得到一个近似错误

So I want exactly the position of the 2 circled points,and as you can see the locator() gives decimal value . I may use ceiling() or round() but i maybe get back an approximation error

我需要我点击的点的整数值,基本上是离该地点最近的点

I need the integer value of the point I clicked on, basically the nearest point to the place

使用 identify() 会很完美,它适用于正常"绘图并返回一个与点击"最接近的绘制值的向量,但是它不适用于 dotPlot() 输出(问题似乎是它不适用于作为 locator() 的图像输出)

Would be perfect to use identify(), which works with "normal" plots and gives back a vector with the closest plotted value to your "click", but it doesn't work on the dotPlot() output (the problem seems to be that it doesn't work on image output as locator() )

欢迎任何可能的解决方案,包括在 shell 或 python 中使用 dotter.谢谢

Any possible solution would be welcome, including using dotter in shell or python. Thanks

推荐答案

在 github 上查看 evolvedmicrobe/dotplot

Have a look at evolvedmicrobe/dotplot on github

https://github.com/evolvedmicrobe/dotplot/blob/master/R/plotters.R

它提供mkDotPlotDataFrame.有了这个,你可以更好地获得匹配之间的坐标,就像 identify 一样.

It provides mkDotPlotDataFrame. With this you can better get coordinates between matches, like with identify.

这篇关于R Doplot() 坐标定位器()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆