in reply to How to find any of many motifs?
While you wait for BioPerl to download and install, and then work out how to use it, this might do the job :)
#! perl -slw use strict; open MOTIFS, '<', '845226.motif' or die $!; my @motifs = <MOTIFS>; close MOTIFS; chomp @motifs; open SEQS, '<', '845226.fasta' or die $!; while( my $seqID = <SEQS> ) { chomp $seqID; $seqID =~s[^>][]; my $seq = ''; { local $/ = ">"; chomp( $seq .= <SEQS> ); $seq =~ tr[\n][]d; } for my $motif ( @motifs ) { if( $seq =~ m[$motif([^A-Z]+)[A-Z]] ) { print "$seqID contains $motif; distance ", length( $1 ); } } } close SEQS; __END__ C:\test>845226 uc002yje.1 chr21:13973492-13976330 contains gccccac; distance 88 uc002yje.1 chr21:13973492-13976330 contains gccccac; distance 92 uc002yje.1 chr21:13973492-13976330 contains gggggaaaaaacc; distance 2 +0 uc002yje.1 chr21:13973492-13976330 contains gccccac; distance 90 uc002yje.1 chr21:13973492-13976330 contains agagggccc; distance 4
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to find any of many motifs?
by Nikulina (Novice) on Jun 18, 2010 at 07:59 UTC | |
by BrowserUk (Patriarch) on Jun 18, 2010 at 09:03 UTC | |
by BrowserUk (Patriarch) on Jun 18, 2010 at 08:58 UTC |