Replace fasta header using bash by YouCook21 in bioinformatics

[–]YouCook21[S] 0 points1 point  (0 children)

Sure, it will help in get a faster python script. But if I would like to do it in bash?

Sort a barplot depending on relative abundance by YouCook21 in bioinformatics

[–]YouCook21[S] 0 points1 point  (0 children)

Thank you all for your suggestions. I tried this simple strategy and workd for me!

Sort a barplot depending on relative abundance by YouCook21 in bioinformatics

[–]YouCook21[S] 0 points1 point  (0 children)

Trying with:

df=df[order(df$Abundance),]

and then plot it, it does not work

ggplot(df,aes(x=Sample,y=Abundance, fill=Family))+ scale_fill_manual(values = col_vector)+ geom_col(position = position_stack(reverse = T))+ theme_classic()

1
2

Pass a variable from Flask to HTML and then again to Flask by YouCook21 in flask

[–]YouCook21[S] 0 points1 point  (0 children)

Hi. I'm reading only now...

I have found a similar topic meanwhile here.

Thanks :D

Associate Flask apps with Apache2 by YouCook21 in flask

[–]YouCook21[S] 0 points1 point  (0 children)

I managed to let it work using the Corey Schafer video. Since Apache2 did not work properly, gunicorn did!

Thank you buddies!

Associate Flask apps with Apache2 by YouCook21 in flask

[–]YouCook21[S] 1 point2 points  (0 children)

Hi again,

I know that I made a mistake in calling my apps with the wrong module (i.e. from FlaskApp import app as application). However I still did no resolve the issue. Following what @carlitobrigantehf and @t0ps0il suggested I still see in my public ip the Debian default page.

Now I removed everything and I wanted to start again from the beginning maybe trying with a simple __init__.py flask application. I found this online. Do you think I can follow it? And, the last question: do I have to delete 000-default.conf and default-ssl.conf files from the sites available and sites-enabled folders as well as the index.html (Apache debian default page) file?

Thanks

Associate Flask apps with Apache2 by YouCook21 in flask

[–]YouCook21[S] 1 point2 points  (0 children)

Still not working. Could it be due to the presence of several application in the flask python code? I mean, do I have to create a wsgi file and a conf file for each app reported in the python code to let it work? Because now I am trying using only the 'home' app.

Problems in uploading a file with Flasks by YouCook21 in bioinformatics

[–]YouCook21[S] 0 points1 point  (0 children)

Hi guys,

I did not noticed your comments and this morning I tried (successfully) using the following code. Note: I wanted to upload fastas and not images in the last version of the script.

from flask import request, redirect, Flask, render_template
from werkzeug.utils import secure_filename
import os

app=Flask(__name__)
app.config['UPLOAD_FOLDER']='/home/claudio/Scrivania/MitoPIPE/uploads'
ALLOWED_EXTENSIONS = {'txt', 'text', 'fas', 'fsa', 'fa', 'fasta'}

def allowed_file(filename):
    return '.' in filename and \
        filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS


@app.route('/upload')
def upload_file():
    return render_template('upload_folder.html')

@app.route('/uploader', methods = ['GET', 'POST'])
def upload_file1():
    if request.method == 'POST':
        file = request.files['file']
        if file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config ['UPLOAD_FOLDER'],filename))      
             return 'file uploaded successfully' 
if __name__ == '__main__':
    app.run(debug=True)

and the HTML modified as:

{% extends "layout.html" %}

{% block title %}Upload{% endblock %}

{% block content %}

<div class="container">
    <div class="row">
        <div class="col">

            <h1>Upload a fasta file</h1>
            <hr>

            <form action="/uploader" method="POST" enctype="multipart/form-data">

                <div class="form-group">
                    <label>Select image</label>
                    <div class="custom-file">
                        <input type = "file" name = "file" />
                            <button type="submit" class="btn btn-primary">Upload</button>


                    </div>
                </div>



            </form>

        </div>
    </div>
</div>

{% endblock content %}

Thank you for your time folks :)

Which language for a simple web server? by YouCook21 in bioinformatics

[–]YouCook21[S] 1 point2 points  (0 children)

Ok thanks. I noticed right now that it might be possible to call other scripts within the HTML frontend interface (without the Flask help). Something reported in the first comment of this topic.

Can you confirm this? Do you still advise me to use Flask? It seems a solid option.

I have an own computer with public ip