-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port prot2pept to typescript #176
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two minor questions. It's probably something I'm overlooking, but these should nonetheless be checked.
lib/commands/prot2pept.ts
Outdated
pattern = new RegExp(this.program.opts().pattern, "g"); | ||
} catch (e) { | ||
this.program.error(`Your pattern was invalid: ${(e as Error).message}`); | ||
//process.exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be uncommented again for the final release?
} | ||
|
||
static splitProtein(line: string, pattern: RegExp): string { | ||
return line.replaceAll(pattern, "$1\n$2").replaceAll(pattern, "$1\n$2").replaceAll("\n\n", "\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably overlooking something, but why do we perform replaceAll(pattern, "$1\n$2")
twice with the same pattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to catch overlapping patterns, like KRKRK
Co-authored-by: Pieter Verschaffelt <[email protected]>
This PR ports prot2pept to typescript.
I ran a benchmark on swissprot. The output is exactly the same between both implementations. Performance improved from 26.5 to 5 seconds.