11 my $raw_vcf_file = $opt_v;
12 my $output_dir = $opt_o;
20 open (SNPS
, "<", $raw_vcf_file) || die "Can't open $raw_vcf_file!\n";
24 #------------------------------------------------------------------
25 # Save header info that should be present in all files into an array
26 #-------------------------------------------------------------------
32 } elsif (m/^#CHROM/) {
36 #--------------------------------------------------------------------------------------------------
37 # Take line with individual accession name and extract that name. Use name to create output vcf file
38 #---------------------------------------------------------------------------------------------------
41 chomp ($accession_name = $full_line);
42 print "Working on accession $accession_name\n";
43 if (exists $already_seen{$accession_name}) { # check to see if this is a repetition
44 print STDERR
"Rep found for $accession_name !\n";
45 $rep_num = $already_seen{$accession_name};
47 $already_seen{$accession_name} = $rep_num;
48 $rep = "_rep" . $rep_num;
50 $already_seen{$accession_name} = 1;
53 my $column_number = $.;
56 $vcf_file = $output_dir . "/" . $accession_name . "_2015_V6" . $rep . ".vcf_" . $column_number;
59 print $vcf_file . "\n";
60 open (OUT
, ">", $vcf_file) || die "Can't open $vcf_file\n";
62 #--------------------------------------------------------------
63 # Print header and info about a single accession to output file
64 #--------------------------------------------------------------
66 foreach my $line (@header) {