@rnacanvas/search 1.5.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,37 +12,7 @@ All exports of this package can be accessed as named imports.
12
12
 
13
13
  ```javascript
14
14
  // some example imports
15
- import { Motif, SequenceCharacter } from '@rnacanvas/search';
16
- ```
17
-
18
- ## `class Motif`
19
-
20
- Represents a motif.
21
-
22
- ```javascript
23
- var CUGCCA = new Motif('CUGCCA');
24
-
25
- CUGCCA.toString(); // "CUGCCA"
26
-
27
- // a single character motif
28
- var A = new Motif('A');
29
-
30
- A.toString(); // "A"
31
-
32
- // empty motifs are accepted
33
- var emptyMotif = new Motif('');
34
-
35
- emptyMotif.toString(); // ""
36
- ```
37
-
38
- ### `toString()`
39
-
40
- Returns the motif as a string.
41
-
42
- ```javascript
43
- var CUGCCA = new Motif('CUGCCA');
44
-
45
- CUGCCA.toString(); // "CUGCCA"
15
+ import { removeGapCharacters, SequenceCharacter } from '@rnacanvas/search';
46
16
  ```
47
17
 
48
18
  ## `function removeGapCharacters()`
@@ -229,3 +199,41 @@ A.complements(''); // throws
229
199
  A.complements('AG'); // throws
230
200
  A.complements('asdf'); // throws
