예제 #1
0
def profile(request):
    '''Calculates and returns a profile.

    :returns: JSON -- profile representation

    '''
    # test URL params: chr21, 13591070, 14845362, z0

    if 'uuid' in request.GET:
        uuid = request.GET['uuid']
    else:
        msg = "Please provide a UUID"
        logger.error(msg)
        return HttpResponse(msg)

    if 'seq' in request.GET:
        seq = request.GET['seq']
    else:
        msg = "Please provide a sequence name"
        logger.error(msg)
        return HttpResponse(msg)

    if 'zoom' in request.GET:
        zoom = request.GET['zoom']
    else:
        msg = "Please provide zoom level"
        logger.error(msg)
        return HttpResponse(msg)

    if 'start' in request.GET:
        start = int(request.GET['start'])
    else:
        msg = "Please provide a start position"
        logger.error(msg)
        return HttpResponse(msg)

    if 'end' in request.GET:
        end = int(request.GET['end'])
    else:
        msg = "Please provide an end position"
        logger.error(msg)
        return HttpResponse(msg)

    item = models.get(uuid)

    try:
        profile = item.get_profile(seq, zoom, ["mean"], start, end)
    except AttributeError as e:
        #return HttpResponse("_FileServerItem with UUID [" + uuid + "] was not found")
        return HttpResponse(e.message)

    return HttpResponse(profile, mimetype='application/json')
def profile(request):
    '''Calculates and returns a profile.

    :returns: JSON -- profile representation

    '''
    # test URL params: chr21, 13591070, 14845362, z0

    if 'uuid' in request.GET:
        uuid = request.GET['uuid']
    else:
        msg = "Please provide a UUID"
        logger.error(msg)
        return HttpResponse(msg)

    if 'seq' in request.GET:
        seq = request.GET['seq']
    else:
        msg = "Please provide a sequence name"
        logger.error(msg)
        return HttpResponse(msg)

    if 'zoom' in request.GET:
        zoom = request.GET['zoom']
    else:
        msg = "Please provide zoom level"
        logger.error(msg)
        return HttpResponse(msg)

    if 'start' in request.GET:
        start = int(request.GET['start'])
    else:
        msg = "Please provide a start position"
        logger.error(msg)
        return HttpResponse(msg)

    if 'end' in request.GET:
        end = int(request.GET['end'])
    else:
        msg = "Please provide an end position"
        logger.error(msg)
        return HttpResponse(msg)

    item = models.get(uuid)

    try:
        profile = item.get_profile(seq, zoom, ["mean"], start, end)
    except AttributeError as e:
        #return HttpResponse("_FileServerItem with UUID [" + uuid + "] was not found")
        return HttpResponse(e.message)

    return HttpResponse(profile, mimetype='application/json')     
예제 #3
0
 def test_get_bigbeditem(self):
     bigbed_item = models.BigBEDItem.objects.create(
         data_file=self.bigbed_file)
     self.assertEqual(models.get(bigbed_item), bigbed_item)
예제 #4
0
 def test_get_bigbeditem(self):
     bigbed_item = models.BigBEDItem.objects.create(
         data_file=self.bigbed_file)
     self.assertEqual(models.get(bigbed_item), bigbed_item)