1 + 1
2
import os
import sys
sys.path.append('/Users/apratap/dev/appys/lib/')
import synapseutils
import synapseclient
syn = synapseclient.login()
Welcome, Abhishek Pratap!
data = syn.query('select * from entity where study =="EpiMap"')
data = synapseutils.query2df(data)
data.head()
alias | benefactorId | cellType | concreteType | consoritum | consortium | createdByPrincipalId | createdOn | dataAvailability | dataFolder | ... | platform | platformProtocal | projectId | protocolType | study | tissueType | tissueTypeAbrv | versionComment | versionLabel | versionNumber | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | None | 4553399 | NeuN+ | Folder | NaN | PEC | 273995 | 1435608625287 | Yes | TRUE | ... | NaN | NaN | 2787333 | ChIP-seq | EpiMap | NaN | DLPFC | None | 1 | 1 |
1 | None | 4553399 | NeuN+ | FileEntity | PEC | NaN | 3322734 | 1436733567413 | NaN | NaN | ... | HiSeq2500 | paired-end, 100bp | 2787333 | ChIP-seq | EpiMap | Anterior Cingulate Cortex | ACC | None | 1 | 1 |
2 | None | 4553399 | NeuN+ | FileEntity | PEC | NaN | 3322734 | 1436733572282 | NaN | NaN | ... | HiSeq2500 | paired-end, 100bp | 2787333 | ChIP-seq | EpiMap | Anterior Cingulate Cortex | ACC | None | 1 | 1 |
3 | None | 4553399 | NeuN+ | FileEntity | PEC | NaN | 3322734 | 1436733584441 | NaN | NaN | ... | HiSeq2500 | paired-end, 100bp | 2787333 | ChIP-seq | EpiMap | Anterior Cingulate Cortex | ACC | None | 1 | 1 |
4 | None | 4553399 | NeuN- | FileEntity | PEC | NaN | 3322734 | 1436735756692 | NaN | NaN | ... | HiSeq2500 | paired-end, 100bp | 2787333 | ChIP-seq | EpiMap | Anterior Cingulate Cortex | ACC | None | 1 | 1 |
5 rows × 39 columns
data_subset = data.ix[: , [ 'dataType ', 'consoritum', 'cellType', 'dataSubType' , 'tissueType', 'fileType','versionNumber']]
grp = data_subset.groupby(['consoritum', 'cellType', 'dataSubType', 'fileType'])
grp.apply(len)
consoritum cellType dataSubType fileType PEC NeuN+ H3K27ac bam 32 bed 32 bigwig 32 H3K4me3 bam 31 bed 31 bigwig 31 Input bam 1 bed 1 bigwig 1 NeuN- H3K27ac bam 32 bed 32 bigwig 32 H3K4me3 bam 32 bed 32 bigwig 32 Input bam 1 bed 1 bigwig 1 dtype: int64
dl_file = syn.get(data.id[1])
--------------------------------------------------------------------------- SynapseUnmetAccessRestrictions Traceback (most recent call last) <ipython-input-42-1954bf1a3410> in <module>() ----> 1 syn.get(data.id[1]) /Users/apratap/anaconda/lib/python2.7/site-packages/synapseclient/client.pyc in get(self, entity, **kwargs) 644 "download requirement(s).\n" % id_of(entity)) 645 if kwargs.get('downloadFile', True): --> 646 raise SynapseUnmetAccessRestrictions(warning_message) 647 warnings.warn(warning_message) 648 SynapseUnmetAccessRestrictions: WARNING: This entity has access restrictions. Please visit the web page for this entity (syn.onweb("syn4599486")). Click the downward pointing arrow next to the file's name to review and fulfill its download requirement(s).
dl_file = syn.get('syn4617583', downloadLocation = "/tmp/")