diff --git a/mutations/import/20210831.Weigand.123.csv b/mutations/import/20210831.Weigand.123.csv new file mode 100644 index 0000000..6909723 --- /dev/null +++ b/mutations/import/20210831.Weigand.123.csv @@ -0,0 +1,5 @@ +Chrom,Gene,Pos,Ref,Mut,Description,Example,Library,Platform,Analysis,Lineage,Submitter,Date +NC_045512,ORFa,26158,G,A,Some human readable description,NA,NA,NA,NA,NA,YourName - YourAffiliation,YYYYMMDD +NC_045512,ORFa,cow,G,A,Some human readable description,NA,NA,NA,NA,NA,Roy Kent - AFC Richmond,20210905 +NC_045512,ORF1a,7243,G,A,Some human readable description,NA,NA,NA,NA,NA,Josef Martinez - ATLUTD,20210905 +NC_045512,ORF1a,70243,G,A,Some human readable description,NA,NA,NA,NA,NA,George Bello - ATLUTD,20210905 diff --git a/mutations/src/table-add.pl b/mutations/src/table-add.pl new file mode 100644 index 0000000..783ec65 --- /dev/null +++ b/mutations/src/table-add.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl -w +use strict; +use Getopt::Long; +use File::Basename; +use Scalar::Util qw(looks_like_number); + +# Adds submitted mutations to existing table +# M. Weigand - CDC +# 20210901 + +&GetOptions( 'indir=s' => \my$indir, + 'now=s' => \my$now, + 'latest=s' => \my$latest, + 'log=s' => \my$log, + 'out=s' => \my$out); + +my@new = glob("$indir/[!mut_template]*csv"); +open(my $fh, '>>', $out) or die "Could not open file '$out' $!"; +open(my $lg, '>>', $log) or die "Could not open file '$log' $!"; + +foreach my$n (@new){ + open IN, "$n"; + while( my$i = ){ + unless($i =~ m/^Chrom/){ + chomp$i; + if( &REQ($i) eq "pass"){ + print $fh "$i\n"; + print $lg basename($n,'.csv').": $i\n"; + }else{ + print "ERROR IN SUBMISSION: \'$i\' \n"; + } + } + } + close IN; + +} +close $fh; +close $lg; + + +#### +sub REQ { + my@mut = split(",", $_[0]); + if(grep { $_ eq 'NA'} @mut[0..5]){ + return("fail"); + }elsif($mut[-2] =~ /YourName/){ + return("fail"); + }elsif($mut[-1] eq 'YYYYMMDD' ){ + return("fail"); + }elsif(!looks_like_number($mut[2])){ + return("fail"); + }elsif($mut[2] >= 29903){ + return("fail"); + }else{ + return("pass"); + } +} + diff --git a/mutations/src/table-convert.pl b/mutations/src/table-convert.pl new file mode 100644 index 0000000..e69de29