RNApolis 0.4.1__tar.gz → 0.4.3__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.1/src/RNApolis.egg-info → rnapolis-0.4.3}/PKG-INFO +1 -1
  2. {rnapolis-0.4.1 → rnapolis-0.4.3}/setup.py +1 -1
  3. {rnapolis-0.4.1 → rnapolis-0.4.3/src/RNApolis.egg-info}/PKG-INFO +1 -1
  4. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/tertiary.py +24 -39
  5. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_bugfixes.py +23 -1
  6. {rnapolis-0.4.1 → rnapolis-0.4.3}/LICENSE +0 -0
  7. {rnapolis-0.4.1 → rnapolis-0.4.3}/README.md +0 -0
  8. {rnapolis-0.4.1 → rnapolis-0.4.3}/pyproject.toml +0 -0
  9. {rnapolis-0.4.1 → rnapolis-0.4.3}/setup.cfg +0 -0
  10. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/RNApolis.egg-info/SOURCES.txt +0 -0
  11. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/RNApolis.egg-info/dependency_links.txt +0 -0
  12. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/RNApolis.egg-info/entry_points.txt +0 -0
  13. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/RNApolis.egg-info/requires.txt +0 -0
  14. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/RNApolis.egg-info/top_level.txt +0 -0
  15. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/annotator.py +0 -0
  16. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/clashfinder.py +0 -0
  17. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/common.py +0 -0
  18. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/metareader.py +0 -0
  19. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/molecule_filter.py +0 -0
  20. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/motif_extractor.py +0 -0
  21. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/parser.py +0 -0
  22. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/rfam_folder.py +0 -0
  23. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/transformer.py +0 -0
  24. {rnapolis-0.4.1 → rnapolis-0.4.3}/src/rnapolis/util.py +0 -0
  25. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_annotator.py +0 -0
  26. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_common.py +0 -0
  27. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_metareader.py +0 -0
  28. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_parser.py +0 -0
  29. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_quadruplexes.py +0 -0
  30. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_rfam_folder.py +0 -0
  31. {rnapolis-0.4.1 → rnapolis-0.4.3}/tests/test_tertiary.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RNApolis
3
- Version: 0.4.1
3
+ Version: 0.4.3
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.1",
8
+ version="0.4.3",
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.1
3
+ Version: 0.4.3
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
@@ -497,42 +497,27 @@ class Mapping2D3D:
497
497
 
498
498
  @cached_property
499
499
  def strands_sequences(self) -> List[Tuple[str, str]]:
500
- nucleotides = [
501
- residue for residue in self.structure3d.residues if residue.is_nucleotide
502
- ]
500
+ nucleotides = list(filter(lambda r: r.is_nucleotide, self.structure3d.residues))
503
501
 
504
- if len(nucleotides) == 0:
502
+ if not nucleotides:
505
503
  return []
506
504
 
507
- result = []
508
- strand = [nucleotides[0]]
505
+ result = [(nucleotides[0].chain, [nucleotides[0].one_letter_name])]
509
506
 
510
507
  for i in range(1, len(nucleotides)):
511
- previous = strand[-1]
512
- current = nucleotides[i]
508
+ previous = nucleotides[i - 1]
509
+ residue = nucleotides[i]
513
510
 
514
- if previous.chain == current.chain and (
515
- self.find_gaps == False or previous.is_connected(current)
516
- ):
517
- strand.append(current)
511
+ if residue.chain != previous.chain:
512
+ result.append((residue.chain, [residue.one_letter_name]))
518
513
  else:
519
- result.append(
520
- (
521
- previous.chain,
522
- "".join([residue.one_letter_name for residue in strand]),
523
- )
524
- )
525
- strand = [current]
526
-
527
- if len(strand) > 0:
528
- result.append(
529
- (
530
- strand[0].chain,
531
- "".join([residue.one_letter_name for residue in strand]),
532
- )
533
- )
514
+ if self.find_gaps:
515
+ if not previous.is_connected(residue):
516
+ for k in range(residue.number - previous.number - 1):
517
+ result[-1][1].append("?")
518
+ result[-1][1].append(residue.one_letter_name)
534
519
 
535
- return result
520
+ return [(chain, "".join(sequence)) for chain, sequence in result]
536
521
 
537
522
  @cached_property
538
523
  def bpseq(self) -> BpSeq:
@@ -549,23 +534,23 @@ class Mapping2D3D:
549
534
  residue_map: Dict[Residue3D, int] = {}
550
535
  i = 1
551
536
 
