#!usr/bin/perl # # read genes into array # my @ARGV = []; my $genesFn = "Genes_list.txt"; open my $genesFh, "<", $genesFn or die "could not open genes file handle!\n"; while (<$genesFh>) { chomp; push @ARGV, $_; } # # write any matches between annotation line and pattern to results file # my $annotationsFn = "GCF_000298275.1_OryAfe1.0_genomic.gff"; my $resultsFn = "answer.gff"; open my $annotationsFh, "<", $annotationsFn or die "could not open annotations file handle!\n"; open my $resultsFh, ">", $resultsFn or die "could not open handle to results file!\n"; while (<$annotationsFh>) { chomp; if ($_ =~ /ACMSD/ || $_ =~ /CRYM/ || $_ =~ /ARID1B/ { print $resultsFh " $_\n"; } close $resultsFh; close $annotationsFh; close $genesFh;