예제 #1
0
def storeFile(fileName, stagingID, used, center, annotations, meta=False):
	print("STORING FILES")
	fileEnt = File(fileName, parent = stagingID)
	fileEnt.center = center
	fileEnt.dataSubType = annotations.get("dataSubType",'')
	fileEnt.dataType = annotations.get("dataType",'')
	fileEnt.disease = 'cancer'
	fileEnt.fileType = annotations.get("fileType",'')
	fileEnt.organism = 'H**o Sapiens'
	fileEnt.platform = annotations.get("platform",'')
	fileEnt.tissueSource = annotations.get("tissueSource",'')
	fileEnt.consortium = 'GENIE'
	if meta:
		fileEnt.fileType = "txt"
		fileEnt.dataType = "meta"
	fileEnt.fileStage = "staging"
	ent = syn.store(fileEnt,annotations = used)
	return(ent)
        'tissueType':
        ['Frontal Pole', 'Superior Temporal Gyrus', 'Parahippocampal Gyrus'],
        'tissueTypeAbrv': ['FP', 'STG', 'PHG'],
        'name':
        'AMP-AD_MSBB_MSSM_IlluminaHiSeq2500_mRNA_normalized-sex-race-age-RIN-PMI-batch-site.corrected.csv'
    },
}

for id, v in toMove.items():
    ent = syn.get(id)
    print v['name']
    os.rename(ent.path, v['name'])

    f = File(v['name'], parentId=v['parentId'], name=v['name'][7:-4])
    print f.name
    f.consortium, f.study, f.center, f.disease = consortium, study, center, disease
    f.dataType = v['dataType']
    f.platfrom = v['platform']
    if 'tissueTypeAbrv' in v:
        f.tissueTypeAbrv = v['tissueTypeAbrv']
        f.tissueType = v['tissueType']
    f.fileType = fileType
    f.organism = organism
    f = syn.store(
        f,
        used=[id],
        executed=[
            'https://github.com/Sage-Bionetworks/ampAdScripts/blob/e71bbde262625e6999ea9defd98e10fce8f3c542/Mount-Sinai/migrateMSBBMetaAndRNASeq.py'
        ],
        activityName='Data migration')
예제 #3
0
PLATFORM_MAP = {'133AB': 'AffymetrixU133AB', 
                'Plus2': 'AffymetrixU133Plus2'}
	
query = 'select id, name from entity where parentId=="%s"' %OLDPARENTID
df = synapseHelpers.query2df(syn.chunkedQuery(query))
for i in range(1,df.shape[0]):
    row =  df.ix[i, :]
    ent = syn.get(row.id)
    fStudy, fTissue, fPlatform, fDatatype,  fRest = ent.name.split('_')
    name = 'AMP-AD_MSBB_MSSM_%s_%s_%s' % (PLATFORM_MAP[fPlatform],   
                                          TISSUEABRMAP[fTissue][0], fRest)
    print name
    os.rename(ent.path, name)

    f = File(name, parentId=NEWPARENTID, name=name[7:])
    f.consortium = 'AMP-AD'
    f.study = 'MSBB'
    f.center = 'MSSM'
    f.dataType =  'mRNA'
    f.disease = 'Alzheimers Disease'
    f.platfrom = PLATFORM_MAP[fPlatform]
    f.tissueTypeAbrv = TISSUEABRMAP[fTissue][1]
    f.tissueType = TISSUEABRMAP[fTissue][0]
    f.dataSubType = 'geneExp'
    f.fileType =  'genomicMatrix'
    f.organism =  'human'
    f = syn.store(f, used = [ent], executed=['https://github.com/Sage-Bionetworks/ampAdScripts/blob/4d7d6b78b1e73058483354a1a18bff7422966a4b/Mount-Sinai/migrateMSBBExpression.py'], activityName='Data migration')
    

                  'tissueTypeAbrv': ['FP', 'STG', 'PHG'],
                  'name' :'AMP-AD_MSBB_MSSM_IlluminaHiSeq2500_mRNA_rawCounts.tsv'},
    'syn2920161':{'parentId' :'syn3157743',  #'normalized.sex_race_age_RIN_PMI_batch_site.corrected.csv'
                  'dataType': 'mRNA',                  
                  'platform': 'IlluminaHiSeq2500',
                  'tissueType':['Frontal Pole', 'Superior Temporal Gyrus','Parahippocampal Gyrus'],
                  'tissueTypeAbrv': ['FP', 'STG', 'PHG'],
                  'name' :'AMP-AD_MSBB_MSSM_IlluminaHiSeq2500_mRNA_normalized-sex-race-age-RIN-PMI-batch-site.corrected.csv'},
    }


for id, v in toMove.items():
    ent = syn.get(id)
    print v['name']
    os.rename(ent.path, v['name'])

    f = File(v['name'], parentId=v['parentId'], name=v['name'][7:-4])
    print f.name
    f.consortium, f.study, f.center, f.disease = consortium, study, center, disease
    f.dataType =  v['dataType']
    f.platfrom = v['platform']
    if 'tissueTypeAbrv' in v:
        f.tissueTypeAbrv = v['tissueTypeAbrv']
        f.tissueType = v['tissueType']
    f.fileType =  fileType
    f.organism =  organism
    f = syn.store(f, used = [id], executed=['https://github.com/Sage-Bionetworks/ampAdScripts/blob/e71bbde262625e6999ea9defd98e10fce8f3c542/Mount-Sinai/migrateMSBBMetaAndRNASeq.py'], 
                  activityName='Data migration')