Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
sv-conflict-analysis/sv_to_gt.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
22 lines (21 sloc)
692 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REGIONS="$1" # e.g. svim_ambiguous_regions.txt | |
METHOD="$2" # e.g. svim | |
VCF_FILE="$3" # $FILTERED_VCFS/svim_sorted_filtered.vcf.gz | |
vcf="$(zgrep -v '^#' "$VCF_FILE")" | |
line_num=0 | |
while read -r line; | |
do | |
((line_num++)) | |
genotypes="$line_num" | |
svs=$(echo "$line" | grep "'$METHOD[[:alnum:]._-]*'" -o | tr -d "\'") | |
[ -z "$svs" ] && continue # if no svim svs are found in that line | |
sv_cnt=0 | |
while read -r sv; | |
do | |
[ $sv_cnt -eq 0 ] && genotypes=$(getpos "$sv") | |
((sv_cnt++)) | |
genotypes="$genotypes $(echo "$vcf" | | |
awk -F'\t' -v "SV=$sv" '$3~SV {split($10,a,":");print a[1], $6}')" | |
done <<< "$svs" | |
echo "$genotypes" | |
done < "$REGIONS" | |