scripts/processing/clan_competition.py
def complete_clan_seqs(sorted_clan, clan_comp_type='FULL'):
    """
    Parses a sorted clan file and generates a list of regions per rfam_acc,
    which are then competed by compete_seq_regions

    sorted_clan: A valid path to a sorted clan file
    """

    fp = open(sorted_clan, 'r')

    # log regions in which calculate overlap returns None
    logging.basicConfig(
        filename="missed_overlaps.log", filemode='w', level=logging.DEBUG)

    non_sig_regs = []
    regions = []

    # read first 2 regions
    seq_prev = fp.readline().strip().split('\t')
    seq_next = fp.readline().strip().split('\t')

    # read while there are no duplicates
    while len(seq_next) > 1:

        # the same accession - create region list, otherwise the sequence is
        # significant...
        while(len(seq_next) > 1 and string.find(seq_prev[SEQ_ACC],
                                                seq_next[SEQ_ACC]) != -1):
            # add the previous only in the first occurence

            if len(regions) == 0:
                regions.append(seq_prev)  # add the first
                regions.append(seq_next)
            # else only add the next one
            else:
                regions.append(seq_next)  # add the next

            seq_prev = seq_next
            seq_next = fp.readline().strip().split('\t')

        # at some point create the seq region list
        # call compete region function
        non_sig_regs.extend(compete_seq_regions(regions, logging))

        seq_prev = seq_next
        seq_next = fp.readline().strip().split('\t')

        regions = []

    fp.close()

    # at this point update full_region table
    if len(non_sig_regs) != 0:
        if clan_comp_type == 'FULL':
            db_utils.set_is_singificant_to_zero_multi(non_sig_regs)
        else:
            db_utils.set_pdb_is_significant_to_zero(non_sig_regs)

    return non_sig_regs

    Parses a sorted clan file and generates a list of regions per rfam_acc,
    which are then competed by compete_seq_regions

    sorted_clan: A valid path to a sorted clan file
    
Parses a sorted clan file and generates a list of regions per rfam_acc,
which are then competed by compete_seq_regions

A valid path to a sorted clan file
Parses a sorted clan file and generates a list of regions per rfam_acc which are then competed by compete_seq_regions A valid path to a sorted clan file
def complete_clan_seqs(sorted_clan, clan_comp_type='FULL'):
    fp = open(sorted_clan, 'r')
    logging.basicConfig(
        filename="missed_overlaps.log", filemode='w', level=logging.DEBUG)
    non_sig_regs = []
    regions = []
    seq_prev = fp.readline().strip().split('\t')
    seq_next = fp.readline().strip().split('\t')
    while len(seq_next) > 1:
        while(len(seq_next) > 1 and string.find(seq_prev[SEQ_ACC],
                                                seq_next[SEQ_ACC]) != -1):
            if len(regions) == 0:
                regions.append(seq_prev)  
                regions.append(seq_next)
            else:
                regions.append(seq_next)  
            seq_prev = seq_next
            seq_next = fp.readline().strip().split('\t')
        non_sig_regs.extend(compete_seq_regions(regions, logging))
        seq_prev = seq_next
        seq_next = fp.readline().strip().split('\t')
        regions = []
    fp.close()
    if len(non_sig_regs) != 0:
        if clan_comp_type == 'FULL':
            db_utils.set_is_singificant_to_zero_multi(non_sig_regs)
        else:
            db_utils.set_pdb_is_significant_to_zero(non_sig_regs)
    return non_sig_regs
def complete_clan_seqs ( sorted_clan , clan_comp_type = 'FULL' ) : fp = open ( sorted_clan , 'r' ) logging . basicConfig ( filename = "missed_overlaps.log" , filemode = 'w' , level = logging . DEBUG ) non_sig_regs = [ ] regions = [ ] seq_prev = fp . readline ( ) . strip ( ) . split ( '\t' ) seq_next = fp . readline ( ) . strip ( ) . split ( '\t' ) while len ( seq_next ) > 1 : while ( len ( seq_next ) > 1 and string . find ( seq_prev [ SEQ_ACC ] , seq_next [ SEQ_ACC ] ) != - 1 ) : if len ( regions ) == 0 : regions . append ( seq_prev ) regions . append ( seq_next ) else : regions . append ( seq_next ) seq_prev = seq_next seq_next = fp . readline ( ) . strip ( ) . split ( '\t' ) non_sig_regs . extend ( compete_seq_regions ( regions , logging ) ) seq_prev = seq_next seq_next = fp . readline ( ) . strip ( ) . split ( '\t' ) regions = [ ] fp . close ( ) if len ( non_sig_regs ) != 0 : if clan_comp_type == 'FULL' : db_utils . set_is_singificant_to_zero_multi ( non_sig_regs ) else : db_utils . set_pdb_is_significant_to_zero ( non_sig_regs ) return non_sig_regs
Parses a sorted clan file and generates a list of regions per rfam_acc,
which are then competed by compete_seq_regions
Parses a sorted clan file and generates a list of regions per rfam_acc which are then competed by compete_seq_regions
"""
    Parses a sorted clan file and generates a list of regions per rfam_acc,
    which are then competed by compete_seq_regions

    sorted_clan: A valid path to a sorted clan file
    """ # log regions in which calculate overlap returns None # read first 2 regions # read while there are no duplicates # the same accession - create region list, otherwise the sequence is # significant... # add the previous only in the first occurence # add the first # else only add the next one # add the next # at some point create the seq region list # call compete region function # at this point update full_region table
sorted_clan
clan_comp_type