Skip to content
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

Merged
merged 3 commits into from
Jun 21, 2024
Merged

Port prot2pept to typescript #176

merged 3 commits into from
Jun 21, 2024

Conversation

bmesuere
Copy link
Member

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.

@bmesuere bmesuere requested a review from pverscha June 21, 2024 12:32
Copy link
Member

@pverscha pverscha left a 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.

pattern = new RegExp(this.program.opts().pattern, "g");
} catch (e) {
this.program.error(`Your pattern was invalid: ${(e as Error).message}`);
//process.exit(1);
Copy link
Member

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");
Copy link
Member

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?

Copy link
Member Author

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

lib/commands/prot2pept.ts Outdated Show resolved Hide resolved
Co-authored-by: Pieter Verschaffelt <[email protected]>
@bmesuere bmesuere merged commit ad82132 into next Jun 21, 2024
2 checks passed
@bmesuere bmesuere deleted the next-prot2pept branch June 21, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants