annotate fastaregexfinder.py @ 1:9a811adb714f draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
author iuc
date Wed, 25 Jan 2023 14:03:52 +0000
parents 269c627ae9f4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
1 #!/usr/bin/env python
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
2
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
3 import argparse
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
4 import operator
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
5 import re
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
6 import sys
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
7
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
8 VERSION = "0.1.1"
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
9
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
10 parser = argparse.ArgumentParser(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
11 description="""
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
12
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
13 DESCRIPTION
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
14
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
15 Search a fasta file for matches to a regex and return a bed file with the
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
16 coordinates of the match and the matched sequence itself.
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
17
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
18 Output bed file has columns:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
19 1. Name of fasta sequence (e.g. chromosome)
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
20 2. Start of the match
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
21 3. End of the match
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
22 4. ID of the match
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
23 5. Length of the match
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
24 6. Strand
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
25 7. Matched sequence as it appears on the forward strand
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
26
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
27 For matches on the reverse strand it is reported the start and end position on the
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
28 forward strand and the matched string on the forward strand (so the G4 'GGGAGGGT'
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
29 present on the reverse strand is reported as ACCCTCCC).
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
30
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
31 Note: Fasta sequences (chroms) are read in memory one at a time along with the
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
32 matches for that chromosome.
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
33 The order of the output is: chroms as they are found in the inut fasta, matches
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
34 sorted within chroms by positions.
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
35
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
36 EXAMPLE:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
37 ## Test data:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
38 echo '>mychr' > /tmp/mychr.fa
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
39 echo 'ACTGnACTGnACTGnTGAC' >> /tmp/mychr.fa
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
40
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
41 fastaRegexFinder.py -f /tmp/mychr.fa -r 'ACTG'
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
42 mychr 0 4 mychr_0_4_for 4 + ACTG
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
43 mychr 5 9 mychr_5_9_for 4 + ACTG
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
44 mychr 10 14 mychr_10_14_for 4 + ACTG
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
45
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
46 fastaRegexFinder.py -f /tmp/mychr.fa -r 'ACTG' --maxstr 3
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
47 mychr 0 4 mychr_0_4_for 4 + ACT[3,4]
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
48 mychr 5 9 mychr_5_9_for 4 + ACT[3,4]
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
49 mychr 10 14 mychr_10_14_for 4 + ACT[3,4]
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
50
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
51 less /tmp/mychr.fa | fastaRegexFinder.py -f - -r 'A\\w\\wGn'
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
52 mychr 0 5 mychr_0_5_for 5 + ACTGn
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
53 mychr 5 10 mychr_5_10_for 5 + ACTGn
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
54 mychr 10 15 mychr_10_15_for 5 + ACTGn
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
55
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
56 DOWNLOAD
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
57 fastaRegexFinder.py is hosted at https://github.com/dariober/bioinformatics-cafe/tree/master/fastaRegexFinder
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
58
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
59 """,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
60 formatter_class=argparse.RawTextHelpFormatter,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
61 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
62
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
63 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
64 "--fasta",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
65 "-f",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
66 type=str,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
67 help="Input fasta file to search. Use '-' to read the file from stdin.",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
68 required=True,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
69 )
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
70
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
71 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
72 "--regex",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
73 "-r",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
74 type=str,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
75 help="""Regex to be searched in the fasta input.
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
76 Matches to the reverse complement will have - strand.
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
77 The default regex is '([gG]{3,}\\w{1,7}){3,}[gG]{3,}' which searches
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
78 for G-quadruplexes.""",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
79 default="([gG]{3,}\\w{1,7}){3,}[gG]{3,}",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
80 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
81
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
82 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
83 "--matchcase",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
84 "-m",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
85 action="store_true",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
86 help="""Match case while searching for matches. Default is
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
87 to ignore case (I.e. 'ACTG' will match 'actg').
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
88 """,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
89 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
90
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
91 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
92 "--noreverse",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
93 action="store_true",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
94 help="""Do not search the reverse complement of the input fasta.
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
95 Use this flag to search protein sequences.""",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
96 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
97
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
98 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
99 "--maxstr",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
100 type=int,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
101 required=False,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
102 default=10000,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
103 help="""Maximum length of the match to report in the 7th column of the output.
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
104 Default is to report up to 10000nt.
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
105 Truncated matches are reported as <ACTG...ACTG>[<maxstr>,<tot length>]
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
106 """,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
107 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
108
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
109 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
110 "--seqnames",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
111 "-s",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
112 type=str,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
113 nargs="+",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
114 default=[None],
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
115 required=False,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
116 help="""List of fasta sequences in --fasta to
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
117 search. E.g. use --seqnames chr1 chr2 chrM to search only these crhomosomes.
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
118 Default is to search all the sequences in input.
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
119 """,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
120 )
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
121 parser.add_argument(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
122 "--quiet",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
123 "-q",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
124 action="store_true",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
125 help="""Do not print progress report (i.e. sequence names as they are scanned).
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
126 """,
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
127 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
128
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
129
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
130 parser.add_argument("--version", "-v", action="version", version="%(prog)s " + VERSION)
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
131
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
132
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
133 args = parser.parse_args()
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
134
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
135 " --------------------------[ Check and parse arguments ]---------------------- "
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
136
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
137 if args.matchcase:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
138 flag = 0
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
139 else:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
140 flag = re.IGNORECASE
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
141
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
142 " ------------------------------[ Functions ]--------------------------------- "
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
143
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
144
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
145 def sort_table(table, cols):
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
146 """Code to sort list of lists
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
147 see http://www.saltycrane.com/blog/2007/12/how-to-sort-table-by-columns-in-python/
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
148
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
149 sort a table by multiple columns
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
150 table: a list of lists (or tuple of tuples) where each inner list
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
151 represents a row
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
152 cols: a list (or tuple) specifying the column numbers to sort by
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
153 e.g. (1,0) would sort by column 1, then by column 0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
154 """
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
155 for col in reversed(cols):
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
156 table = sorted(table, key=operator.itemgetter(col))
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
157 return table
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
158
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
159
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
160 def trimMatch(x, n):
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
161 """Trim the string x to be at most length n. Trimmed matches will be reported
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
162 with the syntax ACTG[a,b] where Ns are the beginning of x, a is the length of
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
163 the trimmed strng (e.g 4 here) and b is the full length of the match
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
164 EXAMPLE:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
165 trimMatch('ACTGNNNN', 4)
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
166 >>>'ACTG[4,8]'
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
167 trimMatch('ACTGNNNN', 8)
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
168 >>>'ACTGNNNN'
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
169 """
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
170 if len(x) > n and n is not None:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
171 m = x[0:n] + "[" + str(n) + "," + str(len(x)) + "]"
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
172 else:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
173 m = x
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
174 return m
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
175
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
176
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
177 def revcomp(x):
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
178 """Reverse complement string x. Ambiguity codes are handled and case conserved.
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
179
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
180 Test
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
181 x= 'ACGTRYSWKMBDHVNacgtryswkmbdhvn'
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
182 revcomp(x)
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
183 """
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
184 compdict = {
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
185 "A": "T",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
186 "C": "G",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
187 "G": "C",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
188 "T": "A",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
189 "R": "Y",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
190 "Y": "R",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
191 "S": "W",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
192 "W": "S",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
193 "K": "M",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
194 "M": "K",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
195 "B": "V",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
196 "D": "H",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
197 "H": "D",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
198 "V": "B",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
199 "N": "N",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
200 "a": "t",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
201 "c": "g",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
202 "g": "c",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
203 "t": "a",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
204 "r": "y",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
205 "y": "r",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
206 "s": "w",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
207 "w": "s",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
208 "k": "m",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
209 "m": "k",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
210 "b": "v",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
211 "d": "h",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
212 "h": "d",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
213 "v": "b",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
214 "n": "n",
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
215 }
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
216 xrc = []
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
217 for n in x:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
218 xrc.append(compdict[n])
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
219 xrc = "".join(xrc)[::-1]
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
220 return xrc
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
221
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
222
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
223 # -----------------------------------------------------------------------------
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
224
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
225 psq_re_f = re.compile(args.regex, flags=flag)
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
226 # psq_re_r= re.compile(regexrev)
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
227
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
228 if args.fasta != "-":
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
229 ref_seq_fh = open(args.fasta)
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
230 else:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
231 ref_seq_fh = sys.stdin
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
232
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
233 ref_seq = []
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
234 line = (ref_seq_fh.readline()).strip()
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
235 chr = re.sub("^>", "", line)
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
236 line = (ref_seq_fh.readline()).strip()
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
237 gquad_list = []
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
238 while True:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
239 if not args.quiet:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
240 sys.stderr.write("Processing %s\n" % (chr))
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
241 while line.startswith(">") is False:
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
242 ref_seq.append(line)
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
243 line = (ref_seq_fh.readline()).strip()
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
244 if line == "":
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
245 break
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
246 ref_seq = "".join(ref_seq)
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
247 if args.seqnames == [None] or chr in args.seqnames:
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
248 for m in re.finditer(psq_re_f, ref_seq):
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
249 matchstr = trimMatch(m.group(0), args.maxstr)
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
250 quad_id = str(chr) + "_" + str(m.start()) + "_" + str(m.end()) + "_for"
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
251 gquad_list.append(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
252 [chr, m.start(), m.end(), quad_id, len(m.group(0)), "+", matchstr]
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
253 )
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
254 if args.noreverse is False:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
255 ref_seq = revcomp(ref_seq)
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
256 seqlen = len(ref_seq)
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
257 for m in re.finditer(psq_re_f, ref_seq):
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
258 matchstr = trimMatch(revcomp(m.group(0)), args.maxstr)
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
259 mstart = seqlen - m.end()
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
260 mend = seqlen - m.start()
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
261 quad_id = str(chr) + "_" + str(mstart) + "_" + str(mend) + "_rev"
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
262 gquad_list.append(
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
263 [chr, mstart, mend, quad_id, len(m.group(0)), "-", matchstr]
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
264 )
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
265 gquad_sorted = sort_table(gquad_list, (1, 2, 3))
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
266 gquad_list = []
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
267 for xline in gquad_sorted:
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
268 xline = "\t".join([str(x) for x in xline])
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
269 print(xline)
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
270 chr = re.sub("^>", "", line)
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
271 ref_seq = []
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
272 line = (ref_seq_fh.readline()).strip()
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
273 if line == "":
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
274 break
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
275
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
276 # gquad_sorted= sort_table(gquad_list, (0,1,2,3))
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
277 #
1
9a811adb714f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bioinformatics-cafe commit c318cd3f894f89c13d7eb257678673da70f72212
iuc
parents: 0
diff changeset
278 # for line in gquad_sorted:
0
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
279 # line= '\t'.join([str(x) for x in line])
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
280 # print(line)
269c627ae9f4 planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/fasta_regex_finder commit 8e118a4d24047e2c62912b962e854f789d6ff559
mbernt
parents:
diff changeset
281 sys.exit()