Example #1
0
    def post(self, preprocessed_data_id):
        # make sure user is admin and can therefore actually submit to VAMPS
        if self.current_user.level != 'admin':
            raise HTTPError(
                403, "User %s cannot submit to VAMPS!" % self.current_user.id)
        msg = ''
        msg_level = 'success'
        preprocessed_data = Artifact(preprocessed_data_id)
        state = preprocessed_data.submitted_to_vamps_status()

        demux = [
            path for _, path, ftype in preprocessed_data.get_filepaths()
            if ftype == 'preprocessed_demux'
        ]
        demux_length = len(demux)

        if state in ('submitting', 'success'):
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        elif demux_length != 1:
            msg = "The study doesn't have demux files or have too many" % state
            msg_level = 'danger'
        else:
            channel = self.current_user.id
            job_id = submit(channel, submit_to_VAMPS,
                            int(preprocessed_data_id))

            self.render('compute_wait.html',
                        job_id=job_id,
                        title='VAMPS Submission',
                        completion_redirect='/compute_complete/%s' % job_id)
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #2
0
    def post(self, preprocessed_data_id):
        user = self.current_user
        # make sure user is admin and can therefore actually submit to EBI
        if user.level != 'admin':
            raise HTTPError(403, "User %s cannot submit to EBI!" %
                            user.id)
        submission_type = self.get_argument('submission_type')

        if submission_type not in ['ADD', 'MODIFY']:
            raise HTTPError(403, "User: %s, %s is not a recognized submission "
                            "type" % (user.id, submission_type))

        msg = ''
        msg_level = 'success'
        preprocessed_data = PreprocessedData(preprocessed_data_id)
        state = preprocessed_data.submitted_to_insdc_status()
        if state == 'submitting':
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        elif state == 'success' and submission_type == "ADD":
            msg = "Cannot resubmit! Current state is: %s, use MODIFY" % state
            msg_level = 'danger'
        else:
            channel = user.id
            job_id = submit(channel, submit_to_ebi, int(preprocessed_data_id),
                            submission_type)

            self.render('compute_wait.html',
                        job_id=job_id, title='EBI Submission',
                        completion_redirect='/compute_complete/%s' % job_id)
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #3
0
    def post(self, preprocessed_data_id):
        user = self.current_user
        # make sure user is admin and can therefore actually submit to VAMPS
        if user.level != 'admin':
            raise HTTPError(403, "User %s cannot submit to VAMPS!" % user.id)
        msg = ''
        msg_level = 'success'
        study = Artifact(preprocessed_data_id).study
        study_id = study.id
        state = study.ebi_submission_status
        if state == 'submitting':
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        else:
            channel = user.id
            job_id = submit(channel, submit_to_VAMPS,
                            int(preprocessed_data_id))

            self.render(
                'compute_wait.html',
                job_id=job_id,
                title='VAMPS Submission',
                completion_redirect=('/study/description/%s?top_tab='
                                     'preprocessed_data_tab&sub_tab=%s' %
                                     (study_id, preprocessed_data_id)))
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
    def post(self):
        study_id = int(self.get_argument('study_id'))
        prep_template_id = int(self.get_argument('prep_template_id'))
        raw_data_id = PrepTemplate(prep_template_id).raw_data

        # Get the preprocessing parameters
        form_data = PreprocessParametersForm()
        form_data.process(data=self.request.arguments)
        rcomp_mapping_barcodes = form_data.data['rev_comp_mapping_barcodes']

        # currently only allow the user to change a single parameter of split
        # libraries: --rev_comp_mapping_barcodes. The parameter ids 1 and 2
        # contain the same set of values except for that flag. If param_id = 1,
        # the flag is not activated, while in param_id = 2; it is.
        if rcomp_mapping_barcodes:
            # Choose the parameter set with the --rev_comp_mapping_barcodes
            # flag activated
            param_id = 2
        else:
            # Choose the parameter set with the --rev_comp_mapping_barcodes
            # flag not activated
            param_id = 1

        param_constructor = PreprocessedIlluminaParams

        job_id = submit(self.current_user, preprocessor, study_id,
                        prep_template_id, param_id, param_constructor)

        self.render('compute_wait.html', user=self.current_user,
                    job_id=job_id, title='Preprocessing',
                    completion_redirect='/study/description/%d?top_tab='
                                        'raw_data_tab&sub_tab=%s&prep_tab=%s'
                                        % (study_id, raw_data_id,
                                           prep_template_id))
