From ca2e6ea9b2c1a596675e759dc8f4a17c73f51988 Mon Sep 17 00:00:00 2001 From: Ale-Rossi <54711719+Ale-Rossi@users.noreply.github.com> Date: Fri, 19 Feb 2021 18:27:28 +0100 Subject: [PATCH] Skip blank lines in the reads file My supervisor wasted a lot of time because he had a blank line in the omic-reads file. Since this is a somewhat common occurrence and it is even pointed out by the authors I thought it would be appropriate for the program to skip blank lines as well as comments when reading said file. I also cleared the syntax of the split in the following line because... why not, I guess --- METABOLIC-C.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/METABOLIC-C.pl b/METABOLIC-C.pl index 1b60e1b..6bc5b1c 100644 --- a/METABOLIC-C.pl +++ b/METABOLIC-C.pl @@ -1775,17 +1775,17 @@ sub _get_Genome_coverge{ open __IN, "$reads"; while (<__IN>){ chomp; - if (!/^#/){ - my @tmp = split (/\,/,$_); - my $tmp_link = ""; - if ($test ne "true"){ - $tmp_link = $tmp[0]."\t".$tmp[1]; - }else{ - $tmp_link = "$METABOLIC_dir/METABOLIC_test_files/METABOLIC_test_reads/".$tmp[0]."\t"."$METABOLIC_dir/METABOLIC_test_files/METABOLIC_test_reads/".$tmp[1]; - } - $Reads{$tmp_link} = $i; - $i++; + next if /^#/ or /^\s*$/; # Skip comments and blank lines + + my @tmp = split /,/; + my $tmp_link = ""; + if ($test ne "true"){ + $tmp_link = $tmp[0]."\t".$tmp[1]; + }else{ + $tmp_link = "$METABOLIC_dir/METABOLIC_test_files/METABOLIC_test_reads/".$tmp[0]."\t"."$METABOLIC_dir/METABOLIC_test_files/METABOLIC_test_reads/".$tmp[1]; } + $Reads{$tmp_link} = $i; + $i++; } close __IN;