Skip to content

Commit

Permalink
starts script for table additions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeyweigand committed Sep 1, 2021
1 parent 0f6a458 commit 0530da0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mutations/import/20210831.Weigand.123.csv
Original file line number Diff line number Diff line change
@@ -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
58 changes: 58 additions & 0 deletions mutations/src/table-add.pl
Original file line number Diff line number Diff line change
@@ -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 = <IN> ){
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");
}
}

Empty file added mutations/src/table-convert.pl
Empty file.

0 comments on commit 0530da0

Please sign in to comment.