I used the script on OSX; it work correctly apart from a little flaw. The
script uses the backslash character ("\") as a directory separator, which may
work correctly on Windows but is interpreted literally on OSX. I haven't tried
on Linux but I'm sure to get the same behaviour. Basically you end up with
various files in the current dir named "mydir\file1.vcf", "mydir\file1.vcf",
where the backslash does not mean there is a subfolder but is a literal (valid)
character for the filename.
changing to a forward slash in the relevant lines solved the issue:
--- split_vcf.pl 2014-12-12 01:43:11.000000000 +0100
+++ split_vcf_andrew.pl 2014-12-12 01:53:20.000000000 +0100
@@ -291,7 +291,7 @@
# Append a VCF to filename and see if that file already exists
# If it does, add a suffix
- $test_fname = "$output_dir\\" . $fname . ".vcf";
+ $test_fname = "$output_dir/" . $fname . ".vcf";
if (-e $test_fname) {
print "\nWARN: $test_fname exists!";
@@ -299,7 +299,7 @@
my $rand_num = int(rand(101));
# Add random number as suffix
- $test_fname = "$output_dir\\" . $fname . "_$rand_num" . ".vcf";
+ $test_fname = "$output_dir/" . $fname . "_$rand_num" . ".vcf";
print " Using $test_fname";
}
I believe that the patched code may also work correctly on Windows. Haven't had
the chance to try, though.
A more resilient solution would be using recommended tools to bulld
$test_fname, cfr.
http://stackoverflow.com/questions/2897295/how-can-i-get-the-directory-file-path
-separator-in-perl
Original issue reported on code.google.com by luca.and...@gmail.com on 12 Dec 2014 at 9:29
Original issue reported on code.google.com by
luca.and...@gmail.com
on 12 Dec 2014 at 9:29Attachments: