Mercurial > repos > yating-l > hubarchivecreator
comparison util/index/ExternIndex.py @ 66:4ca7cbf2d9b8 draft
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 159730602ff500b59aefc7080fb49b726c88d655-dirty
author | yating-l |
---|---|
date | Tue, 26 Sep 2017 16:44:58 -0400 |
parents | |
children | 0bc486356e2a |
comparison
equal
deleted
inserted
replaced
65:5a4206366b41 | 66:4ca7cbf2d9b8 |
---|---|
1 #!/usr/bin/python | |
2 import collections | |
3 import abc | |
4 from abc import ABCMeta | |
5 | |
6 class ExternIndex(object): | |
7 __metaclass__ = ABCMeta | |
8 | |
9 @abc.abstractmethod | |
10 def __init__(self): | |
11 """init""" | |
12 | |
13 @abc.abstractmethod | |
14 def setExtLink(self): | |
15 """set external link""" | |
16 | |
17 | |
18 | |
19 | |
20 ''' | |
21 @staticmethod | |
22 def setExtLink(database, inputFile, extra_settings, seqType=None, useIframe=True, iframeHeight=None, iframeWidth=None): | |
23 if "NCBI" in database: | |
24 if not seqType: | |
25 seqType = int(ExternIndex.getSeqType(inputFile)) | |
26 else: | |
27 seqType = seqType | |
28 if seqType < 0: | |
29 print seqType | |
30 raise Exception("Sequence Type is not set for bigPsl. Stopping the application") | |
31 if seqType == 2: | |
32 extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/$$" | |
33 elif seqType == 1: | |
34 extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/$$" | |
35 else: | |
36 raise Exception("Sequence Type {0} is not valid for bigPsl. Stopping the application".format(seqType)) | |
37 elif "UniProt" in database: | |
38 extra_settings["url"] = "http://www.uniprot.org/uniprot/$$" | |
39 elif "FlyBase" in database: | |
40 extra_settings["url"] = "http://flybase.org/reports/$$" | |
41 else: | |
42 extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$" | |
43 extra_settings["urlLabel"] = database + " Details:" | |
44 if useIframe: | |
45 extra_settings["iframeUrl"] = extra_settings["url"] | |
46 if not iframeHeight: | |
47 iframeHeight = "600" | |
48 if not iframeWidth: | |
49 iframeWidth = "800" | |
50 extra_settings["iframeOptions"] = "height= %s width= %s" % (iframeHeight, iframeWidth) | |
51 | |
52 @staticmethod | |
53 def getSeqType(inputFile): | |
54 with open(inputFile, "r") as bigpsl: | |
55 sampleSeq = bigpsl.readline().split() | |
56 if len(sampleSeq) == 25: | |
57 return sampleSeq[-1] | |
58 else: | |
59 return "-1" | |
60 ''' |