comparison util/index/DatabaseIndex.py @ 14:3f9971a91096 draft

planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit e526b4e8bef4677b832e940bacb8969a18efc3e3
author yating-l
date Wed, 20 Jun 2018 17:24:45 -0400
parents 237707a6b74d
children
comparison
equal deleted inserted replaced
13:43a700afd457 14:3f9971a91096
5 5
6 class DatabaseIndex(ExternIndex): 6 class DatabaseIndex(ExternIndex):
7 def __init__(self, database, **args): 7 def __init__(self, database, **args):
8 self.database = database 8 self.database = database
9 self.seqType=args.get("seqType") 9 self.seqType=args.get("seqType")
10 self.useIframe=args.get("useIframe") 10
11 self.iframeHeight=args.get("iframeHeight")
12 self.iframeWidth=args.get("iframeWidth")
13 11
14 def setExtLink(self): 12 def setExtLink(self):
15 return self.setDatabaseLink(self.database, self.seqType, self.useIframe, self.iframeHeight, self.iframeWidth) 13 return self.setDatabaseLink(self.database, self.seqType)
16 14
17 15
18 def setDatabaseLink(self, database, seqType=None, useIframe=None, iframeHeight=None, iframeWidth=None): 16 def setDatabaseLink(self, database, seqType=None):
19 database_settings = collections.OrderedDict() 17 database_settings = collections.OrderedDict()
18 database_settings.update({"label": "View feature details in the database",
19 "action": "iframeDialog",
20 "iconClass": "dijitIconDatabase",
21 "title": "feature {name}"})
22
20 if "NCBI" in database: 23 if "NCBI" in database:
21 if not seqType: 24 if not seqType:
22 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$" 25 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term={name}"
23 elif seqType == 2: 26 elif seqType == 2:
24 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/$$" 27 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/{name}"
25 elif seqType == 1: 28 elif seqType == 1:
26 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/$$" 29 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/{name}"
27 else: 30 else:
28 raise Exception("Sequence Type {0} is not valid, should be either protein (seqType==2) or nucleotide (seqType==1). Stopping the application".format(seqType)) 31 raise Exception("Sequence Type {0} is not valid, should be either protein (seqType==2) or nucleotide (seqType==1). Stopping the application".format(seqType))
29 elif "UniProt" in database: 32 elif "UniProt" in database:
30 database_settings["url"] = "http://www.uniprot.org/uniprot/$$" 33 database_settings["url"] = "http://www.uniprot.org/uniprot/{name}"
31 elif "FlyBase" in database: 34 elif "FlyBase" in database:
32 database_settings["url"] = "http://flybase.org/reports/$$" 35 database_settings["url"] = "http://flybase.org/reports/{name}"
33 else: 36 else:
34 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$" 37 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term={name}"
35 database_settings["urlLabel"] = database + " Details:"
36 if useIframe or useIframe is None:
37 database_settings["iframeUrl"] = database_settings["url"]
38 if not iframeHeight:
39 iframeHeight = "600"
40 if not iframeWidth:
41 iframeWidth = "800"
42 database_settings["iframeOptions"] = "height= %s width= %s" % (iframeHeight, iframeWidth)
43 return database_settings 38 return database_settings
44 39