@@ -43,6 +43,7 @@ def __init__(
4343 github_url ,
4444 run_in_background = False ,
4545 automatic_close = True ,
46+ port = None ,
4647 ):
4748 self .name = name
4849 self .tab_counter = 0
@@ -61,6 +62,7 @@ def __init__(
6162 )
6263 self .run_in_background = run_in_background
6364 self .automatic_close = automatic_close
65+ self .port = int (port ) if port else port
6466
6567 def start_server (self , run_in_background = False ):
6668 if self .automatic_close :
@@ -73,7 +75,9 @@ def start_server(self, run_in_background=False):
7375 bokeh_ws_handler .on_close = self .__close_browser_tab (
7476 self .bokeh_server_on_close
7577 )
76- self .server = self .layout .show (threaded = True , title = self .name )
78+
79+ port_param = {} if self .port is None else {"port" : self .port }
80+ self .server = self .layout .show (threaded = True , title = self .name , ** port_param )
7781 if not run_in_background :
7882 self .server .join ()
7983 elif not self .run_in_background :
@@ -105,10 +109,11 @@ def stop_server(self):
105109
106110class AlphaQuantGUI (GUI ):
107111 # TODO: docstring
108- def __init__ (self , start_server = False ):
112+ def __init__ (self , start_server = False , port = None ):
109113 super ().__init__ (
110114 name = "directLFQ" ,
111115 github_url = 'https://github.com/MannLabs/directLFQ' ,
116+ port = port ,
112117 )
113118 self .project_description = """### directLFQ provides ratio-based normalization and protein intensity estimation for small and very large numbers of proteomes."""
114119 self .manual_path = os .path .join (
@@ -136,8 +141,8 @@ def __init__(self, start_server=False):
136141 self .start_server ()
137142
138143
139- def run ():
140- AlphaQuantGUI (start_server = True )
144+ def run (port = None ):
145+ AlphaQuantGUI (start_server = True , port = port )
141146
142147
143148if __name__ == '__main__' :
0 commit comments