#!/usr/bin/perl -w #Markus Westphal 13.12.2006 ###################################################### # Markus Westphal profiler shifter # ###################################################### use strict; my($pf,$procount,$profile,%profile,@profile,$abc,@abc,$j,$i,$datei,$seq,$score); $i = 0; #globale Variabeln füllen $profile = "get-prosite-raw.txt"; $datei = "hefeP04807.fas"; $score = ""; $procount = 0; #telomeraseQ86US8.fas,humanP51587.fas,mouseP97929.fas,hefeP04807.fas #EINLESEN Dateinamen Profile for($j = -1; $j < $#ARGV; $j++) { if($ARGV[$j] =~ /^profile/) { ($pf, $profile) = split("=", $ARGV[$j]); } } #AUSGABEDATEI open(TF, ">shifter.txt") || die ("Die Ausgabedatei kann nicht erstellt werden!\n"); #print TF "profile shifter:\n"; open(F, "<$profile") || die ("$profile kann nicht gelesen werden!\n"); while() { #ABC: MA /GENERAL_SPEC: if($_ =~ /^MA \/GENERAL_SPEC: /i) { $_ =~ /MA \/GENERAL_SPEC: ALPHABET=\'(.*)';.*\n/; $abc = $1; @abc = split("", $abc); } if($_ =~ /^MA \/M: SY=/i) { $_ =~ /MA \/M: SY=\'.*\'; M=(.*);\n/; &Buildprofile($1,$i); $i++; } } close (F); #STARTER print TF &Schieben(&Fastaread($datei)); #PROFILE LESEN sub Buildprofile() { my($zeile, $i) = @_; my($p) = 0; @profile = split(",",$zeile); foreach(@profile) { $profile{$i."_".$abc[$p]} = $_; #print TF $i."_".$abc[$p]."\n"; $p++; } $procount++; } #FASTA DATEI LESEN sub Fastaread() { my($odat) = @_; open(DT,"<$odat") || die ("$odat kann nicht geöffnet werden!"); while(
) { $seq .= $_; } close(DT); $seq =~ />.*\.(.*)/s; $seq = $1; $seq =~ s/\n//g; return $seq; } #DURCHSCHIEBEN beliebiger SEQ sub Schieben() { my($seq) = @_; my($d,$z); $d = 0; $z = 0; #profile durch sequenz schieben start bei 0 print length($seq); for($j = 0;$j < (length($seq)-$procount);$j++) { for($i = $j;$i < ($procount+$j);$i++) { $d = ($i-$j)."_".substr($seq,$i,1); $z = $profile{$d}; $score = $score + $z; } #START SCORE print TF "$j $score\n"; $score = 0; } } close(TF);