Opened 4 years ago

Closed 3 years ago

#5055 closed enhancement (fixed)

Allow BLAST gui to use a sequence viewer id and direct sequence input

Reported by: Tom Goddard Owned by: Zach Pearson
Priority: blocker Milestone:
Component: Sequence Version:
Keywords: Cc: pett, Elaine Meng
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

When you make a better BLAST gui it would be nice if it could work directly with a sequence for cases where the user does not have an existing structure. Maybe the Chain menu could instead be called the "Sequence" menu and it could list "chain A", "chain B" but also have entries for any open sequence panels like "MELB_ECOLI:1". Those sequence panel ids can be used with the blastprotein command, so it is just an ability to choose a sequence in the BLAST gui that is missing.

Related ticket #3014 asks that the BLAST GUI accept a pasted in sequence.

Attachments (1)

Screen Shot 2022-12-07 at 12.04.55 PM.png (219.5 KB ) - added by Elaine Meng 3 years ago.
Added by email2trac

Download all attachments as: .zip

Change History (30)

comment:1 by Zach Pearson, 4 years ago

Summary: Allow BLAST gui to use a sequence viewer idAllow BLAST gui to use a sequence viewer id and direct sequence input

comment:2 by Zach Pearson, 4 years ago

The current prototype for the Qt tool uses a ChainMenuButton which doesn't support arbitrary input; is there a widget prefabbed somewhere that would accept typed input or should I be looking at creating one?

comment:3 by pett, 4 years ago

Maybe "Chain:" could instead be "Input:" with three small radio buttons: Chain, Sequence, and Typed (or something). Use your current ChainMenuButton for Chain, a chimerax.seqalign.widgets.AlignSeqMenuButton for Sequence, and QTextEdit for Typed.

in reply to:  4 ; comment:4 by goddard@…, 4 years ago

Take a look at the AlphaFold gui which also takes a sequence and allows pasting or uniprot ids or structure chain specifiers. I built that from basic Qt widgets, nothing complicated.

It might make sense to just support chain specifiers in a menu like the current GUI for the initial port from the HTML implementation to Qt.  Then add fancier options once that is solid if they have a strong use case.

comment:5 by Zach Pearson, 4 years ago

Cc: kvoigtritter@… added

comment:6 by Elaine Meng, 3 years ago

Blocking: 7462

comment:7 by Elaine Meng, 3 years ago

Priority: moderateblocker

comment:8 by pett, 3 years ago

Cc: kvoigtritter@… removed

comment:9 by pett, 3 years ago

Would also need an externally accessible API for setting the input sequence, so that the "Blast" context-menu item on the sequence viewer could set the Blast input widgets to the sequence that the user is requesting.

comment:10 by Zach Pearson, 3 years ago

I have implemented a box for using sequences in the BLAST GUI, now I just need to make sure that the sequence viewer can call the tool and set the sequence for the user.

comment:11 by Zach Pearson, 3 years ago

Resolution: fixed
Status: assignedclosed

seq_view now calls the BLAST GUI and pre-fills the sequence input box for the user.

in reply to:  12 ; comment:12 by Elaine Meng, 3 years ago

Hi Zach,
The "direct sequence input" part of the summary means the user can paste in a sequence as plain text without having to open it in the sequence viewer.  Is that implemented?  Your description sounds like it can fill in a sequence that is already in the sequence viewer. I can't tell what you mean because in today's daily build I don't see either of these possibilities.  Am I just checkinb prematurely, i.e do I just need to wait for the next daily build?
Thanks,
Elaine

comment:13 by Zach Pearson, 3 years ago

Yes, you can paste a sequence in as plain text.

comment:14 by Zach Pearson, 3 years ago

Will be in tomorrow's daily build.

in reply to:  15 ; comment:15 by Elaine Meng, 3 years ago

Woohoo!  It's so great to have these options as well as the ability to use a uniprot name or ID with the command.

The Blast Protein dialog could use some improvements, namely:

(1) please add the word "Query" to the left of the query-sequence-choices menu

(2) maybe "Sequence" should be "Raw Sequence" or "Pasted Sequence" or something like that, what do you think?

(3) entry field is too wide for UniProt, and needs to be bigger/multirow for Sequence or whatever we're calling it

(4) buttons look strange especially if you enlarge the dialog manually in hopes of making the sequence-entry field larger:





Added by email2trac

by Elaine Meng, 3 years ago

Added by email2trac

in reply to:  17 comment:16 by Elaine Meng, 3 years ago

(5) the dialog lists non-amino-acid chains (nucleic, maybe others) as query choices -- I think there is a mechanism to detect/exclude these

in reply to:  18 ; comment:17 by pett, 3 years ago

Hi Zach,
	Having battled with the Qt toolkit extensively, I have some advice for some of these issues:

#3: Consider using a QTextEdit for the multi-line input.  There are examples of this in alphafold/src/panel.py and build_structure/src/providers.py.  To make the UniProt line entry narrower, I think that if you provide an explicit alignment value (e.g. Qt.AlignLeft) when you addWidget() to the layout, then the widget won't span the entire dialog.

#4: Use a non-zero "stretch" value when you layout the QTextEdit and it will expand when given extra room. Use a QDialogButtonBox widget instead of bespoke buttons at the bottom of the dialog to get the proper platform look and feel and correct resize behavior.  There is an example of QDialogButtonBox in change_chains/src/tool.py.

#5: In the ChainMenuButton constructor provide a filter_func keyword argument whose value is a lambda/function that tests the chain's polymer_type attribute against Residue.PT_AMINO, e.g.:

	from chimerax.atomic import Residue
	... = ChimeraMenuButton(.., filter_func=lambda c: c.polymer_type == Residue.PT_AMINO)

--Eric

in reply to:  19 ; comment:18 by pett, 3 years ago



ChainMenuButton, duh!

--Eric

comment:19 by Zach Pearson, 3 years ago

Resolution: fixed
Status: closedreopened

Adding or rewording labels is fine. Is there a particular reason other than aesthetics for there to be a separate, smaller widget for UniProt IDs? As it is, there is no parsing of input at all in the tool (it's all done by the command the tool runs), so both Sequence and UniProt ID use the same underlying widget. Really the only reasons 'Sequence' and 'UniProt ID' are not 'Sequence or UniProt ID' are

  • the latter is too verbose for one entry
  • need some way to telegraph to users that they _can_ input a UniProt ID or sequence

in reply to:  21 comment:20 by Elaine Meng, 3 years ago

Professional-looking tools are what we would hope to put out.  We have other dialogs with similar inputs from the user that have appropriately sized nicer-looking entry fields.  I also think it is slightly confusing to have this weird white bar across the width of the dialog, it's not even totally clear that that is where you are supposed to enter the id or sequence.

in reply to:  22 ; comment:21 by Elaine Meng, 3 years ago

It is also detrimental to sequence input to have only the tail end visible, makes pasting more error prone if you can't see a good fraction of what you are trying to enter.

in reply to:  23 ; comment:22 by Elaine Meng, 3 years ago

Another thing we try for is consistency between tools because if somebody gets used to how one tool works, another tool with a similar feature would ideally have similar choices and behaviors.  The AlphaFold dialog has the same exact options (in terms of functionality) for Search as Blast Protein.  The label to the left of the menu is "Sequence" and the menu contains: [structure chains], Paste, UniProt identifier.  The entry field adjusts when you choose between the latter two.  This part of the Blast Protein dialog could be done exactly the same way except that I favor "Query" as the label to the left of the menu (AlphaFold has other options besides search, so "Query" would not make sense in that tool).

comment:23 by Zach Pearson, 3 years ago

I have fixed the spacing issues and will push an update for tomorrow's daily build; currently working to swap out the UniProt ID input for a smaller one. Note that closing the sequence or UniProt ID dialogs does not shrink the window to fit just the initial menu and buttons, but this is not the behavior of the AlphaFold panel either, and getting all the windows to shrink to their contents should be a separate ticket if desired.

Last edited 3 years ago by Zach Pearson (previous) (diff)

in reply to:  25 comment:24 by Elaine Meng, 3 years ago

I  wasn't suggesting to shrink the overall window, just adjusting the entry field dimensions as appropriate and making the buttons stay a normal size regardless of how the user sizes the window.  At least I think that's how other dialogs behave.

comment:25 by Zach Pearson, 3 years ago

Blocking: 7462

comment:26 by Zach Pearson, 3 years ago

Sure, I was just noting it because I personally find it annoying but I think it requires a discussion among the programmers about which widget would reclaim the leftover space when some other window has a big item that gets hidden.

in reply to:  28 comment:27 by pett, 3 years ago

If you know you are hiding widgets and therefore taking up less space, you can call tool_window.shrink_to_fit() to get the dialog to give up the extra space.

--Eric


comment:28 by Zach Pearson, 3 years ago

Thanks!

comment:29 by Zach Pearson, 3 years ago

Resolution: fixed
Status: reopenedclosed

This pair of commits deals with the follow ups.

Note: See TracTickets for help on using tickets.