name: scsplit
namespace: genetic_demux
scope: "public"
description: "scsplit is a genotype-free demultiplexing methode of pooled single-cell RNA-seq, using a hidden state model for identifying genetically distinct samples within a mixed population."
authors:
  - __merge__: /src/authors/xichen_wu.yaml
    roles: [ author ]
argument_groups:
- name: "Input"
  arguments:
  - name: "--vcf"
    type: file
    description: VCF from mixed BAM
  - name: "--bam"
    type: file
    description: mixed sample BAM
  - name: "--bar"
    type: file
    description: barcodes whitelist
  - name: "--tag"
    type: string
    default: "CB"
    description: tag for barcode
  - name: "--com"
    type: file
    description: common SNVs
  - name: "--num"
    type: integer
    description: expected number of mixed samples
  - name: "--sub"
    type: integer
    default: 10
    description: maximum number of subpopulations in autodetect mode
  - name: "--ems"
    type: integer
    default: 30
    description: number of EM repeats to avoid local maximum
  - name: "--dbl"
    type: double
    description: correction for doublets. There will be no refinement on the results if this optional parameter is not specified or specified percentage is less than doublet rates detected during the run.
  - name: "--vcf_known"
    type: file
    description: known individual genotypes to limit distinguishing variants to available variants, so that users do not need to redo genotyping on selected variants, otherwise any variants could be selected as distinguishing variants.
  - name: "--geno"
    type: boolean_true
    description: generate sample genotypes based on the split result.
  
- name: "Output"
  arguments:
  - name: "--output"
    alternatives: [ "-o" ]
    type: file
    direction: output
    description: Output directory 
    example: "scSplit_out/"
  - name: "--ref"
    type: string
    description: output Ref count matrix
  - name: "--alt"
    type: string
    description: output Alt count matrix
  - name: "--psc"
    type: string
    description: generated P(S|C)
resources:
  - type: bash_script
    path: script.sh
  - path: scSplit.patch
test_resources:
  - type: bash_script
    path: test.sh
  - path: ../../../resources_test/demuxafy_test_data

engines:
  - type: docker
    image: python:3.13
    setup:
    - type: docker
      copy: ["scSplit.patch /opt/scSplit.patch"]
    - type: python
      pip: 
        - numpy
        - pandas
        - pysam
        - scikit-learn
        - scipy
        - statistics
    - type: python
      pip: [ vcfpy ]
    - type: docker
      run: git clone https://github.com/jon-xu/scSplit && cd scSplit && git apply /opt/scSplit.patch && cp scSplit /usr/local/bin && cd .. && rm -rf scSplit
runners:
  - type: executable
  - type: nextflow
    directives:
      label: [ highmem, highcpu ]
