humann/store.py
def process_reference_annotation(self,reference):
        """
        Process the reference string for information on gene, gene length, and bug
        Allow for chocophlan annotations, gene|gene_length, gene_length|gene, and gene
        Also use id mapping if provided
        """
        
        # if id mapping is provided first try to use it for the annotation data
        gene=""
        if self.__id_mapping:
            if reference in self.__id_mapping:
                [gene,length,bug]=self.__id_mapping[reference]
                
        # if id mapping is not provided or not found for the reference then
        # try to process the reference string
        if not gene:
            reference_info=reference.split(config.chocophlan_delimiter)
            
            # identify bug and gene families
            length=0
            gene=reference
            try:
                full_taxonomy=reference_info[config.chocophlan_bug_index]
                # Limit to species/genera
                bug_info=full_taxonomy.split(".")
                bug=".".join([bug_info[config.chocophlan_bug_genera_index],bug_info[config.chocophlan_bug_species_index]])

                # Join all genes selected
                gene_set=[]
                for index in config.chocophlan_gene_indexes:
                    gene_set.append(reference_info[index])
                if gene_set:
                    gene=config.chocophlan_delimiter.join(gene_set)
                length=int(reference_info[config.chocophlan_length_index])
            except (IndexError, ValueError):
                # try to find gene length if present
                bug="unclassified"
                # check for gene|gene_length|taxonomy
                if (len(reference_info)==3 and re.search("^[0-9]+$",reference_info[1])
                    and not re.search("^[0-9]+$",reference_info[2])):
                    bug=reference_info[2]
                    length=int(reference_info[1])
                    gene=reference_info[0]
                elif len(reference_info)==2:
                    if re.search("^[0-9]+$",reference_info[1]):
                        length=int(reference_info[1])
                        gene=reference_info[0]
                    elif re.search("^[0-9]+$",reference_info[0]):
                        length=int(reference_info[0])
                        gene=reference_info[1]
                    
        return [gene,length,bug]

        Process the reference string for information on gene, gene length, and bug
        Allow for chocophlan annotations, gene|gene_length, gene_length|gene, and gene
        Also use id mapping if provided
        
Process the reference string for information on gene, gene length, and bug
Allow for chocophlan annotations, gene|gene_length, gene_length|gene, and gene
Also use id mapping if provided
Process the reference string for information on gene gene length and bug Allow for chocophlan annotations gene|gene_length gene_length|gene and gene Also use id mapping if provided
def process_reference_annotation(self,reference):
        gene=""
        if self.__id_mapping:
            if reference in self.__id_mapping:
                [gene,length,bug]=self.__id_mapping[reference]
        if not gene:
            reference_info=reference.split(config.chocophlan_delimiter)
            length=0
            gene=reference
            try:
                full_taxonomy=reference_info[config.chocophlan_bug_index]
                bug_info=full_taxonomy.split(".")
                bug=".".join([bug_info[config.chocophlan_bug_genera_index],bug_info[config.chocophlan_bug_species_index]])
                gene_set=[]
                for index in config.chocophlan_gene_indexes:
                    gene_set.append(reference_info[index])
                if gene_set:
                    gene=config.chocophlan_delimiter.join(gene_set)
                length=int(reference_info[config.chocophlan_length_index])
            except (IndexError, ValueError):
                bug="unclassified"
                if (len(reference_info)==3 and re.search("^[0-9]+$",reference_info[1])
                    and not re.search("^[0-9]+$",reference_info[2])):
                    bug=reference_info[2]
                    length=int(reference_info[1])
                    gene=reference_info[0]
                elif len(reference_info)==2:
                    if re.search("^[0-9]+$",reference_info[1]):
                        length=int(reference_info[1])
                        gene=reference_info[0]
                    elif re.search("^[0-9]+$",reference_info[0]):
                        length=int(reference_info[0])
                        gene=reference_info[1]
        return [gene,length,bug]
def process_reference_annotation ( self , reference ) : gene = "" if self . __id_mapping : if reference in self . __id_mapping : [ gene , length , bug ] = self . __id_mapping [ reference ] if not gene : reference_info = reference . split ( config . chocophlan_delimiter ) length = 0 gene = reference try : full_taxonomy = reference_info [ config . chocophlan_bug_index ] bug_info = full_taxonomy . split ( "." ) bug = "." . join ( [ bug_info [ config . chocophlan_bug_genera_index ] , bug_info [ config . chocophlan_bug_species_index ] ] ) gene_set = [ ] for index in config . chocophlan_gene_indexes : gene_set . append ( reference_info [ index ] ) if gene_set : gene = config . chocophlan_delimiter . join ( gene_set ) length = int ( reference_info [ config . chocophlan_length_index ] ) except ( IndexError , ValueError ) : bug = "unclassified" if ( len ( reference_info ) == 3 and re . search ( "^[0-9]+$" , reference_info [ 1 ] ) and not re . search ( "^[0-9]+$" , reference_info [ 2 ] ) ) : bug = reference_info [ 2 ] length = int ( reference_info [ 1 ] ) gene = reference_info [ 0 ] elif len ( reference_info ) == 2 : if re . search ( "^[0-9]+$" , reference_info [ 1 ] ) : length = int ( reference_info [ 1 ] ) gene = reference_info [ 0 ] elif re . search ( "^[0-9]+$" , reference_info [ 0 ] ) : length = int ( reference_info [ 0 ] ) gene = reference_info [ 1 ] return [ gene , length , bug ]
Process the reference string for information on gene, gene length, and bug
Allow for chocophlan annotations, gene|gene_length, gene_length|gene, and gene
Also use id mapping if provided
Process the reference string for information on gene gene length and bug Allow for chocophlan annotations gene|gene_length gene_length|gene and gene Also use id mapping if provided
"""
        Process the reference string for information on gene, gene length, and bug
        Allow for chocophlan annotations, gene|gene_length, gene_length|gene, and gene
        Also use id mapping if provided
        """ # if id mapping is provided first try to use it for the annotation data # if id mapping is not provided or not found for the reference then # try to process the reference string # identify bug and gene families # Limit to species/genera # Join all genes selected # try to find gene length if present # check for gene|gene_length|taxonomy
self
reference