Simple Python to Batch search CAZy Database



This code may be old. please follow here to the most up-to-date version: https://github.com/ericoporto/CazyBatchSearch

Yes, a way to use a table to search the Carbohydrate-Active enZYmes Database. Below the Python 2.7.3 script.


'''
Copyright 2014 Érico Porto

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
from __future__ import print_function  
 import httplib  
 def findEnzymeInCazy(enzyname):  
   conn = httplib.HTTPConnection("www.cazy.org", 80)  
   conn.connect()  
   conn.request('GET', "/search?tag=4&recherche=" + enzyname)  
   lines = conn.getresponse().read().split('\n')  
   for i,line in enumerate(lines):  
     if ( '<tr><td><a href="http://www.cazy.org/' in line ):  
       linkLine = lines[i]  
       j = linkLine.find( '"http://www.cazy.org/' ) + 21  
       k = linkLine.find( '.html"', j )  
       return linkLine[j:k] # beteween first and second double quotes  
   return None  
 f = open('saida.csv','w')  
 print("enzima     ; rankdomal", file=f)  
 print("enzima     ; rankdomal")   
 for line in open("enzylist.csv","r"):  
   pieces = line.split(";")  
   enzyname = pieces[0].strip()  
   enzyInCazy = findEnzymeInCazy(enzyname)  
   if ( enzyInCazy != None ):  
     print(enzyname.ljust(15) + '; ' + enzyInCazy.ljust(20), file=f)  
     print(enzyname.ljust(15) + '; ' + enzyInCazy.ljust(20))  
   else:  
     print(enzyname.ljust(15) + '; ' + "not found!", file=f)  
     print(enzyname.ljust(15) + '; ' + "not found!")  

So, you will need a file named enzylist.csv for this to work. Here take this:

 BAI68730
 BAH05588
 ACV62532
 EAL90874
 ABG47447
 ACT04224

So if you run it, you should get something like:

 python .\enzymtable_simple.py  
 enzima     ; rankdomal  
 BAI68730    ; GH57  
 BAH05588    ; GH94  
 ACV62532    ; GH94  
 EAL90874    ; GH13  
 ABG47447    ; GH18  
 ACT04224    ; GH51  

So all should be good. Yes I run Python on Windows 8 using PowerShell. Just add the Python folder to the PATH variable, and all should run well - and also, PowerShell is much faster and easy to use than CMD.

Google Treasure Hunt


Throw the numbers on the browser for going to the gps location. Start researching on the wikipedia about Willian Kid or other pirate.

Example:
Meat | -21.53,46.05
Squid |  34.61,137.7
Boat | -28.30,-57.30
Aligator with letter C | -37.85,-25.83

Right now I could find C R and V if I remember correctly.

Small tip on faster learning when audio is required

Use 1.5x speed. Thanks LifeHacker

Farewell Google Reader

So that all got me thinking... Could I do something? So I started messing around with Python... Turns out yes, but will take a little while...

 from __future__ import print_function  
 import urllib2  
 from bs4 import BeautifulSoup  
 f = open('teste.txt','w')  
 page = urllib2.urlopen("http://kotaku.com/5991061/the-best+looking-isometric-games")  
 s = page.read()  
 page.close()  
 soup = BeautifulSoup(s)  
 txt = soup.find("div", "post-body").getText()  
 print(txt.encode('utf-8'), file=f)  
 f.close()   

So what's my idea? I need some good method to filter and get content from a webpage (usually a blog). Right now I think I will need different codes for different webpages and some way to keep these codes organized. I also need some way to know when any of these pages is updated, which I will use RSS. At the end I want to grab all this and send to my Kindle.

There are paid services right now that do just that. But I know I can probably do something similar from my computer for free.

Oh... And Google search pointed me this using Calibre: http://www.youtube.com/watch?v=aw3jCBQkfWQ

Best Translation and Other



If anyone ever need this, I got this from a friend. The best translation for Affordability in portuguese is "Viabilidade Econômica".

Meetings

I stumbled on this post today:
Every meeting has to have a leader, a stated purpose, a start and end time, and a valid reason for each and every person to be there. The leader documents conclusions, plans, action items, whatever, then follows up.

from http://www.inc.com/steve-tobak/6-ideas-for-awesome-meetings.html via lifehacker
Powered by Blogger.