Mercurial > repos > galaxyp > fragpipe
comparison genericize_db.py @ 0:14785481da2b draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/fragpipe commit 905cc2be18669cffe9ac6c46fcd08b6857a67f4f
author | galaxyp |
---|---|
date | Wed, 10 Jul 2024 06:15:00 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:14785481da2b |
---|---|
1 #!/usr/bin/env python3 | |
2 # | |
3 # 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. | |
4 # | |
5 | |
6 import re | |
7 import sys | |
8 | |
9 input_db_file = sys.argv[1] | |
10 output_db_file = sys.argv[2] | |
11 | |
12 | |
13 def sub_header(line): | |
14 return re.sub(r'^>(?!sp\||tr\||db\||AP_|NP_|YP_|XP_|WP_|ENSP|UniRef|nxp|generic)', '>generic|', line) | |
15 | |
16 | |
17 with open(input_db_file) as in_file, open(output_db_file, 'w') as out_file: | |
18 for line in in_file: | |
19 out_file.write(sub_header(line)) |