diff CoverageReport.pl @ 25:6cb012c8497a draft

Added BED format check before collapsing regions.
author geert-vandeweyer
date Thu, 12 Feb 2015 09:54:03 -0500
parents fd788f9db899
children 859999cb135b
line wrap: on
line diff
--- a/CoverageReport.pl	Thu Feb 12 08:51:37 2015 -0500
+++ b/CoverageReport.pl	Thu Feb 12 09:54:03 2015 -0500
@@ -78,6 +78,13 @@
 
 ## 0. Collapse overlapping target regions.
 if (defined($opts{'T'})) {
+	## check BED format. Must have 6 cols if using this.
+	my $head = `head -n 1 $opts{'t'}`;
+	chomp;
+	my @c = split(/\t/,$head);
+	if (scalar(@c) < 6) {
+		die("Targets BED file must be in 6-column format for collapsings. See tool documentation for more info.\n");
+	}
 	my $targets = $opts{'t'};
 	my $tmptargets = "$wd/collapsedtargets.bed";
 	system("sort -k1,1 -k2,2n $targets > $wd/sorted.targets.bed");