forked from VertebrateResequencing/vr-codebase
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #444 from sanger-pathogens/farm5_snps
Added some missing scripts to bin for snps pipeline
- Loading branch information
Showing
4 changed files
with
894 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env perl | ||
# | ||
# usage: make_indel_mask.pl indel.calls.bed mask_size indels.mask.bed | ||
# | ||
# Author: Sendu Bala <[email protected]> | ||
# PODNAME: bobby_tables.pl at /usr/local/share/perl/5.14.2/Pod/Weaver.pm line 73. | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use File::Spec; | ||
use File::Basename; | ||
|
||
# get user input | ||
my ($in_bed, $mask_size, $out_bed) = @ARGV; | ||
chomp($out_bed); | ||
|
||
($in_bed && -e $in_bed && $mask_size && $out_bed) or die <<USAGE; | ||
Creates a mask version of a bed file. | ||
Usage: $0 indel.calls.bed mask_size indels.mask.bed | ||
where indel.calls.bed is the input bed file, mask_size is the size in bases | ||
(eg. 10), and indels.mask.bed is the output file | ||
USAGE | ||
|
||
open(my $ifh, $in_bed) || die "Could not open $in_bed\n"; | ||
open(my $ofh, '>', $out_bed) || die "Could not write to $out_bed\n"; | ||
$mask_size = int($mask_size); | ||
$mask_size >= 1 || die "Invalid mask_size '$mask_size' (should be int >= 1)\n"; | ||
|
||
|
||
# covert to mask | ||
while (<$ifh>) { | ||
# chr1 71996 72005 -AAAAAAAAA:4/6 | ||
my ($chr, $start, $stop, $notes) = split; | ||
|
||
$start -= $mask_size; | ||
$stop += $mask_size; | ||
$notes .= ":+/-$mask_size" ; | ||
|
||
print $ofh join("\t", $chr, $start, $stop, $notes), "\n"; | ||
} | ||
close($ifh); | ||
close($ofh); | ||
|
||
exit; |
Oops, something went wrong.