Mercurial > repos > yating-l > jbrowsearchivecreator
comparison util/index/DatabaseIndex.py @ 6:237707a6b74d draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
| author | yating-l |
|---|---|
| date | Thu, 15 Feb 2018 17:05:05 -0500 |
| parents | |
| children | 3f9971a91096 |
comparison
equal
deleted
inserted
replaced
| 5:e762f4b9e4bd | 6:237707a6b74d |
|---|---|
| 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 |