552
- for j, residue in enumerate(self.structure3d.residues):
537
+ for j, residue in enumerate(
538
+ filter(lambda r: r.is_nucleotide, self.structure3d.residues)
539
+ ):
553
540
  if self.find_gaps and j > 0:
554
541
  previous = self.structure3d.residues[j - 1]
542
+
555
543
  if (
556
- previous.is_nucleotide
557
- and residue.is_nucleotide
558
- and previous.label
559
- and residue.label
560
- and previous.label.chain == residue.label.chain
544
+ not previous.is_connected(residue)
545
+ and previous.chain == residue.chain
561
546
  ):
562
- for k in range(residue.label.number - previous.label.number - 1):
547
+ for k in range(residue.number - previous.number - 1):
563
548
  result[i] = [i, "?", 0]
564
549
  i += 1
565
- if residue.is_nucleotide:
566
- result[i] = [i, residue.one_letter_name, 0]
567
- residue_map[residue] = i
568
- i += 1
550
+
551
+ result[i] = [i, residue.one_letter_name, 0]
552
+ residue_map[residue] = i
553
+ i += 1
569
554
 
570
555
  for base_pair in base_pairs:
571
556
  j = residue_map.get(base_pair.nt1_3d, None)
@@ -12,7 +12,7 @@ def test_1E7K():
12
12
  mapping = Mapping2D3D(
13
13
  structure3d, base_interaction.basePairs, base_interaction.stackings, True
14
14
  )
15
- assert len(mapping.strands_sequences) == 2
15
+ assert len(mapping.strands_sequences) == 1
16
16
 
17
17
 
18
18
  # in 1DFU the adjacent U and G seem to be base-pair like if you do not take into account angles
@@ -75,3 +75,25 @@ def test_6g90():
75
75
  sequence
76
76
  == "AUACUUACCUUAAGAUAUCAGAGGAGAUCAAGAAGUCCUACUGAUCAAACAUGCGCUUCCAAGAAGGACGUUAAGCAUUUAUCAUUGAACGUUCAUUGAACAUUGAUGCAAACUCCUUGGUCACACACACGCGGAAGGCGUGUUUGCUGACGUCCCUUGUUUCAAUCAUUGGUUAACUGAUUUUUGGGGCCCUUUGUUCUUCUGAGAAGUGACACCAAUUGGUGUUAGGGGAGCUGGGGCCUUUCAAAANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNUUUUGGAAGGUCUUGGUCGGGUGGAUCUUAUAAUUUUUGAUUUA"
77
77
  )
78
+
79
+ base_interactions = extract_base_interactions(structure3d)
80
+
81
+ # without gaps
82
+ mapping = Mapping2D3D(
83
+ structure3d, base_interactions.basePairs, base_interactions.stackings, False
84
+ )
85
+ assert (
86
+ mapping.bpseq.sequence
87
+ == mapping.dot_bracket.split("\n")[1]
88
+ == "AUACUUACCUUAAGAUAUCAGAGGAGAUCAAGAAGUCCUACUGAUCAAACAUGCGCUUCCAAGAAGGACGUUAAGCAUUUAUCAUUGAACGUUCAUUGAACAUUGAUGCAAACUCCUUGGUCACACACACGCGGAAGGCGUGUUUGCUGACGUCCCUUGUUUCAAUCAUUGGUUAACUGAUUUUUGGGGCCCUUUGUUCUUCUGAGAAGUGACACCAAUUGGUGUUAGGGGAGCUGGGGCCUUUCAAAANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNUUUUGGAAGGUCUUGGUCGGGUGGAUCUUAUAAUUUUUGAUUUA"
89
+ )
90
+
91
+ # with gaps
92
+ mapping = Mapping2D3D(
93
+ structure3d, base_interactions.basePairs, base_interactions.stackings, True
94
+ )
95
+ assert (
96
+ mapping.bpseq.sequence
97
+ == mapping.dot_bracket.split("\n")[1]
98
+ == "AUACUUACCUUAAGAUAUCAGAGGAGAUCAAGAAGUCCUACUGAUCAAACAUGCGCUUCCA?????AGAAGGACGUUAAGCAUUUAUCAUUGAAC???????GUUCAUUGAA??CAUUGAUGCAAACUCCUUGGUCACACACAC???????GCGGAAGGCGUGUUUGCUGACG???????UCCCUUGUUUCAAUCAUUGGUU?????????????????????????????????AACUGAUUUUUGGGGCCCUUUGUU?CUUCUG?????AGAAGU??GACACCAA???????UUGGUGUUAGGGGAGCUGGGGCCUUUCAAAANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNUUUUGGAAGGUCUUGGUCGGGUGGAUCUUAUAAUUUUUGAUUUA"
99
+ )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes