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

View of /Sprout/SapLoaderVariantFix.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Oct 7 17:12:21 2014 UTC (4 years, 6 months ago) by parrello
Branch: MAIN
CVS Tags: HEAD
Miscellaneous loader fixes.

#!/usr/bin/perl -w

# Test program for the sapling loader.
use strict;
use Tracer;
use Sapling;
use Stats;

my ($options, @parameters) = StandardSetup([qw(Sapling ERDB  
                                               SaplingDataLoader 
                                               SaplingGenomeLoader)],
                                           { },
                                           "",
                                           @ARGV);
my $sap = Sapling->new();
my %variants = map { $_ => 1 } $sap->GetFlat('Variant', '', [], 'id');
my %badMachines;
my $stats = Stats->new();
my $q = $sap->Get('IsImplementedBy', '', []);
while (my $row = $q->Fetch()) {
	my ($vid, $machine) = $row->Values(['from-link', 'to-link']);
	$stats->Add(record => 1);
	if (! exists $variants{$vid}) {
		$stats->Add(badRecord => 1);
		$badMachines{$machine} = 1;
	}
}
for my $machine (keys %badMachines) {
	$stats->Add(badMachine => 1);
	print "Deleting $machine.\n";
	my $subStats = $sap->Delete(MolecularMachine => $machine);
	$stats->Accumulate($subStats);
}
Trace("All done:\n" . $stats->Show()) if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3