Commit 6391ff30 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

All-vs-All mode: select target, not query

parent f68bd909
......@@ -6,15 +6,12 @@ minimap_exec=$1
nb_threads=$2
fasta_t=$3
fasta_q=$4
query=$5
target=$6
paf=$7
paf_raw=$8
out_dir=$9
paf=$5
paf_raw=$6
# Run minimap:
if [ "$fasta_t" != "NONE" ]; then
if [ "$fasta_q" != "NONE" ]; then
echo "Running: ${minimap_exec} -t ${nb_threads} ${fasta_t} ${fasta_q} > ${paf_raw}"
......@@ -22,9 +19,9 @@ ${minimap_exec} -t ${nb_threads} ${fasta_t} ${fasta_q} > ${paf_raw}
else
echo "Running: ${minimap_exec} -t ${nb_threads} -X ${fasta_q} ${fasta_q} > ${paf_raw}"
echo "Running: ${minimap_exec} -t ${nb_threads} -X ${fasta_t} ${fasta_t} > ${paf_raw}"
${minimap_exec} -t ${nb_threads} -X ${fasta_q} ${fasta_q} > ${paf_raw}
${minimap_exec} -t ${nb_threads} -X ${fasta_t} ${fasta_t} > ${paf_raw}
fi
......
......@@ -243,9 +243,9 @@ dgenies.run.valid_form = function () {
}
//Check input query:
if ($("input#query").val().length === 0) {
$("label.file-query").addClass("error");
dgenies.run.add_error("Query fasta is required!");
if ($("input#target").val().length === 0) {
$("label.file-target").addClass("error");
dgenies.run.add_error("Target fasta is required!");
has_errors = true;
}
......@@ -276,7 +276,7 @@ dgenies.run.reset_errors = function() {
dgenies.run.start_uploads = function() {
let query_type = parseInt($("select.query").val());
if (query_type === 0) {
if (query_type === 0 && $("input#query").val().length > 0) {
$("button#button-query").hide();
dgenies.run.show_loading("query");
}
......
......@@ -84,10 +84,8 @@ class JobManager:
@db_session
def __launch_local(self):
cmd = ["run_minimap2.sh", self.minimap2, self.threads,
self.target.get_path() if self.target is not None else "NONE", self.query.get_path(),
self.query.get_name(), self.target.get_name() if self.target is not None else "NONE", self.paf,
self.paf_raw, self.output_dir]
cmd = ["run_minimap2.sh", self.minimap2, self.threads, self.target.get_path(),
self.query.get_path() if self.query is not None else "NONE", self.paf, self.paf_raw]
with open(self.logs, "w") as logs:
p = subprocess.Popen(cmd, stdout=logs, stderr=logs)
job = Job.get(id_job=self.id_job)
......@@ -184,13 +182,13 @@ class JobManager:
job = Job.get(id_job=self.id_job)
job.status = "indexing"
db.commit()
query_index = os.path.join(self.output_dir, "query.idx")
Functions.index_file(self.query, query_index)
target_index = os.path.join(self.output_dir, "target.idx")
if self.target is not None:
Functions.index_file(self.target, target_index)
Functions.index_file(self.target, target_index)
query_index = os.path.join(self.output_dir, "query.idx")
if self.query is not None:
Functions.index_file(self.query, query_index)
else:
shutil.copyfile(query_index, target_index)
shutil.copyfile(target_index, query_index)
job = Job.get(id_job=self.id_job)
job.status = "success"
db.commit()
......@@ -210,7 +208,7 @@ class JobManager:
if len(j1) > 0:
print("Old job found without result dir existing: delete it from BDD!")
j1.delete()
if self.query is not None:
if self.target is not None:
job = Job(id_job=self.id_job, email=self.email, batch_type=self.batch_system_type,
date_created=datetime.datetime.now())
db.commit()
......
......@@ -91,8 +91,8 @@ def launch_analysis():
if email == "":
errors.append("Email not given")
form_pass = False
if file_query == "":
errors.append("No query fasta selected")
if file_target == "":
errors.append("No target fasta selected")
form_pass = False
# Form pass
......@@ -107,16 +107,16 @@ def launch_analysis():
os.makedirs(folder_files)
# Save files:
query_name = os.path.splitext(file_query.replace(".gz", ""))[0] if file_query_type == "local" else None
query_path = os.path.join(app.config["UPLOAD_FOLDER"], session["user_tmp_dir"], file_query) \
if file_query_type == "local" else file_query
query = Fasta(name=query_name, path=query_path, type_f=file_query_type)
target = None
if file_target != "":
target_name = os.path.splitext(file_target.replace(".gz", ""))[0] if file_target_type == "local" else None
target_path = os.path.join(app.config["UPLOAD_FOLDER"], session["user_tmp_dir"], file_target) \
if file_target_type == "local" else file_target
target = Fasta(name=target_name, path=target_path, type_f=file_target_type)
query = None
if file_query != "":
query_name = os.path.splitext(file_query.replace(".gz", ""))[0] if file_query_type == "local" else None
query_path = os.path.join(app.config["UPLOAD_FOLDER"], session["user_tmp_dir"], file_query) \
if file_query_type == "local" else file_query
query = Fasta(name=query_name, path=query_path, type_f=file_query_type)
target_name = os.path.splitext(file_target.replace(".gz", ""))[0] if file_target_type == "local" else None
target_path = os.path.join(app.config["UPLOAD_FOLDER"], session["user_tmp_dir"], file_target) \
if file_target_type == "local" else file_target
target = Fasta(name=target_name, path=target_path, type_f=file_target_type)
# Launch job:
job = JobManager(id_job, email, query, target, mailer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment