BedFrag

From genomewiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
#!/usr/bin/gawk -f
# extract part of a bed file that lie completely between two limits:
#  example: "cat test.bed | bedFrag chr1 1000 1500"
BEGIN {
    OFS="\t";
    chrom = ARGV[1];
    min = ARGV[2];
    max   = ARGV[3];
    ARGV[1]="";
    ARGV[2]="";
    ARGV[3]="";
    ARGC=1;
}

($1 == chrom) && ($2 >= min) && ($3 <= max)   {
        print $0
}