Mercurial > repos > galaxyp > fragpipe
view genericize_db.py @ 7:b4f6df8fa89b draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/fragpipe commit 9d8b2338a6a513124bc58223637ee4c5813e0bb4
author | galaxyp |
---|---|
date | Wed, 01 Oct 2025 22:20:54 +0000 |
parents | 41990c43f371 |
children |
line wrap: on
line source
#!/usr/bin/env python3 # # Prefixes sequence headers in the input FASTA file that are not formatted according to the UniProt, NCBI, or ENSEMBL formats with '>generic|' to avoid being misinterpreted by Philosopher. # import re import sys input_db_file = sys.argv[1] output_db_file = sys.argv[2] def sub_header(line): return re.sub(r'^>(?!sp\||tr\||db\||AP_|NP_|YP_|XP_|WP_|ENSP|UniRef|nxp|generic)', '>generic|', line) with open(input_db_file) as in_file, open(output_db_file, 'w') as out_file: for line in in_file: out_file.write(sub_header(line))