Example #5
0
    def post(self, preprocessed_data_id):
        # make sure user is admin and can therefore actually submit to VAMPS
        if self.current_user.level != "admin":
            raise HTTPError(403, "User %s cannot submit to VAMPS!" % self.current_user.id)
        msg = ""
        msg_level = "success"
        preprocessed_data = Artifact(preprocessed_data_id)
        state = preprocessed_data.submitted_to_vamps_status()

        demux = [path for _, path, ftype in preprocessed_data.get_filepaths() if ftype == "preprocessed_demux"]
        demux_length = len(demux)

        if state in ("submitting", "success"):
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = "danger"
        elif demux_length != 1:
            msg = "The study doesn't have demux files or have too many" % state
            msg_level = "danger"
        else:
            channel = self.current_user.id
            job_id = submit(channel, submit_to_VAMPS, int(preprocessed_data_id))

            self.render(
                "compute_wait.html",
                job_id=job_id,
                title="VAMPS Submission",
                completion_redirect="/compute_complete/%s" % job_id,
            )
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #6
0
    def post(self, preprocessed_data_id):
        user = self.current_user
        # make sure user is admin and can therefore actually submit to VAMPS
        if user.level != 'admin':
            raise HTTPError(403, "User %s cannot submit to VAMPS!" %
                            user.id)
        msg = ''
        msg_level = 'success'
        study = Artifact(preprocessed_data_id).study
        study_id = study.id
        state = study.ebi_submission_status
        if state == 'submitting':
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        else:
            channel = user.id
            job_id = submit(channel, submit_to_VAMPS,
                            int(preprocessed_data_id))

            self.render('compute_wait.html',
                        job_id=job_id, title='VAMPS Submission',
                        completion_redirect=('/study/description/%s?top_tab='
                                             'preprocessed_data_tab&sub_tab=%s'
                                             % (study_id,
                                                preprocessed_data_id)))
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #7
0
    def post(self, preprocessed_data_id):
        user = self.current_user
        # make sure user is admin and can therefore actually submit to EBI
        if user.level != 'admin':
            raise HTTPError(403, "User %s cannot submit to EBI!" %
                            user.id)
        submission_type = self.get_argument('submission_type')

        if submission_type not in ['ADD', 'MODIFY']:
            raise HTTPError(403, "User: %s, %s is not a recognized submission "
                            "type" % (user.id, submission_type))

        msg = ''
        msg_level = 'success'
        study = Artifact(preprocessed_data_id).study
        study_id = study.id
        state = study.ebi_submission_status
        if state == 'submitting':
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        else:
            channel = user.id
            job_id = submit(channel, submit_to_ebi, int(preprocessed_data_id),
                            submission_type)

            self.render('compute_wait.html',
                        job_id=job_id, title='EBI Submission',
                        completion_redirect=('/study/description/%s?top_tab='
                                             'preprocessed_data_tab&sub_tab=%s'
                                             % (study_id,
                                                preprocessed_data_id)))
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #8
0
    def post(self, preprocessed_data_id):
        # make sure user is admin and can therefore actually submit to VAMPS
        if self.current_user.level != 'admin':
            raise HTTPError(403, "User %s cannot submit to VAMPS!" %
                            self.current_user.id)
        msg = ''
        msg_level = 'success'
        preprocessed_data = PreprocessedData(preprocessed_data_id)
        state = preprocessed_data.submitted_to_vamps_status()

        demux = [path for _, path, ftype in preprocessed_data.get_filepaths()
                 if ftype == 'preprocessed_demux']
        demux_length = len(demux)

        if state in ('submitting',  'success'):
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        elif demux_length != 1:
            msg = "The study doesn't have demux files or have too many" % state
            msg_level = 'danger'
        else:
            channel = self.current_user.id
            job_id = submit(channel, submit_to_VAMPS,
                            int(preprocessed_data_id))

            self.render('compute_wait.html',
                        job_id=job_id, title='VAMPS Submission',
                        completion_redirect='/compute_complete/%s' % job_id)
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #9
0
    def create_from_scratch(self, prep_template, study_id):
        raw_data_filetype = self.get_argument('filetype')
        barcodes_str = self.get_argument('barcodes')
        forward_reads_str = self.get_argument('forward')
        sff_str = self.get_argument('sff')
        fasta_str = self.get_argument('fasta')
        qual_str = self.get_argument('qual')
        reverse_reads_str = self.get_argument('reverse')

        def _split(x):
            return x.split(',') if x else []

        filepaths, fps = [], []
        fps.append((_split(barcodes_str), 'raw_barcodes'))
        fps.append((_split(fasta_str), 'raw_fasta'))
        fps.append((_split(qual_str), 'raw_qual'))
        fps.append((_split(forward_reads_str), 'raw_forward_seqs'))
        fps.append((_split(reverse_reads_str), 'raw_reverse_seqs'))
        fps.append((_split(sff_str), 'raw_sff'))

        # We need to retrieve the full path for all the files, as the
        # arguments only contain the file name. Since we don't know in which
        # mountpoint the data lives, we retrieve all of them and we loop
        # through all the files checking if they exist or not.
        for _, f in get_mountpoint("uploads", retrieve_all=True):
            f = join(f, str(study_id))
            for fp_set, filetype in fps:
                for t in fp_set:
                    ft = join(f, t)
                    if exists(ft):
                        filepaths.append((ft, filetype))

        return submit(self.current_user.id, create_raw_data, raw_data_filetype,
                      prep_template, filepaths)
Example #10
0
    def create_from_scratch(self, prep_template, study_id):
        raw_data_filetype = self.get_argument("filetype")
        barcodes_str = self.get_argument("barcodes")
        forward_reads_str = self.get_argument("forward")
        sff_str = self.get_argument("sff")
        fasta_str = self.get_argument("fasta")
        qual_str = self.get_argument("qual")
        reverse_reads_str = self.get_argument("reverse")

        def _split(x):
            return x.split(",") if x else []

        filepaths, fps = [], []
        fps.append((_split(barcodes_str), "raw_barcodes"))
        fps.append((_split(fasta_str), "raw_fasta"))
        fps.append((_split(qual_str), "raw_qual"))
        fps.append((_split(forward_reads_str), "raw_forward_seqs"))
        fps.append((_split(reverse_reads_str), "raw_reverse_seqs"))
        fps.append((_split(sff_str), "raw_sff"))

        # We need to retrieve the full path for all the files, as the
        # arguments only contain the file name. Since we don't know in which
        # mountpoint the data lives, we retrieve all of them and we loop
        # through all the files checking if they exist or not.
        for _, f in get_mountpoint("uploads", retrieve_all=True):
            f = join(f, str(study_id))
            for fp_set, filetype in fps:
                for t in fp_set:
                    ft = join(f, t)
                    if exists(ft):
                        filepaths.append((ft, filetype))

        return submit(self.current_user.id, create_raw_data, raw_data_filetype, prep_template, filepaths)
