diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/index/ExternIndex.py	Tue Sep 26 16:44:58 2017 -0400
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+import collections
+import abc
+from abc import ABCMeta
+
+class ExternIndex(object):
+    __metaclass__ = ABCMeta
+
+    @abc.abstractmethod
+    def __init__(self):
+        """init"""
+    
+    @abc.abstractmethod
+    def setExtLink(self):
+        """set external link"""
+        
+    
+    
+
+    '''
+    @staticmethod 
+    def setExtLink(database, inputFile, extra_settings, seqType=None, useIframe=True, iframeHeight=None, iframeWidth=None):
+        if "NCBI" in database:
+            if not seqType:
+                seqType = int(ExternIndex.getSeqType(inputFile))
+            else:
+                seqType = seqType
+            if seqType < 0:
+                print seqType
+                raise Exception("Sequence Type is not set for bigPsl. Stopping the application")
+            if seqType == 2:
+                extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/$$"
+            elif seqType == 1:
+                extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/$$"
+            else:
+                raise Exception("Sequence Type {0} is not valid for bigPsl. Stopping the application".format(seqType))
+        elif "UniProt" in database:
+            extra_settings["url"] = "http://www.uniprot.org/uniprot/$$"
+        elif "FlyBase" in database:
+            extra_settings["url"] = "http://flybase.org/reports/$$"
+        else:
+            extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$"
+        extra_settings["urlLabel"] = database + " Details:"
+        if useIframe:
+            extra_settings["iframeUrl"] = extra_settings["url"]
+            if not iframeHeight:
+                iframeHeight = "600"
+            if not iframeWidth:
+                iframeWidth = "800"
+            extra_settings["iframeOptions"] = "height= %s width= %s" % (iframeHeight, iframeWidth)
+
+    @staticmethod
+    def getSeqType(inputFile):
+        with open(inputFile, "r") as bigpsl:
+            sampleSeq = bigpsl.readline().split()
+        if len(sampleSeq) == 25:
+            return sampleSeq[-1]
+        else:
+            return "-1"        
+    '''
\ No newline at end of file