From eadcee529e92b2edd2a637ce46a866304c5d6bf4 Mon Sep 17 00:00:00 2001 From: Simon Roux Date: Mon, 30 Sep 2019 17:41:17 -0700 Subject: [PATCH] Fix error in file name to be checked --- wrapper_phage_contigs_sorter_iPlant.pl | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/wrapper_phage_contigs_sorter_iPlant.pl b/wrapper_phage_contigs_sorter_iPlant.pl index 3844b51..50923e4 100755 --- a/wrapper_phage_contigs_sorter_iPlant.pl +++ b/wrapper_phage_contigs_sorter_iPlant.pl @@ -478,7 +478,7 @@ =head1 DESCRIPTION $out = `$cmd_blast_unclustered`; say "\t$out"; - if (-e $out_blast_unclustered){ + if (-e $out_blast_new_unclustered){ $out = `cat $out_blast_new_unclustered >> $out_blast_unclustered`; say "\t$out"; } @@ -712,18 +712,22 @@ sub check_for_decontamination { $count{"total"}+=$c_seq; $store_len{$c_c}=$c_seq; } - open my $fa_2,"cat $out_file_1 $out_file_2 $out_file_3 |"; - while(<$fa_2>){ - chomp($_); - if ($_=~/^>(\S+)-cat_\d/){$count{"viral"}+=$store_len{$1};} + if (-e $out_file_1 || -e $out_file_2 || -e $out_file_3){ + open my $fa_2,"cat $out_file_1 $out_file_2 $out_file_3 |"; + while(<$fa_2>){ + chomp($_); + if ($_=~/^>(\S+)-cat_\d/){$count{"viral"}+=$store_len{$1};} + } + close $fa_2; } - close $fa_2; - open my $fa_3,"cat $out_file_p1 $out_file_p2 $out_file_p3 |"; - while(<$fa_3>){ - chomp($_); - if ($_=~/^>\S+-gene_\d+_gene_\d+-(\d+)-(\d+)-cat_\d/){$count{"viral"}+=($2-$1+1);} + if (-e $out_file_p1 || -e $out_file_p2 || -e $out_file_p3){ + open my $fa_3,"cat $out_file_p1 $out_file_p2 $out_file_p3 |"; + while(<$fa_3>){ + chomp($_); + if ($_=~/^>\S+-gene_\d+_gene_\d+-(\d+)-(\d+)-cat_\d/){$count{"viral"}+=($2-$1+1);} + } + close $fa_3; } - close $fa_3; if ($count{"total"}==0){} else{