Example #11
0
    def post(self, preprocessed_data_id):
        # make sure user is admin and can therefore actually submit to EBI
        if User(self.current_user).level != 'admin':
            raise HTTPError(403, "User %s cannot submit to EBI!" %
                            self.current_user)
        submission_type = self.get_argument('submission_type')

        if submission_type not in ['ADD', 'MODIFY']:
            raise HTTPError(403, "User: %s, %s is not a recognized submission "
                            "type" % (self.current_user, submission_type))

        msg = ''
        msg_level = 'success'
        preprocessed_data = PreprocessedData(preprocessed_data_id)
        state = preprocessed_data.submitted_to_insdc_status()
        if state == 'submitting':
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        elif state == 'success' and submission_type == "ADD":
            msg = "Cannot resubmit! Current state is: %s, use MODIFY" % state
            msg_level = 'danger'
        else:
            channel = self.current_user
            job_id = submit(channel, submit_to_ebi, int(preprocessed_data_id),
                            submission_type)

            self.render('compute_wait.html', user=self.current_user,
                        job_id=job_id, title='EBI Submission',
                        completion_redirect='/compute_complete/%s' % job_id)
            return

        self.display_template(preprocessed_data_id, msg, msg_level)
Example #12
0
    def post(self):

        # vars to add files to raw data
        study_id = self.get_argument('study_id')
        raw_data_id = self.get_argument('raw_data_id')
        barcodes_str = self.get_argument('barcodes')
        forward_reads_str = self.get_argument('forward')
        reverse_reads_str = self.get_argument('reverse', None)

        study_id = int(study_id)
        try:
            study = Study(study_id)
        except QiitaDBUnknownIDError:
            # Study not in database so fail nicely
            raise HTTPError(404, "Study %d does not exist" % study_id)
        else:
            check_access(User(self.current_user), study, raise_error=True)

        barcodes, forward_reads, reverse_reads = [], [], []
        for _, f in get_mountpoint("uploads", retrive_all=True):
            f = join(f, str(study_id))
            for t in barcodes_str.split(','):
                ft = join(f, t)
                if exists(ft):
                    barcodes.append([ft, "raw_barcodes"])
            for t in forward_reads_str.split(','):
                ft = join(f, t)
                if exists(ft):
                    forward_reads.append([ft, "raw_forward_seqs"])
            if reverse_reads_str:
                for t in reverse_reads_str.split(','):
                    ft = join(f, t)
                    if exists(ft):
                        reverse_reads.append([ft, "raw_reverse_seqs"])

        # this should never happen if following the GUI pipeline
        # but rather be save than sorry
        if (len(barcodes) != len(forward_reads)
           or (barcodes and len(barcodes) != len(forward_reads))):
            raise HTTPError(404, "user %s tried to submit a wrong pair of "
                                 "barcodes/forward/reverse reads" %
                                 self.current_user)

        # join all files to send on single var
        filepaths = barcodes
        filepaths.extend(forward_reads)
        if reverse_reads:
            filepaths.extend(reverse_reads)

        job_id = submit(self.current_user, add_files_to_raw_data, raw_data_id,
                        filepaths)

        self.render('compute_wait.html', user=self.current_user,
                    job_id=job_id, title='Adding files to your raw data',
                    completion_redirect=(
                        '/study/description/%s?top_tab=raw_data_tab&sub_tab=%s'
                        % (study_id, raw_data_id)))
Example #13
0
    def post(self):

        # vars to add files to raw data
        study_id = self.get_argument('study_id')
        raw_data_id = self.get_argument('raw_data_id')
        barcodes_str = self.get_argument('barcodes')
        forward_reads_str = self.get_argument('forward')
        sff_str = self.get_argument('sff')
        fasta_str = self.get_argument('fasta')
        qual_str = self.get_argument('qual')
        reverse_reads_str = self.get_argument('reverse')

        study_id = int(study_id)
        try:
            study = Study(study_id)
        except QiitaDBUnknownIDError:
            # Study not in database so fail nicely
            raise HTTPError(404, "Study %d does not exist" % study_id)
        else:
            check_access(self.current_user, study, raise_error=True)

        def _split(x):
            return x.split(',') if x else []

        filepaths, fps = [], []
        fps.append((_split(barcodes_str), 'raw_barcodes'))
        fps.append((_split(fasta_str), 'raw_fasta'))
        fps.append((_split(qual_str), 'raw_qual'))
        fps.append((_split(forward_reads_str), 'raw_forward_seqs'))
        fps.append((_split(reverse_reads_str), 'raw_reverse_seqs'))
        fps.append((_split(sff_str), 'raw_sff'))

        for _, f in get_mountpoint("uploads", retrieve_all=True):
            f = join(f, str(study_id))
            for fp_set, filetype in fps:
                for t in fp_set:
                    ft = join(f, t)
                    if exists(ft):
                        filepaths.append((ft, filetype))

        job_id = submit(self.current_user.id, add_files_to_raw_data,
                        raw_data_id, filepaths)

        self.render(
            'compute_wait.html',
            job_id=job_id,
            title='Adding files to your raw data',
            completion_redirect=(
                '/study/description/%s?top_tab=raw_data_tab&sub_tab=%s' %
                (study_id, raw_data_id)))
