impute

In 
Impute genotypes for linked-read data with STITCH
  • at least 4 cores/threads available
  • a tab-delimited parameter file
  • sequence alignments: .bam coordinate-sorted
    • sample names: a-z 0-9 . _ - case insensitive
  • a variant call format file: .vcf .vcf.gz .bcf

To work well with STITCH, Harpy needs the input variant call file to meet specific criteria. Where labelled with automatic , Harpy will perform those curation steps on your input variant call file. Where labelled with manual , you will need to perform these curation tasks yourself prior to running the impute module.

Variant call file criteria

  1. automatic Biallelic SNPs only
  2. automatic VCF is sorted by position
  3. manual No duplicate positions
    • example to remove duplicate positions
        bcftools norm -D in.vcf -o out.vcf
  4. manual No duplicate sample names
    • count the occurrence of samples
        bcftools query -l file.bcf | sort | uniq -c
    • you will need to remove duplicate samples how you see fit

After variants have been called, you may want to impute missing genotypes to get the most from your data. Harpy uses STITCH to impute genotypes, a haplotype-based method that is linked-read aware. Imputing genotypes requires a variant call file containing SNPs, such as that produced by harpy snp and preferably filtered in some capacity. You can impute genotypes with Harpy using the impute module:

usage
harpy impute OPTIONS... PARAMETERS VCF INPUTS...

For the time being, it's probably best to set this value to 1 due to this inconsistent issue.

graph LR
    subgraph Inputs
        v[VCF file]:::clean---gen[genome]:::clean
        gen---bam[BAM alignments]:::clean
    end
    B([split contigs]):::clean-->C([keep biallelic SNPs]):::clean
    Inputs-->B & C & G
    C-->D([convert to STITCH format]):::clean
    D-->E([STITCH imputation]):::clean
    E-->F([merge output]):::clean
    G([create file list]):::clean-->E
    style Inputs fill:#f0f0f0,stroke:#e8e8e8,stroke-width:2px,rx:10px,ry:10px
    classDef clean fill:#f5f6f9,stroke:#b7c9ef,stroke-width:2px

The default output directory is Impute with the folder structure below. contig1 and contig2 are generic contig names from an imaginary genome.fasta for demonstration purposes. The directory modelname is a placeholder for whatever name you gave that parameter set in the parameter file's name column. The resulting folder also includes a workflow directory (not shown) with workflow-relevant runtime files and information.

Impute/
└── modelname
    ├── modelname.bcf
    ├── modelname.bcf.csi
    ├── contigs
    │    ├── contig1.vcf.gz
    │    ├── contig1.vcf.gz.tbi
    │    ├── contig2.vcf.gz
    │    └── contig2.vcf.gz.tbi
    ├── logs
    └── reports
        ├── data
        ├── contig1.modelname.ipynb
        ├── contig2.modelname.ipynb
        └── modelname.summary.ipynb
item description
modelname/modelname.bcf final bcf file of imputed genotypes
modelname/modelname.bcf.csi index of modelname.bcf
modelname/reports/modelname.summary.ipynb report summarizing the results of imputation across contigs
modelname/reports/*.modelname.ipynb summary of STITCH imputation (per contig)
modelname/contigs/*.vcf.gz variants resulting from imputation
modelname/contigs/*.vcf.gz.tbi index of variant file

While you are expected to run STITCH using your own set of configurable parameters as described in the section below, Harpy also runs STITCH with a few fixed parameters:

STITCH(
    ..., 
    niterations          = 40,
    switchModelIteration = 39,
    splitReadIterations  = NA
)