This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Tools for searching Pubmed for a list of PMIDs. | |
The goal here is to search for many PMIDs at once, since searching | |
sequentially can take a long time. Using the the BioPython Entrez module | |
is super convenient to this end. | |
The results results are returned in a simple dictionary format. | |
""" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sample PLOS api code for use with python Solr library Sunburnt | |
#( https://github.com/tow/sunburnt ) | |
#!Note! requires sunburnt's external libraries: httplib2,lxml | |
#https://groups.google.com/d/topic/plos-api-developers/zv591sFz6TM/discussion | |
import sunburnt,urllib2 | |
class PlosInterface(sunburnt.SolrInterface): | |
def __init__(self,api_key): | |
plos_url = "http://api.plos.org/search" | |
#either |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | 2.12371 | 0 | |
---|---|---|---|
2 | 1.05275 | 0 | |
3 | 0.865794 | 0 | |
4 | 0.933986 | 0 | |
5 | 1.09092 | 0 | |
6 | 1.22333 | 0 | |
7 | 1.54639 | 0 | |
8 | 1.24223 | 0 | |
9 | 1.10928 | 0 | |
10 | 1.16232 | 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.preprocessing import Imputer | |
#generate some data | |
df1 = np.array(np.random.randn(1000)).reshape(100,10) | |
#make some values 'NaN' | |
df1[(df1>-.05) & (df1<.05)] = np.nan | |
X = df1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def peel(name): | |
return name[1:-1] | |
bag = ['dutch cream','desiree','kifler'] | |
for potato in bag: | |
print peel(potato) |