Location: A review of cardiac cellular electrophysiology models @ 0b61cf0bc2ee / models / rebase-imports.pl

Author:
David Nickerson <nickerso@users.sourceforge.net>
Date:
2010-07-06 16:55:39+12:00
Desc:
correcting errors found with newer versions of the CellML API: e-notation; namespace; and an initial value is required for state variables. The initial value on x1 fixes the problem reported on tracker item 2521
Permanent Source URI:
https://staging.physiomeproject.org/workspace/a1/rawfile/0b61cf0bc2ee4a696e08c67f233a2b5708b66974/models/rebase-imports.pl

#!/usr/bin/perl

use strict;
use File::Find;
use File::Spec;

@ARGV = ('.') unless @ARGV;

sub processFile {
  if (/\.xml$/) {
    my $file = $_;
    my $out = $file . ".tmp";
    open IN,"<$file" or die "Error opening input file ($file): $!\n";
    open OUT,">$out" or die "Error opening output file ($out): $!\n";
    while (<IN>) {
      if (/\"http:\/\/www.physiome.org.nz\/publications\/PBMB-2005-89\/Nickerson\/models\/(\S+)\"/) {
	my $f = "/home/andre/pmr2/a1/models/" . $1;
	my $r = File::Spec->abs2rel($f);
	s/\"http:\/\/www.physiome.org.nz\/.*\"/\"$r\"/;
      }
      print OUT $_;
    }
    close OUT;
    close IN;
    system("mv $out $file");
  }
}

find(\&processFile,@ARGV);

exit;