Teichlab / tracer

TraCeR - reconstruction of T cell receptor sequences from single-cell RNAseq data
Other
122 stars 48 forks source link

Running containerized tracer using singularity #109

Open carlo-deintinis opened 3 years ago

carlo-deintinis commented 3 years ago

Thank you for developing tracer!

I am currently trying to run the tracer docker container using singularity without success.

If for example I run docker run teichlab/tracer test I get the expected results.

However, trying to do the same in singularity with the command singularity run tracer.simg test (or singularity exec tracer.simg tracer test) results in

Config file not found at ~/.tracerrc. Using default tracer.conf in repo...
Traceback (most recent call last):
  File "/usr/local/bin/tracer", line 11, in <module>
    load_entry_point('tracer==0.5', 'console_scripts', 'tracer')()
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/launcher.py", line 43, in launch
    Task().run()
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 1198, in __init__
    self.config = self.read_config(self.config_file)
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 97, in read_config
    tracer_path = self.get_tracer_path()
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 73, in get_tracer_path
    if self.config.has_option('tracer_location', 'tracer_path'):
AttributeError: 'NoneType' object has no attribute 'has_option'

Running the image without arguments seems to work fine: singularity run tracer.simg results in

usage:  tracer <mode> [<args>]

              Modes are :

              - assemble: assemble TCR sequences from single-cell RNA-sequencing reads
              - summarise: summarise TCR sequences from set of cells, build clonotype networks
              - test : use a small dataset from three cells to test TraCeR installation
              - build : build resource files from gene segment sequences

              use tracer <mode> -h for specific help

tracer: error: the following arguments are required: <MODE>

Any suggestions? Thanks in advance for the help.

mstubb commented 3 years ago

Hi Carlo,

I don't have any direct advice for getting it to work in Singularity.

It looks from that that it can't find your config file. Can you use the -c option to point to the tracer/docker_helper_files/docker_tracer.conf file?

Also, see this issue for something else that was encountered previously with Singularity: https://github.com/Teichlab/tracer/issues/87.

Let me know if that helps,

Mike

carlo-deintinis commented 3 years ago

Thank you for your answer!

running singularity exec -H $PWD $PWD/tracer.simg tracer test -c tracer-master/docker_helper_files/docker_tracer.conf results in

Traceback (most recent call last):
  File "/usr/local/bin/tracer", line 11, in <module>
    load_entry_point('tracer==0.5', 'console_scripts', 'tracer')()
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/launcher.py", line 43, in launch
    Task().run()
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 1224, in run
    loci=['A', 'B'], max_junc_len=50).run()
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 358, in run
    io.makeOutputDir(self.output_dir)
  File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/io.py", line 26, in makeOutputDir
    os.makedirs(output_dir_path)
  File "/usr/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/tracer/test_data/results/cell1'

The first idea that comes to mind is that docker containers run as root by default, whereas singularity ones do not follow that behaviour. A whoami inside the docker container results in root, whereas in sinology it results in my username.

mstubb commented 3 years ago

Hi Carlo,

I think you might be right about the permissions. I found this: https://github.com/hpcng/singularity/issues/1132#issuecomment-407104957 which suggests using a Singularity def file to chmod the directories you need. Can you do that?

Sorry, I don't have any experience with Singularity so I can't be that much help.

Please let me know if you manage to make this work.

Cheers,

Mike

On 9 Dec 2020, at 11:54, carlo-deintinis notifications@github.com wrote:

Thank you for your answer!

running singularity exec -H $PWD $PWD/tracer.simg tracer test -c tracer-master/docker_helper_files/docker_tracer.conf results in

Traceback (most recent call last): File "/usr/local/bin/tracer", line 11, in load_entry_point('tracer==0.5', 'console_scripts', 'tracer')() File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/launcher.py", line 43, in launch Task().run() File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 1224, in run loci=['A', 'B'], max_junc_len=50).run() File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/tasks.py", line 358, in run io.makeOutputDir(self.output_dir) File "/usr/local/lib/python3.7/dist-packages/tracer-0.5-py3.7.egg/tracerlib/io.py", line 26, in makeOutputDir os.makedirs(output_dir_path) File "/usr/lib/python3.7/os.py", line 221, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/tracer/test_data/results/cell1' The first idea that comes to mind is that docker containers run as root by default, whereas singularity ones do not follow that behaviour. A whoami inside the docker container results in root, whereas in sinology it results in my username.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Teichlab/tracer/issues/109#issuecomment-741723841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIXBBRPXEFZAHHEPLJZIILST5QOXANCNFSM4UTJBPOQ.

carlo-deintinis commented 3 years ago

In the end, I did not pursue the road of Singularity any further due to many errors and lack of permissions on the cluster on which I was trying to run the analysis.

I was able to create a conda environment with the smallest number of conflicts I could manage between dependencies and run Tracer in there (the assemble and summarise steps work, skipping the plots). I got identical analysis results from the docker image.

However, managing all program versions and python dependencies was a mess (some are still not the same as the ones inside the docker image). Do you by any chance plan to release Tracer as a conda package?