Mercurial > repos > iuc > amas_replicate
annotate check_interleaved.py @ 0:24431ccf6352 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
| author | iuc |
|---|---|
| date | Tue, 02 Dec 2025 09:26:59 +0000 |
| parents | |
| children |
| rev | line source |
|---|---|
|
0
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
1 """ |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
2 Helper script to check if AMAS input files are interleaved. |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
3 """ |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
4 import argparse |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
5 import re |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
6 import sys |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
7 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
8 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
9 def check_phylip_interleaved(filepath): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
10 """Check if PHYLIP file is interleaved.""" |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
11 with open(filepath, encoding='utf-8') as f: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
12 # First line is header: ntax nchar |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
13 header = next(f).strip().split() |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
14 ntax = int(header[0]) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
15 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
16 for idx, line in enumerate(f, 1): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
17 if line.strip(): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
18 if idx > ntax: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
19 return True |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
20 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
21 return False |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
22 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
23 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
24 def check_nexus_interleaved(filepath): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
25 """Check if NEXUS file is interleaved.""" |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
26 in_data_block = False |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
27 in_matrix = False |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
28 ntax = None |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
29 seq_lines = 0 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
30 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
31 with open(filepath, encoding='utf-8') as f: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
32 for line in f: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
33 content = line.strip().lower() |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
34 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
35 if not content: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
36 continue |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
37 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
38 if in_matrix: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
39 if content == 'end;': |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
40 return seq_lines != ntax if ntax else False |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
41 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
42 if content != ';': |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
43 seq_lines += 1 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
44 if ntax and seq_lines > ntax: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
45 return True |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
46 continue |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
47 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
48 if not in_data_block: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
49 if content.startswith('begin'): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
50 words = content.split() |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
51 if len(words) > 1 and ( |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
52 words[1].startswith('data') |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
53 or words[1].startswith('characters')): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
54 in_data_block = True |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
55 continue |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
56 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
57 if content.startswith('dimensions') and ntax is None: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
58 match = re.search(r'ntax=(\d+)', content) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
59 if match: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
60 ntax = int(match.group(1)) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
61 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
62 elif content.startswith('format'): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
63 if re.search(r'\binterleave(?:;|=yes;?)?\b', content): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
64 return True |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
65 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
66 elif content.startswith('matrix'): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
67 in_matrix = True |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
68 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
69 return False |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
70 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
71 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
72 def check_fasta_interleaved(filepath): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
73 """FASTA files are not interleaved.""" |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
74 return False |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
75 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
76 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
77 def main(): |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
78 parser = argparse.ArgumentParser( |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
79 description='Check if AMAS input files are interleaved' |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
80 ) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
81 parser.add_argument('input_files', nargs='+', help='Input sequence files') |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
82 parser.add_argument('--format', required=True, |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
83 choices=['fasta', 'phylip', 'nexus'], |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
84 help='Input format') |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
85 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
86 args = parser.parse_args() |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
87 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
88 interleaved_status = [] |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
89 for filepath in args.input_files: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
90 if args.format == 'phylip': |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
91 is_interleaved = check_phylip_interleaved(filepath) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
92 elif args.format == 'nexus': |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
93 is_interleaved = check_nexus_interleaved(filepath) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
94 else: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
95 is_interleaved = check_fasta_interleaved(filepath) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
96 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
97 interleaved_status.append(is_interleaved) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
98 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
99 interleaved_status = list(set(interleaved_status)) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
100 if len(interleaved_status) > 1: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
101 raise Exception("Error: Input files are a mix of interleaved/sequential formats") |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
102 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
103 if interleaved_status[0]: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
104 print(f"{args.format}-int") |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
105 else: |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
106 print(args.format) |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
107 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
108 return 0 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
109 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
110 |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
111 if __name__ == '__main__': |
|
24431ccf6352
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/amas commit 158ec0e635067d354c425baf14b95cb616fd93c4
iuc
parents:
diff
changeset
|
112 sys.exit(main()) |