Example #14
0
    def post(self):

        # vars to add files to raw data
        study_id = self.get_argument('study_id')
        raw_data_id = self.get_argument('raw_data_id')
        prep_template_id = self.get_argument('prep_template_id')
        barcodes_str = self.get_argument('barcodes')
        forward_reads_str = self.get_argument('forward')
        sff_str = self.get_argument('sff')
        fasta_str = self.get_argument('fasta')
        qual_str = self.get_argument('qual')
        reverse_reads_str = self.get_argument('reverse')

        study_id = int(study_id)
        try:
            study = Study(study_id)
        except QiitaDBUnknownIDError:
            # Study not in database so fail nicely
            raise HTTPError(404, "Study %d does not exist" % study_id)
        else:
            check_access(self.current_user, study, raise_error=True)

        def _split(x):
            return x.split(',') if x else []
        filepaths, fps = [], []
        fps.append((_split(barcodes_str), 'raw_barcodes'))
        fps.append((_split(fasta_str), 'raw_fasta'))
        fps.append((_split(qual_str), 'raw_qual'))
        fps.append((_split(forward_reads_str), 'raw_forward_seqs'))
        fps.append((_split(reverse_reads_str), 'raw_reverse_seqs'))
        fps.append((_split(sff_str), 'raw_sff'))

        for _, f in get_mountpoint("uploads", retrieve_all=True):
            f = join(f, str(study_id))
            for fp_set, filetype in fps:
                for t in fp_set:
                    ft = join(f, t)
                    if exists(ft):
                        filepaths.append((ft, filetype))

        job_id = submit(self.current_user.id, add_files_to_raw_data,
                        raw_data_id, filepaths)

        self.render('compute_wait.html',
                    job_id=job_id, title='Adding files to your raw data',
                    completion_redirect=(
                        '/study/description/%s?top_tab=prep_template_tab'
                        '&sub_tab=%s' % (study_id, prep_template_id)))
Example #15
0
    def post(self):
        study_id = int(self.get_argument('study_id'))
        preprocessed_data_id = int(self.get_argument('preprocessed_data_id'))
        param_id = self.get_argument('parameter-set-%s' % preprocessed_data_id)

        # The only parameter type supported is the ProcessedSortmernaParams
        # so we can hardcode the constructor here
        param_constructor = ProcessedSortmernaParams

        job_id = submit(self.current_user.id, processor, preprocessed_data_id,
                        param_id, param_constructor)

        self.render('compute_wait.html',
                    job_id=job_id,
                    title='Processing',
                    completion_redirect='/study/description/%d?top_tab='
                    'preprocessed_data_tab&sub_tab=%s' %
                    (study_id, preprocessed_data_id))
Example #16
0
    def post(self):
        study_id = int(self.get_argument("study_id"))
        preprocessed_data_id = int(self.get_argument("preprocessed_data_id"))
        param_id = self.get_argument("parameter-set-%s" % preprocessed_data_id)

        # The only parameter type supported is the ProcessedSortmernaParams
        # so we can hardcode the constructor here
        param_constructor = ProcessedSortmernaParams

        job_id = submit(self.current_user.id, processor, preprocessed_data_id, param_id, param_constructor)

        self.render(
            "compute_wait.html",
            job_id=job_id,
            title="Processing",
            completion_redirect="/study/description/%d?top_tab="
            "preprocessed_data_tab&sub_tab=%s" % (study_id, preprocessed_data_id),
        )
