]> git.donarmstrong.com Git - bin.git/commitdiff
output unused rsids
authorDon Armstrong <don@donarmstrong.com>
Mon, 27 Feb 2017 18:29:22 +0000 (10:29 -0800)
committerDon Armstrong <don@donarmstrong.com>
Mon, 27 Feb 2017 18:29:22 +0000 (10:29 -0800)
vcf_rs_grep

index 56aef856b514d4ca83f94a160650b316e1a4bb60..4c89281f037abea871e4209f95f92c52a94bca0f 100755 (executable)
@@ -126,7 +126,20 @@ while (<$vcf>) {
     $_ =~ /^\S+\s+\S+\s+(\S+)/o;
     next unless $1;
     next unless exists $rsids{$1} and $rsids{$1};
     $_ =~ /^\S+\s+\S+\s+(\S+)/o;
     next unless $1;
     next unless exists $rsids{$1} and $rsids{$1};
+    $rsids{$1}++;
     print $_;
 }
 
     print $_;
 }
 
+my @unused_rsids;
+for my $rsid (keys %rsids) {
+    if ($rsids{$rsid} == 1) {
+        push @unused_rsids,$rsid;
+    }
+}
+if (@unused_rsids) {
+    print STDERR "The following rsids were not found\n";
+    print STDERR map {$_."\n"} @unused_rsids;
+}
+
+
 __END__
 __END__