PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : exakte position eines musters in einer sequenz



anou
14-10-2010, 14:56
Hallo,

ich hab folgendes Problem:
Ich habe eine DNA Sequenz und eine Datei mit den verschiedenen Varianten eines Musters (z.B. CGTCGCACAGC/ CGTCGCACGAC- 12 verschiedene Varianten). Jetzt möchte ich das mein Programm mir jede Position des einzelnen Musters anzeigt (z.B. CGTCGCACAGC fängt an bei Basenpaar 788, 901 usw.). Ich komme aber bei dem Programm gerade nicht weiter, wäre nett wenn mir da jemand helfen könnte...
Das habe ich bis jetzt:

#!/usr/bin/perl -w
use strict;
use Bio::Perl;

# This script will find the exact location of motifs in a DNA sequence

my $dnafilename;
my $varfilename;
my $refseq;
my $pos;
my $motif;
my @dna;
my $dna;
my @var;
my $var;
@var=();
@dna=();

print "Enter the filename of your input file with the sequence:= "; # File that contains your DNA sequence
chomp ($dnafilename=<STDIN>);
open(DNAINPUT,'<',$dnafilename) or die ("$dnafilename Can not open file\n");

print "Enter the filename of your input file with the variants:= "; # File that contains your different variants
chomp ($varfilename=<STDIN>);
open (VARINPUT,'<',$varfilename) or die ("$varfilename Can not open file\n");

@dna=<DNAINPUT>; # stores the sequence in an array
# print @dna;

@var=<VARINPUT>; # stores the variants in an array
#print @var;

$refseq= $dna[0];
$pos=0; # position of the first base


while(length($refseq)>0)
{
if ($refseq=~ /($motif)/ig)
{
$pos= $pos + length($`)-1;
print $pos;
$pos= $pos + length($&);
$refseq= $';
$dna=$dna+1;
}
}
if ($dna==0)
{
print "Sorry, no match\n";
}

Danke schon mal im Voraus

LG Anja

anou
15-10-2010, 15:45
okay, ich habe jetzt nochdie äußere schleife eingefügt.

$refseq= $dna[0];
$pos=0; # position of the first base

while (@var)
{
$motif=$_;
while(length($refseq)>0)

Aber ich bekomme einen Fehler in einer Endlosschleife:

use of uninitialized value $motif in regexp...?

Jemand eine Idee?

Anja