def upload_file(): if request.method == 'POST': session['db'] = 'hg38' # use the latest genome by default if 'db' in request.form: if request.form['db'] == 'hg19': session['db'] = 'hg19' elif request.form['db'] != 'hg38': flash('Unsuported genome option %s. Using hg38.' % (request.form['session'])) else: flash('Genome not specified. Using hg38.') # Set up the Spreadhseet Column for this run session['chromcol'] = '#CHROM' session['poscol'] = 'POS' session['refcol'] = 'REF' if 'chromcol' in request.form and \ request.form['chromcol'] != session['chromcol']: session['chromcol'] = request.form['chromcol'] flash("Using %s as chromosome column name" % (session['chromcol'])) if 'poscol' in request.form and \ request.form['poscol'] != session['poscol']: session['poscol'] = request.form['poscol'] flash("Using %s as position column name" % (session['poscol'])) if 'refcol' in request.form and \ request.form['refcol'] != session['refcol']: session['refcol'] = request.form['refcol'] flash("Using %s as reference column name" % (session['refcol'])) # Set up the Sequence Options for this run session['bracketlen'] = 500 session['primerlen'] = '200-500' if 'bracketlen' in request.form and \ int(request.form['bracketlen']) != session['bracketlen']: session['bracketlen'] = int(request.form['bracketlen']) flash("Using %d as bracketed sequence length" % (session['bracketlen'])) if 'primerlen' in request.form and \ request.form['primerlen'] != session['primerlen']: session['primerlen'] = request.form['primerlen'] flash("Using %s as Primer3 sequence length range" % (session['primerlen'])) file = request.files['file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) path = os.path.join(app.config['UPLOAD_FOLDER'], filename) file.save(path) createSession() session['filename'] = filename if filename[-3:] == 'csv': rows = fileutils.readCsv(path) else: rows = fileutils.readExcel(path) session['totalRows'] = len(rows) genomePath = "genomes" if session['db'] == 'hg19': genomeFile = "hg19.2bit" else: session['db'] = 'hg38' genomeFile = "hg38.2bit" genomeFilePath = "/".join([genomePath, genomeFile]) pr_args = [ rows, genomeFilePath, session['db'], session['chromcol'], session['poscol'], session['refcol'], session['bracketlen'], session['primerlen'], ] task = processRows.apply_async(args=pr_args) logger.info('Created task with id %s' % (task.id)) return render_template('status.html', myfunc='primers', task_id=task.id) else: if not file: flash("You must specify a file.") else: flash("Invalid filename. File extensions may include: %s." % (", ".join(ALLOWED_EXTENSIONS))) # if not post, return index.html return render_template('index.html')
def upload_file(): if request.method == 'POST': session['db'] = 'hg38' # use the latest genome by default if 'db' in request.form: if request.form['db'] == 'hg19': session['db'] = 'hg19' elif request.form['db'] != 'hg38': flash('Unsuported genome option %s. Using hg38.' %(request.form['session'])) else: flash('Genome not specified. Using hg38.') # Set up the Spreadhseet Column for this run session['chromcol'] = '#CHROM' session['poscol'] = 'POS' session['refcol'] = 'REF' if 'chromcol' in request.form and \ request.form['chromcol'] != session['chromcol']: session['chromcol'] = request.form['chromcol'] flash("Using %s as chromosome column name"%(session['chromcol'])) if 'poscol' in request.form and \ request.form['poscol'] != session['poscol']: session['poscol'] = request.form['poscol'] flash("Using %s as position column name"%(session['poscol'])) if 'refcol' in request.form and \ request.form['refcol'] != session['refcol']: session['refcol'] = request.form['refcol'] flash("Using %s as reference column name"%(session['refcol'])) # Set up the Sequence Options for this run session['bracketlen'] = 500 session['primerlen'] = '200-500' if 'bracketlen' in request.form and \ int(request.form['bracketlen']) != session['bracketlen']: session['bracketlen'] = int(request.form['bracketlen']) flash("Using %d as bracketed sequence length"%(session['bracketlen'])) if 'primerlen' in request.form and \ request.form['primerlen'] != session['primerlen']: session['primerlen'] = request.form['primerlen'] flash("Using %s as Primer3 sequence length range"%(session['primerlen'])) file = request.files['file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) path = os.path.join(app.config['UPLOAD_FOLDER'],filename) file.save(path) createSession() session['filename'] = filename if filename[-3:] == 'csv': rows = fileutils.readCsv(path) else: rows = fileutils.readExcel(path) session['totalRows'] = len(rows) genomePath = "genomes" if session['db'] == 'hg19': genomeFile = "hg19.2bit" else: session['db'] = 'hg38' genomeFile = "hg38.2bit" genomeFilePath = "/".join([genomePath,genomeFile]) pr_args = [rows, genomeFilePath, session['db'], session['chromcol'], session['poscol'], session['refcol'], session['bracketlen'], session['primerlen'], ] task = processRows.apply_async(args=pr_args) logger.info('Created task with id %s'%(task.id)) return render_template('status.html', myfunc='primers', task_id=task.id) else: if not file: flash("You must specify a file.") else: flash("Invalid filename. File extensions may include: %s."% (", ".join(ALLOWED_EXTENSIONS))) # if not post, return index.html return render_template('index.html')
def multiple_sites(): if request.method == 'POST': session['db'] = 'hg38' # use the latest genome by default if 'db' in request.form: if request.form['db'] == 'hg19': session['db'] = 'hg19' elif request.form['db'] != 'hg38': flash('Unsuported genome option %s. Using hg38.' % (request.form['session'])) else: flash('Genome not specified. Using hg38.') session['chromcol'] = '#CHROM' session['poscol'] = 'POS' session['varcol'] = 'VARIANT' if 'chromcol' in request.form and \ request.form['chromcol'] != session['chromcol']: session['chromcol'] = request.form['chromcol'] flash("Using %s as chromosome column name" % (session['chromcol'])) if 'poscol' in request.form and \ request.form['poscol'] != session['poscol']: session['poscol'] = request.form['poscol'] flash("Using %s as position column name" % (session['poscol'])) if 'varcol' in request.form and \ request.form['varcol'] != session['varcol']: session['varcol'] = request.form['varcol'] flash("Using %s as variant column name" % (session['varcol'])) file = request.files['file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) path = os.path.join(app.config['UPLOAD_FOLDER'], filename) file.save(path) createSession() session['filename'] = filename if filename[-3:] == 'csv': rows = fileutils.readCsv(path) else: rows = fileutils.readExcel(path) session['totalRows'] = len(rows) genomePath = "genomes" if session['db'] == 'hg19': genomeFile = "hg19.2bit" else: session['db'] = 'hg38' genomeFile = "hg38.2bit" genomeFilePath = "/".join([genomePath, genomeFile]) #predictSpliceSites(session['uuid'], # rows, # genomeFilePath, # db=session['db'], # chromcol=session['chromcol'], # poscol=session['poscol'], # varcol=session['varcol'], # ) #return render_template('predictionstatus.html') pr_args = [ rows, genomeFilePath, session['db'], session['chromcol'], session['poscol'], session['varcol'], ] task = predictSpliceSites.apply_async(args=pr_args) logger.info('Created task with id %s' % (task.id)) return render_template('status.html', myfunc='predictions', task_id=task.id) return render_template('index.html')
def multiple_sites(): if request.method == 'POST': session['db'] = 'hg38' # use the latest genome by default if 'db' in request.form: if request.form['db'] == 'hg19': session['db'] = 'hg19' elif request.form['db'] != 'hg38': flash('Unsuported genome option %s. Using hg38.' %(request.form['session'])) else: flash('Genome not specified. Using hg38.') session['chromcol'] = '#CHROM' session['poscol'] = 'POS' session['varcol'] = 'VARIANT' if 'chromcol' in request.form and \ request.form['chromcol'] != session['chromcol']: session['chromcol'] = request.form['chromcol'] flash("Using %s as chromosome column name"%(session['chromcol'])) if 'poscol' in request.form and \ request.form['poscol'] != session['poscol']: session['poscol'] = request.form['poscol'] flash("Using %s as position column name"%(session['poscol'])) if 'varcol' in request.form and \ request.form['varcol'] != session['varcol']: session['varcol'] = request.form['varcol'] flash("Using %s as variant column name"%(session['varcol'])) file = request.files['file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) path = os.path.join(app.config['UPLOAD_FOLDER'],filename) file.save(path) createSession() session['filename'] = filename if filename[-3:] == 'csv': rows = fileutils.readCsv(path) else: rows = fileutils.readExcel(path) session['totalRows'] = len(rows) genomePath = "genomes" if session['db'] == 'hg19': genomeFile = "hg19.2bit" else: session['db'] = 'hg38' genomeFile = "hg38.2bit" genomeFilePath = "/".join([genomePath,genomeFile]) #predictSpliceSites(session['uuid'], # rows, # genomeFilePath, # db=session['db'], # chromcol=session['chromcol'], # poscol=session['poscol'], # varcol=session['varcol'], # ) #return render_template('predictionstatus.html') pr_args = [rows, genomeFilePath, session['db'], session['chromcol'], session['poscol'], session['varcol'], ] task = predictSpliceSites.apply_async(args=pr_args) logger.info('Created task with id %s'%(task.id)) return render_template('status.html', myfunc='predictions', task_id=task.id) return render_template('index.html')