scripts/preprocessing/zwd_import_precompute.py
def fasta_headers_to_urs_accessions(fasta_header_file):
    """
    Extracts the URS accessions from a file containing
    all zwd fasta header lines. Fasta headers can be
    extracted using grep '>' new_zwd.fasta > fasta_header_file

    fasta_header_file: A .txt file containing all header lines
    from a new ZWD fasta file

    returns: A dictionary with all URS accessions as keys
    """

    urs_accs = {}
    fp = open(fasta_header_file, 'r')

    for line in fp:
        # split header line on spaces and trip first '>' character
        urs_acc = line.strip().split(' ')[0][1:]
        if urs_acc not in urs_accs:
            urs_accs[urs_acc] = ""

    fp.close()

    return urs_accs

    Extracts the URS accessions from a file containing
    all zwd fasta header lines. Fasta headers can be
    extracted using grep '>' new_zwd.fasta > fasta_header_file

    fasta_header_file: A .txt file containing all header lines
    from a new ZWD fasta file

    returns: A dictionary with all URS accessions as keys
    
Extracts the URS accessions from a file containing
all zwd fasta header lines. Fasta headers can be
extracted using grep '>' new_zwd.fasta > fasta_header_file

A .txt file containing all header lines
from a new ZWD fasta file

A dictionary with all URS accessions as keys
Extracts the URS accessions from a file containing all zwd fasta header lines . Fasta headers can be extracted using grep ' > ' new_zwd . fasta > fasta_header_file A . txt file containing all header lines from a new ZWD fasta file A dictionary with all URS accessions as keys
def fasta_headers_to_urs_accessions(fasta_header_file):
    urs_accs = {}
    fp = open(fasta_header_file, 'r')
    for line in fp:
        urs_acc = line.strip().split(' ')[0][1:]
        if urs_acc not in urs_accs:
            urs_accs[urs_acc] = ""
    fp.close()
    return urs_accs
def fasta_headers_to_urs_accessions ( fasta_header_file ) : urs_accs = { } fp = open ( fasta_header_file , 'r' ) for line in fp : urs_acc = line . strip ( ) . split ( ' ' ) [ 0 ] [ 1 : ] if urs_acc not in urs_accs : urs_accs [ urs_acc ] = "" fp . close ( ) return urs_accs
Extracts the URS accessions from a file containing
all zwd fasta header lines.
Extracts the URS accessions from a file containing all zwd fasta header lines .
"""
    Extracts the URS accessions from a file containing
    all zwd fasta header lines. Fasta headers can be
    extracted using grep '>' new_zwd.fasta > fasta_header_file

    fasta_header_file: A .txt file containing all header lines
    from a new ZWD fasta file

    returns: A dictionary with all URS accessions as keys
    """ # split header line on spaces and trip first '>' character
fasta_header_file