#!/usr/bin/perl -w use strict; my %estadistica; ############################################################################################# ############################################################################################# if (scalar (@ARGV) != 1) { print STDERR "UTILITZA: progama_dades_pergens.pl fitxer_resultats.txt\n"; }; my ($resultat) = @ARGV; ############################################################################################### ############################## FUNCIO OBRIR FITXER DELS RESULTATS ######################## ############################################################################################### &obrirfitxer_construirhash($resultat); &tractament_dades(); ################################################################################################ ################################# FUNCIONS ################################################## ################################################################################################ sub obrirfitxer_construirhash () { my $fitxer_SNPs = $_[0]; open(FITXER1, "<$fitxer_SNPs"); while () { my ($identificador,$UTRs,$exons,$introns,$donors,$acceptors); ($identificador,$UTRs,$exons,$introns,$donors,$acceptors) = split /\t/o, $_; ######################################################################################### ############################ CREACIO DEL HASH ########################################## ######################################################################################### unless (defined ($estadistica{$identificador})) {%{$estadistica{$identificador}} = ()}; $estadistica {$identificador} {UTRS} = $UTRs; $estadistica {$identificador} {EXONS} = $exons; $estadistica {$identificador} {INTRONS} = $introns; $estadistica {$identificador} {DONORS} = $donors; $estadistica {$identificador} {ACCEPTORS} = $acceptors; } # while } #funcio obrirfitxer_contruirhash ############################################################################################## ###################### TRACTAMENT DE LES DADES ############################################## ############################################################################################## sub tractament_dades() { my $identificador; foreach $identificador (keys (%estadistica)) { my ($utrs,$exons,$introns,$donors,$acceptors); $utrs = $estadistica {$identificador} {UTRS}; $exons = $estadistica {$identificador} {EXONS}; $introns = $estadistica {$identificador} {INTRONS}; $donors = $estadistica {$identificador} {DONORS}; $acceptors = $estadistica {$identificador} {ACCEPTORS}; my $totalSNPs_per_gen = 0; $totalSNPs_per_gen = $utrs + $exons + $introns + $donors + $acceptors; print "$identificador:\t$totalSNPs_per_gen\n"; } #foreach }; # funcio tractament_dades