If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > counting simple repeat in a sequence

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-08-04, 04:38
amubioinfo amubioinfo is offline
Registered User
 
Join Date: Apr 2004
Posts: 1
Smile counting simple repeat in a sequence

Hi all,
I have a problem that I have a dna sequence and i want to count the number of times a particular pattern appears in the entire sequence(for ex. how many times the triplet ATT or ATG appears in the dna sequence ). I wrote a programme it finds only the pattern and i also want to get count of the pattern. Can anyone there help me i am giving the programme below.
Thanx


#!/usr/bin/perl
#searching for motifs

#Ask the user for the file name
print "Please enter the file name of the dna sequence data \n";
$dna_filename= <STDIN>;
print "For this program to run, the sequence file to be processed must be in the\n";
print "current working directory. Ie. in:\n";
system pwd;
print "\n";

#remive filename from dna file
chomp $dna_filename;

#open the file or exit
unless (open(DNAFILE,"$dna_filename")){
print "cannot open file \"$dna_filename\"\n\n";
exit;
}
#read the protein sequence data from the file and store it into
#an array variable @dna
@dna = <DNAFILE>;

#close the file we've read dna into @dna
close DNAFILE;
$dna = join('',@dna);
$dna =~ s/\s//g;
do {
print "Enter a motif to search for:";
$motif = <STDIN>;
chomp $motif;
if ( $dna =~ /$motif/i ){
print "I found it:\n\n";
}
else{
print "I couldn\'t find it\n\n";
}
}until ( $motif =~/^\s*$/ );
exit;
Reply With Quote
  #2 (permalink)  
Old 04-08-04, 04:42
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Is the data stored in a DB2 table (DB2 is an IBM DBMS product)? If not, you are in the wrong forum. If the data is stored in DB2, please show the table DDL.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On