ramachandran-lab / pong

Fast analysis and visualization of latent clusters in population genetic data
66 stars 11 forks source link

socket.error: [Errno 98] Address already in use #24

Closed yzliu01 closed 2 years ago

yzliu01 commented 2 years ago

Hi,

I am using this program to visualize my admixture runs., but I got errors as below and I was not navigated to a web browser. I googled and investigated this issue but still could not figure it out. Looking forward to your help.

my codes: pong -m pas_filemap -i pas_ind2pop.txt -n pas_pop_order_expandednames.txt -o pas_admixture_plot-1/ -f -v

errors:

                        p o n g
  by A. Behr, K. Liu, T. Devlin, G. Liu-Fang, and S. Ramachandran
                   Version 1.4.7 (2016)


Parsing input and generating cluster network graph Matching clusters within each K and finding representative runs For K=2, there is 1 mode across 1 run. For K=3, there is 1 mode across 1 run. For K=4, there is 1 mode across 1 run. Matching clusters across K Finding best alignment for all runs within and across K match time: 0.01s align time: 0.09s total time: 0.59s Traceback (most recent call last): File "/sw/apps/bioinfo/pong/1.4.7/rackham/bin/pong", line 437, in main() File "/sw/apps/bioinfo/pong/1.4.7/rackham/bin/pong", line 281, in main app.listen(opts.port) File "/sw/comp/python/2.7.11_milou/lib/python2.7/site-packages/tornado-4.5.2-py2.7-linux-x86_64.egg/tornado/web .py", line 1943, in listen server.listen(port, address) File "/sw/comp/python/2.7.11_milou/lib/python2.7/site-packages/tornado-4.5.2-py2.7-linux-x86_64.egg/tornado/tcp server.py", line 142, in listen sockets = bind_sockets(port, address=address) File "/sw/comp/python/2.7.11_milou/lib/python2.7/site-packages/tornado-4.5.2-py2.7-linux-x86_64.egg/tornado/net util.py", line 197, in bind_sockets sock.bind(sockaddr) File "/sw/comp/python/2.7.11_milou/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 98] Address already in use

Thank you very much.

Best Liu

shahamat commented 2 years ago

Hi Liu,

This is most likely because the there is another instance of pong running that did not exit properly. You can search for the process and kill it.

Find the process id "PID" by using the command ps -ef | grep pong and looking for the PID (which is the second column). And then kill that pong instance by replacing "PID" in this command with the actual PID kill "PID".

Let me know if that works!

yzliu01 commented 2 years ago

Hi Shahamat Thanks a lot for your quick response. Here is the information after I execute the command. "yzliu" is myself and "lucsi" is another user in the server. Do you think I kill the process 20972 under my user name? Does it have something to do with another user's job of pong? ps -ef | grep pong yzliu 20972 5036 0 08:49 pts/108 00:00:00 grep --color=auto pong lucsi 27006 6226 0 Mar16 pts/27 00:00:03 /sw/comp/python/2.7.11_milou/bin/python /sw/apps/bioinfo/pong/1.4.7/rackham/bin/pong -m pong_filemap -n pop_correct_order.txt -i ind2pop.txt -g -o Morocco_16March2022_short_noIranN

I killed it but it was not actually killed. I saw the "--color=auto pong" again. I think I did this yesterday and could not solve this problem. kill 20972 -bash: kill: (20972) - No such process kill -9 20972 -bash: kill: (20972) - No such process ps -ef | grep pong yzliu 13951 5036 0 08:58 pts/108 00:00:00 grep --color=auto pong lucsi 27006 6226 0 Mar16 pts/27 00:00:03 /sw/comp/python/2.7.11_milou/bin/python /sw/apps/bioinfo/pong/1.4.7/rackham/bin/pong -m pong_filemap -n pop_correct_order.txt -i ind2pop.txt -g -o Morocco_16March2022_short_noIranN

Best Liu

yzliu01 commented 2 years ago

I have solved the above problem but got another one on server with my data "invalid value encountered in double_scalars" as shown below. My data don/t have Nans which may cause this problem. I test your example data and they work.

Here is my code: pong -m pas_filemap -i pas_ind2pop.txt -n pas_pop_order_ind.txt -o pas_admixture_plot -f -v -p 4009

Let me know if you want to reproduce the issue. Thanks Error: Parsing input and generating cluster network graph Matching clusters within each K and finding representative runs For K=2, there is 1 mode across 1 run. For K=3, there is 1 mode across 1 run. For K=4, there is 1 mode across 1 run. Matching clusters across K Finding best alignment for all runs within and across K /sw/comp/python/2.7.11_milou/lib/python2.7/site-packages/numpy-1.12.0b1-py2.7-linux-x86_64.egg/numpy/core/fromnumeric.py:2889: RuntimeWarning: Mean of empty slice. out=out, kwargs) /sw/comp/python/2.7.11_milou/lib/python2.7/site-packages/numpy-1.12.0b1-py2.7-linux-x86_64.egg/numpy/core/_methods.py:80: RuntimeWarning: _invalid value encountered in doublescalars** ret = ret.dtype.type(ret / rcount) /sw/comp/python/2.7.11_milou/lib/python2.7/site-packages/numpy-1.12.0b1-py2.7-linux-x86_64.egg/numpy/lib/function_base.py:1110: RuntimeWarning: Mean of empty slice. avg = a.mean(axis) match time: 0.00s align time: 0.00s total time: 0.01s

pong server is now running locally & listening on port 4009 Open your web browser and navigate to http://localhost:4009 to see the visualization

abehr commented 2 years ago

Hi Liu,

This issue might be occurring if you have duplicate entries in your pop labels file (similar: https://github.com/ramachandran-lab/pong/issues/8). I would also recommend upgrading to the latest version of pong (v1.5), or if you need to be on python 2.7, at least pong v1.4.9 (which handles this issue more gracefully and prints a more informative error message).

yzliu01 commented 2 years ago

Thanks abehr. Yes, the pop labels should be the cause. I have pop_order_ind like below that I tried, 1st column of the pop code, and 2nd column of the individuals, which is not the format defined for the -n flag. Just hoped the program sorts individuals within groups and labels each individual, but it didn't have this feature yet. DA DA_01 DA DA_03 DA DA_02 DA DA_04 GT GT_03 GT GT_02 GT GT_01 GT GT_04 It worked if either pop codes or individual labels are used.

abehr commented 2 years ago

You can provide just the first column of your pop_order_ind file with the -i flag (which tells pong which population each individual belongs to -- you don't need to include the individuals' ids, bc the ordering of indivs in that file should be the same as the ordering of indivs in your Q-matrices).

Separately, you can provide a file that has each population just once, in the left-to-right order you want them to be organized in the plot, with the -n flag.

Then, pong will sort the groups as specified and will also automatically sort individuals within groups as you mentioned (by their membership in the major cluster at the highest K-value for each group -- we find that this produces the most useful visualization). We don't label each individual in the output, but I can see how that could be useful. We can consider that in a future update.

yzliu01 commented 2 years ago

Hi, thanks a lot for your quick response. I could use both -i and -n flag and arrange the group order. My idea is to virtually recognize the genetic component (colors) of each individual in combination with the results of an NJ tree. The program can sort ind's order within group but then I cannot really know which bar corresponds to which sample. If after the sorting within groups we can still label the individuals as we wish, so it would be perfect! Maybe it's a personal taste : )