syntax error at motif_finder.pl line 18, near ") {" Execution of motif_finder.pl aborted due to compilation errors.
(that;s just where the while loop begins)
Another task is to not only find a motif but to report the title for each line in which it is found. If you could help me out here I'd appreciate it. can't figure out what's causing the error message. Here's the code#!/usr/bin/perl use warnings; use strict; my $motif; my $fastaseq; my $filename; my $line; print "Please enter the name of the file containing the DNA sequence d +ata: "; $filename = <STDIN>; chomp $filename; open (DNAFILE, $filename) || die "Cannot open file\n" while (<DNAFILE>) { if ($line =~ m/^>/) { next; } else { $fastaseq .= $line; } } close DNAFILE; $fastaseq =~ s/\s//g; print "Enter a motif to search for; "; $motif = <STDIN>; chomp $motif; if ($fastaseq =~ /$motif/) { print "Motif found\n\n"; } else { print "Motif was not found\n\n"; } }
In reply to How do i write code for searching motifs in a FASTA file? by egorleg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |