def getAllSOPs(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): sops = artefactDAO.getAllArtefacts(projectId) return jsonify(sops), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getProjectById(): id = request.args.get('id') project = projectDAO.getProjectById(id) if project: return jsonify(project), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getSOPsByType(): projectId = request.args.get('projectId') artefactClass = request.args.get('sopType') if (projectDAO.getProjectById(projectId)): sops = artefactDAO.getArtefactsByType(projectId, artefactClass) return jsonify(sops), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getAllClinicalSamples(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): samples = clinicalSampleDAO.getClinicalSamplesByProject(projectId) return jsonify(samples), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getMaxCounter(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): maxCounter = clinicalSampleDAO.getMaxCounter(projectId) return jsonify({"maxCounter": maxCounter}), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getAllSpectralLibraries(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): spec_libs = spectralLibraryDAO.getAllLibrariesForProject(projectId) for s in spec_libs: augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames( s['clinicalSamples']) augmentedMSRuns = MSRunDAO.augmentMSRunNames(s['msRunIds']) s['clinicalSamples'] = augmentedClinicalSamples s['msRunIds'] = augmentedMSRuns return jsonify(spec_libs), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getMSRunsByProjectId(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): msruns = MSRunDAO.getAllMSRunsByProjectId(projectId) for msrun in msruns: augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames( msrun['clinicalSamples']) msReadySampleName = msReadySamplesDAO.getMSReadySampleName( msrun['msReadySampleId']) msrun['clinicalSamples'] = augmentedClinicalSamples msrun['msReadySampleName'] = msReadySampleName return jsonify(msruns), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getAllSwathAnalysis(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): swath_analysis = swathAnalysisDAO.getSWATHByProject(projectId) for s in swath_analysis: augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames( s['clinicalSamples']) augmentedMSRuns = MSRunDAO.augmentMSRunNames( s['msRunIds']) s['clinicalSamples'] = augmentedClinicalSamples s['msRunIds'] = augmentedMSRuns return jsonify(swath_analysis), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getMsReadySamplesByProject(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): samples = msReadySamplesDAO.getMsReadySamplesByProject(projectId) for s in samples: augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames( s['clinicalSamples']) intermediateSampleName = intermediateSampleDAO.getIntermediateSampleName( s['intermediateSampleId']) s['clinicalSamples'] = augmentedClinicalSamples s['intermediateSampleName'] = intermediateSampleName return jsonify(samples), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND
def getIntermediateSamplesByProject(): projectId = request.args.get('projectId') if (projectDAO.getProjectById(projectId)): samples = intermediateSampleDAO.getIntermediateSamplesByProject( projectId) for s in samples: augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames( s['clinicalSamples']) # if('parentSamples' in s): # augmentedIntermediateSamples = intermediateSampleDAO.augmentIntermediateSampleNames( # s['parentSamples']) # s['parentSamples'] = augmentedIntermediateSamples s['clinicalSamples'] = augmentedClinicalSamples return jsonify(samples), status.HTTP_200_OK else: return 'Project with id does not exist.', status.HTTP_404_NOT_FOUND