Mercurial > repos > rmarenco > hubarchivecreator
comparison util/index/DatabaseIndex.py @ 29:7e8a8b732db3 draft
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
author | yating-l |
---|---|
date | Wed, 16 May 2018 18:04:20 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
28:6aa28a85cc38 | 29:7e8a8b732db3 |
---|---|
1 #!/usr/bin/python | |
2 | |
3 import collections | |
4 from ExternIndex import ExternIndex | |
5 | |
6 class DatabaseIndex(ExternIndex): | |
7 def __init__(self, database, **args): | |
8 self.database = database | |
9 self.seqType=args.get("seqType") | |
10 self.useIframe=args.get("useIframe") | |
11 self.iframeHeight=args.get("iframeHeight") | |
12 self.iframeWidth=args.get("iframeWidth") | |
13 | |
14 def setExtLink(self): | |
15 return self.setDatabaseLink(self.database, self.seqType, self.useIframe, self.iframeHeight, self.iframeWidth) | |
16 | |
17 | |
18 def setDatabaseLink(self, database, seqType=None, useIframe=None, iframeHeight=None, iframeWidth=None): | |
19 database_settings = collections.OrderedDict() | |
20 if "NCBI" in database: | |
21 if not seqType: | |
22 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$" | |
23 elif seqType == 2: | |
24 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/$$" | |
25 elif seqType == 1: | |
26 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/$$" | |
27 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)) | |
29 elif "UniProt" in database: | |
30 database_settings["url"] = "http://www.uniprot.org/uniprot/$$" | |
31 elif "FlyBase" in database: | |
32 database_settings["url"] = "http://flybase.org/reports/$$" | |
33 else: | |
34 database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$" | |
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 | |
44 |