RNApolis 0.4.1__py3-none-any.whl → 0.4.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -6,12 +6,12 @@ rnapolis/molecule_filter.py,sha256=hB6-nXgjmw7FAsQ3bj0cZ2FvuW2I1PXunEfcdwEUB1o,7
6
6
  rnapolis/motif_extractor.py,sha256=duHvpi9Ulcny9K60E6VBpz5RpJZw-KdTB4_Ph0iP478,774
7
7
  rnapolis/parser.py,sha256=wCA9rXqt51iLECgeBqOShFpuT8JwanNkHYD5uXYvLzU,13988
8
8
  rnapolis/rfam_folder.py,sha256=SjiiyML_T1__saruFwSMJEoQ7Y55GIU8ktS8ZUn5-fw,11111
9
- rnapolis/tertiary.py,sha256=qk1te8GPDuvQsnm4rTiw96VDYyNoO5x4IPf98zDzxPw,20824
9
+ rnapolis/tertiary.py,sha256=kysCb3U93Cpxxsfq5uwFxvcI_biwMiRJgWsNZxrXcaA,20501
10
10
  rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
11
11
  rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
12
- RNApolis-0.4.1.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
- RNApolis-0.4.1.dist-info/METADATA,sha256=EayMQbE4Y5raff-7pFMmeh4EB81JaLEEMrbvEA4mbAk,54322
14
- RNApolis-0.4.1.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
15
- RNApolis-0.4.1.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
- RNApolis-0.4.1.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
- RNApolis-0.4.1.dist-info/RECORD,,
12
+ RNApolis-0.4.3.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
+ RNApolis-0.4.3.dist-info/METADATA,sha256=24AO4oRKx840RqJLNOF_SrT4xHNtu26s0Nx3URw0NZI,54322
14
+ RNApolis-0.4.3.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
15
+ RNApolis-0.4.3.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
+ RNApolis-0.4.3.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
+ RNApolis-0.4.3.dist-info/RECORD,,
rnapolis/tertiary.py CHANGED
@@ -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)