231
201
  ```
202
+
203
+ ## `function isWobblePair()`
204
+
205
+ Returns `true` if the two input characters form a `G:U` or `G:T` pair.
206
+
207
+ ```javascript
208
+ isWobblePair('G', 'U'); // true
209
+ isWobblePair('G', 'T'); // true
210
+
211
+ isWobblePair('A', 'U'); // false
212
+ isWobblePair('G', 'C'); // false
213
+
214
+ // order doesn't matter
215
+ isWobblePair('U', 'G'); // true
216
+
217
+ // case doesn't matter
218
+ isWobblePair('g', 'u'); // true
219
+
220
+ var G = new SequenceCharacter('G');
221
+ var U = new SequenceCharacter('U');
222
+
223
+ // handles sequence character instances
224
+ isWobblePair(G, U); // true
225
+
226
+ var A = new SequenceCharacter('A');
227
+
228
+ isWobblePair(A, U); // false
229
+ ```
230
+
231
+ Returns `false` for empty strings
232
+ and strings containing more than one character.
233
+
234
+ ```javascript
235
+ isWobblePair('G', ''); // false
236
+
237
+ // each string must be a single character
238
+ isWobblePair('G', 'UT'); // false
239
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"SequenceCharacter.d.ts","sourceRoot":"","sources":["../src/SequenceCharacter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,iBAAiB;;gBAGhB,SAAS,EAAE,MAAM;IAU7B,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,cAAc,EAAE,iBAAiB,GAAG,MAAM,GAAG,OAAO;IAkC5D,WAAW,CAAC,cAAc,EAAE,iBAAiB,GAAG,MAAM,GAAG,OAAO;CAiCjE"}
1
+ {"version":3,"file":"SequenceCharacter.d.ts","sourceRoot":"","sources":["../src/SequenceCharacter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,iBAAiB;;gBAGhB,SAAS,EAAE,MAAM;IAU7B,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,cAAc,EAAE,iBAAiB,GAAG,MAAM,GAAG,OAAO;IAgC5D,WAAW,CAAC,cAAc,EAAE,iBAAiB,GAAG,MAAM,GAAG,OAAO;CA+BjE"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { Motif } from './Motif';
2
- export { Motif };
3
1
  import { removeGapCharacters } from './removeGapCharacters';
4
2
  export { removeGapCharacters };
5
3
  import { SequenceCharacter } from './SequenceCharacter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.search=t():e.search=t()}(this,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Motif:()=>o,SequenceCharacter:()=>c,removeGapCharacters:()=>n});var r;class o{constructor(e){r.set(this,void 0),function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,r):n?n.value=r:t.set(e,r)}(this,r,e,"f")}toString(){return function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)}(this,r,"f")}}function n(e){return e.replace(/[\.-]/g,"")}r=new WeakMap;var a,i=function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)};class c{constructor(e){if(a.set(this,void 0),0==e.length)throw new Error("Character cannot be an empty string.");if(e.length>1)throw new Error("Character must be a single character.");!function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,r):n?n.value=r:t.set(e,r)}(this,a,e,"f")}toString(){return i(this,a,"f")}matches(e){var t,r;if("string"!=typeof e&&(e=e.toString()),0==e.length)throw new Error("Other character cannot be an empty string.");if(e.length>1)throw new Error("Other character cannot be multiple characters.");let o=i(this,a,"f").toUpperCase();return e=e.toUpperCase(),!(!s.includes(o)||!s.includes(e))||!s.includes(o)&&!s.includes(e)&&("N"===o&&!s.includes(e)||"N"===e&&!s.includes(o)||(o in l?null!==(r=null===(t=l[o])||void 0===t?void 0:t.includes(e))&&void 0!==r&&r:o===e))}complements(e){var t,r;if("string"!=typeof e&&(e=e.toString()),0==e.length)throw new Error("Other character cannot be an empty string.");if(e.length>1)throw new Error("Other character cannot be multiple characters.");let o=i(this,a,"f").toUpperCase();return e=e.toUpperCase(),!(!s.includes(o)||!s.includes(e))||!s.includes(o)&&!s.includes(e)&&("N"===o&&!s.includes(e)||"N"===e&&!s.includes(o)||o in h&&null!==(r=null===(t=h[o])||void 0===t?void 0:t.includes(e))&&void 0!==r&&r)}}a=new WeakMap;const s=[...".-"],l={A:[..."A"],C:[..."C"],G:[..."G"],U:[..."UT"],T:[..."TU"],R:[..."AG"],Y:[..."CUT"],S:[..."GC"],W:[..."AUT"],K:[..."GUT"],M:[..."AC"],B:[..."CGUTYSK"],D:[..."AGUTRWK"],H:[..."ACUTYWM"],V:[..."ACGRSM"]},h={A:[..."UT"],C:[..."G"],G:[..."CUTY"],U:[..."AGR"],T:[..."AGR"],R:[..."UT"],Y:[..."G"]};return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.search=t():e.search=t()}(this,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e.replace(/[\.-]/g,"")}e.r(t),e.d(t,{SequenceCharacter:()=>i,removeGapCharacters:()=>r});var n,o=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class i{constructor(e){if(n.set(this,void 0),0==e.length)throw new Error("Character cannot be an empty string.");if(e.length>1)throw new Error("Character must be a single character.");!function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(e,r):o?o.value=r:t.set(e,r)}(this,n,e,"f")}toString(){return o(this,n,"f")}matches(e){var t,r;if("string"!=typeof e&&(e=e.toString()),1!=e.length)return!1;let i=o(this,n,"f").toUpperCase();return e=e.toUpperCase(),!(!a.includes(i)||!a.includes(e))||!a.includes(i)&&!a.includes(e)&&("N"===i&&!a.includes(e)||"N"===e&&!a.includes(i)||(i in s?null!==(r=null===(t=s[i])||void 0===t?void 0:t.includes(e))&&void 0!==r&&r:i===e))}complements(e){var t,r;if("string"!=typeof e&&(e=e.toString()),1!=e.length)return!1;let i=o(this,n,"f").toUpperCase();return e=e.toUpperCase(),!(!a.includes(i)||!a.includes(e))||!a.includes(i)&&!a.includes(e)&&("N"===i&&!a.includes(e)||"N"===e&&!a.includes(i)||i in c&&null!==(r=null===(t=c[i])||void 0===t?void 0:t.includes(e))&&void 0!==r&&r)}}n=new WeakMap;const a=[...".-"],s={A:[..."A"],C:[..."C"],G:[..."G"],U:[..."UT"],T:[..."TU"],R:[..."AG"],Y:[..."CUT"],S:[..."GC"],W:[..."AUT"],K:[..."GUT"],M:[..."AC"],B:[..."CGUTYSK"],D:[..."AGUTRWK"],H:[..."ACUTYWM"],V:[..."ACGRSM"]},c={A:[..."UT"],C:[..."G"],G:[..."CUTY"],U:[..."AGR"],T:[..."AGR"],R:[..."UT"],Y:[..."G"]};return t})());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/search",
3
- "version": "1.5.0",
3
+ "version": "3.0.0",
4
4
  "description": "Find motifs and complements",
5
5
  "repository": {
6
6
  "type": "git",
package/dist/Motif.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare class Motif {
2
- #private;
3
- constructor(motif: string);
4
- toString(): string;
5
- }
6
- //# sourceMappingURL=Motif.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Motif.d.ts","sourceRoot":"","sources":["../src/Motif.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;;gBAGJ,KAAK,EAAE,MAAM;IAIzB,QAAQ,IAAI,MAAM;CAGnB"}