Esempio n. 1
0
def get_file_name(nodeuuid, sampFile=None, is_file_uuid=False):
    """Helper function for getting a file_name from a filestore uuid
    :param fileuuid: Filestore uuid
    :type fileuuid: String
    """
    # if uuid is a file_store uuid (associated w/ analysis results)
    if is_file_uuid:
        temp_fs = FileStoreItem.objects.get(uuid=nodeuuid)
    else:
        # getting the current file_uuid from the given node_uuid
        curr_file_uuid = Node.objects.get(uuid=nodeuuid).file_uuid
        # checking to see if it has a file_server item
        temp_fs = get_aux_file_item(curr_file_uuid)

    # If no associated file_server auxiliary file then use main data file for
    # IGV
    if temp_fs is None:
        # getting file information based on file_uuids
        temp_fs = FileStoreItem.objects.get(uuid=curr_file_uuid)

    temp_name = temp_fs.datafile.name.split('/')
    temp_name = temp_name[len(temp_name) - 1]

    # full path to selected UUID File
    temp_url = get_full_url(temp_fs.get_datafile_url())

    # IGV SEG FILE HACK
    if sampFile:
        if temp_name.startswith("metaData"):
            new_name = temp_name.split("_")
            if len(new_name) > 1:
                temp_name = new_name[0]

    return temp_name, temp_url
Esempio n. 2
0
def get_file_name(nodeuuid, samp_file=None, is_file_uuid=False):
    """Helper function for getting a file_name from a filestore uuid
    :param nodeuuid: Node uuid
    :type nodeuuid: String
    """
    temp_fs = None
    try:
        # getting the current file_uuid from the given node_uuid
        curr_file_uuid = Node.objects.get(uuid=nodeuuid).file_uuid
    except (Node.DoesNotExist, Node.MultipleObjectsReturned) as e:
        logger.error("Could not fetch Node from %s: %s", nodeuuid, e)

    # if uuid is a file_store uuid (associated w/ analysis results)
    if is_file_uuid:
        try:
            temp_fs = FileStoreItem.objects.get(uuid=nodeuuid)
        except (FileStoreItem.DoesNotExist,
                FileStoreItem.MultipleObjectsReturned) as e:
            logger.error("Could not fetch FileStoreItem from %s: %s", nodeuuid,
                         e)
    else:
        try:
            # checking to see if it has a file_server item
            temp_fs = get_aux_file_item(curr_file_uuid)
        except Exception as e:
            logger.error("Could not fetch aux_file_item from %s: %s",
                         curr_file_uuid, e)

    # If no associated file_server auxiliary file then use main data file for
    # IGV
    if temp_fs is None:
        # getting file information based on file_uuids
        try:
            temp_fs = FileStoreItem.objects.get(uuid=curr_file_uuid)
        except (FileStoreItem.DoesNotExist,
                FileStoreItem.MultipleObjectsReturned) as e:
            logger.error("Could not fetch FileStoreItem: %s", e)

    try:
        return create_temp_filename_and_url(temp_fs, samp_file)
    except AttributeError as e:
        logger.error("Could not create temp filename and url %s", e)
        return ''
Esempio n. 3
0
def get_file_name(nodeuuid, sampFile=None, is_file_uuid=False):
    """ Helper function for getting a file_name from a filestore uuid
    
    :param fileuuid: Filestore uuid
    :type fileuuid: String
    """
    #logger.debug("visualization_manager.get_file_name: nodeuuid=%s", nodeuuid)
    #logger.debug(sampFile)
    
    # if uuid is a file_store uuid (associated w/ analysis results) 
    if (is_file_uuid):
        temp_fs = FileStoreItem.objects.get(uuid=nodeuuid)
    else:
        # getting the current file_uuid from the given node_uuid
        curr_file_uuid = Node.objects.get( uuid=nodeuuid ).file_uuid   
        
        # checking to see if it has a file_server item 
        temp_fs = get_aux_file_item(curr_file_uuid)
        
    # If no associated file_server auxiliary file then use main data file for IGV
    if temp_fs is None:
        # getting file information based on file_uuids
        temp_fs = FileStoreItem.objects.get(uuid=curr_file_uuid)
    
    temp_name = temp_fs.datafile.name
    temp_name = temp_fs.datafile.name.split('/')
    temp_name = temp_name[len(temp_name)-1]

    # full path to selected UUID File
    temp_url = temp_fs.get_full_url()
    
    # IGV SEG FILE HACK
    if (sampFile):
        if (temp_name.startswith("metaData")):
            new_name = temp_name.split("_")
            if len(new_name) > 1:
                temp_name = new_name[0]
            
    return temp_name, temp_url
Esempio n. 4
0
def get_file_name(nodeuuid, samp_file=None, is_file_uuid=False):
    """Helper function for getting a file_name from a filestore uuid
    :param nodeuuid: Node uuid
    :type nodeuuid: String
    """
    temp_fs = None
    try:
        # getting the current file_uuid from the given node_uuid
        curr_file_uuid = Node.objects.get(uuid=nodeuuid).file_uuid
    except (Node.DoesNotExist, Node.MultipleObjectsReturned) as e:
        logger.error("Could not fetch Node from %s: %s", nodeuuid, e)

    # if uuid is a file_store uuid (associated w/ analysis results)
    if is_file_uuid:
        try:
            temp_fs = FileStoreItem.objects.get(uuid=nodeuuid)
        except (FileStoreItem.DoesNotExist, FileStoreItem.MultipleObjectsReturned) as e:
            logger.error("Could not fetch FileStoreItem from %s: %s", nodeuuid, e)
    else:
        try:
            # checking to see if it has a file_server item
            temp_fs = get_aux_file_item(curr_file_uuid)
        except Exception as e:
            logger.error("Could not fetch aux_file_item from %s: %s", curr_file_uuid, e)

    # If no associated file_server auxiliary file then use main data file for
    # IGV
    if temp_fs is None:
        # getting file information based on file_uuids
        try:
            temp_fs = FileStoreItem.objects.get(uuid=curr_file_uuid)
        except (FileStoreItem.DoesNotExist, FileStoreItem.MultipleObjectsReturned) as e:
            logger.error("Could not fetch FileStoreItem: %s", e)

    try:
        return create_temp_filename_and_url(temp_fs, samp_file)
    except AttributeError as e:
        logger.error("Could not create temp filename and url %s", e)
        return ""