New upstream version 2.9.3+ds
Sascha Steinbiss
7 years ago
0 | 0 |
import tempfile
|
|
1 |
import re
|
1 | 2 |
import time
|
2 | 3 |
import os
|
3 | 4 |
import shutil
|
|
78 | 79 |
def _rename_seqs_in_fasta(cls, infile, outfile):
|
79 | 80 |
f = pyfastaq.utils.open_file_write(outfile)
|
80 | 81 |
file_reader = pyfastaq.sequences.file_reader(infile)
|
|
82 |
nodot_regex = re.compile(r'^.*(?P<separator>[^.0-9])[0-9]+$')
|
81 | 83 |
|
82 | 84 |
for seq in file_reader:
|
83 | |
seq.id = seq.id.replace('_', '.').replace('-', '.')
|
|
85 |
if seq.id.startswith('Oxf.'):
|
|
86 |
seq.id = 'Oxf_' + seq.id[4:]
|
|
87 |
|
|
88 |
regex_match = nodot_regex.match(seq.id)
|
|
89 |
if regex_match is not None:
|
|
90 |
seq.id = '.'.join(seq.id.rsplit(regex_match.groupdict()['separator'], maxsplit=1))
|
|
91 |
|
84 | 92 |
print(seq, file=f)
|
85 | 93 |
|
86 | 94 |
pyfastaq.utils.close(f)
|
3 | 3 |
AAAA
|
4 | 4 |
>gene.3
|
5 | 5 |
CCCC
|
|
6 |
>foo_gene.4
|
|
7 |
TTTT
|
|
8 |
>Oxf_gltA.42
|
|
9 |
A
|
|
10 |
>Oxf_gltA.43
|
|
11 |
C
|
|
12 |
>Oxf_gltA.44
|
|
13 |
G
|
|
14 |
>Oxf_gltA.45
|
|
15 |
T
|
3 | 3 |
AAAA
|
4 | 4 |
>gene.3
|
5 | 5 |
CCCC
|
|
6 |
>foo_gene.4
|
|
7 |
TTTT
|
|
8 |
>Oxf.gltA.42
|
|
9 |
A
|
|
10 |
>Oxf.gltA-43
|
|
11 |
C
|
|
12 |
>Oxf.gltA_44
|
|
13 |
G
|
|
14 |
>Oxf.gltA?45
|
|
15 |
T
|
54 | 54 |
setup(
|
55 | 55 |
ext_modules=[minimap_mod, fermilite_mod, vcfcall_mod],
|
56 | 56 |
name='ariba',
|
57 | |
version='2.9.2',
|
|
57 |
version='2.9.3',
|
58 | 58 |
description='ARIBA: Antibiotic Resistance Identification By Assembly',
|
59 | 59 |
packages = find_packages(),
|
60 | 60 |
package_data={'ariba': ['test_run_data/*']},
|