Skip to content
Snippets Groups Projects
Commit 95cc1c58 authored by yakomaxa's avatar yakomaxa
Browse files

remove comment and unused character and functions

parent 0511d3e5
No related branches found
No related tags found
No related merge requests found
...@@ -18,10 +18,7 @@ import { Transpiler } from '../transpiler'; ...@@ -18,10 +18,7 @@ import { Transpiler } from '../transpiler';
function listMap(x: string) { return x.split(',').map(x => x.replace(/^["']|["']$/g, '')); } function listMap(x: string) { return x.split(',').map(x => x.replace(/^["']|["']$/g, '')); }
function rangeMap(x: string) {
const [min, max] = x.split('-').map(x => parseInt(x));
return { min, max };
}
function listOrRangeMap(x: string) { function listOrRangeMap(x: string) {
if (x.includes('-') && x.includes(',')) { if (x.includes('-') && x.includes(',')) {
const pSplit = x.split(',').map(x => x.replace(/^["']|["']$/g, '')); const pSplit = x.split(',').map(x => x.replace(/^["']|["']$/g, ''));
...@@ -38,11 +35,11 @@ function listOrRangeMap(x: string) { ...@@ -38,11 +35,11 @@ function listOrRangeMap(x: string) {
}); });
return res; return res;
} else if (x.includes('-') && !x.includes(',')) { } else if (x.includes('-') && !x.includes(',')) {
const res: number[] = []; const res: number[] = [];
const [min, max] = x.split('-').map(x=>parseInt(x)); const [min, max] = x.split('-').map(x=>parseInt(x));
for (let i = min; i <= max; i++) { for (let i = min; i <= max; i++) {
res.push(i); res.push(i);
} }
return res; return res;
} else if (!x.includes('-') && x.includes(',')) { } else if (!x.includes('-') && x.includes(',')) {
return listMap(x).map(x => parseInt(x)); return listMap(x).map(x => parseInt(x));
...@@ -57,8 +54,6 @@ const propertiesDict = h.getPropertyRules(macroproperties); ...@@ -57,8 +54,6 @@ const propertiesDict = h.getPropertyRules(macroproperties);
const dot = P.MonadicParser.string('.'); const dot = P.MonadicParser.string('.');
const colon = P.MonadicParser.string(':'); const colon = P.MonadicParser.string(':');
const star = P.MonadicParser.string('*'); const star = P.MonadicParser.string('*');
const bra = P.MonadicParser.string('(');
const ket = P.MonadicParser.string(')');
const commu = P.MonadicParser.string('['); const commu = P.MonadicParser.string('[');
const tator = P.MonadicParser.string(']'); const tator = P.MonadicParser.string(']');
...@@ -96,20 +91,20 @@ function atomExpressionQuery(x: any[]) { ...@@ -96,20 +91,20 @@ function atomExpressionQuery(x: any[]) {
tests['chain-test'] = B.core.rel.eq([B.ammp('auth_asym_id'), chainname]); tests['chain-test'] = B.core.rel.eq([B.ammp('auth_asym_id'), chainname]);
} }
const resnoRangeProps:any = []; const resnoRangeProps: any = [];
console.log(resnorange) console.log(resnorange);
if (resnorange){ if (resnorange) {
resnorange.forEach((x:number) =>{ resnorange.forEach((x: number) =>{
resnoRangeProps.push(B.core.rel.eq([B.ammp('auth_seq_id'), x])); resnoRangeProps.push(B.core.rel.eq([B.ammp('auth_seq_id'), x]));
}) });
console.log(resnoRangeProps); console.log(resnoRangeProps);
}; };
if (resnoRangeProps.length) tests['residue-test'] = h.orExpr(resnoRangeProps); if (resnoRangeProps.length) tests['residue-test'] = h.orExpr(resnoRangeProps);
const resProps:any = []; const resProps: any = [];
if (resno){ if (resno) {
console.log(resno) console.log(resno);
resProps.push(B.core.rel.eq([B.ammp('auth_seq_id'), resno])); resProps.push(B.core.rel.eq([B.ammp('auth_seq_id'), resno]));
} }
if (inscode) resProps.push(B.core.rel.eq([B.ammp('pdbx_PDB_ins_code'), inscode])); if (inscode) resProps.push(B.core.rel.eq([B.ammp('pdbx_PDB_ins_code'), inscode]));
if (resProps.length) tests['residue-test'] = h.andExpr(resProps); if (resProps.length) tests['residue-test'] = h.andExpr(resProps);
...@@ -132,8 +127,7 @@ const lang = P.MonadicParser.createLanguage({ ...@@ -132,8 +127,7 @@ const lang = P.MonadicParser.createLanguage({
r.Parens, r.Parens,
r.Operator, r.Operator,
r.Expression r.Expression
).wrap(P.MonadicParser.string("("), P.MonadicParser.string(")")); ).wrap(P.MonadicParser.string('('), P.MonadicParser.string(')'));
// ).wrap(P.MonadicParser.regexp(/\(\s+/), P.MonadicParser.regexp(/\s+\)/));
}, },
Expression: function (r: any) { Expression: function (r: any) {
...@@ -287,7 +281,7 @@ const lang = P.MonadicParser.createLanguage({ ...@@ -287,7 +281,7 @@ const lang = P.MonadicParser.createLanguage({
return P.MonadicParser.seq( return P.MonadicParser.seq(
P.MonadicParser.lookahead(r.AtomPrefix), P.MonadicParser.lookahead(r.AtomPrefix),
P.MonadicParser.seq( P.MonadicParser.seq(
r.ResnoRange.or(P.MonadicParser.of(null)), r.ResnoRange.or(P.MonadicParser.of(null)),
r.Resno.or(P.MonadicParser.of(null)), r.Resno.or(P.MonadicParser.of(null)),
r.Inscode.or(P.MonadicParser.of(null)), r.Inscode.or(P.MonadicParser.of(null)),
r.Chainname.or(P.MonadicParser.of(null)), r.Chainname.or(P.MonadicParser.of(null)),
...@@ -309,9 +303,9 @@ const lang = P.MonadicParser.createLanguage({ ...@@ -309,9 +303,9 @@ const lang = P.MonadicParser.createLanguage({
Inscode: () => P.MonadicParser.regexp(/\^([a-zA-Z0-9])/, 1).desc('inscode'), Inscode: () => P.MonadicParser.regexp(/\^([a-zA-Z0-9])/, 1).desc('inscode'),
ResnoRange: function (r:any) { ResnoRange: function (r: any) {
return P.MonadicParser.regex(/[0-9,-]+/).map( listOrRangeMap ).desc('resnorange') return P.MonadicParser.regex(/[0-9,-]+/).map(listOrRangeMap).desc('resnorange');
// // 123-200 // // 123-200
// // -12--3 // // -12--3
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment