Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #1000 kartu sudaryti DB ir KEGG ID poras atsitiktines
- #atmesti jei nera target
- #likusiu paskaiciuoti kiek % bent vienas target sutampa
- #
- # VR
- use Data::Dump;
- open(KEGG, '<:encoding(UTF-8)', "KEGG_galutinis.targets")
- or die "Could not open file KEGG_galutinis.targets $!";
- open(DB, '<:encoding(UTF-8)', "DB_clean.targets")
- or die "Could not open file DB_clean.targets $!";
- while ($DB_row = <DB>) {
- chomp $DB_row;
- #gal paskui...:
- #@DB_line = split(',', $DB_row);
- push(@DB_data, $DB_row);
- }
- while ($KEGG_row = <KEGG>) {
- chomp $KEGG_row;
- #gal paskui...:
- #@KEGG_line = split(',', $KEGG_row);
- push(@KEGG_data, $KEGG_row);
- #print "$KEGG_row\n";
- }
- #DB 10499 paskutinis, o KEGG 1609
- #print "$DB_data[10499]\n";
- #print "@KEGG_data[1609]\n";
- #dd @KEGG_data;
- #main loop:
- for ($x=1; $x <=1000; $x++) {
- $turi_target = 0;
- $sutampa_target = 0;
- for ($i=0; $i <= 4000; $i++) { #viso 4000 poru
- $KEGG_random = int(rand(1609));
- $DB_random = int(rand(10499));
- #patikrinti ar turi target:
- if (($DB_data[$DB_random] =~ /\./) && ($KEGG_data[$KEGG_random] =~ /\./)) {
- #print "$DB_data[$DB_random]\n";
- #print "$KEGG_data[$KEGG_random]\n\n";
- $turi_target++;
- #patikrinti ar sutampa bent vienas target:
- @KEGG_line = split(',', $KEGG_data[$KEGG_random]);
- @DB_line = split(',', $DB_data[$DB_random]);
- foreach $n (@KEGG_line) {
- foreach $m (@DB_line) {
- if ($n eq $m) {
- #print "$n\n";
- $sutampa_target++;
- }
- }
- }
- }
- }
- $ats[$x] = ($sutampa_target/$turi_target)*100;
- print "$ats[$x]\n";
- $suma = $suma + $ats[$x];
- }
- $vidurkis = $suma/$x;
- print "average: $vidurkis\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement