Anonymous avatar Anonymous committed ad199f7

Need to process affycrap to genecards only in the myriad html - not the main one

Comments (0)

Files changed (1)

tools/rgenetics/rgGSEA.py

     """
     return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))
 
+
+
 def fix_subdir(adir,destdir):
     """ Galaxy wants everything in the same files_dir
     if os.path.exists(adir):
                 sauce = os.path.join(d,f) 
                 shutil.copy(sauce,destdir)   
     """
+
+    def fixAffycrap(apath=''):
+        """class='richTable'>RUNNING ES</th><th class='richTable'>CORE ENRICHMENT</th><tr><td class='lessen'>1</td>
+        <td><a href='https://www.affymetrix.com/LinkServlet?probeset=LBR'>LBR</a></td><td></td><td></td><td>1113</td>
+        <td>0.194</td><td>-0.1065</td><td>No</td></tr><tr><td class='lessen'>2</td><td>
+        <a href='https://www.affymetrix.com/LinkServlet?probeset=GGPS1'>GGPS1</a></td><td></td><td></td><td>4309</td><td>0.014</td><td>-0.4328</td>
+        <td>No</td></tr>
+        """
+        html = open(apath,'r').readlines()       
+        genecards="<a href='http://www.genecards.org/index.php?path=/Search/keyword/"
+        crapstart = '<a href='https://www.affymetrix.com/LinkServlet?probeset='
+        for i,row in enumerate(html):
+             test = row.split(crapstart)
+             if len(test) > 1:
+                 start = test[0]
+                 symbol = test[1].split("'>")[0]
+                 rest = test[1].split('</td>',1)
+                 rn = '%s%s>%s</a> % (genecards,symbol,symbol)
+                 html[i] = '%s%s%s' % (start,rn,rest)
+        return html
+
+
     if os.path.exists(adir):
         flist = os.listdir(adir) # get all files created
         for f in flist:
            apath = os.path.join(adir,f)
+           dest = os.path.join(destdir,f)
            if not os.path.isdir(apath):
-               dest = os.path.join(destdir,f)
+               if os.path.splitext(f).lower == '.html':
+                   html = fixAffycrap(apath)
+                   fixed = open(apath,'w')
+                   fixed.write('\n'.join(html))
+                   fixed.write('\n')
+                   fixed.close()
                if not os.path.isfile(dest):
                    shutil.move(apath,dest)
            else:
         allids = [x[0] for x in allids] # list of ids
         gmtpath = os.path.split(self.opts.use_gmt)[0] # get path to all chip
 
-    def fixAffycrap(html = []):
-        """class='richTable'>RUNNING ES</th><th class='richTable'>CORE ENRICHMENT</th><tr><td class='lessen'>1</td>
-        <td><a href='https://www.affymetrix.com/LinkServlet?probeset=LBR'>LBR</a></td><td></td><td></td><td>1113</td>
-        <td>0.194</td><td>-0.1065</td><td>No</td></tr><tr><td class='lessen'>2</td><td>
-        <a href='https://www.affymetrix.com/LinkServlet?probeset=GGPS1'>GGPS1</a></td><td></td><td></td><td>4309</td><td>0.014</td><td>-0.4328</td>
-        <td>No</td></tr>
-        """        
-        genecards="<a href='http://www.genecards.org/index.php?path=/Search/keyword/"
-        crapstart = '<a href='https://www.affymetrix.com/LinkServlet?probeset='
-        for i,row in enumerate(html):
-             test = row.split(crapstart)
-             if len(test) > 1:
-                 start = test[0]
-                 symbol = test[1].split("'>")[0]
-                 rest = test[1].split('</td>',1)
-                 rn = '%s%s>%s</a> % (genecards,symbol,symbol)
-                 html[i] = '%s%s%s' % (start,rn,rest)
-        return html
-
     def run(self):
         """
         
         try:
             html = open(htmlfname,'r').readlines()
             html = [x.strip() for x in html]
-            html = self.fixAffycrap(html)
         except:
             html = []
             htmlhead = '<html><head></head><body>'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.