DENOFO Questionnaire

The DENOFO questionnaire is a set of questions that guide the annotation process of de novo genes. This tool is designed to ensure that all relevant information is captured and that the annotation is consistent across different studies.

There are two interfaces for the questionnaire: a command-line interface (CLI) and a graphical user interface (GUI).

For a complete overview of all questions and their data model mapping, see the Questionnaire Overview page.

Command-line interface (CLI)

denofo.questionnaire.questionnaire_cli.custom_entry_insertion(stdscr: window, description: str, multi_entries_lst: list, multi_choice: bool, section_idx: int, prev_answer: Any) str | list[str] | GoQBack

Ask for custom entry/ies from the user.

Parameters:
  • stdscr (curses.window) – The curses window.

  • description (str) – The description of the question.

  • multi_entries_lst (list) – The list of multiple entries.

  • multi_choice (bool) – If multiple entries are allowed.

  • section_idx (int) – The index of the section.

  • prev_answer (Any) – The previous answer.

Returns:

The custom entry/ies.

Return type:

str | list[str] | GoQBack

denofo.questionnaire.questionnaire_cli.enum_choice_selection(stdscr: window, question: str, items: list[Enum], multi: bool, selected: list[str], section_idx: int, prev_answer: Any) GoQBack | list[str]

Select an item from a list of items.

Parameters:
  • stdscr (curses.window) – The curses window.

  • question (str) – The question to ask.

  • items (list[Enum]) – The list of items to choose from.

  • multi (bool) – If multiple choices are allowed.

  • selected (list[str]) – The selected items.

  • section_idx (int) – The index of the section.

  • prev_answer (Any) – The previous answer.

Returns:

The selected item/items.

Return type:

GoQBack | list[str]

denofo.questionnaire.questionnaire_cli.get_custom_entry(description: str = '', multi_choice: bool = False, section_idx: int = 0, prev_answer: Any = None) str | list[str] | GoQBack

Wrapper to get custom entry/ies from the user.

Parameters:
  • description (str) – The description of the question.

  • multi_choice (bool) – If multiple entries are allowed.

  • section_idx (int) – The index of the section.

  • prev_answer (Any) – The previous answer.

Returns:

The custom entry/ies.

Return type:

str | list[str] | GoQBack

denofo.questionnaire.questionnaire_cli.get_enum_choice_conversion(my_enum: Enum, question: str = '', multi_choice: bool = False, section_idx: int = 0, prev_answer: Any = None) GoQBack | str | list[str]

Wrapper to get an enum choice from the user.

Parameters:
  • my_enum (Enum) – The enum to choose from.

  • question (str) – The question to ask.

  • multi_choice (bool) – If multiple choices are allowed.

  • section_idx (int) – The index of the section.

  • prev_answer (Any) – The previous answer.

Returns:

The selected item/items.

Return type:

GoQBack | str | list[str]

denofo.questionnaire.questionnaire_cli.get_yes_no(description: str = '', section_idx: int = 0, prev_answer: Any = None) GoQBack | bool

Wrapper to get an answer for a yes or no question from the user.

Parameters:
  • description – The description of the question.

  • section_idx – The index of the section.

  • prev_answer – The previous answer.

Returns:

The binary answer.

denofo.questionnaire.questionnaire_cli.init_colors(stdscr: window)

Initialize the colors for the curses window.

Parameters:

stdscr (curses.window) – The curses window.

denofo.questionnaire.questionnaire_cli.main()

The main function of the program including argument parsing. Entry point of the denofo-questionnaire-cli executable.

denofo.questionnaire.questionnaire_cli.valid_input_for_pydmodel(pydmodel: BaseModel, field_name: str, inp_val: Any) bool

Validate the input value with a certain pydantic model and model field to ask the user for input again if the input is invalid.

Parameters:
  • pydmodel (BaseModel) – The pydantic model.

  • field_name (str) – The field name of the model.

  • inp_val (Any) – The input value to validate.

Returns:

True if the input is valid, False otherwise.

Return type:

bool

denofo.questionnaire.questionnaire_cli.yes_or_no(stdscr: window, description: str = '', section_idx: int = 0, prev_answer: Any = None) bool | GoQBack

Ask the user for a yes or no answer.

Parameters:
  • stdscr (curses.window) – The curses window.

  • description (str) – The description of the question.

  • section_idx (int) – The index of the section.

  • prev_answer (Any) – The previous answer.

Returns:

The binary answer.

Return type:

bool | GoQBack

Graphical user interface (GUI)

class denofo.questionnaire.questionnaire_gui.Back_button

Back button class for the GUI application.

class denofo.questionnaire.questionnaire_gui.Custom_entry(question, multi_choice: bool, prev_answer: str | list[str] | None = None)

Custom entry class for the GUI application.

class denofo.questionnaire.questionnaire_gui.Enum_choice_selection(enum_choices, question, multi_choice=False, prev_answer=None)

Enum choice selection class for the GUI application.