Example #17
0
    def post(self):
        pt_id = self.get_argument('prep_template_id')
        raw_data_filetype = self.get_argument('filetype')
        barcodes_str = self.get_argument('barcodes')
        forward_reads_str = self.get_argument('forward')
        sff_str = self.get_argument('sff')
        fasta_str = self.get_argument('fasta')
        qual_str = self.get_argument('qual')
        reverse_reads_str = self.get_argument('reverse')

        pt = PrepTemplate(pt_id)
        study_id = pt.study_id

        def _split(x):
            return x.split(',') if x else []
        filepaths, fps = [], []
        fps.append((_split(barcodes_str), 'raw_barcodes'))
        fps.append((_split(fasta_str), 'raw_fasta'))
        fps.append((_split(qual_str), 'raw_qual'))
        fps.append((_split(forward_reads_str), 'raw_forward_seqs'))
        fps.append((_split(reverse_reads_str), 'raw_reverse_seqs'))
        fps.append((_split(sff_str), 'raw_sff'))

        # We need to retrieve the full path for all the files, as the
        # arguments only contain the file name. Since we don't know in which
        # mountpoint the data lives, we retrieve all of them and we loop
        # through all the files checking if they exist or not.
        for _, f in get_mountpoint("uploads", retrieve_all=True):
            f = join(f, str(study_id))
            for fp_set, filetype in fps:
                for t in fp_set:
                    ft = join(f, t)
                    if exists(ft):
                        filepaths.append((ft, filetype))

        job_id = submit(self.current_user.id, create_raw_data,
                        raw_data_filetype, pt, filepaths)

        self.render('compute_wait.html',
                    job_id=job_id, title='Adding raw data',
                    completion_redirect=(
                        '/study/description/%s?top_tab=prep_template_tab'
                        '&sub_tab=%s' % (study_id, pt_id)))
Example #18
0
    def post(self):
        study_id = int(self.get_argument('study_id'))
        prep_template_id = int(self.get_argument('prep_template_id'))
        rcomp_mapping_barcodes = self.get_argument('rev_comp_mapping_barcodes')
        # currently forcing these values
        # param_constructor = self.get_argument('param_constructor')
        if rcomp_mapping_barcodes == 'false':
            param_id = 1
        else:
            param_id = 2

        param_constructor = PreprocessedIlluminaParams

        job_id = submit(self.current_user, preprocessor, study_id,
                        prep_template_id, param_id, param_constructor)

        self.render('compute_wait.html', user=self.current_user,
                    job_id=job_id, title='Preprocessing',
                    completion_redirect='/study/description/%d' % study_id)
