Biowulf High Performance Computing at the NIH
hap-ibd on Biowulf

The hap-ibd program detects identity-by-descent (IBD) segments and homozygosity-by-descent (HBD) segments in phased genotype data.

References:

Documentation
Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and run the program.
Sample session (user input in bold):

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job

[user@cn3144 ~]$ module load hap-ibd
[user@cn3144 ~]$ mkdir /data/$USER/hap-ibd_test/
[user@cn3144 ~]$ cd /data/$USER/hap-ibd_test/
[user@cn3144 ~]$ cp $HAPIBD_TEST_DATA/* .
[user@cn3144 ~]$ hap-ibd
hap-ibd.jar  [ version 1.0, 23Apr20.f1a ]

Syntax: java -jar hap-ibd.jar [arguments in format: parameter=value]

Data Parameters:
  gt=                         (required)
  map=                  (required)
  out=                            (required)
  excludesamples=              (optional)

Algorithm Parameters:
  min-seed=            (default: 2.0)
  max-gap=             (default: 1000)
  min-extend=     (default: min(1.0, min-seed))
  min-output=        (default: 2.0)
  min-markers=           (default: 100)
  min-mac=         (default: 2)
  nthreads=          (default: all CPU cores)

[user@cn3144 ~]$ hap-ibd gt=target.truth.vcf.gz map=target.map out=test_out
Copyright (C) 2019 Brian L. Browning
Enter "java -jar hap-ibd.jar" to print a list of command line arguments

Program            :  hap-ibd.jar  [ version 1.0, 23Apr20.f1a ]
Start Time         :  11:23 AM EDT on 27 Apr 2021
Max Memory         :  371 MB

Parameters
  gt               :  target.truth.vcf.gz
  map              :  target.map
  out              :  test_out
  min-seed         :  2.0
  max-gap          :  1000
  min-extend       :  1.0
  min-output       :  2.0
  min-markers      :  100
  min-mac          :  2
  nthreads         :  2

Statistics
  samples          :  300
  markers          :  24965
  IBD segments     :  181
  IBD segs/sample  :  0.6
  HBD segments     :  0
  HBD segs/sample  :  0.000

Wallclock Time:    :  3 seconds
End Time           :  11:23 AM EDT on 27 Apr 2021

[user@cn3144 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. hap-ibd.sh). For example:


#!/bin/bash
set -e
module load hap-ibd
hap-ibd gt=target.truth.vcf.gz map=target.map out=test_out threads=$SLURM_CPUS_PER_TASK

Submit this job using the Slurm sbatch command.

sbatch --cpus-per-task=4 --mem=2g hap-ibd.sh
Swarm of Jobs
A swarm of jobs is an easy way to submit a set of independent commands requiring identical resources.

Create a swarmfile (e.g. hap-ibd.swarm). For example:

cd dir1;hap-ibd gt=target1.truth.vcf.gz map=target1.map out=test1_out threads=$SLURM_CPUS_PER_TASK
cd dir2;hap-ibd gt=target2.truth.vcf.gz map=target2.map out=test2_out threads=$SLURM_CPUS_PER_TASK

Submit this job using the swarm command.

swarm -f hap-ibd.swarm -t 4 [-g #] --module hap-ibd
where
-g # Number of Gigabytes of memory required for each process (1 line in the swarm command file)
-t # Number of threads/CPUs required for each process (1 line in the swarm command file).
--module hap-ibd Loads the hap-ibd module for each subjob in the swarm