Mercurial > repos > niels > annovar_yaml_wrapper
changeset 15:7f4fb56714e8 draft
Uploaded
author | niels |
---|---|
date | Fri, 07 Jun 2019 09:23:41 -0400 |
parents | 94ddfdeb1d38 |
children | fe3deb1dc20b |
files | annovar_yaml/YAML_annovar.yml annovar_yaml/YAML_arguments_annovar.yml annovar_yaml/annovar_yaml.pl annovar_yaml/annovar_yaml.xml |
diffstat | 4 files changed, 557 insertions(+), 483 deletions(-) [+] |
line wrap: on
line diff
--- a/annovar_yaml/YAML_annovar.yml Tue May 14 07:49:56 2019 -0400 +++ b/annovar_yaml/YAML_annovar.yml Fri Jun 07 09:23:41 2019 -0400 @@ -3,7 +3,7 @@ PATHSCRIPTS: '/hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/Annovar/' CODING_ANNOVAR: 'coding_annovar.pl' TABLE_ANNOVAR: 'table_annovar.pl' - LOCATION_DATABASE: '/hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/Annovar/' + LOCATION_DATABASE: ' /hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/Annovar/' DOT2UNDERLINE: 'yes' NASTRING: '.' OTHERINFO: 'yes' @@ -16,6 +16,7 @@ ANALYSIS: DATABASES: - NAME: 'cosmic84' + ALIAS: 'N/A' PROTOCOL: 'cosmic' VERSION: '84' COMMENT: '20190221' @@ -24,6 +25,7 @@ OPERATION: 'f' COLSWANTED: '4' - NAME: 'refgene19' + ALIAS: 'N/A' PROTOCOL: 'refgene' VERSION: '19' AVAILABLE: 'yes' @@ -34,6 +36,7 @@ SPLICING: '6' EXONSPLIC: 'yes' - NAME: 'ncbiRefSeq_UMCU' + ALIAS: 'Annotation' PROTOCOL: 'ncbiRefSeq' VERSION: '_UMCU' AVAILABLE: 'yes' @@ -44,6 +47,7 @@ SPLICING: '6' EXONSPLIC: 'yes' - NAME: 'avsnp150' + ALIAS: 'dbSNP' PROTOCOL: 'avsnp' VERSION: '150' AVAILABLE: 'yes' @@ -51,6 +55,7 @@ OPERATION: 'f' COLSWANTED: '1' - NAME: 'clinvar_20180603' + ALIAS: 'N/A' PROTOCOL: 'clinvar' VERSION: '_20180603' AVAILABLE: 'yes' @@ -58,6 +63,7 @@ OPERATION: 'f' COLSWANTED: '5' - NAME: 'class100519' + ALIAS: 'Class' PROTOCOL: 'class' VERSION: '100519' AVAILABLE: 'yes'
--- a/annovar_yaml/YAML_arguments_annovar.yml Tue May 14 07:49:56 2019 -0400 +++ b/annovar_yaml/YAML_arguments_annovar.yml Fri Jun 07 09:23:41 2019 -0400 @@ -3,7 +3,7 @@ PATHSCRIPTS: '/hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/Annovar/' CODING_ANNOVAR: 'coding_annovar.pl ' TABLE_ANNOVAR: 'table_annovar.pl ' - LOCATION_DATABASE: '/hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/Annovar/' + LOCATION_DATABASE: ' /hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/Annovar/' DOT2UNDERLINE: yes: '--dot2underline ' no: '' @@ -27,6 +27,7 @@ ANALYSIS: DATABASES: - NAME: 'cosmic84' + ALIAS: 'N/A' PROTOCOL: 'cosmic' VERSION: '84' COMMENT: '20190221' @@ -39,6 +40,7 @@ OPERATION: 'f' COLSWANTED: '--colswanted 4 ' - NAME: 'refgene19' + ALIAS: 'N/A' PROTOCOL: 'refgene' VERSION: '19' COMMENT: '20190210' @@ -57,6 +59,7 @@ yes: '--exonicsplicing ' no: '' - NAME: 'ncbiRefSeq_UMCU' + ALIAS: 'Annotation' PROTOCOL: 'ncbiRefSeq' VERSION: '_UMCU' AVAILABLE: @@ -75,6 +78,7 @@ yes: '--exonicsplicing ' no: '' - NAME: 'avsnp150' + ALIAS: 'dbSNP' PROTOCOL: 'avsnp' VERSION: '150' AVAILABLE: @@ -86,6 +90,7 @@ OPERATION: 'f' COLSWANTED: '--colswanted 1 ' - NAME: 'clinvar_20180603' + ALIAS: 'N/A' PROTOCOL: 'clinvar' VERSION: '_20180603' COMMENT: 'blah' @@ -98,6 +103,7 @@ OPERATION: 'f' COLSWANTED: '--colswanted 5 ' - NAME: 'class100519' + ALIAS: 'Class' PROTOCOL: 'class' VERSION: '100519' AVAILABLE:
--- a/annovar_yaml/annovar_yaml.pl Tue May 14 07:49:56 2019 -0400 +++ b/annovar_yaml/annovar_yaml.pl Fri Jun 07 09:23:41 2019 -0400 @@ -1,4 +1,13 @@ #/usr/bin/perl +#This code is using v4 of the Run_Annovar_vx.pl script! + +################## +#!!TEST COMMAND!!# +################## +#Following input required, input fixed currently to run limited Annovar settings +#perl annovar_yaml.pl --inyml YAML_annovar.yml --invcf invcf.vcf --outvcf outvcf.vcf > log.txt + +#Future prospects: ability to learn to read YAML files to pick up parameters. Manual definition of command line still required! #perl modules use use YAML; @@ -7,6 +16,9 @@ use Data::Dumper; #use Data::YAML::Writer; use Getopt::Long; +use feature qw(postderef postderef_qq); +use feature qw(refaliasing); +#no warnings qw(experimental::postderef); use strict; #input required @@ -19,9 +31,12 @@ #protocolversion [default required] #basic paramters +#Switch to enable disable Aliasses; enable=1 disable=0 +my $use_alias = "1"; my $edit = "0"; my $run = "0"; my $application = "0"; +#arguments yaml file is fixed! my $parameter_yml = "YAML_arguments_annovar.yml"; my $inyml; my $outyml; @@ -38,6 +53,8 @@ my %in; my %in2; my $writer; +my $lookup; +my $data_type; #parameter applications my %annovarparameters_array; @@ -94,6 +111,9 @@ my @match_value; my @readonly; my %editinyml; +my $folder_symlinks = '0'; +my $path_symlinks; +my @softlink_building_blocks; #Fixed values for searching hashes my $level5 = "DATABASES"; @@ -135,6 +155,8 @@ 'splicing=s' => \$input_databases_splicing, ); +chomp $invcf; +chomp $outvcf; #inactive options # 'drequired=s' => \$input_databases_required, @@ -175,9 +197,8 @@ @readonly = ("hg19","human","mouse","mm10","annovar","VERSION","TABLE_ANNOVAR","refgene","cosmic"); -#converting string into arrays +#converting input strings into input arrays @inprotocol = split (",", $inprotocol); -print "version $inprotocolversion\n"; @inprotocolversion = split (",", $inprotocolversion); @input_databases_colswanted = split (",", $input_databases_colswanted); @input_databases_exonicsplic = split (",", $input_databases_exonicsplic); @@ -356,109 +377,56 @@ #load_arguments($in); #print "Finished loading arguments...\n"; -#Build command for application -################### stuff to replace with loop - -#Starting with Annovar -#$count = "0"; -#foreach (@inprotocol) { -#$protocol .= "$_$inprotocolversion[$count]"; -#print "protocol $inprotocol\n"; -#print "protocol_version $inprotocolversion\n"; -#if ($count+1 >= scalar @inprotocol) { } else { $protocol .= "','"; }; -#$count++; -#} - -#Make new array with protocol plus version -#@protocol = split (",", $protocol); -#foreach (@protocol) { -#print "print value: $_\n"; -#} - -#Required as input value, not pickup from yaml file! -#$operation = $input_databases_operation; -#$operation =~ s/,/','/g; - -#$count= "0"; -#foreach (@inprotocol) { -#if ( $_ =~ /refgene/ ) { -#print "Entering refgene...\n"; -#$argument .= "$yml_hash_arguments->{$application}{ANALYSIS}{$input_annovar_species}{$input_annovar_build}{DATABASES}{$protocol[$count]}{ARG}{HGVS}{$yml_hash_edit->{$application}{ANALYSIS}{$input_annovar_species}{$input_annovar_build}{DATABASES}{$protocol[$count]}{ARG}{HGVS}} "; -#$argument .= "--splicing $yml_hash_edit->{$application}{ANALYSIS}{$input_annovar_species}{$input_annovar_build}{DATABASES}{$protocol[$count]}{ARG}{SPLICING} "; -#$argument .= "$yml_hash_arguments->{$application}{ANALYSIS}{$input_annovar_species}{$input_annovar_build}{DATABASES}{$protocol[$count]}{ARG}{EXONSPLIC}{$yml_hash_edit->{$application}{ANALYSIS}{$input_annovar_species}{$input_annovar_build}{DATABASES}{$protocol[$count]}{ARG}{EXONSPLIC}}"; -#if ($count+1 >= scalar @inprotocol) { } else { $argument .= "','"; }; -#} elsif ( $_ =~ /cosmic/ ) { -#print "Entering cosmic...\n"; -#$argument .= "--colswanted $yml_hash_edit->{$application}{ANALYSIS}{$input_annovar_species}{$input_annovar_build}{DATABASES}{$protocol[$count]}{ARG}{COLSWANTED}"; -#if ($count+1 >= scalar @inprotocol) { } else { $argument .= "','"; }; -#} -#$count++; -#} - -#print "$argument\n"; - -#Put content to print in arrays -#my @protocol_values = ("$inprotocol","$operation","$argument"); -#my @values = ("$yml_hash_edit->{$application}{GENERAL}{PATHSCRIPTS}","$yml_hash_edit->{$application}{GENERAL}{$script}","$yml_hash_edit->{$application}{GENERAL}{LOCATION_DATABASE}","$input_annovar_build","$yml_hash_arguments->{$application}{GENERAL}{REMOVE}{$yml_hash_edit->{$application}{GENERAL}{REMOVE}}","$yml_hash_arguments->{$application}{GENERAL}{DOT2UNDERLINE}{$yml_hash_edit->{$application}{GENERAL}{DOT2UNDERLINE}}","$yml_hash_arguments->{$application}{GENERAL}{OTHERINFO}{$yml_hash_edit->{$application}{GENERAL}{OTHERINFO}}","$yml_hash_edit->{$application}{GENERAL}{NASTRING}","$yml_hash_arguments->{$application}{GENERAL}{INPUTFORMAT}{$yml_hash_edit->{$application}{GENERAL}{INPUTFORMAT}}","$yml_hash_edit->{$application}{GENERAL}{THREAD}","$yml_hash_arguments->{$application}{GENERAL}{POLISH}{$yml_hash_edit->{$application}{GENERAL}{POLISH}}"); - -#foreach (@protocol_values) { print "line array1: $_\n" }; -#foreach (@values) { print "line array2: $_\n" }; - -#Build actual command -#my $annovar_command = "perl $values[0]$values[1] $invcf $values[2] --buildver $values[3] $values[4] --protocol \'$protocol_values[0]\' --operation \'$protocol_values[1]\' $values[5] $values[6] --nasstring \'$values[7]\' $values[8] --arg \'$protocol_values[2]\' --thread $values[9] $values[10] --outfile $outvcf"; - -################### end of static code - -#Printing/execting command! -#print "$annovar_command\n"; - -#Execute command -#Do some stuff to actual run the command... - -#Build command - -#my @parameters_test = $yml_hash->{ANALYSIS}{DATABASES}; -#foreach (@parameters_test) { -#print "value: $_\n"; -#} -#my $test_hash = $yml_hash->{ }{map}; - -#print "value: $yml_hash->{ANALYSIS}{DATABASES}\n"; - -#Fill hashes with input yaml files +#Fill hashes with input yaml files as defined in input and fixed arguments yaml openyml_read ($parameter_yml); openyml_read ($inyml); load ($inyml, %yml_hash, $yml_hash); load_arguments ($parameter_yml, %yml_hash_arguments, $yml_hash_arguments); -#Building annovar command: +##Check input yaml files format +##Pickup arguments from YAML to run command + +######################### +#!!General parser test!!# +######################### + +#Parsing both input YML files to check format, deviations results in killing the process +print "\nParsing Input YAML File\n"; +parse ($yml_hash, $data_type); +print "\nParsing Argument YAML File\n"; +parse ($yml_hash_arguments, $data_type); + +#Manually defined values to fill Annovar command +#Possible to extract from YAML using parser my $application = 'annovar'; +#Possible to extract from YAML using parser my $ncbiRefSeq = 'ncbiRefSeq'; my $cosmic = 'cosmic'; my $dbsnp = 'avsnp'; my $clinvar = 'clinvar'; my $class = 'class'; +#Possible to extract from YAML using parser my $ncbiRefSeq_version = '_UMCU'; my $cosmic_version = '84'; my $dbsnp_version = '150'; my $clinvar_version = '_20180603'; my $class_version = '100519'; +#possible to extract from YAML using parser #species input fixed my $input_annovar_species = "human"; -#Defined in input -#my $invcf = "/hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/input_vcfs/prepared_vcfs/PA-AI-201812-154T_norm_2.vcf "; -#my $outvcf = "/hpc/cog_bioinf/pathologie/users/snouwens/Annovar_Moldia/input_vcfs/prepared_vcfs/PA-AI-201812-154T_norm_2_out.vcf "; - +#manual definition required! --> parameter in plugin galaxy / script hardcoded?? my $language = 'perl '; +#Possible to extract from YAML using parser my $parse1 = 'parse1'; my $parse2 = 'parse2'; +#Possible to extract from YAML my $application_path = "$application,APPLICATION,GENERAL"; my $ncbiRefSeq_path = "$ncbiRefSeq$ncbiRefSeq_version,NAME,ANALYSIS,DATABASES"; @@ -467,6 +435,78 @@ my $clinvar_path = "$clinvar$clinvar_version,NAME,ANALYSIS,DATABASES"; my $class_path = "$class$class_version,NAME,ANALYSIS,DATABASES"; +##Code to create folder for database softlinks + +my $path_folder_symlinks; +my @symlinkfolder_building_blocks; +my $symlinks_folder_created; + +if ( $use_alias =~ /^1$/) { + +@symlinkfolder_building_blocks = ("$parse1,LOCATION_DATABASE,$application_path","$parse1,SPECIES,$application_path"); +} + +#Setup variables for processing parse_look function +my $lookup; +my %input; +my $input; +my ($pattern1, $pattern2, $pattern3, $pattern4, $pattern5); + +$symlinks_folder_created = '0'; + + +#Code reading species en database location from YAML +if ( $use_alias =~ /^1$/) { + + foreach (@symlinkfolder_building_blocks) { + $in = $inyml; + $in2 = $parameter_yml; + #print "loop1:$_\n"; + my @values = split /\,/, $_; + foreach (@values) { + if ( $_ !~ /^parse[12]$/ ) { + print "Error while generating soflink folder [$_]...\n"; + $path_folder_symlinks .= "$_"; + last; + } + $lookup = ""; + parse_lookup ($values[0], $values[1], $values[2], $values[3], $values[4], $values[5], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments, $lookup, $data_type); + chomp $lookup; + $path_folder_symlinks .= "$lookup"; + $lookup = ''; + %input = ''; + $input = ''; + last; + } + } + + #Generate base name folder, numbered 0 up to endless to allow specific folder for parrallel analysis + + $symlinks_folder_created = '0'; + + $path_folder_symlinks =~ s/^\s+|\s+$//g; + $folder_symlinks =~ s/^\s+|\s+$//g; + + print "\n"; + print "Folder symlinks: $path_folder_symlinks/$folder_symlinks\n"; + + while ($symlinks_folder_created =~ /^0$/ ) { + if ( -d "$path_folder_symlinks/$folder_symlinks" and -e "$path_folder_symlinks/$folder_symlinks" ) { + print "Folder $path_folder_symlinks/$folder_symlinks is in use!\n"; + $folder_symlinks++; + } else { + print "Creating $path_folder_symlinks/$folder_symlinks...\n"; + system ( "mkdir $path_folder_symlinks/$folder_symlinks" ); + $path_symlinks = "$path_folder_symlinks/$folder_symlinks/"; + print "Created $path_symlinks\n"; + $symlinks_folder_created++; + } + } +} + +##Building annovar command: + +#Manual definition required #blocks to build command my @command_building_blocks = ( "$language", @@ -477,16 +517,18 @@ "$parse1,SPECIES,$application_path", "$parse1,BUILD,$application_path", "$parse1,REMOVE,$application_path", +#Manually define arguments using ALIASES or regular NAME argument based on turning ALIAS on or OFF +#Define this in sections scanning the YAML file "--protocol \'", -"$parse2,NAME,$ncbiRefSeq_path", +"$parse2,ALIAS,$ncbiRefSeq_path", "\,", "$parse2,NAME,$cosmic_path", "\,", -"$parse2,NAME,$dbsnp_path", +"$parse2,ALIAS,$dbsnp_path", "\,", "$parse2,NAME,$clinvar_path", "\,", -"$parse2,NAME,$class_path", +"$parse2,ALIAS,$class_path", "\' ", "--operation \'", "$parse2,OPERATION,$ncbiRefSeq_path", @@ -545,82 +587,182 @@ print "\n"; -#Setup variables for processing -my $lookup; -my %input; -my $input; -my $match1; -my $in_key; -my $in_value; -my $in_lookup; -my ($pattern1, $pattern2, $pattern3, $pattern4, $pattern5); -#Empty command +#Create Empty command my $test_command = ""; +#Start building command to run foreach (@command_building_blocks) { $in = $inyml; $in2 = $parameter_yml; #print "loop1:$_\n"; if ( $_ =~ /^,$/ ) { - print "$_ is separator and does not require matching!\n\n"; + print "[NOT YAML] $_ is separator and does not require matching!\n"; $test_command .= "$_"; next; } my @values = split /\,/, $_; foreach (@values) { - if ( $_ =~ /^parse1/ ) { - #print "parse1: $in, $in2, $values[1], $values[2], $values[3], $values[4], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments\n"; - parse1 ($in, $in2, $values[1], $values[2], $values[3], $values[4], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments); - print "parse1_out:$lookup...\n"; - $test_command .= "$lookup"; - $lookup = ''; - $input = ''; - %input = ''; - print "\n"; - last; + if ( $_ !~ /^parse[12]$/ ) { + print "[NOT YAML] $_ does not require matching!\n"; + $test_command .= "$_"; + last; } - elsif ( $_ =~ /^parse2/ ) { - #print "parse2: $in, $in2, $values[1], $values[2], $values[3], $values[4], $values[5], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments\n"; - parse2 ($in, $in2, $values[1], $values[2], $values[3], $values[4], $values[5], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments); - print "parse2_out:$lookup...\n"; + $lookup = ""; + parse_lookup ($values[0], $values[1], $values[2], $values[3], $values[4], $values[5], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments, $lookup, $data_type); + + #If alias is enable determine which number is used for this analysis to pickup the correct database files + if ( $use_alias =~ /^1$/ ) { + #add code to add folder number for analysis + if ($values[1]=~/^SPECIES/ ) { + $lookup =~ s/^\s+|\s+$//g; + $folder_symlinks; + $lookup .= "/$folder_symlinks "; + } + } + print "[YAML]: $lookup\n"; $test_command .= "$lookup"; $lookup = ''; $input = ''; %input = ''; - print "\n"; last; - } - elsif ( $_ !~ /^parse1$/ && $_ !~ /^parse2$/ ) { print "$_ does not require matching!\n\n"; - $test_command .= "$_"; - last; - } } } -print "\n"; -print "Resulting in following command: $test_command\n"; -system ($test_command); -print "Job done program stopping.\n"; +print "\nalias:$use_alias\n"; + +#Created softlinks voor database files + +my @database_info; + +if ( $use_alias =~ /^1$/ ) { + print "Entering Alias stuff..\n"; + #Define databases in use + @softlink_building_blocks = ( + "$parse2,NAME,$ncbiRefSeq_path", + "$parse2,NAME,$cosmic_path", + "$parse2,NAME,$dbsnp_path", + "$parse2,NAME,$clinvar_path", + "$parse2,NAME,$class_path" ); + + print "\nCreating softlinks to Annovar database files:\n"; + + #Use parse_lookup to find argument and create symlinks in analysis database folder + foreach (@softlink_building_blocks) { + $in = $inyml; + $in2 = $parameter_yml; + my @values = split /\,/, $_; + foreach (@values) { + if ( $_ !~ /^parse[12]$/ ) { + print "[NOT YAML] $_ does not require matching!\n"; + last; + } + $lookup = ""; + parse_lookup ($values[0], $values[1], $values[2], $values[3], $values[4], $values[5], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments, $lookup, $data_type); + print "database=$lookup\n"; + #add code to add folder number for analysis + #print "Path_destination=$path_symlinks\n"; + #print "Path_origin=$path_folder_symlinks\n"; + my $database_detail = $lookup; + + $lookup = ""; + parse_lookup ("parse1", "BUILD", "$application","APPLICATION","GENERAL", %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments, $lookup, $data_type); + print "Species: $lookup\n"; + my @build = split /\s/, $lookup; + #print "Species=$build[1]\n"; + my $species = $build[1]; + + $lookup = ''; + print "$values[0], 'ALIAS', $values[2], $values[3], $values[4], $values[5]\n"; + parse_lookup ($values[0], 'ALIAS', $values[2], $values[3], $values[4], $values[5], %yml_hash, %yml_hash_arguments, $yml_hash, $yml_hash_arguments, $lookup, $data_type); + #print "Alias=$lookup\n"; + my $alias = $lookup; + + #Based on database and presence of either index file or not run softlink commands + if ( $alias =~ /^N\/A$/ ) { + my $command = "ln -s $path_folder_symlinks/$species\_$database_detail.txt $path_symlinks$species\_$database_detail.txt"; + print "command: $command\n"; + system ( $command ); + } elsif ( $alias !~ /^N\/A$/ ) { + my $command = "ln -s $path_folder_symlinks/$species\_$database_detail.txt $path_symlinks$species\_$alias.txt"; + print "command2: $command\n"; + system ( $command ); + } + if ( $alias =~ /^dbSNP$/ ) { + my $command = "ln -s $path_folder_symlinks/$species\_$database_detail.txt.idx $path_symlinks$species\_$alias.txt.idx"; + print "command3: $command\n"; + system ( $command ); + } -#testing parse2 -#%in = $inyml; -#$pattern1 = "PROTOCOL"; -#$pattern2 = "$inprotocol$inprotocolversion"; -#$pattern2 = "$inprotocol"; -#$pattern3 = "NAME"; -#$pattern4 = "ANALYSIS"; -#$pattern5 = "DATABASES"; -#parse2 ($in, $yml_hash_arguments, $pattern1, $pattern2, $pattern3, $pattern4, $pattern5); + #Push all softlinks used in array + if ( $alias !~ /^N\/A$/ ) { + push @database_info, "$alias=$species\_$database_detail"; + } + + + $lookup = ''; + $input = ''; + %input = ''; + last; + } + } + print "Done preparing databases!\n"; +} + +#Run Generated annovar command + +print "\nResulting in following command: $test_command\n"; +################################################# +#!!IMPORTANT# DECOMMENT FOR ACTIVE USE!!# +system ($test_command); +################################################# + +my $addition_vcf; + +if ( $use_alias =~ /^1$/ ) { + + #Add translation for common databases to specific version + $addition_vcf; + my $database_details = $path_symlinks.'database_details.txt'; + $addition_vcf .= "##"; + foreach (@database_info) { + $addition_vcf .= ":$_"; + } -#application is checked as well -#testing parse3 -#%in = $inyml; -#$pattern1 = "OTHERINFO"; -#$pattern2 = $application; #is value is which used for check -#patteern3 = "APPLICATION"; -#$pattern4 = "GENERAL"; -#parse1 ($in, $yml_hash_arguments, $pattern1, $pattern2, $pattern3, $pattern4); + #Add information to vcf output file + open(OUTVCF_EDIT, '>', "$outvcf\_edit") or die "Could not open file '$outvcf' $!"; + print "\nDone open edit output vcf file...\n"; + open(OUTVCF, '<', "$outvcf") or die "Could not open file '$outvcf' $!"; + print "Done reading vcf output vcf file...\n\n"; + + + while ( my $line = <OUTVCF> ) { + my @row = split ( "\t", $line ); + if ( $row[0] =~ /^#CHROM$/ ) { + print OUTVCF_EDIT "$addition_vcf\n"; + print OUTVCF_EDIT "$line"; + } else { + print OUTVCF_EDIT "$line"; + } + } + + close OUTVCF_EDIT; + close OUTVCF; + + #Replace orginal vcf file with edited vcf file with additional information + my $mv_command = "mv $outvcf\_edit $outvcf"; + system ($mv_command); + + print "\nAdding line to vcf file:\n"; + print "$addition_vcf\n\n"; + + #Remove folder containing softlinks + print "Removing temporary directory:\n"; + print "rm -r $path_symlinks\n\n"; + system ( "rm -r $path_symlinks" ); +} + +print "Job done program stopping.\n"; exit; @@ -632,184 +774,267 @@ #SUBROUTINES# ############# -sub check_lookup { -if ($in_lookup =~ /^$/) { - #No argument found error, mismatch between arguments and inyml! - print " mismatch between yml input and arguments yml!\n"; - print "Problem with following values: $in_key: $in_value!\n"; } -elsif ($in_lookup !~ /^$/) { - #argument found in arguments file! - print " found argument!\n"; - print "Following values used: $in_key:$in_value:$in_lookup!\n"; - $match1++; } +############# +#Subroutine to obtain datatype variable +############# +sub test_type { + +my $input = $_[0]; +$data_type = ref($input); +return $data_type; + +} + + +############# +#Subroutine to parse and check yaml for correct format +############# +sub parse { + +#@inyml = @{$yml_hash->{$pattern4}{$pattern5}}; +#@inarguments = @{$yml_hash_arguments->{$pattern4}{$pattern5}}; + +my $input_hash = $_[0]; + +my ($key_a, $key_a2, $key_b, $key_b2, $key_c, $key_c2); +my ($value_a, $value_a2, $value_b, $value_b2, $value_c, $value_c2); +my (@hash, @hash2, $hash, $hash2); + +my $count_a = '0'; +my $count_a2 = '0'; +my $count_a3 = '0'; +my $count_a4 = '0'; +my $count_b = '0'; +my $count_b2 = '0'; +my $count_b3 = '0'; +my $count_b4 = '0'; +my $count_c = '0'; +my $count_c2 = '0'; +my $count_c3 = '0'; +my $count_c4 = '0'; + +for $key_a (keys %$input_hash) { + $count_a++; + for $value_a (values %$input_hash) { + $count_a2++; + if ( $count_a =~ /^$count_a2$/ ) { + test_type($value_a); + if ($data_type =~ /^HASH$/) { + for $key_a2 ( keys %{$input_hash->{$key_a}} ) { + $count_a3++; + for $value_a2 ( values %{$input_hash->{$key_a}} ) { + $count_a4++; + if ($count_a3 =~ /^$count_a4$/) { + test_type($value_a2); + if ($data_type =~ /^HASH$/) { + print "[ERROR1] Found unexpected yml file format [ key: $key_a2 ] , please check whether your YAML file meets requirements!\n"; + exit; + } elsif ($data_type =~ /^ARRAY$/) { + @hash = @{$input_hash->{$key_a}{$key_a2}}; + foreach $hash ( @hash ) { + for $key_b ( keys %$hash ) { + $count_b++; + for $value_b (values %$hash ) { + $count_b2++; + if ($count_b =~ /^$count_b2$/) { + test_type($value_b); + if ( $data_type =~ /^HASH$/ ) { + for $key_b2 ( keys %{$hash->{$key_b}} ) { + $count_b3++; + for $value_b2 (values %{$hash->{$key_b}} ) { + $count_b4++; + if ($count_b3 =~ /^$count_b4/) { + test_type($value_b2); + if ( $data_type =~ /^HASH$/ ) { + print "[ERROR2] Found unexpected yml file format [ key: $key_b2 ] , please check whether your YAML file meets requirements!\n"; + exit; + } elsif ( $data_type =~ /^ARRAY$/ ) { + print "[ERROR3] Found unexpected yml file format [ key: $key_b2 ] , please check whether your YAML file meets requirements!\n"; + exit; + } else { + #Assume value level 4 + print "value_b2: $key_a:$key_a2:$key_b:$key_b2:$value_b2\n"; + } + } + } + $count_b4 = "0"; + } + $count_b3 = "0"; + } + elsif ( $data_type =~ /^ARRAY$/ ) { + print "[ERROR4] Found unexpected yml file format [ key: $key_b ] , please check whether your YAML file meets requirements!\n"; + exit; + } else { + #assume value level 3 + print "value_b: $key_a:$key_a2:$key_b:$value_b\n"; + } + } + } + $count_b2 = '0'; + } + $count_b = '0'; + } + } else { + #Assume value level 2 + print "Value_a2: $key_a:$value_a2\n"; + } + } + } + $count_a4 = '0'; + } + $count_a3 = '0'; + } + elsif ($data_type =~ /^ARRAY/) { + @hash2 = @{$input_hash->{$key_a}}; + foreach $hash2 ( @hash2 ) { + for my $key_c ( keys %$hash2 ) { + $count_c++; + for $value_c ( values %$hash2 ) { + $count_c2++; + if ($count_c =~ /^$count_c2$/) { + test_type($value_c); + if ( $data_type =~ /^HASH$/ ) { + for $key_c2 ( keys %{$hash2->{$key_c}} ) { + $count_c3++; + for $value_c2 ( values %{$hash2->{$key_c}} ) { + $count_c4++; + if ( $count_c3 =~ /^$count_c4$/ ) { + test_type($value_c2); + if ( $data_type =~ /^HASH$/ ) { + print "[ERROR5] Found unexpected yml file format [ key: $key_c2 ] , please check whether your YAML file meets requirements!\n"; + exit; + } elsif ( $data_type =~ /^ARRAY$/ ) { + print "[ERROR6] Found unexpected yml file format [ key: $key_c2 ] , please check whether your YAML file meets requirements!\n"; + exit; + } else { + #Assume level 4 + print "value_c2: $key_a:$key_a2:$key_c:$key_c2:$value_c2\n"; + } + } + } + $count_c4 = '0'; + } + $count_c3 = '0'; + } + elsif ( $data_type =~ /^ARRAY$/ ) { + print "[ERROR7] Found unexpected yml file format [ key: $key_c ] , please check whether your YAML file meets requirements!\n"; + exit; + } else { + #assume value level 3 + print "value_c: $key_a:$key_c:$value_c\n"; + } + } + } + $count_c2 = '0'; + } + $count_c = '0'; + } + } else { + #Assume value level 1 + print "value_a: $key_a:$value_a\n"; + } + } + } +$count_a2 = '0'; +} +$count_a = '0'; + +$data_type = ""; + +} + +######################################### +#Subroutine to fetch arguments from YAML# +######################################### + +sub parse_lookup { + +my $hash; +my %hash; +my $hash_a; +my %hash_a; +my %hash_a2; +my $hash_a2; +my @inyml; +my @inarguments; +my $count; +my $match; +my $match2; +my $argument; +my ($pattern1, $pattern2, $pattern3, $pattern4, $pattern5); + +if ( $_[0] =~ /^parse1$/ ) { +$pattern1 = $_[1]; +$pattern2 = $_[2]; +$pattern3 = $_[3]; +$pattern4 = $_[4]; +@inyml = @{$yml_hash->{$pattern4}}; +@inarguments = @{$yml_hash_arguments->{$pattern4}}; +} elsif ( $_[0] =~ /^parse2$/) { +$pattern1 = $_[1]; +$pattern2 = $_[2]; +$pattern3 = $_[3]; +$pattern4 = $_[4]; +$pattern5 = $_[5]; +@inyml = @{$yml_hash->{$pattern4}{$pattern5}}; +@inarguments = @{$yml_hash_arguments->{$pattern4}{$pattern5}}; +} + +$match = "0"; + +foreach my $hash ( @inyml ) { + $hash = \%$hash; + if ($hash->{$pattern3} =~ /^$pattern2$/ ) { + my $value = $hash->{$pattern1}; + if ($value eq "" ) { + print "Error unknown argument \"$pattern1\" for annotation database \"$pattern2\" in input YAML!\n"; + exit; + } + foreach my $hash_a (@inarguments) { + my $hash_a2 = $hash_a->{$pattern1}; + if ( $hash_a->{$pattern3} =~ /^$pattern2$/ ) { + $match2++; + if ($hash_a2 =~ /^HASH/ ) { + $argument = $hash_a2->{$value}; + } else { + $argument = $hash_a2; + } + if ($argument eq "" ) { + print "Unknown given option \"$value\" for argument \"$pattern1\" in YAML arguments file or input YAML for database \"$pattern2\"!\n"; + print "Please check your input and start the plugin again.\n"; + exit; + } + } + if ($match2 =~ /^1$/) { + #Do nothing + } elsif ( $match2 > 1 ) { + print "Error Multiple matches for database \"$pattern2\" database in YAML argumentsfile.\n"; + print "Please check your input and start the plugin again.\n"; + exit; + } elsif ( $match2 =~ /^0$/ ) { + print "Error no matches for database \"$pattern2\" in YAML argumentsfile.\n"; + print "Please check your input and start the plugin again.\n"; + exit; + } + } + $match++; + $lookup = $argument; + } +} +if ($match =~ /^1$/) { + #Do nothing +} else { + print "match: $match \n"; + print "Error in yaml file multiple instances matching input yaml, please check input!\n"; + exit; +} + +return $lookup; + } ############# -#Subroutine to process parsing for 2-layered arrays in yamls -############# -sub parse2 { - -#presetting variables -$input = ''; -%input = ''; -$lookup = ''; -my $find_parameter; -my $find_parameter_result; -my $count_key; -my $count_value; -my $count_inner_key; -my $count_inner_value; -my %test_value_ANALYSIS; -my %test_value_GENERAL; -my $pattern1 = $_[2]; -my $pattern2 = $_[3]; -my $pattern3 = $_[4]; -my $pattern4 = $_[5]; -my $pattern5 = $_[6]; - -print "Searching for matching parameter for: $pattern1..."; - -for my $test_value_ANALYSIS (@{$yml_hash->{$pattern4}{$pattern5}}) { - $count_key = 0; - foreach my $key (keys $test_value_ANALYSIS) { - $count_key++; - $count_value = 1; - foreach my $value (values $test_value_ANALYSIS) { - if ($count_value =~ /^$count_key$/) { - for my $test_value_ANALYSIS_arguments (@{$yml_hash_arguments->{$pattern4}{$pattern5}}) { - $count_inner_key = 0; - foreach my $inner_key (keys $test_value_ANALYSIS_arguments ) { - if ( $key =~ /^$inner_key$/ ) { - $count_inner_key++; - $count_inner_value = 1; - foreach my $inner_value (values $test_value_ANALYSIS_arguments) { - $match1 = 0; - $lookup = ""; - if ( $test_value_ANALYSIS_arguments->{$pattern3} =~ /^$pattern2$/ && $test_value_ANALYSIS->{$pattern3} =~ /^$pattern2$/ ) { - if ( $count_inner_value =~ /^$count_inner_key$/ && $key =~ /^$pattern1$/) { - if ( $test_value_ANALYSIS_arguments->{$key} =~ /^HASH/ ) { - #print "\nIs hash! $key:$value:$inner_key:$inner_value:$pattern1\n"; - $lookup = $test_value_ANALYSIS_arguments->{$key}{$value}; - check_lookup ($in_key = $key,$in_value = $value, $in_lookup = $lookup, $match1); - $in_key = ''; - $in_value = ''; - $in_lookup = ''; - return; - } - elsif ( $test_value_ANALYSIS_arguments->{$key} !~ /^HASH/ ) { - $lookup = $test_value_ANALYSIS_arguments->{$key}; - check_lookup ($in_key = $key,$in_value = $value, $in_lookup = $lookup, $match1); - $in_key = ''; - $in_value = ''; - $in_lookup = ''; - return; - } - } - $count_inner_value++; - } - } - } - } - } - } - $count_value++; - } - } -} - -print " parameter not found!\n"; -print "Problem with following value: $pattern1!\n"; -print "Please check your yaml files for errors!\n"; -print "Aborting...\n"; - -} - -############# -#Subroutine to process parsing of 1-layered array in yamls -############# -sub parse1 { - -#presetting variables -%input = ''; -$lookup = ''; -my $find_parameter; -my $find_parameter_result; -my $count_key; -my $count_value; -my $count_inner_key; -my $count_inner_value; -my %test_value_ANALYSIS; -my %test_value_GENERAL; -my $pattern1 = $_[2]; -my $pattern2 = $_[3]; -my $pattern3 = $_[4]; -my $pattern4 = $_[5]; - -print "Searching for matching parameter for: $pattern1..."; - -foreach my $find_parameter (@{$yml_hash->{$pattern4}}) { - #print "hash: $find_parameter->{$pattern1}\n"; -} - -for my $test_value_ANALYSIS (@{$yml_hash->{$pattern4}}) { - $count_key = 0; - foreach my $key (keys $test_value_ANALYSIS) { - $count_key++; - $count_value = 0; - foreach my $value (values $test_value_ANALYSIS) { - $count_value++; - if ($count_value =~ /^$count_key$/) { - for my $test_value_ANALYSIS_arguments (@{$yml_hash_arguments->{$pattern4}}) { - $count_inner_key = 0; - foreach my $inner_key (keys $test_value_ANALYSIS_arguments ) { - $count_inner_key++; - $count_inner_value = 0; - if ( $key =~ /^$inner_key$/ ) { - foreach my $inner_value (values $test_value_ANALYSIS_arguments) { - $count_inner_value++; - #print "Innervalue: $inner_value $key:$value:$inner_key:$inner_value:$count_key:$count_value:$count_inner_key:$count_inner_value\n"; - $match1 = 0; - $lookup = ""; - if ( $test_value_ANALYSIS_arguments->{$pattern3} =~ /^$pattern2$/ && $test_value_ANALYSIS->{$pattern3} =~ /^$pattern2$/ ) { - if ( $count_inner_value =~ /^$count_inner_key$/ && $key =~ /^$pattern1$/ ) { - if ( $test_value_ANALYSIS_arguments->{$key} =~ /^HASH/ ) { - #print "\nIs hash! $key:$value:$inner_key:$lookup:$match1\n"; - $lookup = $test_value_ANALYSIS_arguments->{$key}{$value}; - check_lookup ($in_key = $key,$in_value = $value, $in_lookup = $lookup, $match1); - $in_key = ''; - $in_value = ''; - $in_lookup = ''; - return; - } - elsif ( $test_value_ANALYSIS_arguments->{$key} !~ /^HASH/ ) { - $lookup = $test_value_ANALYSIS_arguments->{$key}; - #print "Is not a Hash! $lookup\n"; - check_lookup ($in_key = $key,$in_value = $value, $in_lookup = $lookup, $match1); - $in_key = ''; - $in_value = ''; - $in_lookup = ''; - return; - } - } - } - } - } - } - } - } - } - } -} - -print " parameter not found!\n"; -print "Problem with following value: $pattern1!\n"; -print "Please check your yaml files for errors!\n"; -print "Aborting...\n"; - -} - -############# -#subroutine parsing yaml hash +#Subroutine for opening out / edited yaml file ############# sub openyml_write { my $outyml = $in; @@ -819,7 +1044,7 @@ } ############# -# +#Subroutine to check whether yaml file exists ############# sub openyml_read { $in = $_[0]; @@ -831,7 +1056,7 @@ } ############# -## +#Subroutine for reading argument yaml file in hash ############## sub load_arguments { $in = $_[0]; @@ -840,8 +1065,7 @@ } ############# -#pen(FILE, '<', "$inyml") or die "Could not open file '$inyml' $!"; -## +#Subroutine for reading input yaml file in hash ############## sub load { $in = $_[0]; @@ -850,7 +1074,7 @@ } ############# -## +#Subroutine for reading edited input yml file in hash ############## sub load_edit { $in = $_[0]; @@ -858,7 +1082,7 @@ } ############# -## +#Subroutine for editing content yaml hash ############## sub writeyml { my $yml_hash = $in; @@ -871,7 +1095,7 @@ } ############# -## +#Subroutine for editing content edited yaml hash ############## sub writeyml_edit { my $yml_hash = $in; @@ -883,165 +1107,3 @@ $file->write( $yml_hash_edit, $writer ); close OUT; } - -############# -## -############## -sub parse { -my $ymlhash = $in; - -print "searching for: $pattern\n"; - -$match = "0"; -$match_value = ''; - -for my $key1 (keys %{$yml_hash}) { -#print "Key1: $key1\n"; -$type = ''; -$type = ref(${$yml_hash}{$key1}); - if (exists $yml_hash->{$key1} || $type =~ /HASH/) { - for my $key2 (keys %{$yml_hash->{$key1}}) { - #print "Key2: $key2\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}); - if (exists $yml_hash->{$key2} || $type =~ /HASH/) { - for my $key3 (keys %{$yml_hash->{$key1}{$key2}}) { - #print "Key3: $key3\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}); - if (exists $yml_hash->{$key3} || $type =~ /HASH/) { - for my $key4 (keys %{$yml_hash->{$key1}{$key2}{$key3}}) { - #print "Key4: $key4\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}{$key4}); - if (exists $yml_hash->{$key4} || $type =~ /HASH/) { - for my $key5 (keys %{$yml_hash->{$key1}{$key2}{$key3}{$key4}}) { - #print "Key5: $key5\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}{$key4}{$key5}); - if (exists $yml_hash->{$key5} || $type =~ /HASH/) { - for my $key6 (keys %{$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}}) { - #print "Key6: $key6\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}); - if (exists $yml_hash->{$key6} || $type =~ /HASH/) { - for my $key7 (keys %{$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}}) { - #print "Key7: $key7\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}); - if (exists $yml_hash->{$key7} || $type =~ /HASH/) { - for my $key8 (keys %{$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}}) { - #print "Key8: $key8\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}); - if (exists $yml_hash->{$key8} || $type =~ /HASH/) { - for my $key9 (keys %{$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}}) { - #print "Key9: $key9\n"; - $type = ''; - $type = ref(${$yml_hash}{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}); - if (exists $yml_hash->{$key9} || $type =~ /HASH/) { - for my $key10 (keys %{$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}}) { - my $value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}{$key10}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9:$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}{$key10}"; - #print "value $key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}{$key10}\n"; - } - #print "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}{$key10}"; - } - } else { - my $value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9:$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}"; - #print "value: $key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}\n"; - } - #print "value: $key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$key9 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}{$key9}\n"; - } - } - } else { - my $value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8:$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}"; - #print "value: $key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}\n"; - } - #print "value: $key1:$key2:$key3:$key4:$key5:$key6:$key7:$key8 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}{$key8}\n"; - } - } - } else { - my $value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$key5:$key6:$key7:$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}"; - #print "value: $key1:$key2:$key3:$key4:$key5:$key6:$key7 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}\n"; - } - #print "value: $key1:$key2:$key3:$key4:$key5:$key6:$key7 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}{$key7}\n"; - } - } - } else { - my $value = "$key1:$key2:$key3:$key4:$key5:$key6 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$key5:$key6:$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}"; - #print "value: $key1:$key2:$key3:$key4:$key5:$key6 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}\n"; - } - #print "value: $key1:$key2:$key3:$key4:$key5:$key6 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}{$key6}\n"; - } - } - } else { - my $value = "$key1:$key2:$key3:$key4:$key5 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$key5:$yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}"; - #print "value: $key1:$key2:$key3:$key4:$key5 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}\n"; - } - #print "value: $key1:$key2:$key3:$key4:$key5 $yml_hash->{$key1}{$key2}{$key3}{$key4}{$key5}\n"; - } - } - } else { - my $value = "$key1:$key2:$key3:$key4 $yml_hash->{$key1}{$key2}{$key3}{$key4}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$key4:$yml_hash->{$key1}{$key2}{$key3}{$key4}"; - #print "value: $key1:$key2:$key3:$key4 $yml_hash->{$key1}{$key2}{$key3}{$key4}\n"; - } - #print "value: $key1:$key2:$key3:$key4 $yml_hash->{$key1}{$key2}{$key3}{$key4}\n"; - } - } - } else { - my $value = "$key1:$key2:$key3 $yml_hash->{$key1}{$key2}{$key3}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$key3:$yml_hash->{$key1}{$key2}{$key3}"; - #print "value: $key1:$key2:$key3 $yml_hash->{$key1}{$key2}{$key3}\n"; - } - #print "value: $key1:$key2:$key3 $yml_hash->{$key1}{$key2}{$key3}\n"; - } - } - } else { - my $value = "$key1:$key2 $yml_hash->{$key1}{$key2}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$key2:$yml_hash->{$key1}{$key2}"; - #print "value: $key1:$key2 $yml_hash->{$key1}{$key2}\n"; - } - #print "value: $key1:$key2 $yml_hash->{$key1}{$key2}\n"; - } - } - } else { - my $value = "$key1 $yml_hash->{$key1}"; - if ( $value =~ /$pattern/ ) { - $match++; - $match_value = "$key1:$yml_hash->{$key1}"; - #print "value: $key1 $yml_hash->{$key1}\n"; - } - #print "value: $key1 $yml_hash->{$key1}\n"; - } -} - -print "Match: $match\n"; - -return $match; -return $match_value; -}
--- a/annovar_yaml/annovar_yaml.xml Tue May 14 07:49:56 2019 -0400 +++ b/annovar_yaml/annovar_yaml.xml Fri Jun 07 09:23:41 2019 -0400 @@ -1,14 +1,14 @@ -<tool id="annovar_yaml" name="Annovar YAML" version="1.1"> +<tool id="annovar_yaml" name="Annovar YAML" version="1.0"> <requirements> <requirement type="package" version="5.22.0">perl</requirement> - <requirement type="package" version="1.24">perl-yaml</requirement> - <requirement type="package" version="1.70">perl-yaml-tiny</requirement> + <requirement type="package" version="1.27">perl-yaml</requirement> + <requirement type="package" version="1.73">perl-yaml-tiny</requirement> <requirement type="package" version="0.74">perl-yaml-xs</requirement> - <requirement type="package" version="2.161">perl-data-dumper</requirement> + <requirement type="package" version="2.173">perl-data-dumper</requirement> <requirement type="package" version="2.50">perl-getopt-long</requirement> </requirements> <command detect_errors="exit_code"><![CDATA[ - which perl && perl $__tool_directory__/annovar_yaml.pl --invcf $vcf --inyml $yaml --outvcf $output + perl $__tool_directory__/annovar_yaml.pl --invcf $vcf --inyml $yaml --outvcf $output ]]></command> <inputs>