Example #19
0
    def post(self):
        # vars to remove all files from a raw data
        study_id = self.get_argument('study_id', None)
        raw_data_id = self.get_argument('raw_data_id', None)

        study_id = int(study_id) if study_id else None

        try:
            study = Study(study_id)
        except QiitaDBUnknownIDError:
            # Study not in database so fail nicely
            raise HTTPError(404, "Study %d does not exist" % study_id)
        else:
            check_access(User(self.current_user), study, raise_error=True)

        job_id = submit(self.current_user, unlink_all_files, raw_data_id)

        self.render('compute_wait.html', user=self.current_user,
                    job_id=job_id, title='Removing files from your raw data',
                    completion_redirect='/study/description/%d' % study_id)
    def post(self):
        study_id = int(self.get_argument('study_id'))
        prep_template_id = int(self.get_argument('prep_template_id'))
        raw_data = RawData(PrepTemplate(prep_template_id).raw_data)
        param_id = int(self.get_argument('preprocessing_parameters_id'))

        # Get the preprocessing parameters
        if raw_data.filetype in ('FASTQ', 'per_sample_FASTQ'):
            param_constructor = PreprocessedIlluminaParams
        elif raw_data.filetype in ('FASTA', 'SFF'):
            param_constructor = Preprocessed454Params
        else:
            raise ValueError('Unknown filetype')

        job_id = submit(self.current_user.id, preprocessor, study_id,
                        prep_template_id, param_id, param_constructor)

        self.render('compute_wait.html',
                    job_id=job_id, title='Preprocessing',
                    completion_redirect='/study/description/%d?top_tab='
                                        'prep_template_tab&sub_tab=%s'
                                        % (study_id, prep_template_id))
    def post(self):
        study_id = int(self.get_argument('study_id'))
        prep_template_id = int(self.get_argument('prep_template_id'))
        raw_data = RawData(PrepTemplate(prep_template_id).raw_data)
        param_id = int(self.get_argument('preprocessing_parameters_id'))

        # Get the preprocessing parameters
        if raw_data.filetype == 'FASTQ':
            param_constructor = PreprocessedIlluminaParams
        elif raw_data.filetype in ('FASTA', 'SFF'):
            param_constructor = Preprocessed454Params
        else:
            raise ValueError('Unknown filetype')

        job_id = submit(self.current_user.id, preprocessor, study_id,
                        prep_template_id, param_id, param_constructor)

        self.render('compute_wait.html',
                    job_id=job_id, title='Preprocessing',
                    completion_redirect='/study/description/%d?top_tab='
                                        'raw_data_tab&sub_tab=%s&prep_tab=%s'
                                        % (study_id, raw_data.id,
                                           prep_template_id))
Example #22
0
    def post(self):
        # vars to remove all files from a raw data
        study_id = self.get_argument('study_id', None)
        raw_data_id = self.get_argument('raw_data_id', None)

        study_id = int(study_id) if study_id else None

        try:
            study = Study(study_id)
        except QiitaDBUnknownIDError:
            # Study not in database so fail nicely
            raise HTTPError(404, "Study %d does not exist" % study_id)
        else:
            check_access(self.current_user, study, raise_error=True)

        job_id = submit(self.current_user.id, unlink_all_files, raw_data_id)

        self.render(
            'compute_wait.html',
            job_id=job_id,
            title='Removing files from your raw data',
            completion_redirect=(
                '/study/description/%s?top_tab=raw_data_tab&sub_tab=%s' %
                (study_id, raw_data_id)))
Example #23
0
 def create_from_artifact(self, prep_template, artifact_id):
     return submit(self.current_user.id, copy_raw_data, prep_template, artifact_id)
Example #24
0
 def create_from_artifact(self, prep_template, artifact_id):
     return submit(self.current_user.id, copy_raw_data, prep_template,
                   artifact_id)
Example #25
0
        preprocessed_data = Artifact(preprocessed_data_id)
        state = preprocessed_data.submitted_to_vamps_status()

        demux = [path for _, path, ftype in preprocessed_data.get_filepaths()
                 if ftype == 'preprocessed_demux']
        demux_length = len(demux)

        if state in ('submitting',  'success'):
            msg = "Cannot resubmit! Current state is: %s" % state
            msg_level = 'danger'
        elif demux_length != 1:
            msg = "The study doesn't have demux files or have too many" % state
            msg_level = 'danger'
        else:
            channel = self.current_user.id
            job_id = submit(channel, submit_to_VAMPS,
                            int(preprocessed_data_id))

            self.render('compute_wait.html',
                        job_id=job_id, title='VAMPS Submission',
                        completion_redirect='/compute_complete/%s' % job_id)
            return
=======
        if user.level != 'admin':
            raise HTTPError(403, reason="User %s cannot submit to VAMPS!" %
                            user.id)
        msg = ''
        msg_level = 'success'

        plugin = Software.from_name_and_version('Qiita', 'alpha')
        cmd = plugin.get_command('submit_to_VAMPS')
        artifact = Artifact(preprocessed_data_id)