This commit is contained in:
XXAY
2021-09-24 16:05:56 +08:00
parent 04b4cbc2ed
commit 8908b88284
48 changed files with 2473 additions and 521 deletions

View File

@@ -4,7 +4,7 @@ from tools import views
urlpatterns = [
url("(.*\.html$)", views.out_page),
url("id_transform", views.id_transform),
url("gen_to_fa", views.gen_to_fa),
url("gff_to_gtf", views.gff_to_gtf),
url("blast", views.blast)
]

View File

@@ -3,7 +3,7 @@ import os, time
from django.http import JsonResponse
from django.shortcuts import render
from chart import tools
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
def out_page(request, page):
@@ -18,8 +18,8 @@ def id_transform(request):
return JsonResponse({})
return JsonResponse({})
def blast(request):
def blast(request):
file1 = request.FILES.get('file1', None)
pass
@@ -27,10 +27,42 @@ def blast(request):
def gen_to_fa(request):
file = request.FILES.get("file")
file_path, file_id = tools.path_out("chart")
keep_file(file, file_path)
tools.keep_file(file, file_path)
data = {"id": file_id}
time.sleep(1)
# records = SeqIO.parse(file_path, "genbank") # 读入
# SeqIO.write(records, f"{file_path}", "fasta") # 写出
records = SeqIO.parse(file_path, "genbank") # 读入
SeqIO.write(records, f"{file_path}.fasta", "fasta") # 写出
return JsonResponse(data)
def gff_to_gtf(request):
file = request.FILES.get("file")
file_path, file_id = tools.path_out("chart")
tools.keep_file(file, file_path)
data = {"id": file_id}
os.system(f"{tools.tools_path}/gffread {file_path} -T -o {file_path}.gtf")
return JsonResponse(data)
def gff_to_gtf(request):
file = request.FILES.get("file")
file_path, file_id = tools.path_out("chart")
tools.keep_file(file, file_path)
data = {"id": file_id}
os.system(f"{tools.tools_path}/gffread {file_path} -T -o {file_path}.gtf")
return JsonResponse(data)
def orf(request):
file = request.FILES.get("file", None)
begin = request.POST.get("begin", None)
end = request.POST.get("end", None)
Cyclotype = request.POST.get("Cyclotype", None)
Codons = request.POST.get("Codons", None)
outfmt = request.POST.get("outfmt", None)
file_path, file_id = tools.path_out("chart")
tools.keep_file(file, file_path)
data = {"id": file_id}
os.system(
f"{tools.tools_path}/ORFfinder {file_path} -b {begin} -e {end} -c {'t' if Cyclotype == 'YES' else 'f'} -g {Codons} -outfmt {outfmt} -out {file_path}.txt")
return JsonResponse(data)