class denofo.questionnaire.questionnaire_gui.ErrorDialog(err_warn_type: str = 'Error', error_message: str = '')

Error dialog class for the GUI application.

class denofo.questionnaire.questionnaire_gui.MainWindow(*args, **kwargs)

Main window class for the GUI application.

closeEvent(self, a0: QCloseEvent | None)
class denofo.questionnaire.questionnaire_gui.ProgressBar(section_idx)

Progress bar class for the GUI application.

class denofo.questionnaire.questionnaire_gui.QSingleton(*args, **kwargs)

Metaclass for Qt classes that are singletons.

class denofo.questionnaire.questionnaire_gui.Yes_no(question, prev_answer=None)

Yes or No class for the GUI application.

denofo.questionnaire.questionnaire_gui.clearLayout(layout)

Function to clear the layout of a QWidget.

denofo.questionnaire.questionnaire_gui.get_custom_entry(question: str = '', multi_choice: bool = False, section_idx: int = 0, prev_answer: any = None) Any

Function to get the user’s custom entry.

Parameters:
  • question (str) – Question to ask the user

  • multi_choice (bool) – Whether the user can enter multiple values

  • section_idx (int) – Index of the section in the progress bar

  • prev_answer (any) – Previous answer given by the user

Returns:

User’s choice

Return type:

Any

denofo.questionnaire.questionnaire_gui.get_enum_choice_conversion(my_enum: Enum, question: str = '', multi_choice: bool = False, section_idx: int = 0, prev_answer: Any = None) Any

Function to get the user’s choice for an Enum.

Parameters:
  • my_enum (Enum) – Enum class to get the choices from

  • question (str) – Question to ask the user

  • multi_choice (bool) – Whether the user can select multiple choices

  • section_idx (int) – Index of the section in the progress bar

  • prev_answer (Any) – Previous answer given by the user

Returns:

User’s choice

Return type:

Any

denofo.questionnaire.questionnaire_gui.get_yes_no(question: str = '', section_idx: int = 0, prev_answer: any = None) bool

Function to get the user’s choice for Yes or No.

Parameters:
  • question (str) – Question to ask the user

  • section_idx (int) – Index of the section in the progress bar

  • prev_answer (any) – Previous answer given by the user

Returns:

User’s choice

Return type:

bool

denofo.questionnaire.questionnaire_gui.main()

The main function of the program. Entry point for the GUI executable.

denofo.questionnaire.questionnaire_gui.main_app()

The main function for the GUI application. Calls questionnaire functions and saves the gene annotation, while showing Widgets in the privously initiated MainWindow.

denofo.questionnaire.questionnaire_gui.save_annotation(gene_annotation: BaseModel)

Function to save the gene annotation in the dngf format into a file.

Parameters:

gene_annotation (BaseModel) – Gene annotation to save

denofo.questionnaire.questionnaire_gui.show_error_message(warn_type: str = 'Error', message: str = '')

Function to show an error message to the user.

denofo.questionnaire.questionnaire_gui.valid_input_for_pydmodel(pydmodel: BaseModel, field_name: str, inp_val: Any) bool

Validate the input value with a certain pydantic model and model field to ask the user for input again if the input is invalid.

Parameters:
  • pydmodel (BaseModel) – Pydantic model to validate the input with

  • field_name (str) – Field name of the model to validate the input with

  • inp_val (Any) – Input value to validate

Returns:

Whether the input is valid

Return type:

bool

questionnaire logic implementation

class denofo.questionnaire.questions.DeNovoQuestionnaire(user_interface_funcs_dict: dict)

A class to handle the questionnaire for the de novo gene annotation. Order of questions is defined here as well as the logic to call the next question or go back to the previous question.

Parameters:

user_interface_funcs_dict (dict) – The user interface functions dictionary.

Variables:
  • question_stack (list[tuple[callable, Any]]) – The question stack.

  • current_idx (int) – The current index in the question stack.

  • interface_funcs_dict (dict) – The user interface functions dictionary.

Func call_last_question:

Call the previous question in the question stack.

Func call_next_question:

Call the next question in the question stack.

Func q_end:

End of the questionnaire.

Func start_questionnaire:

Start the questionnaire.

call_last_question()

Call the previous question in the question stack.

call_next_question(current_answer: Any, this_q: callable, next_q: callable, prev_answer: list = None)

Call the next question in the question stack.

Parameters:
  • current_answer (Any) – The current answer.

  • this_q (callable) – The current question.

  • next_q (callable) – The next question.

  • prev_answer (list, optional) – The previous answer.

