#!/bin/bash

# create a bed file from hap-ibd output with columns "chr, start, end, sample_name1 hap1 sample_name2 hap2"
# add this config to jbrowse get(feature,'sample1')+':HP'+get(feature,'hap1')+'     '+get(feature,'sample2')+':HP'+get(feature,'hap2')
zcat out1234.ibd.gz |  cut -f 5,6,7 >! out.bed   
zcat out1234.ibd.gz |  cut -f 1,2,3,4 >! samples.txt                                
echo "#chr	start	end	sample1	hap1	sample2	hap2" > out.bed
paste out.bed samples.txt >> out.bed