@@ -4,7 +4,6 @@ import { BackBoneBondSequenceRenderer } from 'application/render/renderers/seque
4
4
import { PolymerBondSequenceRenderer } from 'application/render/renderers/sequence/PolymerBondSequenceRenderer' ;
5
5
import { BaseMonomer } from 'domain/entities/BaseMonomer' ;
6
6
import { DrawingEntity } from 'domain/entities/DrawingEntity' ;
7
- import { Phosphate } from 'domain/entities/Phosphate' ;
8
7
import { RNABase } from 'domain/entities/RNABase' ;
9
8
import { Sugar } from 'domain/entities/Sugar' ;
10
9
import { Vec2 } from 'domain/entities/vec2' ;
@@ -80,50 +79,36 @@ export class PolymerBond extends DrawingEntity {
80
79
81
80
public get isBackboneChainConnection ( ) : boolean {
82
81
// Variants:
83
- // • Sugar [R2] — [R1] Phosphate
84
- // • Sugar [R1] — [R2] Phosphate
85
- // • Phosphate [R2] — [R1] Sugar
86
- // • Phosphate [R1] — [R2] Sugar
82
+ // • Not RNA base [R2] — [R1] Not RNA base
87
83
// • Sugar [R3] — [R1] RNA base
88
- // • RNA base [R1] — [R3] Sugar
89
84
if ( ! this . secondMonomer ) {
90
85
return true ;
91
86
}
92
87
93
- let sugarMonomer : Sugar ;
94
- let anotherMonomer : BaseMonomer ;
95
- if ( this . firstMonomer instanceof Sugar ) {
96
- sugarMonomer = this . firstMonomer ;
97
- anotherMonomer = this . secondMonomer ;
98
- } else if ( this . secondMonomer instanceof Sugar ) {
99
- sugarMonomer = this . secondMonomer ;
100
- anotherMonomer = this . firstMonomer ;
101
- } else {
102
- return false ;
103
- }
104
-
105
- const sugarMonomerAttachmentPoint =
106
- sugarMonomer . getAttachmentPointByBond ( this ) ;
107
- const anotherMonomerAttachmentPoint =
108
- anotherMonomer . getAttachmentPointByBond ( this ) ;
109
- if ( ! sugarMonomerAttachmentPoint || ! anotherMonomerAttachmentPoint ) {
88
+ const firstMonomer = this . firstMonomer ;
89
+ const secondMonomer = this . secondMonomer ;
90
+ const firstMonomerAttachmentPoint =
91
+ firstMonomer . getAttachmentPointByBond ( this ) ;
92
+ const secondMonomerAttachmentPoint =
93
+ secondMonomer . getAttachmentPointByBond ( this ) ;
94
+ if ( ! firstMonomerAttachmentPoint || ! secondMonomerAttachmentPoint ) {
110
95
return true ;
111
96
}
112
97
113
- const thereArePhosphateAndSugar = anotherMonomer instanceof Phosphate ;
114
- const thereAreR1AndR2 =
115
- ( sugarMonomerAttachmentPoint === AttachmentPointName . R2 &&
116
- anotherMonomerAttachmentPoint === AttachmentPointName . R1 ) ||
117
- ( sugarMonomerAttachmentPoint === AttachmentPointName . R1 &&
118
- anotherMonomerAttachmentPoint === AttachmentPointName . R2 ) ;
119
- if ( thereArePhosphateAndSugar && thereAreR1AndR2 ) {
98
+ if (
99
+ firstMonomerAttachmentPoint === AttachmentPointName . R2 &&
100
+ secondMonomerAttachmentPoint === AttachmentPointName . R1 &&
101
+ ! ( firstMonomer instanceof RNABase ) &&
102
+ ! ( secondMonomer instanceof RNABase )
103
+ ) {
120
104
return true ;
121
105
}
122
106
123
107
return (
124
- sugarMonomerAttachmentPoint === AttachmentPointName . R3 &&
125
- anotherMonomer instanceof RNABase &&
126
- anotherMonomerAttachmentPoint === AttachmentPointName . R1
108
+ firstMonomer instanceof Sugar &&
109
+ firstMonomerAttachmentPoint === AttachmentPointName . R3 &&
110
+ secondMonomer instanceof RNABase &&
111
+ secondMonomerAttachmentPoint === AttachmentPointName . R1
127
112
) ;
128
113
}
129
114
0 commit comments