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
Ejemplo n.º 2
0
def getMSRunById():
    id = ObjectId(request.args.get('id'))
    msrun = MSRunDAO.getMsRun(id)
    if(msrun):
        msrun = msrun.dump()
        augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames(
            msrun['clinicalSamples'])
        msReadySampleName = msReadySamplesDAO.getMSReadySampleName(
            msrun['msReadySampleId'])
        msrun['clinicalSamples'] = augmentedClinicalSamples
        msrun['msReadySampleName'] = msReadySampleName
        return jsonify(msrun), status.HTTP_200_OK
    else:
        return 'MS Run with id does not exist.', status.HTTP_404_NOT_FOUND
Ejemplo n.º 3
0
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
Ejemplo n.º 5
0
def getMsReadySamplesByClinicalSampleId():
    clinicalSampleId = ObjectId(request.args.get('id'))
    if clinicalSampleDAO.getClinicalSampleById(clinicalSampleId):
        samples = msReadySamplesDAO.getMSReadySamplesByClinicalSampleId(
            clinicalSampleId)
        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 'Clinical Sample with id does not exist.', status.HTTP_404_NOT_FOUND
Ejemplo n.º 6
0
def getMsReadySamplesById():
    id = ObjectId(request.args.get('id'))
    sample = msReadySamplesDAO.getMSReadySampleById(id)

    if (sample):
        s = sample.dump()
        augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames(
            s['clinicalSamples'])
        intermediateSampleName = intermediateSampleDAO.getIntermediateSampleName(
            s['intermediateSampleId'])
        s['clinicalSamples'] = augmentedClinicalSamples
        s['intermediateSampleName'] = intermediateSampleName
        return jsonify(s), status.HTTP_200_OK
    else:
        return 'Ms Ready Sample with id does not exist.', status.HTTP_404_NOT_FOUND
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
def getMsRunsByClinicalSampleId():
    clinicalSampleId = ObjectId(request.args.get('id'))
    if clinicalSampleDAO.getClinicalSampleById(clinicalSampleId):
        msruns = MSRunDAO.getMsRunsByClinicalSampleId(
            clinicalSampleId)
        for ms_run in msruns:
            augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames(
                ms_run['clinicalSamples'])
            msReadySampleName = msReadySamplesDAO.getMSReadySampleName(
                ms_run['msReadySampleId'])
            ms_run['clinicalSamples'] = augmentedClinicalSamples
            ms_run['msReadySampleName'] = msReadySampleName
        return jsonify(msruns), status.HTTP_200_OK
    else:
        return 'Clinical Sample with id does not exist.', status.HTTP_404_NOT_FOUND
Ejemplo n.º 9
0
def getIntermediateSampleById():
    id = ObjectId(request.args.get('id'))
    s = intermediateSampleDAO.getIntermediateSampleById(id)

    if (s):
        s = s.dump()
        augmentedClinicalSamples = clinicalSampleDAO.augmentClinicalSampleNames(
            s['clinicalSamples'])
        # if('parentSamples' in s):
        #     augmentedIntermediateSamples = intermediateSampleDAO.augmentIntermediateSampleNames(
        #         s['parentSamples'])
        #     s['parentSamples'] = augmentedIntermediateSamples
        s['clinicalSamples'] = augmentedClinicalSamples

        return jsonify(s), status.HTTP_200_OK
    else:
        return 'Intermediate Sample with id does not exist.', status.HTTP_404_NOT_FOUND
Ejemplo n.º 10
0
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