File: tdiary.rb

package info (click to toggle)
ruby-bio 2.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,108 kB
  • sloc: ruby: 68,331; perl: 13; makefile: 11; sh: 1
file content (158 lines) | stat: -rw-r--r-- 4,743 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#
# tDiary : plugin/bio.rb
#
#   Copyright (C) 2003 KATAYAMA Toshiaki <k@bioruby.org>
#                      Mitsuteru C. Nakao <n@bioruby.org>
#                      Itoshi NIKAIDO  <itoshi@gsc.riken.go.jp>
#                      Takeya KASUKAWA <kasukawa@gsc.riken.go.jp>
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
#
#  $Id: tdiary.rb,v 1.3 2003/03/17 04:24:47 k Exp $
#

=begin

== What's this?

This is a plugin for the ((<tDiary|URL:http://www.tdiary.org/>)) to create
various links for biological resources from your diary.

tDiary is an extensible web diary application written in Ruby.

== How to install

Just copy this file under the tDiary's plugin directory as bio.rb.

== Usage

--- pubmed(pmid, comment = nil)

Create a link to NCBI Entrez reference database by using PubMed ID.
See ((<URL:http://www.ncbi.nlm.nih.gov/entrez/query.fcgi>)) for more
information.

  * tDiary style
     * <%= pubmed 12345 %>
     * <%= pubmed 12345, 'hogehoge' %>
  * RD style
     * ((% pubmed 12345 %))
     * ((% pubmed 12345, 'hogehoge' %))

--- biofetch(db, entry_id)

Create a link to the BioFetch detabase entry retrieval system.
See ((<URL:http://biofetch.bioruby.org/>)) for more information.

  * tDiary style
    * <%= biofetch 'genbank', 'AA2CG' %>
  * RD style
    * ((% biofetch 'genbank', 'AA2CG' %))

--- amigo(go_id, comment = nil)

Create a link to the AmiGO GO term browser by using GO ID.
See ((<URL:http://www.godatabase.org/cgi-bin/go.cgi>)) for more 
information.

  * tDiary style
    * <%= amigo '0003673' %>
    * <%= amigo '0003673', 'The root of GO' %>
  * RD style
    * ((% amigo 0003673 %))
    * ((% amigo 0003673, 'The root of GO' %))

--- fantom(id, comment = nil)

Create a link to FANTOM database by using Clone ID.
You can use RIKEN clone ID, Rearray ID, Seq ID and Accession Number.
See ((<URL:http://fantom2.gsc.riken.go.jp/db/>)) for more information.

  * tDiary style
     * <%= fantom 12345 %>
     * <%= fantom 12345, 'hogehoge' %>
  * RD style
    * ((% fantom 12345 %))
    * ((% fantom 12345, 'hogehoge' %))

--- rtps(id, comment = nil)

Create a link to FANTOM RTPS database by using Clone ID. 
You can use only RTPS ID.
See ((<URL:http://fantom2.gsc.riken.go.jp/RTPS/>)) for more information.

  * tDiary style
     * <%= rtps 12345 %>
     * <%= rtps 12345, 'hogehoge' %>
  * RD style
    * ((% rtps 12345 %))
    * ((% rtps 12345, 'hogehoge' %))

== References

* Analysis of the mouse transcriptome based on functional annotation of
  60,770 full-length cDNAs, The FANTOM Consortium and the RIKEN Genome
  Exploration Research Group Phase I & II Team, Nature 420:563-573, 2002

* Functional annotation of a full-length mouse cDNA collection,
  The RIKEN Genome Exploration Research Group Phase II Team and 
  the FANTOM Consortium, Nature 409:685-690, 2001

=end

def pubmed(pmid, comment = nil)
  pmid = pmid.to_s.strip
  url = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi"
  url << "?cmd=Retrieve&db=PubMed&dopt=Abstract&list_uids=#{pmid}"
  if comment
    %Q[<a href="#{url}">#{comment.to_s.strip}</a>]
  else
    %Q[<a href="#{url}">PMID:#{pmid}</a>]
  end
end

def biofetch(db, entry_id) 
  url = "http://biofetch.bioruby.org/"
  %Q[<a href="#{url}?db=#{db};id=#{entry_id};style=raw">#{db}:#{entry_id}</a>] 
end

def amigo(go_id = '0003673', comment = nil)
  go_id = go_id.to_s.strip
  url = "http://www.godatabase.org/cgi-bin/go.cgi?query=#{go_id};view=query;action=query;search_constraint=terms"
  comment = "AmiGO:#{go_id}" unless comment
  %Q[<a href="#{url}">#{comment}</a>]
end

def fantom(id, comment = nil)
  id = id.to_s.strip
  url = "http://fantom2.gsc.riken.go.jp/db/link/id.cgi"
  url << "?id=#{id}"
  if comment
    %Q[<a href="#{url}">#{comment.to_s.strip}</a>]
  else
    %Q[<a href="#{url}">FANTOM DB:#{id}</a>]
  end
end

def rtps(id, comment = nil)
  id = id.to_s.strip
  url = "http://fantom2.gsc.riken.go.jp/RTPS/link/id.cgi"
  url << "?id=#{id}"
  if comment
    %Q[<a href="#{url}">#{comment.to_s.strip}</a>]
  else
    %Q[<a href="#{url}">FANTOM RTPS DB:#{id}</a>]
  end
end