Created
November 10, 2016 21:54
-
-
Save larssono/308c8e8399cd9060b76f11881b4f2536 to your computer and use it in GitHub Desktop.
This file contains 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 synapseclient | |
syn=synapseclient.Synapse() | |
syn.login() | |
def determineNewSampleCount(): | |
""" | |
""" | |
table = syn.tableQuery('SELECT * FROM syn3281840') | |
df = table.asDataFrame() | |
#Create a summary of the number of samples for each platform and disease | |
return df.pivot_table('patient_barcode', columns=['acronym'], index=['platform'], aggfunc=lambda x:len(set(x))) | |
wiki = syn.getWiki('syn2485697', '409059') | |
table = determineNewSampleCount() | |
tablestr = table.to_csv(sep='|') | |
startIndex = wiki.markdown.index('1|2|3') | |
endIndex = wiki.markdown.index('Table x') | |
wiki.markdown = '%s\n%s\n%s' %(wiki.markdown[:startIndex], tablestr, wiki.markdown[endIndex:]) | |
syn.store(wiki) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment