[Bio] / Sprout / SapLoaderVariantFix.pl Repository:
ViewVC logotype

Annotation of /Sprout/SapLoaderVariantFix.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     # Test program for the sapling loader.
4 :     use strict;
5 :     use Tracer;
6 :     use Sapling;
7 :     use Stats;
8 :    
9 :     my ($options, @parameters) = StandardSetup([qw(Sapling ERDB
10 :     SaplingDataLoader
11 :     SaplingGenomeLoader)],
12 :     { },
13 :     "",
14 :     @ARGV);
15 :     my $sap = Sapling->new();
16 :     my %variants = map { $_ => 1 } $sap->GetFlat('Variant', '', [], 'id');
17 :     my %badMachines;
18 :     my $stats = Stats->new();
19 :     my $q = $sap->Get('IsImplementedBy', '', []);
20 :     while (my $row = $q->Fetch()) {
21 :     my ($vid, $machine) = $row->Values(['from-link', 'to-link']);
22 :     $stats->Add(record => 1);
23 :     if (! exists $variants{$vid}) {
24 :     $stats->Add(badRecord => 1);
25 :     $badMachines{$machine} = 1;
26 :     }
27 :     }
28 :     for my $machine (keys %badMachines) {
29 :     $stats->Add(badMachine => 1);
30 :     print "Deleting $machine.\n";
31 :     my $subStats = $sap->Delete(MolecularMachine => $machine);
32 :     $stats->Accumulate($subStats);
33 :     }
34 :     Trace("All done:\n" . $stats->Show()) if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3