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_chr*CHROMOSOME*_duplicates_standard_len_triangle HS1328_chr_CHROMOSOME_duplicates_standard_len_triangle HS1329_dpwg_chr_chr*CHROMOSOME*_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