use warnings; use strict; my %HoProPos = (1 => 1916); my %snpHash = (PF14_0747 => [1]); my @geneArr = qw(PF14_0747); while (my $line = ) { my $header = 1; chomp $line; next if $line !~ m/^Gene:\s*(.*)/; my $geneName = $1; next if ! grep (/^$geneName$/, @geneArr); while (substr ($line, 0, 3) ne "---") { $line = ; chomp $line; next if $line !~ m/(\d+)\s*([A-Z]+)\s*(\d+)-(\d+)/; my ($epitope, $epiSeq, $locBeg, $locEnd) = ($1, $2, $3, $4); foreach my $snpID (@{$snpHash{$geneName}}) { next if $locBeg > $HoProPos{$snpID} || $HoProPos{$snpID} > $locEnd; print "Gene: $geneName\n" if $header; print "SNP $snpID found in epitope $epitope at protein position $HoProPos{$snpID}\n"; $header = undef; } } } __DATA__ Gene: PF14_0747 TABLE: Epitopes from IEDB Epitope Sequence Location on Protein Strain Confidence 26850 IKND 1914-1917 Plasmodium falciparum 3D7 Medium ------------------------------------------------------------ Gene: PF14_0711 TABLE: Epitopes from IEDB Epitope Sequence Location on Protein Strain Confidence 26850 IKND 9-12 Plasmodium falciparum 3D7 Medium ------------------------------------------------------------ #### open my $inFile, '<', $dataFileName or die "Unable to open $dataFileName: $!\n";