libs/decluster.py
def decluster(cluster_files, headers_file=None, out_file=None, look_for=None):
    '''
        Description: Takes a series of cluster file from cdhit and extracts all members
            from a cluster if the cluster representative is defined in a list.
            
        Inputs:
        cluster_files - string or list. Path or list of paths to a cd_hit cluster file. To extract members  
                        from successive cdhit files, arrange the filenames from the most condensed to the 
                        least condensied. E.g. 40% -> 70% -> 90%
        headers_file - list. A file containing list of cluster headers, whose members should be extracted from the cluster_file. Use only one of headers_file or look_for.
        out_file -  string. optional. if given, writes all the headers to a file, with each header separated by a new line.
        look_for - list. A list of cluster headers to look for
        
        Outputs:
        out - list. A list of cluster headers extracted from the cluster files
    '''
    if not look_for and headers_file:
        look_for = extractHeaders(headers_file)
        
    if type(cluster_files)!=type([]):
        cluster_files = [cluster_files]
    out = []
    for cluster_file in cluster_files:
        out.extend( extractMembers(cluster_file, out + look_for) )
    out = list(set(out))
    if out_file:
        with open(out_file, 'w') as f:
            for header in out:
                f.write(header+'\n')
    return out

        Description: Takes a series of cluster file from cdhit and extracts all members
            from a cluster if the cluster representative is defined in a list.
            
        Inputs:
        cluster_files - string or list. Path or list of paths to a cd_hit cluster file. To extract members  
                        from successive cdhit files, arrange the filenames from the most condensed to the 
                        least condensied. E.g. 40% -> 70% -> 90%
        headers_file - list. A file containing list of cluster headers, whose members should be extracted from the cluster_file. Use only one of headers_file or look_for.
        out_file -  string. optional. if given, writes all the headers to a file, with each header separated by a new line.
        look_for - list. A list of cluster headers to look for
        
        Outputs:
        out - list. A list of cluster headers extracted from the cluster files
    
Takes a series of cluster file from cdhit and extracts all members
from a cluster if the cluster representative is defined in a list.

string or list. Path or list of paths to a cd_hit cluster file. To extract members
from successive cdhit files, arrange the filenames from the most condensed to the
least condensied.

list. A list of cluster headers extracted from the cluster files
Takes a series of cluster file from cdhit and extracts all members from a cluster if the cluster representative is defined in a list . string or list . Path or list of paths to a cd_hit cluster file . To extract members from successive cdhit files arrange the filenames from the most condensed to the least condensied . list . A list of cluster headers extracted from the cluster files
def decluster(cluster_files, headers_file=None, out_file=None, look_for=None):
    if not look_for and headers_file:
        look_for = extractHeaders(headers_file)
    if type(cluster_files)!=type([]):
        cluster_files = [cluster_files]
    out = []
    for cluster_file in cluster_files:
        out.extend( extractMembers(cluster_file, out + look_for) )
    out = list(set(out))
    if out_file:
        with open(out_file, 'w') as f:
            for header in out:
                f.write(header+'\n')
    return out
def decluster ( cluster_files , headers_file = None , out_file = None , look_for = None ) : if not look_for and headers_file : look_for = extractHeaders ( headers_file ) if type ( cluster_files ) != type ( [ ] ) : cluster_files = [ cluster_files ] out = [ ] for cluster_file in cluster_files : out . extend ( extractMembers ( cluster_file , out + look_for ) ) out = list ( set ( out ) ) if out_file : with open ( out_file , 'w' ) as f : for header in out : f . write ( header + '\n' ) return out
Description: Takes a series of cluster file from cdhit and extracts all members
from a cluster if the cluster representative is defined in a list.
Description : Takes a series of cluster file from cdhit and extracts all members from a cluster if the cluster representative is defined in a list .
'''
        Description: Takes a series of cluster file from cdhit and extracts all members
            from a cluster if the cluster representative is defined in a list.
            
        Inputs:
        cluster_files - string or list. Path or list of paths to a cd_hit cluster file. To extract members  
                        from successive cdhit files, arrange the filenames from the most condensed to the 
                        least condensied. E.g. 40% -> 70% -> 90%
        headers_file - list. A file containing list of cluster headers, whose members should be extracted from the cluster_file. Use only one of headers_file or look_for.
        out_file -  string. optional. if given, writes all the headers to a file, with each header separated by a new line.
        look_for - list. A list of cluster headers to look for
        
        Outputs:
        out - list. A list of cluster headers extracted from the cluster files
    '''
cluster_files
headers_file
out_file
look_for