Permalink
Browse files

Modified examples of libcloud, added the Twisted SOAP/REST example

  • Loading branch information...
abhishektiwari committed Oct 30, 2010
1 parent ca5e0e4 commit e6390e4600cda80e85202df5d0cf500e746735f8
View
@@ -11,17 +11,25 @@
|-- Perl
|-- Python
| |-- BioRelated
-| | |-- ebi_ftp.py
-| | |-- kegg_ftp.py
-| | `-- ncbi_ftp.py
+| | |-- eutils
+| | | |-- eutils1.py
+| | | `-- eutils2json.py
+| | `-- ftp
+| | |-- ebi_ftp.py
+| | |-- kegg_ftp.py
+| | `-- ncbi_ftp.py
| |-- Cloud
+| | |-- bootstrapping_puppet.py
| | |-- libcloud1.py
| | |-- libcloud2.py
| | `-- rackspace_deploy_ssh.py
| |-- Plotting
| | `-- csv2plot.py
| |-- PyMongo
| |-- README.rdoc
+| |-- Twisted
+| | |-- search.py
+| | `-- server.py
| `-- Twitter
| |-- twitter_oauth.py
| `-- twitt_from_cmd.py
@@ -30,4 +38,4 @@
|-- README.rdoc
`-- Ruby
-14 directories, 16 files
+17 directories, 21 files
@@ -0,0 +1,42 @@
+>>> from Bio import Entrez
+>>> Entrez.email = "Abhishek abhishek.twr@gmail.com"
+>>> handle = Entrez.egquery(term = "cortisol")
+>>> record = Entrez.read(handle)
+>>> for row in record["eGQueryResult"]: print row["DbName"], row["Count"]
+
+pubmed 74012
+pmc 12689
+journals 0
+mesh 28
+books 510
+omim 79
+omia 0
+ncbisearch 0
+nuccore 188
+nucgss 0
+nucest 2499
+protein 257
+genome 0
+structure 32
+taxonomy 0
+snp 19
+gene 133
+unigene 2
+cdd 3
+domains 13
+unists 3
+popset 0
+geo 12488
+gds 137
+homologene 1
+cancerchromosomes 0
+pccompound 101
+pcsubstance 230
+pcassay 1192
+nlmcatalog 339
+gensat 0
+probe 1
+genomeprj 0
+gap 6
+proteinclusters 0
+>>>
@@ -0,0 +1,9 @@
+>>> from Bio import Entrez
+>>> import json
+>>> Entrez.email = "Abhishek abhishek.twr@gmail.com"
+>>> handle = Entrez.egquery(term = "cortisol")
+>>> record = Entrez.read(handle)
+>>> record
+{u'Term': 'cortisol', u'eGQueryResult': [{u'Count': '74012', u'Status': 'Ok', u'MenuName': 'PubMed', u'DbName': 'pubmed'}, {u'Count': '12693', u'Status': 'Ok', u'MenuName': 'PMC', u'DbName': 'pmc'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'Journals', u'DbName': 'journals'}, {u'Count': '28', u'Status': 'Ok', u'MenuName': 'MeSH', u'DbName': 'mesh'}, {u'Count': '510', u'Status': 'Ok', u'MenuName': 'Books', u'DbName': 'books'}, {u'Count': '79', u'Status': 'Ok', u'MenuName': 'OMIM', u'DbName': 'omim'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'OMIA', u'DbName': 'omia'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'NCBI Web Site', u'DbName': 'ncbisearch'}, {u'Count': '188', u'Status': 'Ok', u'MenuName': 'CoreNucleotide', u'DbName': 'nuccore'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'GSS', u'DbName': 'nucgss'}, {u'Count': '2499', u'Status': 'Ok', u'MenuName': 'EST', u'DbName': 'nucest'}, {u'Count': '257', u'Status': 'Ok', u'MenuName': 'Protein', u'DbName': 'protein'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'Genome', u'DbName': 'genome'}, {u'Count': '32', u'Status': 'Ok', u'MenuName': 'Structure', u'DbName': 'structure'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'Taxonomy', u'DbName': 'taxonomy'}, {u'Count': '19', u'Status': 'Ok', u'MenuName': 'SNP', u'DbName': 'snp'}, {u'Count': '133', u'Status': 'Ok', u'MenuName': 'Gene', u'DbName': 'gene'}, {u'Count': '2', u'Status': 'Ok', u'MenuName': 'UniGene', u'DbName': 'unigene'}, {u'Count': '3', u'Status': 'Ok', u'MenuName': 'Conserved Domains', u'DbName': 'cdd'}, {u'Count': '13', u'Status': 'Ok', u'MenuName': '3D Domains', u'DbName': 'domains'}, {u'Count': '3', u'Status': 'Ok', u'MenuName': 'UniSTS', u'DbName': 'unists'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'PopSet', u'DbName': 'popset'}, {u'Count': '12488', u'Status': 'Ok', u'MenuName': 'GEO Profiles', u'DbName': 'geo'}, {u'Count': '137', u'Status': 'Ok', u'MenuName': 'GEO DataSets', u'DbName': 'gds'}, {u'Count': '1', u'Status': 'Ok', u'MenuName': 'HomoloGene', u'DbName': 'homologene'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'CancerChromosomes', u'DbName': 'cancerchromosomes'}, {u'Count': '101', u'Status': 'Ok', u'MenuName': 'PubChem Compound', u'DbName': 'pccompound'}, {u'Count': '230', u'Status': 'Ok', u'MenuName': 'PubChem Substance', u'DbName': 'pcsubstance'}, {u'Count': '1194', u'Status': 'Ok', u'MenuName': 'PubChem BioAssay', u'DbName': 'pcassay'}, {u'Count': '339', u'Status': 'Ok', u'MenuName': 'NLM Catalog', u'DbName': 'nlmcatalog'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'GENSAT', u'DbName': 'gensat'}, {u'Count': '1', u'Status': 'Ok', u'MenuName': 'Probe', u'DbName': 'probe'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'Genome Project', u'DbName': 'genomeprj'}, {u'Count': '6', u'Status': 'Ok', u'MenuName': 'dbGaP', u'DbName': 'gap'}, {u'Count': '0', u'Status': 'Term or Database is not found', u'MenuName': 'Protein Clusters', u'DbName': 'proteinclusters'}]}
+>>> json.dumps(record)
+'{"Term": "cortisol", "eGQueryResult": [{"Count": "74012", "Status": "Ok", "MenuName": "PubMed", "DbName": "pubmed"}, {"Count": "12693", "Status": "Ok", "MenuName": "PMC", "DbName": "pmc"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "Journals", "DbName": "journals"}, {"Count": "28", "Status": "Ok", "MenuName": "MeSH", "DbName": "mesh"}, {"Count": "510", "Status": "Ok", "MenuName": "Books", "DbName": "books"}, {"Count": "79", "Status": "Ok", "MenuName": "OMIM", "DbName": "omim"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "OMIA", "DbName": "omia"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "NCBI Web Site", "DbName": "ncbisearch"}, {"Count": "188", "Status": "Ok", "MenuName": "CoreNucleotide", "DbName": "nuccore"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "GSS", "DbName": "nucgss"}, {"Count": "2499", "Status": "Ok", "MenuName": "EST", "DbName": "nucest"}, {"Count": "257", "Status": "Ok", "MenuName": "Protein", "DbName": "protein"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "Genome", "DbName": "genome"}, {"Count": "32", "Status": "Ok", "MenuName": "Structure", "DbName": "structure"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "Taxonomy", "DbName": "taxonomy"}, {"Count": "19", "Status": "Ok", "MenuName": "SNP", "DbName": "snp"}, {"Count": "133", "Status": "Ok", "MenuName": "Gene", "DbName": "gene"}, {"Count": "2", "Status": "Ok", "MenuName": "UniGene", "DbName": "unigene"}, {"Count": "3", "Status": "Ok", "MenuName": "Conserved Domains", "DbName": "cdd"}, {"Count": "13", "Status": "Ok", "MenuName": "3D Domains", "DbName": "domains"}, {"Count": "3", "Status": "Ok", "MenuName": "UniSTS", "DbName": "unists"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "PopSet", "DbName": "popset"}, {"Count": "12488", "Status": "Ok", "MenuName": "GEO Profiles", "DbName": "geo"}, {"Count": "137", "Status": "Ok", "MenuName": "GEO DataSets", "DbName": "gds"}, {"Count": "1", "Status": "Ok", "MenuName": "HomoloGene", "DbName": "homologene"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "CancerChromosomes", "DbName": "cancerchromosomes"}, {"Count": "101", "Status": "Ok", "MenuName": "PubChem Compound", "DbName": "pccompound"}, {"Count": "230", "Status": "Ok", "MenuName": "PubChem Substance", "DbName": "pcsubstance"}, {"Count": "1194", "Status": "Ok", "MenuName": "PubChem BioAssay", "DbName": "pcassay"}, {"Count": "339", "Status": "Ok", "MenuName": "NLM Catalog", "DbName": "nlmcatalog"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "GENSAT", "DbName": "gensat"}, {"Count": "1", "Status": "Ok", "MenuName": "Probe", "DbName": "probe"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "Genome Project", "DbName": "genomeprj"}, {"Count": "6", "Status": "Ok", "MenuName": "dbGaP", "DbName": "gap"}, {"Count": "0", "Status": "Term or Database is not found", "MenuName": "Protein Clusters", "DbName": "proteinclusters"}]}'
@@ -0,0 +1,35 @@
+>>> from ftplib import FTP
+>>> ftpebi = FTP('ftp.ebi.ac.uk')
+>>> ftpebi.login()
+'230 Login successful.'
+>>> ftpebi.dir()
+drwxr-xr-x 10 ftp ftp 4096 Aug 27 14:13 pub
+>>> ftpebi.cwd('pub')
+'250 Directory successfully changed.'
+>>> ftpebi.dir()
+lrwxrwxrwx 1 ftp ftp 20 May 13 18:21 blast -> databases/ncbi/blast
+drwxrwxr-x 57 ftp ftp 4096 Oct 08 21:01 contrib
+drwxrwxr-x 152 ftp ftp 8192 Sep 03 16:34 databases
+drwxrwxr-x 2 ftp ftp 4096 Aug 29 2002 embnet.news
+drwxrwxr-x 2 ftp ftp 4096 Mar 25 2008 help
+drwxr-x--- 7 ftp ftp 4096 May 15 2000 mirror-patch-test
+drwxrwxr-x 2 ftp ftp 4096 Aug 15 2001 phd
+drwxrwxr-x 27 ftp ftp 4096 Dec 19 2007 software
+>>> ftpebi.cwd('databases')
+'250 Directory successfully changed.'
+>>> ftpebi.dir()
+drwxrwsr-x 2 ftp ftp 4096 Feb 13 2009 1000genomes
+drwxr-xr-x 6 ftp ftp 4096 Mar 25 1997 16S_RNA
+drwxrwxr-x 2 ftp ftp 4096 Nov 02 2000 3Dee
+drwxrwxr-x 2 ftp ftp 8192 May 18 2000 3d_ali
+drwxrwxr-x 2 ftp ftp 4096 Jun 08 2007 ASD
+
+output truncated
+
+>>> ftpebi.nlst()
+['1000genomes', '16S_RNA', '3Dee', '3d_ali', 'ASD', 'DictyDB', 'EGI', 'FBA2KO', 'Fregene_datasets', 'GO', 'HGNC', 'IPI', 'IntAct', 'MassSpecDB', 'PeptideSearch', 'Pfam', 'RESID', 'RHdb', 'SPproteomes', 'Science', 'SubtiList', 'UTR', 'Unigene', 'ace', 'alu', 'androgenr', 'arrayexpress', 'astd', 'backup.info', 'berlin', 'bii', 'bio_catal', 'biomart', 'blocks', 'blocks.old', 'camoddssp', 'camodhssp', 'camodpdb', 'cd40lbase', 'chebi', 'chembl', 'clustr', 'codonusage', 'cpgisle', 'cutg', 'dali', 'databanks', 'dbEST', 'dbGSS', 'dbSTS', 'dbcat', 'dgva', 'domo', 'dssp', 'ecdc', 'edgp', 'edpcc', 'embl', 'embnet', 'emdb', 'emp', 'emvec', 'ena', 'ensembl', 'enzyme', 'epd', 'fans_ref', 'fastafiles', 'fingerPRINTScan', 'flybase', 'fssp', 'geneticcode', 'genome_reviews', 'genomes', 'gpcrdbsup', 'haema', 'haemb', 'hamsters', 'hla', 'hovergen', 'hssp', 'imgt', 'info', 'intact', 'integr8', 'intenz', 'interpro', 'ipd', 'journals_toc', 'kabat', 'limb', 'lista', 'lrgex', 'mdm2', 'methyl', 'microarray', 'microcosm', 'misfolded', 'models', 'msd', 'mutres', 'ncbi', 'nmrshiftdb', 'nrdb90', 'nrl_3d', 'nrsub', 'nucleosomal_dna', 'ols', 'p53', 'p53APC', 'parasites', 'patentdata', 'pdb_finder', 'pdb_select', 'pdb_seq', 'pir', 'pir2sptr', 'piraln', 'pkcdd', 'plmitrna', 'pmc', 'pride', 'primers', 'prints', 'prodom', 'prof_pat', 'prosite', 'pubchem', 'puu', 'ras', 'rcsb', 'rdp', 'rebase', 'reference_proteomes', 'reflist', 'relibrary', 'repbase', 'rhea', 'rldb', 'rrna', 'sbase', 'seqanalref', 'smallrna', 'srp', 'stackdb', 'stride', 'supplementary', 'swissprot', 'taxonomy', 'testsets', 'tfd', 'tmp', 'transfac', 'transterm', 'trembl', 'trna', 'uniprot', 'variantdbs', 'xray', 'yeast']
+>>> ftpebi.nlst('pubchem')
+['pubchem/Bioassay', 'pubchem/CACTVS', 'pubchem/Compound', 'pubchem/Compound_3D', 'pubchem/README', 'pubchem/Substance', 'pubchem/data_spec', 'pubchem/publications', 'pubchem/specifications']
+>>> ftpebi.nlst('pubchem/Compound')
+['pubchem/Compound/CURRENT-Full', 'pubchem/Compound/Daily', 'pubchem/Compound/Extras', 'pubchem/Compound/Monthly', 'pubchem/Compound/README', 'pubchem/Compound/Weekly']
+
@@ -0,0 +1,31 @@
+>>> ftpkegg = FTP('ftp.genome.jp')
+>>> ftpkegg.login()
+'230 Anonymous access granted, restrictions apply'
+>>> ftpkegg.retrlines('LIST')
+drwxr-xr-x 4 (?) (?) 4096 Nov 5 2007 pub
+'226 Transfer complete'
+>>> ftpkegg.dir()
+drwxr-xr-x 4 (?) (?) 4096 Nov 5 2007 pub
+>>> ftpkegg.cwd('pub')
+'250 CWD command successful'
+>>> ftpkegg.dir()
+drwxr-xr-x 3 (?) (?) 4096 Nov 5 2007 db
+drwxrwxr-x 13 (?) (?) 4096 Oct 4 03:06 kegg
+>>> ftpkegg.cwd('kegg')
+'250 CWD command successful'
+>>> ftpkegg.dir()
+drwxrwxr-x 6 (?) (?) 4096 Oct 16 22:25 brite
+lrwxrwxrwx 1 (?) (?) 26 Jan 30 2009 expression -> ../db/community/expression
+drwxr-xr-x 8 (?) (?) 4096 Oct 16 22:16 genes
+drwxrwxr-x 8 (?) (?) 4096 Oct 17 00:24 ligand
+drwxr-xr-x 3 (?) (?) 4096 Oct 11 2005 linkdb
+drwxr-xr-x 3 (?) (?) 4096 Oct 16 03:11 medicus
+drwxrwxr-x 7 (?) (?) 4096 Oct 16 23:59 pathway
+drwxrwxr-x 9 (?) (?) 4096 Jun 24 2009 pathway_gif
+drwxrwxr-x 4 (?) (?) 4096 Mar 28 2007 release
+drwxr-xr-x 5 (?) (?) 4096 Jan 6 2010 software
+drwxrwxr-x 4 (?) (?) 4096 Apr 30 00:04 xml
+>>> ftpkegg.nlst()
+['expression', 'brite', 'genes', 'ligand', 'linkdb', 'pathway', 'release', 'software', 'xml', 'pathway_gif', 'medicus']
+
+>>>ftp.close
@@ -0,0 +1,48 @@
+>>> from ftplib import FTP
+>>> ftp = FTP('ftp.ncbi.nih.gov')
+>>> ftp.login()
+'230-Anonymous access granted, restrictions apply.\n Please read the file README.ftp\n230 it was last modified on Wed Apr 7 10:18:00 2010 - 193 days ago'
+>>> ftp.retrlines('LIST')
+dr-xr-xr-x 3 ftp anonymous 4096 Sep 7 21:03 1000genomes
+-r--r--r-- 1 ftp anonymous 10737418240 May 17 19:21 10GB
+-r--r--r-- 1 ftp anonymous 1073741824 May 17 19:19 1GB
+-r--r--r-- 1 ftp anonymous 1868 Apr 7 2010 README.ftp
+lr--r--r-- 1 ftp anonymous 29 Apr 7 2010 asn1-converters -> toolbox/ncbi_tools/converters
+dr-xr-xr-x 8 ftp anonymous 4096 Sep 29 2004 blast
+dr-xr-xr-x 3 ftp anonymous 4096 Sep 13 2004 cgap
+dr-xr-xr-x 4 ftp anonymous 4096 Jan 8 2009 cn3d
+dr-xr-xr-x 27 ftp anonymous 4096 Sep 13 20:05 dbgap
+dr-xr-xr-x 3 ftp anonymous 4096 Aug 23 19:52 dra0
+dr-xr-xr-x 11 ftp anonymous 4096 Jun 4 2006 entrez
+dr-xr-xr-x 7 ftp anonymous 4096 Jun 2 15:21 epigenomics
+dr-xr-xr-x 0 ftp anonymous 0 Dec 4 2009 era0
+dr-xr-xr-x 3 ftp anonymous 4096 May 3 19:46 era1
+dr-xr-xr-x 6 ftp anonymous 4096 Aug 4 2006 fa2htgs
+dr-xr-xr-x 10 ftp anonymous 155648 Oct 1 20:20 genbank
+dr-xr-xr-x 6 ftp anonymous 4096 Aug 11 17:09 gene
+dr-xr-xr-x 63 ftp anonymous 8192 Sep 21 14:02 genomes
+dr-xr-xr-x 24 ftp anonymous 4096 Aug 18 03:08 hapmap
+dr-xr-xr-x 12 ftp anonymous 4096 Oct 14 16:39 mmdb
+dr-xr-xr-x 5 ftp anonymous 135168 Aug 19 03:53 ncbi-asn1
+dr-xr-xr-x 147 ftp anonymous 12288 Jul 26 20:07 pub
+dr-xr-xr-x 10 ftp anonymous 4096 Oct 15 18:28 pubchem
+dr-xr-xr-x 2 ftp anonymous 4096 Oct 16 01:15 pubmed
+dr-xr-xr-x 15 ftp anonymous 4096 Mar 24 2010 refseq
+dr-xr-xr-x 57 ftp anonymous 8192 Aug 20 2008 repository
+dr-xr-xr-x 5 ftp anonymous 4096 Oct 8 18:51 sequin
+dr-xr-xr-x 9 ftp anonymous 4096 May 24 20:03 sky-cgh
+dr-xr-xr-x 16 ftp anonymous 12288 May 18 02:50 snp
+dr-xr-xr-x 13 ftp anonymous 4096 Jul 9 16:55 sra
+dr-xr-xr-x 4 ftp anonymous 4096 Apr 13 2010 sra0
+dr-xr-xr-x 5 ftp anonymous 4096 May 5 00:11 sra1
+dr-xr-xr-x 4 ftp anonymous 4096 May 24 21:46 sra2
+dr-xr-xr-x 2 ftp anonymous 4096 Sep 29 2004 tech-reports
+dr-xr-xr-x 13 ftp anonymous 4096 Oct 16 2006 toolbox
+dr-xr-xr-x 5 ftp anonymous 4096 Apr 24 2009 tpa
+dr-xr-xr-x 2 ftp anonymous 4096 Sep 2 16:04 varpipe-intqc
+'226 Transfer complete.'
+
+>>>ftp.close
+
+
+
@@ -0,0 +1,43 @@
+#! /usr/bin/env python
+# -*- coding: utf8 -*-
+
+# Copyright © 2010 Abhishek Tiwari (abhishek@abhishek-tiwari.com)
+#
+# This file is part of ToyProjects.
+#
+# Files included in this package ToyProjects are copyrighted freeware
+# distributed under the terms and conditions as specified in file LICENSE.
+
+from libcloud.types import Provider
+from libcloud.providers import get_driver
+from libcloud.deployment import MultiStepDeployment, ScriptDeployment, SSHKeyDeployment
+import os
+
+RACKSPACE_USER = 'user'
+RACKSPACE_KEY = 'key'
+
+print "Getting connection"
+Driver = get_driver(Provider.RACKSPACE)
+conn = Driver(RACKSPACE_USER, RACKSPACE_KEY)
+print "Now connected"
+# read your public key in
+print "Reading ssh key"
+sd = SSHKeyDeployment(open(os.path.expanduser("~/.ssh/id_rsa.pub")).read())
+print "Public key succesfully loaded"
+# a simple script to install puppet post boot, use - y option
+script = ScriptDeployment("apt-get -y install puppet")
+# a task that first installs the ssh key, and then runs the script Yes to all queries
+print "Preparing multi-step deployment"
+msd = MultiStepDeployment([sd, script])
+
+images = conn.list_images()
+sizes = conn.list_sizes()
+print "Images: ", images
+print "Sizes : ", sizes
+print "Selected size and image", sizes[0], images[1]
+# deploy_node takes the same base keyword arguments as create_node.
+node = conn.deploy_node(name='MyDeploument2', image=images[1], size=sizes[0], deploy=msd)
+# <Node: uuid=..., name=test, state=3, public_ip=['1.1.1.1'], provider=Rackspace ...>
+# the node is now booted, with your ssh key and puppet installed.
+# If you get error like ''connect not implemented for this ssh client'
+# then install Paramiko (apt-get install python-paramiko) which is required in ssh.py
@@ -16,6 +16,8 @@
port = 22
keypath = os.path.expanduser("~/.ssh/id_rsa.pub")
+RACKSPACE_USER = 'user'
+RACKSPACE_KEY = 'key'
def run_on_node(host, user, cmd, password=None):
ssh = paramiko.SSHClient()
@@ -55,22 +57,22 @@ def _is_host_up(host, port):
if __name__ == "__main__":
Driver = get_driver(Provider.RACKSPACE)
print "Connecting to Rackspace..."
- conn = Driver('xxx', 'yyy')
+ conn = Driver(RACKSPACE_USER, RACKSPACE_KEY)
images = conn.list_images()
sizes = conn.list_sizes()
# Some clouds can deploy keys using the following libcloud functionality
- #sd = SSHKeyDeployment(open(os.path.expanduser("~/.ssh/id_rsa.pub")).read())
- #node = conn.deploy_node(name='test', image=images[0], size=sizes[0], deploy=sd)
+ # sd = SSHKeyDeployment(open(os.path.expanduser("~/.ssh/id_rsa.pub")).read())
+ # node = conn.deploy_node(name='test', image=images[0], size=sizes[0], deploy=sd)
## CREATE NODE ##
- nodename = "test2"
+ nodename = "test"
print 'Creating new node "%s"...' % nodename
- node = conn.create_node(name=nodename, image=images[0], size=sizes[0])
- print "Node parameters:"
- d = node.__dict__
- for field in d: print field + ": " + d[field]
- print "Node features dict:"
+ node = conn.create_node(name=nodename, image=images[1], size=sizes[0])
+ # print "Node parameters:"
+ # d = node.__dict__
+ # for field in d: print field + ": " + d[field]
+ # print "Node features dict:"
print conn.features
## Wait until node comes online ##
View
@@ -0,0 +1,22 @@
+#! /usr/bin/env python
+# -*- coding: utf8 -*-
+
+# Copyright © 2010 Abhishek Tiwari (abhishek@abhishek-tiwari.com)
+#
+# This file is part of ToyProjects.
+#
+# Files included in this package ToyProjects are copyrighted freeware
+# distributed under the terms and conditions as specified in file LICENSE.
+
+
+from Bio import Entrez
+import json
+
+def search(keyword):
+ """
+ this function takes the keyword and search in NCBI using eUtils
+ """
+ Entrez.email = "Abhishek abhishek.twr@gmail.com"
+ handle = Entrez.egquery(term = keyword)
+ record = Entrez.read(handle)
+ return json.dumps(record)
Oops, something went wrong.

0 comments on commit e6390e4

Please sign in to comment.