File: create_IGV_compatible_VCF.sh

package info (click to toggle)
discosnp 1%3A2.6.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,656 kB
  • sloc: python: 5,893; sh: 2,966; cpp: 2,692; makefile: 14
file content (39 lines) | stat: -rwxr-xr-x 1,333 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash


function help {
echo " ##############################"
echo "   Create a IGV compatible file"
echo " ##############################"
echo "Usage : ./create_IGV_compatible_VCF.sh VCF_file"

echo -e "\t VCF_file: the vcf created by run_VCF_creator"
echo -e "\t 1/ Remove from this file the unmapped variants"
echo -e "\t 2/ Make the vcf 0-based"
echo -e "\t 3/ sort variants by position"
echo -e "\t-h: print this message"
}
if test -z "$1" 
then
       help
       exit
fi
vcffile=$1
#---------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )


igvfiletemp=$(basename $vcffile .vcf)"_for_IGV.vcf.tmp"
igvfile=$(basename $vcffile .vcf)"_for_IGV.vcf"
cat $vcffile|grep "#">$igvfile
#cat $vcffile|grep -v  "#"|sort -k 2n,2n -n|grep -v "^SNP"|grep -v "^INDEL">>$igvfile
cat $vcffile|grep -v  "#"|sort -k 1,1 -k 2,2n |grep -v "^SNP"|grep -v "^INDEL">>$igvfile # from 2 2 6
#python3 $DIR/tools/one2zeroBased_vcf.py $igvfiletemp 
#cat VCFone2zeroBAsed.vcf >> $igvfile
#rm -f $igvfiletemp VCFone2zeroBAsed.vcf
echo -e "... Creation of the vcf file for IGV: done ...==> $igvfile"