@rnacanvas/search 1.4.0 → 2.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
@@ -45,6 +45,18 @@ var CUGCCA = new Motif('CUGCCA');
45
45
  CUGCCA.toString(); // "CUGCCA"
46
46
  ```
47
47
 
48
+ ## `function removeGapCharacters()`
49
+
50
+ Returns a new string with all periods and dashes having been removed from the input string.
51
+
52
+ Removing gap characters can make searching for motifs and complements a simpler task.
53
+
54
+ ```javascript
55
+ removeGapCharacters('.A-GU..C--'); // "AGUC"
56
+
57
+ removeGapCharacters('---...'); // ""
58
+ ```
59
+
48
60
  ## `class SequenceCharacter`
49
61
 
50
62
  Represents a character in a sequence.
@@ -217,3 +229,41 @@ A.complements(''); // throws
217
229
  A.complements('AG'); // throws
218
230
  A.complements('asdf'); // throws
219
231
  ```
232
+
233
+ ## `function isWobblePair()`
234
+
235
+ Returns `true` if the two input characters form a `G:U` or `G:T` pair.
236
+
237
+ ```javascript
238
+ isWobblePair('G', 'U'); // true
239
+ isWobblePair('G', 'T'); // true
240
+
241
+ isWobblePair('A', 'U'); // false
242
+ isWobblePair('G', 'C'); // false
243
+
244
+ // order doesn't matter
245
+ isWobblePair('U', 'G'); // true
246
+
247
+ // case doesn't matter
248
+ isWobblePair('g', 'u'); // true
249
+
250
+ var G = new SequenceCharacter('G');
251
+ var U = new SequenceCharacter('U');
252
+
253
+ // handles sequence character instances
254
+ isWobblePair(G, U); // true
255
+
256
+ var A = new SequenceCharacter('A');
257
+
258
+ isWobblePair(A, U); // false
259
+ ```
260
+
261
+ Returns `false` for empty strings
262
+ and strings containing more than one character.
263
+
264
+ ```javascript
265
+ isWobblePair('G', ''); // false
266
+
267
+ // each string must be a single character
268
+ isWobblePair('G', 'UT'); // false
269
+ ```
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:()=>a,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 a{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()),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 a=o(this,n,"f").toUpperCase();return e=e.toUpperCase(),!(!i.includes(a)||!i.includes(e))||!i.includes(a)&&!i.includes(e)&&("N"===a&&!i.includes(e)||"N"===e&&!i.includes(a)||(a in c?null!==(r=null===(t=c[a])||void 0===t?void 0:t.includes(e))&&void 0!==r&&r:a===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 a=o(this,n,"f").toUpperCase();return e=e.toUpperCase(),!(!i.includes(a)||!i.includes(e))||!i.includes(a)&&!i.includes(e)&&("N"===a&&!i.includes(e)||"N"===e&&!i.includes(a)||a in s&&null!==(r=null===(t=s[a])||void 0===t?void 0:t.includes(e))&&void 0!==r&&r)}}n=new WeakMap;const i=[...".-"],c={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"]},s={A:[..."UT"],C:[..."G"],G:[..."CUTY"],U:[..."AGR"],T:[..."AGR"],R:[..."UT"],Y:[..."G"]};return t})());
@@ -0,0 +1,8 @@
1
+ import type { SequenceCharacter } from './SequenceCharacter';
2
+ /**
3
+ * Returns true if the two characters form a G:U or G:T pair.
4
+ *
5
+ * Returns false for empty strings and strings containing more than one character.
6
+ */
7
+ export declare function isWobblePair(c1: SequenceCharacter | string, c2: SequenceCharacter | string): boolean;
8
+ //# sourceMappingURL=isWobblePair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isWobblePair.d.ts","sourceRoot":"","sources":["../src/isWobblePair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,EAAE,EAAE,EAAE,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAiBpG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/search",
3
- "version": "1.4.0",
3
+ "version": "2.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"}