Git Product home page Git Product logo

ligo's Introduction

LIgO

Python application Docker

LIgO is a tool for simulation of adaptive immune receptors and repertoires, internally powered by immuneML. The README includes quick installation instructions and information on how to run a quickstart. For more detailed documentation, see https://uio-bmi.github.io/ligo/.

Installation

Requirements: Python 3.11 or later.

To install from PyPI (recommended), run the following command in your virtual environment:

pip install ligo

To install LIgO from the repository, run the following:

pip install git+https://github.com/uio-bmi/ligo.git

To be able to use Stitcher to export full-length sequences, download the database after installing LIgO:

stitchrdl -s human

Usage

To run LIgO simulation, it is necessary to define the YAML file describing the simulation. Here is an example YAML specification, that will create 300 T-cell receptors. The first 100 receptors will contain signal1 (which means all of these 100 receptors will have TRBV7 gene and AS somewhere in the receptor sequence), the next 100 receptors will contain signal2 (sequences will contain G/G with the gap denoted by '' sign and the gap size between 1 and 2 inclusive), and the final 100 receptors will not contain any of these signals.

  definitions:
    motifs:
      motif1:
        seed: AS
      motif2:
        seed: G/G
        max_gap: 2
        min_gap: 1
    signals:
      signal1:
        v_call: TRBV7
        motifs:
          - motif1
      signal2:
        motifs:
          - motif2
    simulations:
      sim1:
        is_repertoire: false
        paired: false
        sequence_type: amino_acid
        simulation_strategy: RejectionSampling
        remove_seqs_with_signals: true 
        sim_items:
          sim_item1: # group of AIRs with the same parameters
            generative_model:
              chain: beta
              default_model_name: humanTRB
              model_path: null
              type: OLGA
            number_of_examples: 100
            signals:
              signal1: 1
          sim_item2:
            generative_model:
              chain: beta
              default_model_name: humanTRB
              model_path: null
              type: OLGA
            number_of_examples: 100
            signals:
              signal2: 1
          sim_item3:
            generative_model:
              chain: beta
              default_model_name: humanTRB
              model_path: null
              type: OLGA
            number_of_examples: 100
            signals: {} # no signal
  instructions:
    my_sim_inst:
      export_p_gens: false
      max_iterations: 100
      number_of_processes: 4
      sequence_batch_size: 1000
      simulation: sim1
      type: LigoSim

To run this simulation, save the YAML file above as specs.yaml and run the following:

ligo specs.yaml output_folder

Note that output_folder (user-defined name) should not exist before the run.

Citing LIgO

If you are using LIgO in any published work, please cite:

Chernigovskaya, M.; Pavlović, M.; Kanduri, C.; Gielis, S.; Robert, P. A.; Scheffer, L.; Slabodkin, A.; Haff, I. H.; Meysman, P.; Yaari, G.; Sandve, G. K.; Greiff, V “Simulation of Adaptive Immune Receptors and Repertoires with Complex Immune Information to Guide the Development and Benchmarking of AIRR Machine Learning” bioRxiv, 2023, 2023.10.20.562936. https://doi.org/10.1101/2023.10.20.562936.

ligo's People

Contributors

mchernigovskaya avatar pavlovicmilena avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nahid18

ligo's Issues

Can't install with python 3.12

I was able to get ligo to install with 3.11, but not 3.12.

firebrick local-reviews/24-chernigovskaia-thesis-oslo-grieff » python3.12 -m venv .venv/ligopy312
firebrick local-reviews/24-chernigovskaia-thesis-oslo-grieff » source .venv/ligopy312/bin/activate
(ligopy312) firebrick local-reviews/24-chernigovskaia-thesis-oslo-grieff » python --version
Python 3.12.3
(ligopy312) firebrick local-reviews/24-chernigovskaia-thesis-oslo-grieff » pip install ligo
Collecting ligo
  Using cached ligo-1.0.3-py3-none-any.whl.metadata (4.4 kB)
Collecting pandas (from ligo)
  Using cached pandas-2.2.2-cp312-cp312-macosx_11_0_arm64.whl.metadata (19 kB)
Collecting bionumpy==0.2.26 (from ligo)
  Using cached bionumpy-0.2.26-py2.py3-none-any.whl.metadata (2.5 kB)
Collecting numpy (from ligo)
  Using cached numpy-2.0.0-cp312-cp312-macosx_14_0_arm64.whl.metadata (60 kB)
Collecting olga (from ligo)
  Using cached olga-1.2.4-py3-none-any.whl.metadata (856 bytes)
Collecting pyyaml (from ligo)
  Using cached PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl.metadata (2.1 kB)
Collecting airr<1.4 (from ligo)
  Using cached airr-1.3.1.tar.gz (49 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      /private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-install-qe_u8ekb/airr_19c922cba1e9413faa7bdc82f46894e4/versioneer.py:421: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "/Users/matsen/Documents/local-reviews/24-chernigovskaia-thesis-oslo-grieff/.venv/ligopy312/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/matsen/Documents/local-reviews/24-chernigovskaia-thesis-oslo-grieff/.venv/ligopy312/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/matsen/Documents/local-reviews/24-chernigovskaia-thesis-oslo-grieff/.venv/ligopy312/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-build-env-c6bxv9vc/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-build-env-c6bxv9vc/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-build-env-c6bxv9vc/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-build-env-c6bxv9vc/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 26, in <module>
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-install-qe_u8ekb/airr_19c922cba1e9413faa7bdc82f46894e4/versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-install-qe_u8ekb/airr_19c922cba1e9413faa7bdc82f46894e4/versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/16/pkph6n2962g3lf2wpwwt0wwr0000gn/T/pip-install-qe_u8ekb/airr_19c922cba1e9413faa7bdc82f46894e4/versioneer.py", line 342, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 24.0 -> 24.1.1
[notice] To update, run: pip install --upgrade pip
(ligopy312) firebrick local-reviews/24-chernigovskaia-thesis-oslo-grieff » 

No repertoires generated in output

Hello there - thanks for making this very interesting tool! I have installed LigO in a virtual environment as suggested, running Python 3.11.0rc1. All dependencies were installed without errors. On running the provided quickstart example, I receive the following output:


> (ligo_env) aag7319@aag7319-MS-7C91:~$ ligo specs.yaml output_folder
> 2023-11-02 14:38:37.703487: LIgO: parsing the specification...
> 2023-11-02 14:38:39.077426: Full specification is available at output_folder/full_specs.yaml.
> 2023-11-02 14:38:39.077473: LIgO: starting the simulation...
> 2023-11-02 14:38:39.078744: Generating HTML reports...
> 2023-11-02 14:38:39.078796: HTML reports are generated.
> 2023-11-02 14:38:39.078818: LIgO: finished simulation.

On examination, my output folder only contains full_specs.yaml and log.txt. Log reports no errors and shows the following:

2023-11-02 14:43:51,727 INFO: LIgO: parsing the specification...

2023-11-02 14:43:51,743 INFO: --- Entering: _parse_seed_motif with parameters ('motif1', {'seed': 'AS'})
2023-11-02 14:43:51,743 INFO: --- Exiting: _parse_seed_motif
2023-11-02 14:43:51,743 INFO: --- Entering: _parse_seed_motif with parameters ('motif2', {'seed': 'G/G', 'max_gap': 2, 'min_gap': 1})
2023-11-02 14:43:51,743 INFO: --- Exiting: _parse_seed_motif
2023-11-02 14:43:51,743 INFO: --- Entering: parse with parameters ({'signal1': {'v_call': 'TRBV7', 'motifs': ['motif1']}, 'signal2': {'motifs': ['motif2']}}, SymbolTable())
2023-11-02 14:43:51,743 INFO: --- Exiting: parse
2023-11-02 14:43:53,084 INFO: Full specification is available at output_folder/full_specs.yaml.

2023-11-02 14:43:53,084 INFO: LIgO: starting the simulation...

2023-11-02 14:43:53,085 INFO: Generating HTML reports...
2023-11-02 14:43:53,086 INFO: HTML reports are generated.
2023-11-02 14:43:53,086 INFO: LIgO: finished simulation.

Any help would be appreciated - thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.