['CHROM', 'POS', 'REF', 'ALT', 'LIST', 'SAMPLE_1A', 'SAMPLE_2A', 'SAMPLE_3A']
['M, '16', 'T', 'C', 'C', 'REF', 'C', 'REF']
['M', '381', 'T', 'A', 'A', T', 'REF', 'REF']
['M', '529', 'A', 'G', 'G', 'REF', 'G', 'REF']
####
['CHROM', 'POS', 'REF', 'ALT', 'LIST', 'SAMPLE_1B', 'SAMPLE_2B', 'SAMPLE_3B']
['M', '16', 'T', 'C', 'C', 'C', 'REF', 'REF']
['M', '381', 'T', 'A', 'A', 'A', 'REF', 'REF']
['M', '528', 'A', 'G', 'G', 'REF', 'REF', 'REF']
####
['CHROM', 'POS', 'REF', 'ALT', 'LIST', 'SAMPLE_1A', 'SAMPLE_2A', 'SAMPLE_3A']
['M, '16', 'T', 'C', 'C', 'REF', 'C', 'REF']
['M', '381', 'T', 'A', 'A', 'A', 'REF', 'REF']
####
#!/usr/bin/local/perl
use strict;
use warnings;
my %HashRef = ();
my $File1 = 'blah.txt;
my $File2 = 'moreblah.txt';
my $outfile = 'blank.txt';
open FILE2, "< $File2" or die "could not open tumour file...\n";
open FILE1, "< $File1" or die "could not open host file...\n";
open( my $out_fh, '>', $outfile ) or die "$!";
while (my $cols =
{
chomp $cols;
my @values = split ',', $cols;
for my $i(5..$#values)
{
push( @{$HashRef{ $values[2] }}, $values[$i]);
}
}
while (my $cols = )
{
chomp $cols;
my @values = split ',', $cols;
my @newarray = ($values[0], $values[1], $values[2], $values[3], $values[
4]);
for my $j(5..$#values)
{
if($values[$j] =~ m/'REF'/)
{
push(@newarray, $values[$j]);
}
elsif( $HashRef{ $values[$j]} =~ m/'REF'/)
{
push(@newarray, $values[$j]);
}
else
{
push(@newarray, " REF ");
}
}
say $out_fh @newarray;
}
close $out_fh;
close file1;
close file2;