Exemple #1
0
def raw_data(request):
    form = DataRequestForm()
    if request.method == 'POST':
        form = DataRequestForm(request.POST)
        if form.is_valid():
            seqid_input = form.cleaned_data.get('seqids')
            seqids = seqid_input.split()
            data_request = DataRequest.objects.create(seqids=seqids,
                                                      user=request.user)
            data_request.status = 'Processing'
            data_request.request_type = 'FASTQ'
            data_request.save()
            get_raw_data(data_request_pk=data_request.pk)
            return redirect('data:data_download',
                            data_request_pk=data_request.pk)
    return render(request, 'data/raw_data.html', {'form': form})
Exemple #2
0
def assembled_data(request):
    form = DataRequestForm()
    if request.method == 'POST':
        form = DataRequestForm(request.POST)
        if form.is_valid():
            seqid_input = form.cleaned_data.get('seqids')
            seqids = seqid_input.split()
            data_request = DataRequest.objects.create(seqids=seqids,
                                                      user=request.user)
            data_request.status = 'Processing'
            data_request.request_type = 'FASTA'
            data_request.save()
            get_assembled_data.apply_async(queue='default',
                                           args=(data_request.pk, ),
                                           countdown=10)
            return redirect('data:data_download',
                            data_request_pk=data_request.pk)
    return render(request, 'data/assembled_data.html', {'form': form})
Exemple #3
0
 def test_invalid_form_seqid_does_not_exist(self):
     form = DataRequestForm({'seqids': '2015-SEQ-0711 2020-SEQ-0712'})
     self.assertFalse(form.is_valid())
Exemple #4
0
 def test_invalid_form_wrong_regex(self):
     form = DataRequestForm({'seqids': '2015-SEQ-0711 2015-SEQ-07124'})
     self.assertFalse(form.is_valid())
Exemple #5
0
 def test_valid_form(self):
     form = DataRequestForm({'seqids': '2015-SEQ-0711 2015-SEQ-0712'})
     self.assertTrue(form.is_valid())