in reply to Question on loops

Also untested, since I don't have Bio::SeqIO:

use Bio::SeqIO; use strict; use warnings; my @V; open (LIST1, 'list') || die; while (<LIST1>){ push @V, (split(/\t/, $_))[0]; } close(LIST1); my $seqIO_object = Bio::SeqIO->new(-file => 'infile.gb'); my $seq_object = $seqIO_object->next_seq; for my $feat_object ($seq_object->get_SeqFeatures) { if ($feat_object->primary_tag eq 'CDS' && $feat_object->has_tag('locus_tag')) { for my $V3 ($feat_object->get_tag_values('locus_tag')) { for my $V1 (@V) { print "locus_tag $V1 is unique\n" if $V1 eq $V3; } } } }

I could probably streamline this further if I knew exactly what you were trying to do, but oh well.

Replies are listed 'Best First'.
Re^2: Question on loops
by Bforde (Initiate) on Dec 12, 2011 at 16:42 UTC

    Thanks all for answering. Book are being read and tutorial done

    TJPride, your code works if I change the last two lines

    ) for my $V1 (@V){ if ($V1 eq $V3){ print "locus_tag $V1 is unique\n"; } }