libs/decluster.py
def extractHeaders(cluster_file):
    '''
        Description: Takes a file and extracts fasta headers from it.
            The input is expected to be a cdhit file, but a file with a
            single header on each line is also fine.
            
        Inputs:
        cluster_file - string. Path to a cd_hit cluster file.
        
        Outputs:
        out - list. A list of cluster headers
    '''
    out = []
    with open(cluster_file, 'r') as f:
        for line in f:
            if not line.startswith('>') and not line.strip()=='':
                cur_header = line.split('...')[0].split(' ')[-1].strip()
                if cur_header.startswith('>'):
                    cur_header = cur_header[1:]
                out.append( cur_header )
    return list(set(out))

        Description: Takes a file and extracts fasta headers from it.
            The input is expected to be a cdhit file, but a file with a
            single header on each line is also fine.
            
        Inputs:
        cluster_file - string. Path to a cd_hit cluster file.
        
        Outputs:
        out - list. A list of cluster headers
    
Takes a file and extracts fasta headers from it.
The input is expected to be a cdhit file, but a file with a
single header on each line is also fine.

string. Path to a cd_hit cluster file.

list. A list of cluster headers
Takes a file and extracts fasta headers from it . The input is expected to be a cdhit file but a file with a single header on each line is also fine . string . Path to a cd_hit cluster file . list . A list of cluster headers
def extractHeaders(cluster_file):
    out = []
    with open(cluster_file, 'r') as f:
        for line in f:
            if not line.startswith('>') and not line.strip()=='':
                cur_header = line.split('...')[0].split(' ')[-1].strip()
                if cur_header.startswith('>'):
                    cur_header = cur_header[1:]
                out.append( cur_header )
    return list(set(out))
def extractHeaders ( cluster_file ) : out = [ ] with open ( cluster_file , 'r' ) as f : for line in f : if not line . startswith ( '>' ) and not line . strip ( ) == '' : cur_header = line . split ( '...' ) [ 0 ] . split ( ' ' ) [ - 1 ] . strip ( ) if cur_header . startswith ( '>' ) : cur_header = cur_header [ 1 : ] out . append ( cur_header ) return list ( set ( out ) )
Description: Takes a file and extracts fasta headers from it.
Description : Takes a file and extracts fasta headers from it .
'''
        Description: Takes a file and extracts fasta headers from it.
            The input is expected to be a cdhit file, but a file with a
            single header on each line is also fine.
            
        Inputs:
        cluster_file - string. Path to a cd_hit cluster file.
        
        Outputs:
        out - list. A list of cluster headers
    '''
cluster_file