get_DeNovoGeneAnnotation_from_qstack(match_dict: dict[str, Any] = {'q1': 'inputData', 'q1_1': 'annotGenomeChoice', 'q1_2': 'inputTranscriptome', 'q1_2_1': 'expressionLevel', 'q1_2_2': 'transContextChoice', 'q1_2_3': 'customGeneticContext', 'q1_2_4': 'transORFChoice', 'q1_2_5': 'customORF', 'q1_2_6': 'answerTranscriptomeInfo', 'q1_2_7': 'transcriptomeInfo', 'q1_3': 'customInputData', 'q2': 'homologyFilter', 'q2_1': 'phylogeneticTaxa', 'q2_2': 'taxSpecificity', 'q2_2_1': 'taxID', 'q2_3': 'seqType', 'q2_4': 'customSeqType', 'q2_5_1': 'QStructuralSimilarity', 'q2_5_2': 'structuralSimilarity', 'q2_5_3': 'threshold', 'q2_6': 'customThreshold', 'q2_6_1': 'thresholdValue', 'q2_7': 'dataBase', 'q2_8': 'customDB', 'q3': 'nonCodingHomologs', 'q3_1': 'enablingMutations', 'q3_2': 'synteny', 'q3_3': 'anchors', 'q3_3_1': 'customAnchor', 'q3_3_2': 'answerSoftwareSyntenySearch', 'q3_3_3': 'softwareSyntenySearch', 'q4': 'evolutionaryInformation', 'q4_1': 'selection', 'q5': 'translationalEvidence', 'q5_1': 'translationEvidence', 'q5_2': 'customTranslationEvidence', 'q6': 'QstudyURL', 'q6_1': 'studyURL'}) DeNovoGeneAnnotation

Create a DeNovoGeneAnnotation object from the given question stack.

Parameters:
  • question_stack (list[tuple[callable, Any]]) – The question stack.

  • match_dict (dict[str, Any]) – The dictionary to match function callables to field names.

Returns:

The DeNovoGeneAnnotation object.

Return type:

DeNovoGeneAnnotation

q1(answer: Any = None)

Get the input data choice from the user.

q1_1(answer: Any = None)

Get the genome annotation method from the user.

q1_2(answer: Any = None)

Get the transcriptome information from the user.

q1_2_1(answer: Any = None)

Get the TPM threshold used as a minimum level of transcript expression.

q1_2_2(answer: Any = None)

Get the genetic context information from the user.

q1_2_3(answer: Any = None)

Get the custom genetic context information from the user.

q1_2_4(answer: Any = None)

Get which ORFs in transcripts were selected.

q1_2_5(answer: Any = None)

Get the custom ORF selection for the transcriptome data.

q1_2_6(answer: Any = None)

Check if additional info about the transcriptome should be added.

q1_2_7(answer: Any = None)

Get the additional, custom transcriptome information from the user.

q1_3(answer: Any = None)

Get the custom input data (not annotated genome or transcriptome).

q2(answer: Any = None)

Check if a homology filter was applied.

q2_1(answer: Any = None)

Check if phylogenetic taxa information is known.

q2_2(answer: Any = None)

Get the taxonomic group where the de novo genes emerged.

q2_2_1(answer: Any = None)

Get the taxonomic ID where the de novo genes emerged.

q2_3(answer: Any = None)

Get the sequence type(s) used for homology filtering.

q2_4(answer: Any = None)

Get the custom sequence type(s) used for homology filtering.

q2_5_1(answer: Any = None)

Check if structural similarity was used for homology filtering.

q2_5_2(answer: Any = None)

Get the custom structural similarity search software/method used for homology filtering

q2_5_3(answer: Any = None)

Get the metric used for homology filtering.

q2_6(answer: Any = None)

Get the custom metric for homology filtering.

q2_6_1(answer: Any = None)

Get the threshold value(s) for homology filtering based on selected metric(s).

q2_7(answer: Any = None)

Get the custom database(s) used for homology filtering.

q2_8(answer: Any = None)

Get the custom database(s) used for homology filtering.

q3(answer: Any = None)

Check if non-genic homologous sequences were detected.

q3_1(answer: Any = None)

Check if conservation/mutations between de novo genes and homologous sequences were studied.

q3_2(answer: Any = None)

Check if synteny was studied between de novo genes and homologous sequences.

q3_3(answer: Any = None)

Get the synteny search information from the user.

q3_3_1(answer: Any = None)

Get the custom anchor for synteny search.

q3_3_2(answer: Any = None)

Check if specific software was used for the synteny search.

q3_3_3(answer: Any = None)

Get the custom software used for the synteny search.

q4(answer: Any = None)

Check if selection pressure was studied for the de novo genes.

q4_1(answer: Any = None)

Get the custom metric or method used to identify selection pressure.

q5(answer: Any = None)

Check if translation of the de novo genes was verified.

q5_1(answer: Any = None)

Get the custom method used as evidence for translation.

q5_2(answer: Any = None)

Get the custom method used as evidence for translation.

q6(answer: Any = None)

Check if URL/doi to the study/detailed methods should be provided.

q6_1(answer: Any = None)

Get the URL/doi to the study/detailed methods.

q_end(answer: Any = None)

End of the questionnaire. Calling this last function (without an actual question) is necessary to trigger saving the last answer in the question stack through the call_next_question function.

start_questionnaire() DeNovoGeneAnnotation

Start the questionnaire to get the user input.

Returns:

The DeNovoGeneAnnotation object.

Return type:

DeNovoGeneAnnotation