RNApolis 0.4.9__tar.gz → 0.4.10__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. {rnapolis-0.4.9/src/RNApolis.egg-info → rnapolis-0.4.10}/PKG-INFO +1 -1
  2. {rnapolis-0.4.9 → rnapolis-0.4.10}/setup.py +1 -1
  3. {rnapolis-0.4.9 → rnapolis-0.4.10/src/RNApolis.egg-info}/PKG-INFO +1 -1
  4. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/common.py +25 -0
  5. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/motif_extractor.py +12 -0
  6. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_common.py +34 -0
  7. {rnapolis-0.4.9 → rnapolis-0.4.10}/LICENSE +0 -0
  8. {rnapolis-0.4.9 → rnapolis-0.4.10}/README.md +0 -0
  9. {rnapolis-0.4.9 → rnapolis-0.4.10}/pyproject.toml +0 -0
  10. {rnapolis-0.4.9 → rnapolis-0.4.10}/setup.cfg +0 -0
  11. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/RNApolis.egg-info/SOURCES.txt +0 -0
  12. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/RNApolis.egg-info/dependency_links.txt +0 -0
  13. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/RNApolis.egg-info/entry_points.txt +0 -0
  14. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/RNApolis.egg-info/requires.txt +0 -0
  15. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/RNApolis.egg-info/top_level.txt +0 -0
  16. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/annotator.py +0 -0
  17. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/clashfinder.py +0 -0
  18. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/metareader.py +0 -0
  19. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/molecule_filter.py +0 -0
  20. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/parser.py +0 -0
  21. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/rfam_folder.py +0 -0
  22. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/tertiary.py +0 -0
  23. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/transformer.py +0 -0
  24. {rnapolis-0.4.9 → rnapolis-0.4.10}/src/rnapolis/util.py +0 -0
  25. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_annotator.py +0 -0
  26. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_bugfixes.py +0 -0
  27. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_metareader.py +0 -0
  28. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_parser.py +0 -0
  29. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_quadruplexes.py +0 -0
  30. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_rfam_folder.py +0 -0
  31. {rnapolis-0.4.9 → rnapolis-0.4.10}/tests/test_tertiary.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RNApolis
3
- Version: 0.4.9
3
+ Version: 0.4.10
4
4
  Summary: A Python library containing RNA-related bioinformatics functions and classes
5
5
  Home-page: https://github.com/tzok/rnapolis-py
6
6
  Author: Tomasz Zok
@@ -5,7 +5,7 @@ with open("README.md") as f:
5
5
 
6
6
  setup(
7
7
  name="RNApolis",
8
- version="0.4.9",
8
+ version="0.4.10",
9
9
  packages=["rnapolis"],
10
10
  package_dir={"": "src"},
11
11
  author="Tomasz Zok",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RNApolis
3
- Version: 0.4.9
3
+ Version: 0.4.10
4
4
  Summary: A Python library containing RNA-related bioinformatics functions and classes
5
5
  Home-page: https://github.com/tzok/rnapolis-py
6
6
  Author: Tomasz Zok
@@ -940,6 +940,27 @@ class BpSeq:
940
940
  solutions.add(self.__make_dot_bracket(regions, orders))
941
941
  return list(solutions)
942
942
 
943
+ def without_pseudoknots(self):
944
+ return BpSeq.from_dotbracket(self.dot_bracket.without_pseudoknots())
945
+
946
+ def without_isolated(self):
947
+ stems, _, _, _ = self.elements
948
+ to_unpair = []
949
+
950
+ for stem in stems:
951
+ if stem.strand5p.first == stem.strand5p.last:
952
+ to_unpair.append(stem.strand5p.first - 1)
953
+ to_unpair.append(stem.strand3p.first - 1)
954
+
955
+ if not to_unpair:
956
+ return self
957
+
958
+ entries = self.entries.copy()
959
+ for i in to_unpair:
960
+ entries[i].pair = 0
961
+
962
+ return BpSeq(entries)
963
+
943
964
 
944
965
  @dataclass
945
966
  class DotBracket:
@@ -990,6 +1011,10 @@ class DotBracket:
990
1011
  def __hash__(self) -> int:
991
1012
  return hash((self.sequence, self.structure))
992
1013
 
1014
+ def without_pseudoknots(self):
1015
+ structure = re.sub(r"[\[\]\{\}\<\>A-Za-z]", ".", self.structure)
1016
+ return DotBracket(self.sequence, structure)
1017
+
993
1018
 
994
1019
  @dataclass
995
1020
  class MultiStrandDotBracket(DotBracket):
@@ -9,6 +9,12 @@ def main():
9
9
  parser = argparse.ArgumentParser()
10
10
  parser.add_argument("--dbn", help="path to DotBracket file")
11
11
  parser.add_argument("--bpseq", help="path to BpSeq file")
12
+ parser.add_argument(
13
+ "--remove-pseudoknots", action="store_true", help="remove pseudoknots"
14
+ )
15
+ parser.add_argument(
16
+ "--remove-isolated", action="store_true", help="remove isolated base pairs"
17
+ )
12
18
  args = parser.parse_args()
13
19
 
14
20
  if args.dbn:
@@ -19,6 +25,12 @@ def main():
19
25
  parser.print_help()
20
26
  return
21
27
 
28
+ if args.remove_isolated:
29
+ bpseq = bpseq.without_isolated()
30
+
31
+ if args.remove_pseudoknots:
32
+ bpseq = bpseq.without_pseudoknots()
33
+
22
34
  print(f"Full dot-bracket:\n{bpseq.dot_bracket}")
23
35
  stems, single_strands, hairpins, loops = bpseq.elements
24
36
 
@@ -199,3 +199,37 @@ def test_high_level_pseudoknot():
199
199
  dot_bracket.structure
200
200
  == "([{<" + string.ascii_uppercase + ")]}>" + string.ascii_lowercase
201
201
  )
202
+
203
+
204
+ def test_bpseq_removal_options():
205
+ sequence = (
206
+ "GCGGAUUUAGCUCAGUUGGGAGAGCGCCAGACUGAAGAUCUGGAGGUCCUGUGUUCCAUCCACAGAAUUCGCACCA"
207
+ )
208
+ structure = (
209
+ "(((((((..((((....[[..)))).((((..(...)..)))).....(((((..]]...))))))))))))...."
210
+ )
211
+
212
+ bpseq = BpSeq.from_dotbracket(DotBracket(sequence, structure))
213
+ assert bpseq.dot_bracket.sequence == sequence
214
+ assert bpseq.dot_bracket.structure == structure
215
+
216
+ bpseq_without_isolated = bpseq.without_isolated()
217
+ assert bpseq_without_isolated.dot_bracket.sequence == sequence
218
+ assert (
219
+ bpseq_without_isolated.dot_bracket.structure
220
+ == "(((((((..((((....[[..)))).((((.........)))).....(((((..]]...))))))))))))...."
221
+ )
222
+
223
+ bpseq_without_pseudoknots = bpseq.without_pseudoknots()
224
+ assert bpseq_without_pseudoknots.dot_bracket.sequence == sequence
225
+ assert (
226
+ bpseq_without_pseudoknots.dot_bracket.structure
227
+ == "(((((((..((((........)))).((((..(...)..)))).....(((((.......))))))))))))...."
228
+ )
229
+
230
+ bpseq_without_both = bpseq.without_isolated().without_pseudoknots()
231
+ assert bpseq_without_both.dot_bracket.sequence == sequence
232
+ assert (
233
+ bpseq_without_both.dot_bracket.structure
234
+ == "(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))...."
235
+ )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes