-
Notifications
You must be signed in to change notification settings - Fork 177
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
Macro: #3869 - Left-to-right ("Snake-like") layout for RNA #3932
Changes from 12 commits
20d7fa7
4bff65c
916d69e
a8dbc32
c835c2e
f705c8a
219fc53
debbbe9
fc7d6c7
8b455e1
53f4793
6a1a825
187aedb
639f783
f77a9c1
f53ce80
8019421
4cc6baa
00910a8
1946733
0e25fd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { Page, test, expect } from '@playwright/test'; | ||
import { | ||
addMonomerToCanvas, | ||
addRnaPresetOnCanvas, | ||
clickRedo, | ||
clickUndo, | ||
selectSingleBondTool, | ||
|
@@ -119,7 +120,7 @@ test.describe('Snake Bond Tool', () => { | |
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check snake mode arrange', async ({ page }) => { | ||
test('Check snake mode arrange for peptides chain', async ({ page }) => { | ||
/* | ||
Test case: #3280 - Check snake mode | ||
Description: Snake bond tool | ||
|
@@ -269,4 +270,377 @@ test.describe('Snake Bond Tool', () => { | |
await clickRedo(page); | ||
await expect(snakeModeButton).toHaveClass(/active/); | ||
}); | ||
|
||
test('Create snake bond between RNA nucleotides', async ({ page }) => { | ||
await page.getByText('RNA').click(); | ||
await selectSnakeBondTool(page); | ||
|
||
await addRnaPresetOnCanvas(page, 'A_A_R_P', 300, 300); | ||
await addRnaPresetOnCanvas(page, 'C_C_R_P', 400, 600); | ||
await addRnaPresetOnCanvas(page, 'G_G_R_P', 600, 400); | ||
|
||
await selectSingleBondTool(page); | ||
|
||
const phosphate1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(0); | ||
|
||
const phosphate2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(1); | ||
|
||
const sugar1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(1); | ||
const sugar2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(2); | ||
|
||
await bondTwoMonomers(page, phosphate1, sugar1); | ||
await bondTwoMonomers(page, phosphate2, sugar2); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check snake mode arrange for RNA chain', async ({ page }) => { | ||
await page.getByText('RNA').click(); | ||
|
||
await addRnaPresetOnCanvas(page, 'A_A_R_P', 300, 300); | ||
await addRnaPresetOnCanvas(page, 'C_C_R_P', 400, 600); | ||
await addRnaPresetOnCanvas(page, 'G_G_R_P', 600, 400); | ||
await addRnaPresetOnCanvas(page, 'T_T_R_P', 800, 200); | ||
await addRnaPresetOnCanvas(page, 'T_T_R_P', 100, 100); | ||
|
||
await selectSingleBondTool(page); | ||
|
||
const phosphate1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(0); | ||
const phosphate2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(1); | ||
const phosphate3 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(2); | ||
const phosphate4 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(3); | ||
const sugar1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(1); | ||
const sugar2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(2); | ||
const sugar3 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(3); | ||
const sugar4 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(4); | ||
|
||
await bondTwoMonomers(page, phosphate1, sugar1); | ||
await bondTwoMonomers(page, phosphate2, sugar2); | ||
await bondTwoMonomers(page, phosphate3, sugar3); | ||
await bondTwoMonomers(page, phosphate4, sugar4); | ||
|
||
await selectSnakeBondTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Create snake bond for mix chains with nucleotides and peptides', async ({ | ||
page, | ||
}) => { | ||
const peptide1 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
500, | ||
500, | ||
0, | ||
); | ||
const peptide2 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
600, | ||
600, | ||
1, | ||
); | ||
|
||
const peptide3 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
650, | ||
650, | ||
2, | ||
); | ||
|
||
const peptide4 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
700, | ||
500, | ||
3, | ||
); | ||
const peptide5 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
750, | ||
550, | ||
4, | ||
); | ||
const peptide6 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
800, | ||
600, | ||
5, | ||
); | ||
const peptide7 = await addMonomerToCanvas( | ||
page, | ||
MONOMER_NAME_TZA, | ||
MONOMER_ALIAS_TZA, | ||
850, | ||
650, | ||
6, | ||
); | ||
await page.getByText('RNA').click(); | ||
await selectSnakeBondTool(page); | ||
|
||
await addRnaPresetOnCanvas(page, 'A_A_R_P', 200, 200); | ||
await addRnaPresetOnCanvas(page, 'C_C_R_P', 300, 500); | ||
await addRnaPresetOnCanvas(page, 'G_G_R_P', 400, 300); | ||
|
||
await selectSingleBondTool(page); | ||
|
||
const phosphate1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(0); | ||
const phosphate2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(1); | ||
const phosphate3 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(2); | ||
|
||
const sugar1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(1); | ||
const sugar2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(2); | ||
|
||
await bondTwoMonomers(page, phosphate1, sugar1); | ||
await bondTwoMonomers(page, phosphate2, sugar2); | ||
await bondTwoMonomers(page, phosphate3, peptide1); | ||
|
||
await page.locator('button[title=R1]').nth(1).click(); | ||
await page.locator('button[title=Connect]').click(); | ||
await bondTwoMonomers(page, peptide1, peptide2); | ||
await bondTwoMonomers(page, peptide2, peptide3); | ||
|
||
await bondTwoMonomers(page, peptide4, peptide5); | ||
await bondTwoMonomers(page, peptide5, peptide6); | ||
await bondTwoMonomers(page, peptide6, peptide7); | ||
|
||
await takeEditorScreenshot(page); | ||
|
||
await selectSnakeBondTool(page); | ||
await takeEditorScreenshot(page); | ||
|
||
await selectSnakeBondTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Create snake bond for chain with nucleoside', async ({ page }) => { | ||
await page.getByText('RNA').click(); | ||
await selectSnakeBondTool(page); | ||
|
||
await addRnaPresetOnCanvas(page, 'A_A_R_P', 200, 200); | ||
await addRnaPresetOnCanvas(page, 'G_G_R_P', 700, 300); | ||
|
||
await page.getByTestId('summary-Sugars').click(); | ||
const sugarOfNucleoside = await addMonomerToCanvas( | ||
page, | ||
'R___Ribose', | ||
'R', | ||
500, | ||
500, | ||
2, | ||
); | ||
await page.getByTestId('summary-Bases').click(); | ||
const baseOfNucleoside = await addMonomerToCanvas( | ||
page, | ||
'A___Adenine', | ||
'A', | ||
600, | ||
600, | ||
1, | ||
); | ||
|
||
await selectSingleBondTool(page); | ||
await bondTwoMonomers(page, sugarOfNucleoside, baseOfNucleoside); | ||
|
||
const phosphate = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(0); | ||
|
||
const sugar = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(1); | ||
|
||
await bondTwoMonomers(page, phosphate, sugarOfNucleoside); | ||
await bondTwoMonomers(page, sugarOfNucleoside, sugar); | ||
|
||
await takeEditorScreenshot(page); | ||
|
||
await selectSnakeBondTool(page); | ||
await takeEditorScreenshot(page); | ||
|
||
await selectSnakeBondTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Create snake bond for chain with side chains', async ({ page }) => { | ||
await page.getByText('RNA').click(); | ||
|
||
await addRnaPresetOnCanvas(page, 'A_A_R_P', 200, 200); | ||
await addRnaPresetOnCanvas(page, 'G_G_R_P', 500, 300); | ||
await addRnaPresetOnCanvas(page, 'T_T_R_P', 700, 300); | ||
await addRnaPresetOnCanvas(page, 'U_U_R_P', 900, 300); | ||
|
||
await page.getByTestId('summary-Sugars').click(); | ||
const sugarOfNucleoside = await addMonomerToCanvas( | ||
page, | ||
'R___Ribose', | ||
'R', | ||
350, | ||
350, | ||
4, | ||
); | ||
await page.getByTestId('summary-Bases').click(); | ||
const baseOfNucleoside = await addMonomerToCanvas( | ||
page, | ||
'nC6n8A___6-Aminohexyl-8-aminoadenine', | ||
'nC6n8A', | ||
350, | ||
500, | ||
0, | ||
); | ||
|
||
await page.getByTestId('PEPTIDES-TAB').click(); | ||
|
||
const monomer1 = await addMonomerToCanvas( | ||
page, | ||
'A___Alanine', | ||
'A', | ||
500, | ||
500, | ||
1, | ||
); | ||
const monomer2 = await addMonomerToCanvas( | ||
page, | ||
'Hcy___homocysteine', | ||
'Hcy', | ||
550, | ||
550, | ||
0, | ||
); | ||
const monomer3 = await addMonomerToCanvas( | ||
page, | ||
'A___Alanine', | ||
'A', | ||
600, | ||
600, | ||
2, | ||
); | ||
const monomer4 = await addMonomerToCanvas( | ||
page, | ||
'A___Alanine', | ||
'A', | ||
650, | ||
650, | ||
3, | ||
); | ||
const monomer5 = await addMonomerToCanvas( | ||
page, | ||
'A___Alanine', | ||
'A', | ||
700, | ||
700, | ||
4, | ||
); | ||
const monomer6 = await addMonomerToCanvas( | ||
page, | ||
'Bal___beta-Alanine', | ||
'Bal', | ||
600, | ||
500, | ||
0, | ||
); | ||
const monomer7 = await addMonomerToCanvas( | ||
page, | ||
'Bal___beta-Alanine', | ||
'Bal', | ||
650, | ||
500, | ||
1, | ||
); | ||
const monomer8 = await addMonomerToCanvas( | ||
page, | ||
'Bal___beta-Alanine', | ||
'Bal', | ||
750, | ||
500, | ||
2, | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be great to have some helper to create monomers like that:
Where deltaX and deltaY will be an increment of position of each monomer from initial x and y. Also we probably can create addBondedMonomersToCanvas over it. If it is time consuming we can create a separate ticket for that. Please let me know if so. |
||
|
||
await selectSingleBondTool(page); | ||
await bondTwoMonomers(page, sugarOfNucleoside, baseOfNucleoside); | ||
await bondTwoMonomers(page, baseOfNucleoside, monomer1); | ||
await page.locator('button[title=R2]').nth(0).click(); | ||
await page.locator('button[title=R1]').nth(1).click(); | ||
await page.locator('button[title=Connect]').click(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would propose to move it to bondTwoMonomers. Check if modal window appeared after connecting monomers so choose attachment points (by default R2 - R1, but could be configured by function parameters) and click connect |
||
|
||
await bondTwoMonomers(page, monomer1, monomer2); | ||
await bondTwoMonomers(page, monomer2, monomer3); | ||
await bondTwoMonomers(page, monomer3, monomer4); | ||
await bondTwoMonomers(page, monomer2, monomer5); | ||
await page.locator('button[title=R1]').nth(1).click(); | ||
await page.locator('button[title=Connect]').click(); | ||
|
||
const phosphate = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(0); | ||
|
||
const sugar = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(1); | ||
const sugar1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='R']]`) | ||
.nth(2); | ||
const phosphate1 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(1); | ||
const phosphate2 = await page | ||
.locator(`//\*[name() = 'g' and ./\*[name()='text' and .='P']]`) | ||
.nth(2); | ||
await bondTwoMonomers(page, phosphate, sugarOfNucleoside); | ||
await bondTwoMonomers(page, sugarOfNucleoside, sugar); | ||
await bondTwoMonomers(page, phosphate1, sugar1); | ||
await bondTwoMonomers(page, phosphate2, monomer6); | ||
await page.locator('button[title=R1]').nth(1).click(); | ||
await page.locator('button[title=Connect]').click(); | ||
await bondTwoMonomers(page, monomer6, monomer7); | ||
await bondTwoMonomers(page, monomer7, monomer8); | ||
|
||
await takeEditorScreenshot(page); | ||
|
||
await selectSnakeBondTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
}); |
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 would propose to add it to addRnaPresetOnCanvas method so that it will return object with 3 locators, one for each part of rna preset