egorleg has asked for the wisdom of the Perl Monks concerning the following question:
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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do i write code for searching motifs in a FASTA file?
by johngg (Canon) on Nov 22, 2010 at 20:54 UTC | |
by Anonymous Monk on Nov 23, 2010 at 00:10 UTC | |
by johngg (Canon) on Nov 23, 2010 at 09:53 UTC | |
by umasuresh (Hermit) on Nov 23, 2010 at 16:14 UTC | |
|
Re: How do i write code for searching motifs in a FASTA file?
by Sinistral (Monsignor) on Nov 22, 2010 at 21:35 UTC | |
|
Re: How do i write code for searching motifs in a FASTA file?
by umasuresh (Hermit) on Nov 22, 2010 at 22:30 UTC |