humann/store.py
def store_id_mapping(file):
    """
    Store the id mapping data from the tab delimited file
    """

    id_mapping={}

    # Check the file exists and is readable
    utilities.file_exists_readable(file)
         
    file_handle=open(file,"rt")
         
    line=file_handle.readline()
    while line:
        # Ignore comment lines
        if not re.search(config.id_mapping_comment_indicator,line):
            data=line.rstrip().split(config.id_mapping_delimiter) 
            # set the default values for the mapping
            reference=""
            gene=""
            length=0
            bug="unclassified"
            try:
                reference=data[config.id_mapping_reference_index]
                gene=data[config.id_mapping_gene_index]
                length=data[config.id_mapping_gene_length_index]
                bug=data[config.id_mapping_bug_index]  
            except IndexError:
                logger.debug("Unable to read full mapping for id")
                    
            try:
                length=int(length)
            except ValueError:
                length=0
                    
            # if the reference and gene are found, store the mapping
            if reference and gene:
                id_mapping[reference]=[gene,length,bug]
                
        line=file_handle.readline()
        
    file_handle.close() 
    
    return id_mapping

    Store the id mapping data from the tab delimited file
    
Store the id mapping data from the tab delimited file
Store the id mapping data from the tab delimited file
def store_id_mapping(file):
    id_mapping={}
    utilities.file_exists_readable(file)
    file_handle=open(file,"rt")
    line=file_handle.readline()
    while line:
        if not re.search(config.id_mapping_comment_indicator,line):
            data=line.rstrip().split(config.id_mapping_delimiter) 
            reference=""
            gene=""
            length=0
            bug="unclassified"
            try:
                reference=data[config.id_mapping_reference_index]
                gene=data[config.id_mapping_gene_index]
                length=data[config.id_mapping_gene_length_index]
                bug=data[config.id_mapping_bug_index]  
            except IndexError:
                logger.debug("Unable to read full mapping for id")
            try:
                length=int(length)
            except ValueError:
                length=0
            if reference and gene:
                id_mapping[reference]=[gene,length,bug]
        line=file_handle.readline()
    file_handle.close() 
    return id_mapping
def store_id_mapping ( file ) : id_mapping = { } utilities . file_exists_readable ( file ) file_handle = open ( file , "rt" ) line = file_handle . readline ( ) while line : if not re . search ( config . id_mapping_comment_indicator , line ) : data = line . rstrip ( ) . split ( config . id_mapping_delimiter ) reference = "" gene = "" length = 0 bug = "unclassified" try : reference = data [ config . id_mapping_reference_index ] gene = data [ config . id_mapping_gene_index ] length = data [ config . id_mapping_gene_length_index ] bug = data [ config . id_mapping_bug_index ] except IndexError : logger . debug ( "Unable to read full mapping for id" ) try : length = int ( length ) except ValueError : length = 0 if reference and gene : id_mapping [ reference ] = [ gene , length , bug ] line = file_handle . readline ( ) file_handle . close ( ) return id_mapping
Store the id mapping data from the tab delimited file
Store the id mapping data from the tab delimited file
"""
    Store the id mapping data from the tab delimited file
    """ # Check the file exists and is readable # Ignore comment lines # set the default values for the mapping # if the reference and gene are found, store the mapping
file