scripts/release/uniprot_file_converter.py
def convert_proteome_list_to_upid_gca_file(input_file, filename=None, dest_dir=None):
    """
    Converts a proteome list file in tabular format to the upid_gca file format
    used with the genome_downloader and genome_search pipelines

    input_file: A proteome-all.tab file downloaded from Uniprot's proteomes website
    filename: A name for the new file to be generated. Defaults to input_file filename
    if None
    dest_dir: A path to an output directory. If None, uses the location of the input
    file
    """

    input_fp = open(input_file, 'r')

    if filename is None:
        filename = os.path.basename(input_file).partition('.')[0]

    if dest_dir is None:
        dest_dir = os.path.split(input_file)[0]

    output_fp = open(os.path.join(dest_dir, filename + '.tsv'), 'w')

    for proteome in input_fp:
        fields = proteome.strip().split('\t')

        # mark any erroneous cases with  missing domains
        if len(fields) < 4 and fields[-1].find(',') == -1:
            domain = "N/A"
        else:
            domain = fields[3].split(',')[0].strip().lower()

        output_fp.write(fields[0] + '\t' + fields[2] + '\t' + domain + '\n')

    output_fp.close()

    Converts a proteome list file in tabular format to the upid_gca file format
    used with the genome_downloader and genome_search pipelines

    input_file: A proteome-all.tab file downloaded from Uniprot's proteomes website
    filename: A name for the new file to be generated. Defaults to input_file filename
    if None
    dest_dir: A path to an output directory. If None, uses the location of the input
    file
    
Converts a proteome list file in tabular format to the upid_gca file format
used with the genome_downloader and genome_search pipelines

A proteome-all.tab file downloaded from Uniprot's proteomes website
filename: A name for the new file to be generated. Defaults to input_file filename
if None
dest_dir: A path to an output directory. If None, uses the location of the input
file
Converts a proteome list file in tabular format to the upid_gca file format used with the genome_downloader and genome_search pipelines A proteome - all . tab file downloaded from Uniprot ' s proteomes website filename : A name for the new file to be generated . Defaults to input_file filename if None dest_dir : A path to an output directory . If None uses the location of the input file
def convert_proteome_list_to_upid_gca_file(input_file, filename=None, dest_dir=None):
    input_fp = open(input_file, 'r')
    if filename is None:
        filename = os.path.basename(input_file).partition('.')[0]
    if dest_dir is None:
        dest_dir = os.path.split(input_file)[0]
    output_fp = open(os.path.join(dest_dir, filename + '.tsv'), 'w')
    for proteome in input_fp:
        fields = proteome.strip().split('\t')
        if len(fields) < 4 and fields[-1].find(',') == -1:
            domain = "N/A"
        else:
            domain = fields[3].split(',')[0].strip().lower()
        output_fp.write(fields[0] + '\t' + fields[2] + '\t' + domain + '\n')
    output_fp.close()
def convert_proteome_list_to_upid_gca_file ( input_file , filename = None , dest_dir = None ) : input_fp = open ( input_file , 'r' ) if filename is None : filename = os . path . basename ( input_file ) . partition ( '.' ) [ 0 ] if dest_dir is None : dest_dir = os . path . split ( input_file ) [ 0 ] output_fp = open ( os . path . join ( dest_dir , filename + '.tsv' ) , 'w' ) for proteome in input_fp : fields = proteome . strip ( ) . split ( '\t' ) if len ( fields ) < 4 and fields [ - 1 ] . find ( ',' ) == - 1 : domain = "N/A" else : domain = fields [ 3 ] . split ( ',' ) [ 0 ] . strip ( ) . lower ( ) output_fp . write ( fields [ 0 ] + '\t' + fields [ 2 ] + '\t' + domain + '\n' ) output_fp . close ( )
Converts a proteome list file in tabular format to the upid_gca file format
used with the genome_downloader and genome_search pipelines
Converts a proteome list file in tabular format to the upid_gca file format used with the genome_downloader and genome_search pipelines
"""
    Converts a proteome list file in tabular format to the upid_gca file format
    used with the genome_downloader and genome_search pipelines

    input_file: A proteome-all.tab file downloaded from Uniprot's proteomes website
    filename: A name for the new file to be generated. Defaults to input_file filename
    if None
    dest_dir: A path to an output directory. If None, uses the location of the input
    file
    """ # mark any erroneous cases with  missing domains
input_file
filename
dest_dir