def getAttrTestFile(key): if(key == "ribosome"): riboDataset = DataSet.getDataSet('riboMovies') riboFiles = riboDataset.getFile("allMovies") attr = {#"filesPath" : "/services/scipion/data/scipionweb/movies_testdata/80S_ribosome/", "path": riboDataset.getPath(), "filesPath" : riboFiles, "voltage" : 300.0, "sphericalAberration" : 2.7, "amplitudeContrast" : 0.1, "magnification" : 59000, "samplingRate": 1.77} if(key == "falcon"): jmbFalconDataset = DataSet.getDataSet('jmbFalconMovies') jmbFalconFiles = jmbFalconDataset.getFile("allMovies") attr = {#"path" : "/services/scipion/data/scipionweb/movies_testdata/JMB_2015/", "path": jmbFalconDataset.getPath(), "filesPath" : jmbFalconFiles, "voltage" : 300.0, "sphericalAberration" : 2.7, "amplitudeContrast" : 0.1, "magnification" : 59000, "samplingRate": 1.34} return attr
def getAttrTestFile(key): if (key == "ribosome"): riboDataset = DataSet.getDataSet('riboMovies') riboFiles = riboDataset.getFile("allMovies") attr = { #"filesPath" : "/services/scipion/data/scipionweb/movies_testdata/80S_ribosome/", "path": riboDataset.getPath(), "filesPath": riboFiles, "voltage": 300.0, "sphericalAberration": 2.7, "amplitudeContrast": 0.1, "magnification": 59000, "samplingRate": 1.77 } if (key == "falcon"): jmbFalconDataset = DataSet.getDataSet('jmbFalconMovies') jmbFalconFiles = jmbFalconDataset.getFile("allMovies") attr = { #"path" : "/services/scipion/data/scipionweb/movies_testdata/JMB_2015/", "path": jmbFalconDataset.getPath(), "filesPath": jmbFalconFiles, "voltage": 300.0, "sphericalAberration": 2.7, "amplitudeContrast": 0.1, "magnification": 59000, "samplingRate": 1.34 } return attr
def getAttrTestFile(key): if key == "ribosome": riboDataset = DataSet.getDataSet('riboMovies') riboFiles = riboDataset.getFile("allMovies") attr = { "path": riboDataset.getPath(), "filesPath": riboFiles, "voltage": 300.0, "sphericalAberration": 2.7, "amplitudeContrast": 0.1, "magnification": 59000, "samplingRate": 1.77 } if key == "falcon": jmbFalconDataset = DataSet.getDataSet('jmbFalconMovies') jmbFalconFiles = jmbFalconDataset.getFile("allMovies") attr = { "path": jmbFalconDataset.getPath(), "filesPath": jmbFalconFiles, "voltage": 300.0, "sphericalAberration": 2.7, "amplitudeContrast": 0.1, "magnification": 59000, "samplingRate": 1.34 } return attr
def getAttrTestFile(key): resmap = DataSet.getDataSet('resmap') if key == "fcv": attr = { "file": resmap.getFile("fcv"), "samplingRate": 2.33, } if key == "mito_ribosome": attr = { "file": resmap.getFile("mito_ribo"), "samplingRate": 1.34, } if key == "t20s_proteasome": attr = { "file": resmap.getFile("t20s"), "samplingRate": 0.98, } return attr
def getAttrTestFile(key, projectPath): pval = DataSet.getDataSet('particle_validation') attr = None if key == "betagal": attr = { "path": pval.getPath(), "volume": pval.getFile("betagal_volume"), "samplingRate": 3.98, "particles": pval.getFile("betagal_particles"), "metaFile": pval.getFile("betagal_meta"), "microscopeVoltage": 300, "sphericalAberration": 2, "amplitudeContrast": 0.1, "magnificationRate": 50000, "particlesSamplingRate": 3.98, "symmetry": 'd2', "numberOfParticles": '10 20 50 100 200 500 1000 2000', "importFrom": ProtImportParticles.IMPORT_FROM_RELION } linkTestData(pval.getFile('betagal_optimizer'), projectPath) linkTestData(pval.getFile('betagal_half1'), projectPath) linkTestData(pval.getFile('betagal_half2'), projectPath) linkTestData(pval.getFile('betagal_sampling'), projectPath) elif key == "10004": attr = { "path": pval.getPath(), "volume": pval.getFile("10004_volume"), "samplingRate": 4.32, "particles": pval.getFile("10004_particles"), "metaFile": pval.getFile("10004_meta"), "microscopeVoltage": 80, "sphericalAberration": 2, "amplitudeContrast": 0.1, "magnificationRate": 75000, "particlesSamplingRate": 4.32, "symmetry": 'c3', "numberOfParticles": '10 20 50 100 200 500 1000 2000', "importFrom": ProtImportParticles.IMPORT_FROM_RELION } linkTestData(pval.getFile('10004_optimizer'), projectPath) linkTestData(pval.getFile('10004_half1'), projectPath) linkTestData(pval.getFile('10004_half2'), projectPath) linkTestData(pval.getFile('10004_sampling'), projectPath) elif key == "10008": attr = { "path": pval.getPath(), "volume": pval.getFile("10008_volume"), "samplingRate": 3.00, "particles": pval.getFile("10008_particles"), "metaFile": pval.getFile("10008_meta"), "microscopeVoltage": 200, "sphericalAberration": 2, "amplitudeContrast": 0.1, "magnificationRate": 50000, "particlesSamplingRate": 3.00, "symmetry": 'c3', "numberOfParticles": '10 20 50 100 200 500 1000 2000', "importFrom": ProtImportParticles.IMPORT_FROM_SCIPION } return attr
def create_service_project(request): if request.is_ajax(): import os from pyworkflow.object import Pointer from pyworkflow.em.protocol import ProtUnionSet, ProtImportAverages from pyworkflow.em.packages.xmipp3 import XmippProtRansac, XmippProtReconstructSignificant, XmippProtAlignVolumeForWeb from pyworkflow.em.packages.eman2 import EmanProtInitModel from pyworkflow.em.packages.simple import ProtPrime # Create a new project projectName = request.GET.get('projectName') # Filename to use as test data testDataKey = request.GET.get('testData') #customMenu = os.path.join(os.path.dirname(os.environ['SCIPION_PROTOCOLS']), 'menu_initvolume.conf') manager = getServiceManager('myfirstmap') writeCustomMenu(manager.protocols) project = manager.createProject(projectName, runsView=1, hostsConf=manager.hosts, protocolsConf=manager.protocols ) project.getSettings().setLifeTime(14) project.saveSettings() #copyFile(customMenu, project.getPath('.config', 'protocols.conf')) # 1. Import averages # If using test data execute the import averages run # options are set in 'project_utils.js' dsMDA = DataSet.getDataSet('initial_volume') if testDataKey : fn = dsMDA.getFile(testDataKey) newFn = join(project.uploadPath, basename(fn)) copyFile(fn, newFn) label_import = 'import averages ('+ testDataKey +')' protImport = project.newProtocol(ProtImportAverages, objLabel=label_import) protImport.filesPath.set(newFn) protImport.samplingRate.set(1.) project.launchProtocol(protImport, wait=True) else: protImport = project.newProtocol(ProtImportAverages, objLabel='import averages') project.saveProtocol(protImport) # 2a. Ransac protRansac = project.newProtocol(XmippProtRansac) protRansac.setObjLabel('xmipp - ransac') protRansac.inputSet.set(protImport) protRansac.inputSet.setExtended('outputAverages') if testDataKey : setProtocolParams(protRansac, testDataKey) project.saveProtocol(protRansac) # 2b. Eman protEmanInitVol = project.newProtocol(EmanProtInitModel) protEmanInitVol.setObjLabel('eman - initial vol') protEmanInitVol.inputSet.set(protImport) protEmanInitVol.inputSet.setExtended('outputAverages') if testDataKey : setProtocolParams(protEmanInitVol, testDataKey) project.saveProtocol(protEmanInitVol) # 2c. Significant protSignificant = project.newProtocol(XmippProtReconstructSignificant) protSignificant.setObjLabel('xmipp - significant') protSignificant.inputSet.set(protImport) protSignificant.inputSet.setExtended('outputAverages') if testDataKey : setProtocolParams(protSignificant, testDataKey) project.saveProtocol(protSignificant) # 3. Join result volumes p1 = Pointer() p1.set(protRansac) p1.setExtended('outputVolumes') p2 = Pointer() p2.set(protEmanInitVol) p2.setExtended('outputVolumes') p3 = Pointer() p3.set(protSignificant) p3.setExtended('outputVolume') protJoin = project.newProtocol(XmippProtAlignVolumeForWeb) protJoin.setObjLabel('align volumes') protJoin.inputVolumes.append(p1) protJoin.inputVolumes.append(p2) protJoin.inputVolumes.append(p3) # protJoin.inputVolumes.append(p4) project.saveProtocol(protJoin) protValidate = project.newProtocol(XmippProtValidateNonTilt) protValidate.setObjLabel('validate nontilt') protValidate.inputVolumes.set(protJoin) protValidate.inputVolumes.setExtended('outputVolumes') protValidate.inputParticles.set(protImport) protValidate.inputParticles.setExtended('outputAverages') protValidate.numberOfThreads.set(8) if testDataKey : setProtocolParams(protValidate, testDataKey) # protJoin.inputVolumes.append(p4) project.saveProtocol(protValidate) return HttpResponse(mimetype='application/javascript')
def get_testdata(request): # Filename to use as test data testDataKey = request.GET.get('testData') dsMDA = DataSet.getDataSet('initial_volume') fn = dsMDA.getFile(testDataKey) return HttpResponse(fn, mimetype='application/javascript')
def create_service_project(request): if request.is_ajax(): import os from pyworkflow.object import Pointer from pyworkflow.em.protocol import ProtUnionSet, ProtImportAverages from pyworkflow.em.packages.xmipp3 import XmippProtRansac, XmippProtReconstructSignificant, XmippProtAlignVolumeForWeb from pyworkflow.em.packages.eman2 import EmanProtInitModel from pyworkflow.em.packages.simple import ProtPrime # Create a new project projectName = request.GET.get('projectName') # Filename to use as test data testDataKey = request.GET.get('testData') #customMenu = os.path.join(os.path.dirname(os.environ['SCIPION_PROTOCOLS']), 'menu_initvolume.conf') manager = getServiceManager('myfirstmap') writeCustomMenu(manager.protocols) project = manager.createProject(projectName, runsView=1, hostsConf=manager.hosts, protocolsConf=manager.protocols) project.getSettings().setLifeTime(336) # 14 days * 24 hours project.saveSettings() #copyFile(customMenu, project.getPath('.config', 'protocols.conf')) # 1. Import averages # If using test data execute the import averages run # options are set in 'project_utils.js' dsMDA = DataSet.getDataSet('initial_volume') if testDataKey: fn = dsMDA.getFile(testDataKey) newFn = join(project.uploadPath, basename(fn)) copyFile(fn, newFn) label_import = 'import averages (' + testDataKey + ')' protImport = project.newProtocol(ProtImportAverages, objLabel=label_import) protImport.filesPath.set(newFn) protImport.samplingRate.set(1.) project.launchProtocol(protImport, wait=True) else: protImport = project.newProtocol(ProtImportAverages, objLabel='import averages') project.saveProtocol(protImport) # 2a. Ransac protRansac = project.newProtocol(XmippProtRansac) protRansac.setObjLabel('xmipp - ransac') protRansac.inputSet.set(protImport) protRansac.inputSet.setExtended('outputAverages') if testDataKey: setProtocolParams(protRansac, testDataKey) project.saveProtocol(protRansac) # 2b. Eman protEmanInitVol = project.newProtocol(EmanProtInitModel) protEmanInitVol.setObjLabel('eman - initial vol') protEmanInitVol.inputSet.set(protImport) protEmanInitVol.inputSet.setExtended('outputAverages') if testDataKey: setProtocolParams(protEmanInitVol, testDataKey) project.saveProtocol(protEmanInitVol) # 2c. Significant protSignificant = project.newProtocol(XmippProtReconstructSignificant) protSignificant.setObjLabel('xmipp - significant') protSignificant.inputSet.set(protImport) protSignificant.inputSet.setExtended('outputAverages') if testDataKey: setProtocolParams(protSignificant, testDataKey) project.saveProtocol(protSignificant) # 3. Join result volumes p1 = Pointer() p1.set(protRansac) p1.setExtended('outputVolumes') p2 = Pointer() p2.set(protEmanInitVol) p2.setExtended('outputVolumes') p3 = Pointer() p3.set(protSignificant) p3.setExtended('outputVolume') protJoin = project.newProtocol(XmippProtAlignVolumeForWeb) protJoin.setObjLabel('align volumes') protJoin.inputVolumes.append(p1) protJoin.inputVolumes.append(p2) protJoin.inputVolumes.append(p3) # protJoin.inputVolumes.append(p4) project.saveProtocol(protJoin) # protValidate = project.newProtocol(XmippProtValidateNonTilt) # protValidate.setObjLabel('validate nontilt') # protValidate.inputVolumes.set(protJoin) # protValidate.inputVolumes.setExtended('outputVolumes') # protValidate.inputParticles.set(protImport) # protValidate.inputParticles.setExtended('outputAverages') # protValidate.numberOfThreads.set(8) # if testDataKey : # setProtocolParams(protValidate, testDataKey) # # protJoin.inputVolumes.append(p4) # project.saveProtocol(protValidate) return HttpResponse(mimetype='application/javascript')
def create_service_project(request): if request.is_ajax(): # Create a new project projectName = getVarFromRequest(request, PROJECT_NAME) # Filename to use as test data testDataKey = request.GET.get('testData') manager = getServiceManager(MYFIRSTMAP_SERVICE) writeCustomMenu(manager.protocols) project = manager.createProject(projectName, runsView=1, hostsConf=manager.hosts, protocolsConf=manager.protocols, chdir=False) project.getSettings().setLifeTime(336) # 14 days * 24 hours project.saveSettings() #copyFile(customMenu, project.getPath('.config', 'protocols.conf')) # 1. Import averages # If using test data execute the import averages run # options are set in 'project_utils.js' dsMDA = DataSet.getDataSet('initial_volume') if testDataKey : fn = dsMDA.getFile(testDataKey) newFn = getImageFullPath(project.path, join(project.uploadPath, basename(fn))) copyFile(fn, newFn) label_import = 'import averages ('+ testDataKey +')' protImport = project.newProtocol(ProtImportAverages, objLabel=label_import) protImport.filesPath.set(newFn) protImport.samplingRate.set(1.) project.launchProtocol(protImport, wait=True, chdir=False) else: protImport = project.newProtocol(ProtImportAverages, objLabel='import averages') project.saveProtocol(protImport) # 2a. Ransac protRansac = project.newProtocol(XmippProtRansac) protRansac.setObjLabel('xmipp - ransac') protRansac.inputSet.set(protImport) protRansac.inputSet.setExtended('outputAverages') setProtocolParams(protRansac, testDataKey) project.saveProtocol(protRansac) # 2b. Eman protEmanInitVol = project.newProtocol(EmanProtInitModel) protEmanInitVol.setObjLabel('eman - initial vol') protEmanInitVol.inputSet.set(protImport) protEmanInitVol.inputSet.setExtended('outputAverages') setProtocolParams(protEmanInitVol, testDataKey) project.saveProtocol(protEmanInitVol) # 2c. Significant protSignificant = project.newProtocol(XmippProtReconstructSignificant) protSignificant.setObjLabel('xmipp - significant') protSignificant.inputSet.set(protImport) protSignificant.inputSet.setExtended('outputAverages') setProtocolParams(protSignificant, testDataKey) project.saveProtocol(protSignificant) # 3. Join result volumes p1 = Pointer() p1.set(protRansac) p1.setExtended('outputVolumes') p2 = Pointer() p2.set(protEmanInitVol) p2.setExtended('outputVolumes') p3 = Pointer() p3.set(protSignificant) p3.setExtended('outputVolume') protJoin = project.newProtocol(XmippProtAlignVolumeForWeb) protJoin.setObjLabel('align volumes') protJoin.inputVolumes.append(p1) protJoin.inputVolumes.append(p2) protJoin.inputVolumes.append(p3) project.saveProtocol(protJoin) # protValidate = project.newProtocol(XmippProtValidateNonTilt) # protValidate.setObjLabel('validate nontilt') # protValidate.inputVolumes.set(protJoin) # protValidate.inputVolumes.setExtended('outputVolumes') # protValidate.inputParticles.set(protImport) # protValidate.inputParticles.setExtended('outputAverages') # protValidate.numberOfThreads.set(8) # if testDataKey : # setProtocolParams(protValidate, testDataKey) # # protJoin.inputVolumes.append(p4) # project.saveProtocol(protValidate) return HttpResponse(content_type='application/javascript')