count_reads.py
def parse_usearch_header(header, 
                         delims={'fields':';','key-value':'='}):
    '''
    Extracts annotations from a FASTA/FASTQ sequence description
    Default delimiters are the usearch/qiime format
    '''
    fields = header.split(delims['fields'])
    field_dict = OrderedDict([('ID', fields.pop(0))])
    for field in fields:
        pair = field.split(delims['key-value'])
        if len(pair)>1: # in ase not every field is a key-value pair 
            field_dict[pair[0].lower()] = pair[1]
        else:
            field_dict[pair[0].lower()] = pair[0]
    return field_dict

    Extracts annotations from a FASTA/FASTQ sequence description
    Default delimiters are the usearch/qiime format
    
Extracts annotations from a FASTA/FASTQ sequence description
Default delimiters are the usearch/qiime format
Extracts annotations from a FASTA / FASTQ sequence description Default delimiters are the usearch / qiime format
def parse_usearch_header(header, 
                         delims={'fields':';','key-value':'='}):
    fields = header.split(delims['fields'])
    field_dict = OrderedDict([('ID', fields.pop(0))])
    for field in fields:
        pair = field.split(delims['key-value'])
        if len(pair)>1: 
            field_dict[pair[0].lower()] = pair[1]
        else:
            field_dict[pair[0].lower()] = pair[0]
    return field_dict
def parse_usearch_header ( header , delims = { 'fields' : ';' , 'key-value' : '=' } ) : fields = header . split ( delims [ 'fields' ] ) field_dict = OrderedDict ( [ ( 'ID' , fields . pop ( 0 ) ) ] ) for field in fields : pair = field . split ( delims [ 'key-value' ] ) if len ( pair ) > 1 : field_dict [ pair [ 0 ] . lower ( ) ] = pair [ 1 ] else : field_dict [ pair [ 0 ] . lower ( ) ] = pair [ 0 ] return field_dict
Extracts annotations from a FASTA/FASTQ sequence description
Default delimiters are the usearch/qiime format
Extracts annotations from a FASTA / FASTQ sequence description Default delimiters are the usearch / qiime format
'''
    Extracts annotations from a FASTA/FASTQ sequence description
    Default delimiters are the usearch/qiime format
    ''' # in ase not every field is a key-value pair 
header
delims