BedFrag

From genomewiki
Revision as of 10:06, 28 September 2006 by Max (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
#!/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
}