#!/usr/bin/perl use 5.010; use strict; use warnings; use diagnostics; open GENES,'genes.txt' or print "cant open genes\t"; open LOG,'log.txt' or print "cant open log\t"; open START,'start.txt' or print "cant open start\t"; open STOP,'stop.txt' or print "cant open stop\t"; open DIST,'diff.txt' or print "cant open diff"; open O,'>logratio_g0_revised_withnp.txt'; my @genes=; my @start=; my @stop=; my @log=; my @dist=; chomp @genes; chomp @start; chomp @stop; chomp @log; chomp @dist; my $index=0; my $index1=1; my $ind=0; my $in=0; my $count=1; do { $ind=0; $ind1=1; $hit=0; undef @hold; undef @aminoacid; if($proteome[$index]=~m/^>/) { $val++; $proteome[$index] =~ /\|(.+)\|(.+)$/; $id=$1; $name=$2; $index++; print O "$name\t$id\t"; push @hold,$proteome[$index]; $index++; do { push @hold,$proteome[$index]; $index++; } until($proteome[$index]=~m/^>/); $peptide= join ('', @hold); undef @hold; @aminoacid=split(//,$peptide); } if(@aminoacid>0) { do { if($aminoacid[$ind]=~/^X$/) { $ind++; $ind1++; } else { if($aminoacid[$ind] eq $aminoacid[$ind1]) { do { $hit++; $ind++; $ind1++; } until($aminoacid[$ind] ne $aminoacid[$ind1] or $ind==@aminoacid); $hit++; if($hit>9) { print O "$aminoacid[$ind]\t$hit\t"; } else { $hit=0; } $ind++; $ind1++; $hit=0; } else { $ind++; $ind1++; } } } until($ind==@aminoacid); undef @aminoacid; print O "\n"; } } until($index==@proteome); say $val;