用于打开用户定义的链接并进行用户定义的表单下拉框选择的书签
我编写了一个书签来打开用户定义的网络链接,在本例中是 UCSC 基因组浏览器中的特定基因组位置。
javascript:d=%22%22+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);d=d.replace(/%5Cr%5Cn%7C%5Cr%7C%5Cn/g,%22%20,%22);if(!d)d=prompt(%22Enter%20the%20chromosomal%20location%20(ex.%20chr1:213243007-213243247):%22,%20%22%22);if(d!=null)location=%22http://genome.ucsc.edu/cgi-bin/hgTracks?hgS_doOtherUser=submit&hgS_otherUserName=Denilw&hgS_otherUserSessionName=mrkdOvrExpUniqMonometh&position=%22+escape(d).replace(/%20/g,%22+%22);void%200
人类基因组中有 24 条染色体可以显示,我想执行以下操作:
1)从用户输入的字符串中解析出染色体
在 java 脚本中使用正则表达式从 chr22 中解析 22 :213243007-213243247 或 chrX 中的 X:213243007-213243247
2) 根据用户输入在 UCSC 表单的下拉选项中进行选择
每个轨道或数据集显示 4 个轨道或数据集22条染色体,总共88条。这些可以在 UCSC 基因组浏览器的“自定义轨迹”部分中根据上面选择的链接进行选择,例如
HS0356_chr_CHROMOSOME_duplicates_标准长度三角形 HS0445_dpwg_chr_chr染色体_duplicates_standard_len_triangle HS1328_chr_染色体_duplicates_standard_len_triangle HS1329_dpwg_chr_chrCHROMOSOME_duplicates_standard_len_triangle
然后我希望上面的下拉菜单,其中 CHROMOSOME 在第 1 部分中定义,从 隐藏 更改为 < em>Full,以便仅显示感兴趣染色体的数据。
也许这样的事情会有所帮助: http://www.codeproject.com/KB/scripting/autoselect.aspx
I've written a bookmarlet to open a user defined web link, in this specific case a specific genomic location in the UCSC genome broswer.
javascript:d=%22%22+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);d=d.replace(/%5Cr%5Cn%7C%5Cr%7C%5Cn/g,%22%20,%22);if(!d)d=prompt(%22Enter%20the%20chromosomal%20location%20(ex.%20chr1:213243007-213243247):%22,%20%22%22);if(d!=null)location=%22http://genome.ucsc.edu/cgi-bin/hgTracks?hgS_doOtherUser=submit&hgS_otherUserName=Denilw&hgS_otherUserSessionName=mrkdOvrExpUniqMonometh&position=%22+escape(d).replace(/%20/g,%22+%22);void%200
There are 24 chromosomes in the human genome that can be displayed and I would like to do the following:
1) Parse the chromosome out of the user entered string
Use a regex in java script to parse 22 from chr22:213243007-213243247 or X from chrX:213243007-213243247
2) Make selections in the dropdown options of the form on UCSC based on the user input
There are 4 tracks or data sets to show for each of the 22 chromosomes, 88 in total. These are available for selection in the Custom Tracks section of UCSC genome browser as per the linke chosen above, say
HS0356_chr_CHROMOSOME_duplicates_standard_len_triangle
HS0445_dpwg_chr_chrCHROMOSOME_duplicates_standard_len_triangle
HS1328_chr_CHROMOSOME_duplicates_standard_len_triangle
HS1329_dpwg_chr_chrCHROMOSOME_duplicates_standard_len_triangle
Then I would like the drop down menus for the above, where CHROMOSOME is defined in part 1 to be changed from Hide to Full so that only the data for the chromosome of interest will be displayed.
Perhaps something like this would be helpful:
http://www.codeproject.com/KB/scripting/autoselect.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于第一个问题,
如果您不需要
result[2]
和result[3]
,请忽略它们。我看了你问题的第二部分(希望我理解正确),页面上的大部分下拉列表如下所示:
现在,我们可以使用以下代码来获取上面的
select
元素并将所选选项设置为“完整”:(编辑:添加了一个解决方法,因为无法预测完整元素名称)我不喜欢这个解决方案,因为它涉及循环遍历页面上的所有选择元素,当您只需要一个。如果有人知道更好的解决方案,请告诉我。
希望能回答您的问题!
For your first problem,
If you don't need
result[2]
andresult[3]
, just ignore them.I looked at the second part of your question (hopefully I understood it right), and most of the drop-downs on the page look like this:
Now, we can use the following code to get the above
select
element and set the selected option to 'full': (Edit: added a workaround since full element name can't be predicted)I don't like this solution since it involves looping through all the select elements on the page when you only need one. If someone knows a better solution, please tell me.
Hope that answers your question!