code
stringlengths
2
1.05M
repo_name
stringlengths
5
101
path
stringlengths
4
991
language
stringclasses
3 values
license
stringclasses
5 values
size
int64
2
1.05M
#!/usr/bin/perl use FCGI; use Socket; use POSIX qw(setsid); require 'syscall.ph'; &daemonize; #this keeps the program alive or something after exec'ing perl scripts END() { } BEGIN() { } *CORE::GLOBAL::exit = sub { die "fakeexit\nrc=".shift()."\n"; }; eval q{exit}; if ($@) { exit unless $@ =~ /^fakeexit/; }; &main; sub daemonize() { chdir '/' or die "Can't chdir to /: $!"; defined(my $pid = fork) or die "Can't fork: $!"; exit if $pid; setsid or die "Can't start a new session: $!"; umask 0; } sub main { $socket = FCGI::OpenSocket( "127.0.0.1:8999", 10 ); #use IP sockets $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%req_params, $socket ); if ($request) { request_loop()}; FCGI::CloseSocket( $socket ); } sub request_loop { while( $request->Accept() >= 0 ) { #processing any STDIN input from WebServer (for CGI-POST actions) $stdin_passthrough =''; $req_len = 0 + $req_params{'CONTENT_LENGTH'}; if (($req_params{'REQUEST_METHOD'} eq 'POST') && ($req_len != 0) ){ my $bytes_read = 0; while ($bytes_read < $req_len) { my $data = ''; my $bytes = read(STDIN, $data, ($req_len - $bytes_read)); last if ($bytes == 0 || !defined($bytes)); $stdin_passthrough .= $data; $bytes_read += $bytes; } } #running the cgi app if ( (-x $req_params{SCRIPT_FILENAME}) && #can I execute this? (-s $req_params{SCRIPT_FILENAME}) && #Is this file empty? (-r $req_params{SCRIPT_FILENAME}) #can I read this file? ){ pipe(CHILD_RD, PARENT_WR); my $pid = open(KID_TO_READ, "-|"); unless(defined($pid)) { print("Content-type: text/plain\r\n\r\n"); print "Error: CGI app returned no output - "; print "Executing $req_params{SCRIPT_FILENAME} failed !\n"; next; } if ($pid > 0) { close(CHILD_RD); print PARENT_WR $stdin_passthrough; close(PARENT_WR); while(my $s = <KID_TO_READ>) { print $s; } close KID_TO_READ; waitpid($pid, 0); } else { foreach $key ( keys %req_params){ $ENV{$key} = $req_params{$key}; } # cd to the script's local directory if ($req_params{SCRIPT_FILENAME} =~ /^(.*)\/[^\/]+$/) { chdir $1; } close(PARENT_WR); close(STDIN); #fcntl(CHILD_RD, F_DUPFD, 0); syscall(&SYS_dup2, fileno(CHILD_RD), 0); #open(STDIN, "<&CHILD_RD"); exec($req_params{SCRIPT_FILENAME}); die("exec failed"); } } else { print("Content-type: text/plain\r\n\r\n"); print "Error: No such CGI app - $req_params{SCRIPT_FILENAME} may not "; print "exist or is not executable by this process.\n"; } } }
heyihan/scripts
perl-fcgi/perl-fastcgi.pl
Perl
bsd-3-clause
2,757
############################################################################### ## Copyright 2005-2016 OCSInventory-NG/OCSInventory-Server contributors. ## See the Contributors file for more details about them. ## ## This file is part of OCSInventory-NG/OCSInventory-ocsreports. ## ## OCSInventory-NG/OCSInventory-Server is free software: you can redistribute ## it and/or modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation, either version 2 of the License, ## or (at your option) any later version. ## ## OCSInventory-NG/OCSInventory-Server is distributed in the hope that it ## will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty ## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the ## Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ## MA 02110-1301, USA. ################################################################################ package Apache::Ocsinventory::Interface::History; use Apache::Ocsinventory::Interface::Database; use XML::Simple; use strict; require Exporter; our @ISA = qw /Exporter/; our @EXPORT = qw / get_history_events clear_history_events /; sub get_history_events { my $offset = shift; my @tmp; $offset = $offset * $ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT}; my $sth = get_sth( "SELECT DATE,DELETED,EQUIVALENT FROM deleted_equiv ORDER BY DATE,DELETED LIMIT $offset, $ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT}" ); while( my $row = $sth->fetchrow_hashref() ){ push @tmp, { 'DELETED' => [ $row->{'DELETED'} ], 'DATE' => [ $row->{'DATE'} ], 'EQUIVALENT' => [ $row->{'EQUIVALENT'} ] } } $sth->finish(); return XML::Simple::XMLout( {'EVENT' => \@tmp} , RootName => 'EVENTS' ); } sub clear_history_events { my $offset = shift; my $ok = 0; my $sth = get_sth( "SELECT * FROM deleted_equiv ORDER BY DATE,DELETED LIMIT 0,$offset" ); while( my $row = $sth->fetchrow_hashref() ) { if( defined $row->{'EQUIVALENT'} ){ do_sql('DELETE FROM deleted_equiv WHERE DELETED=? AND DATE=? AND EQUIVALENT=?', $row->{'DELETED'}, $row->{'DATE'}, $row->{'EQUIVALENT'}) or die; } else{ do_sql('DELETE FROM deleted_equiv WHERE DELETED=? AND DATE=? AND EQUIVALENT IS NULL', $row->{'DELETED'}, $row->{'DATE'}) or die; } $ok++; } return $ok; }
himynameismax/codeigniter
ocsinventory-server/perl/Apache/Ocsinventory/Interface/History.pm
Perl
mit
2,570
package BkxMojo::Plugin::Bkmrx; use Mojo::Base 'Mojolicious::Plugin'; use Net::IP::Match::Regexp qw( create_iprange_regexp match_ip ); use Mojo::URL; use Mojo::Util qw(url_escape squish); use Data::Validate::Domain; use Data::Validate::IP; use List::Util qw( max min ); use POSIX qw( ceil ); use HTML::Entities; sub register { my ($self, $app) = @_; # Controller alias helpers for my $name (qw(paginate clean_tag clean_url valid_uri clean_text)) { $app->helper($name => sub { shift->$name(@_) }); } $app->helper(paginate => \&_paginate); $app->helper(clean_tag => \&_clean_tag); $app->helper(clean_url => \&_clean_url); $app->helper(clean_text => \&_clean_text); $app->helper(valid_uri => \&_is_valid_uri); } sub new { my $class = shift; my $self = { @_ }; bless ($self, $class); return $self; } # core functions sub _paginate { my ($self, $total_hits, $offset, $page_size, $href, $params) = @_; my $paging_info; if ( $total_hits == 0 ) { # Alert the user that their search failed. $paging_info = ''; } else { # if page size != 10 append num param my $num = ''; if ($page_size != 10) { $num = '&num=' . $page_size; } # Calculate the nums for the first and last hit to display. my $last_result = min( ( $offset + $page_size ), $total_hits ); my $first_result = min( ( $offset + 1 ), $last_result ); # Calculate first and last hits pages to display / link to. my $current_page = int( $first_result / $page_size ) + 1; my $last_page = ceil( $total_hits / $page_size ); my $first_page = max( 1, ( $current_page - 9 ) ); $last_page = min( $last_page, ( $current_page + 10 ) ); # Create a url for use in paging links. $href .= "?offset=" . $offset; if ($params->{'from'}) { $href .= "&from=" . $params->{'from'}; } if ($params->{'q'}) { $href .= "&q=" . url_escape $params->{'q'}; } if ($params->{'type'}) { $href .= "&type=" . $params->{'type'}; } # Generate the "Prev" link. if ( $current_page > 1 ) { my $new_offset = ( $current_page - 2 ) * $page_size; $href =~ s/(?<=offset=)\d+/$new_offset/; $href .= $num; $paging_info .= qq|<li><a href="$href">Prev</a></li>|; } # Generate paging links. for my $page_num ( $first_page .. $last_page ) { if ( $page_num == $current_page ) { $paging_info .= qq|<li class="active"><a href="">$page_num</a></li> |; } else { my $new_offset = ( $page_num - 1 ) * $page_size; $href =~ s/(?<=offset=)\d+/$new_offset/; $href .= $num; $paging_info .= qq|<li><a href="$href">$page_num</a></li>|; } } # Generate the "Next" link. if ( $current_page != $last_page ) { my $new_offset = $current_page * $page_size; $href =~ s/(?<=offset=)\d+/$new_offset/; $href .= $num; $paging_info .= qq|<li><a href="$href" id="next">Next</a></li>|; } } return $paging_info; } sub _clean_tag { my ($self, $tag) = @_; # ensure lower case $tag = lc $tag; # sub whitespace & underscores $tag =~ s![ _]!-!g; # remove dupe hyphens $tag =~ s!-+!-!g; # ensure only alphanum & hyphen $tag =~ s![^-a-z0-9]!!g; return $tag; } sub _clean_url { my ($self, $url) = @_; # GA $url =~ s![?&]utm_(?:medium|source|campaign|content)=[^&]+!!gi; # ? $url =~ s![?&]mkt_tok=[^&]+!!gi; # GAds $url =~ s![?&]gcid=[^&]+!!gi; # WT $url =~ s![?&]wt\.[a-z0-9_]+=[^&]+!!gi; # make sure we don't break the url if ($url =~ m{^[^?]+\&}) { $url =~ s!\&!?!; } unless ($url =~ m{^[hf]t?tps?://}gsi) { return if $url =~ m{^(javascript)}i; $url = 'http://' . $url; return $url; } return $url; } sub _clean_text { my ($self, $text) = @_; # strip whitespace $text = squish $text; $text = encode_entities($text); return $text; } sub _is_valid_uri { my ($self, $uri) = @_; my $url = Mojo::URL->new($uri); # ensure critical pieces return unless $url->scheme; return unless $url->host; # ignore local IP ranges my $regexp = create_iprange_regexp( qw( 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 ) ); return if match_ip($url->host, $regexp); return if $url->host =~ m{^localhost|127\.0\.0\.1$}; if ($url->host =~ m{^[0-9.:]+$}) { return unless Data::Validate::IP::is_ipv4($url->host); } else { return unless Data::Validate::Domain::is_domain($url->host); } return 1; } 1; =head1 NAME Mojolicious::Plugin::Bkmrx - Bkmrx helpers plugin for bkmrx.org =head1 SYNOPSIS # Mojolicious $self->plugin('BkxMojo::Plugin::Bkmrx'); =head1 DESCRIPTION Mojolicious::Plugin::Bkmrx is a collection of helpers for bkmrx.org =head1 HELPERS Mojolicious::Plugin::Bkmrx implements the following helpers. =head2 paginate $self->paginate($total_hits, $offset, $page_size, $href, \%params) Accepts a list of arguments and produces Bootstrap-friendly pagination HTML. =head2 clean_tag $self->clean_tag($tag) Applies rules to 'clean' tag inputs =head2 clean_url $self->clean_url($url) Applies rules to 'clean' URL inputs =head2 valid_uri $self->valid_uri($url) Tests any given URI for validity. =head2 register $plugin->register(Mojolicious->new); Register helpers in L<Mojolicious> application. =cut
vasun77/bkmrx.com
lib/BkxMojo/Plugin/Bkmrx.pm
Perl
mit
5,628
#------------------------------------------------------------------------------- # Copyright (c) 2014-2019 René Just, Darioush Jalali, and Defects4J contributors. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #------------------------------------------------------------------------------- =pod =head1 NAME Project::Jsoup.pm -- L<Project> submodule for jsoup. =head1 DESCRIPTION This module provides all project-specific configurations and subroutines for the jsoup project. =cut package Project::Jsoup; use strict; use warnings; use Constants; use Vcs::Git; our @ISA = qw(Project); my $PID = "Jsoup"; sub new { @_ == 1 or die $ARG_ERROR; my ($class) = @_; my $name = "jsoup"; my $vcs = Vcs::Git->new($PID, "$REPO_DIR/$name.git", "$PROJECTS_DIR/$PID/$BUGS_CSV_ACTIVE", \&_post_checkout); return $class->SUPER::new($PID, $name, $vcs); } # # Post-checkout tasks include, for instance, providing cached build files, # fixing compilation errors, etc. # sub _post_checkout { my ($self, $rev_id, $work_dir) = @_; my $project_dir = "$PROJECTS_DIR/$self->{pid}"; # Check whether ant build file exists unless (-e "$work_dir/build.xml") { my $build_files_dir = "$PROJECTS_DIR/$PID/build_files/$rev_id"; if (-d "$build_files_dir") { Utils::exec_cmd("cp -r $build_files_dir/* $work_dir", "Copy generated Ant build file") or die; } } } # # This subroutine is called by the bug-mining framework for each revision during # the initialization of the project. Example uses are: converting and caching # build files or other time-consuming tasks, whose results should be cached. # sub initialize_revision { my ($self, $rev_id, $vid) = @_; $self->SUPER::initialize_revision($rev_id); my $work_dir = $self->{prog_root}; my $result = {src=>"src/main/java", test=>"src/test/java"}; $self->_add_to_layout_map($rev_id, $result->{src}, $result->{test}); $self->_cache_layout_map(); # Force cache rebuild } 1;
rjust/defects4j
framework/core/Project/Jsoup.pm
Perl
mit
3,103
#!/usr/bin/env perl # #------------------------------------------------------------------------------- # Copyright (c) 2014-2019 René Just, Darioush Jalali, and Defects4J contributors. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #------------------------------------------------------------------------------- =pod =head1 NAME run_klocs.pl -- count test suite KLOCS. =head1 SYNOPSIS run_klocs.pl -p project_id -v version_id -n test_id -o out_dir [-D] =head1 OPTIONS =over 4 =item -p C<project_id> Count KLOCs for this project id. See L<Project|Project/"Available Project IDs"> module for available project IDs. =item -v C<version_id> Count KLOCs for this version id. Format: C<\d+[bf]>. =item -n C<test_id> The id of the generated test suite (i.e., which run of the same configuration). =item -o F<out_dir> The root output directory for the generated test suite. The test suite and logs are written to: F<out_dir/project_id/version_id>. =item -D Debug: Enable verbose logging and do not delete the temporary check-out directory (optional). =back =head1 DESCRIPTION This script prepares a particular program version as if it was going to run Randoop on it. It then counts the program KLOCS to use later in calculating Randoop test coverage. =cut use strict; use warnings; use FindBin; use File::Basename; use Cwd qw(abs_path); use Getopt::Std; use Pod::Usage; use lib abs_path("$FindBin::Bin/../core"); use Constants; use Utils; use Project; use Log; # # Process arguments and issue usage message if necessary. # my %cmd_opts; getopts('p:v:o:n:D', \%cmd_opts) or pod2usage(1); pod2usage(1) unless defined $cmd_opts{p} and defined $cmd_opts{v} and defined $cmd_opts{n} and defined $cmd_opts{o}; my $PID = $cmd_opts{p}; # Instantiate project my $project = Project::create_project($PID); my $VID = $cmd_opts{v}; # Verify that the provided version id is valid my $BID = Utils::check_vid($VID)->{bid}; $project->contains_version_id($VID) or die "Version id ($VID) does not exist in project: $PID"; my $TID = $cmd_opts{n}; $TID =~ /^\d+$/ or die "Wrong test_id format (\\d+): $TID!"; my $OUT_DIR = $cmd_opts{o}; # Enable debugging if flag is set $DEBUG = 1 if defined $cmd_opts{D}; if ($DEBUG) { Utils::print_env(); } # List of loaded classes my $LOADED_CLASSES = "$SCRIPT_DIR/projects/$PID/loaded_classes/$BID.src"; # Temporary directory for project checkout my $TMP_DIR = Utils::get_tmp_dir(); system("mkdir -p $TMP_DIR"); # Set working directory $project->{prog_root} = $TMP_DIR; # Checkout project $project->checkout_vid($VID) or die "Cannot checkout!"; my $output; #my $output = `env`; #print "env\n$output\n"; #my $x=$ENV{'PWD'}; #print "PWD: ", $x, "\n"; my $extcode; # run count-klocs.pl on the generated sources if (defined $cmd_opts{D}) { $output = `$SCRIPT_DIR/test/count_klocs.pl -d $TMP_DIR $PID $BID`; $extcode = $?>>8; } else { $output = `$SCRIPT_DIR/test/count_klocs.pl $TMP_DIR $PID $BID`; $extcode = $?>>8; } print "count klocs output:\n$output\n"; # Remove temporary directory system("rm -rf $TMP_DIR") unless defined $cmd_opts{D}; exit $extcode;
jose/defects4j
framework/bin/run_klocs.pl
Perl
mit
4,190
#------------------------------------------------------------------------------ # File: fr.pm # # Description: ExifTool French language translations # # Notes: This file generated automatically by Image::ExifTool::TagInfoXML #------------------------------------------------------------------------------ package Image::ExifTool::Lang::fr; use strict; use vars qw($VERSION); $VERSION = '1.22'; %Image::ExifTool::Lang::fr::Translate = ( 'AEAperture' => 'Ouverture AE', 'AEBAutoCancel' => { Description => 'Annulation bracketing auto', PrintConv => { 'Off' => 'Arrêt', 'On' => 'Marche', }, }, 'AEBSequence' => 'Séquence de bracketing', 'AEBSequenceAutoCancel' => { Description => 'Séquence auto AEB/annuler', PrintConv => { '-,0,+/Disabled' => '-,0,+/Désactivé', '-,0,+/Enabled' => '-,0,+/Activé', '0,-,+/Disabled' => '0,-,+/Désactivé', '0,-,+/Enabled' => '0,-,+/Activé', }, }, 'AEBShotCount' => 'Nombre de vues bracketées', 'AEBXv' => 'Compensation d\'expo. auto en bracketing', 'AEExposureTime' => 'Temps d\'exposition AE', 'AEExtra' => 'Suppléments AE', 'AEInfo' => 'Info sur l\'exposition auto', 'AELock' => { Description => 'Verrouillage AE', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AEMaxAperture' => 'Ouverture maxi AE', 'AEMaxAperture2' => 'Ouverture maxi AE (2)', 'AEMeteringMode' => { Description => 'Mode de mesure AE', PrintConv => { 'Multi-segment' => 'Multizone', }, }, 'AEMeteringSegments' => 'Segments de mesure AE', 'AEMinAperture' => 'Ouverture mini AE', 'AEMinExposureTime' => 'Temps d\'exposition mini AE', 'AEProgramMode' => { Description => 'Mode programme AE', PrintConv => { 'Av, B or X' => 'Av, B ou X', 'Candlelight' => 'Bougie', 'DOF Program' => 'Programme PdC', 'DOF Program (P-Shift)' => 'Programme PdC (décalage P)', 'Hi-speed Program' => 'Programme grande vitesse', 'Hi-speed Program (P-Shift)' => 'Programme grande vitesse (décalage P)', 'Kids' => 'Enfants', 'Landscape' => 'Paysage', 'M, P or TAv' => 'M, P ou TAv', 'MTF Program' => 'Programme FTM', 'MTF Program (P-Shift)' => 'Programme FTM (décalage P)', 'Museum' => 'Musée', 'Night Scene' => 'Nocturne', 'Night Scene Portrait' => 'Portrait nocturne', 'No Flash' => 'Sans flash', 'Pet' => 'Animaux de compagnie', 'Sunset' => 'Coucher de soleil', 'Surf & Snow' => 'Surf et neige', 'Sv or Green Mode' => 'Sv ou mode vert', 'Text' => 'Texte', }, }, 'AEXv' => 'Compensation d\'exposition auto', 'AE_ISO' => 'Sensibilité ISO AE', 'AFAdjustment' => 'Ajustement AF', 'AFAperture' => 'Ouverture AF', 'AFAreaIllumination' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AFAreaMode' => { Description => 'Mode de zone AF', PrintConv => { '1-area' => 'Mise au point 1 zone', '1-area (high speed)' => 'Mise au point 1 zone (haute vitesse)', '3-area (center)?' => 'Mise au point 3 zones (au centre) ?', '3-area (high speed)' => 'Mise au point 3 zones (haute vitesse)', '3-area (left)?' => 'Mise au point 3 zones (à gauche) ?', '3-area (right)?' => 'Mise au point 3 zones (à droite) ?', '5-area' => 'Mise au point 5 zones', '9-area' => 'Mise au point 9 zones', 'Face Detect AF' => 'Dét. visage', 'Spot Focusing' => 'Mise au point Spot', 'Spot Mode Off' => 'Mode Spot désactivé', 'Spot Mode On' => 'Mode Spot enclenché', }, }, 'AFAssist' => { Description => 'Faisceau d\'assistance AF', PrintConv => { 'Does not emit/Fires' => 'N\'émet pas/Se déclenche', 'Emits/Does not fire' => 'Emet/Ne se déclenche pas', 'Emits/Fires' => 'Emet/Se déclenche', 'Off' => 'Désactivé', 'On' => 'Activé', 'Only ext. flash emits/Fires' => 'Flash ext émet/Se déclenche', }, }, 'AFAssistBeam' => { Description => 'Faisceau d\'assistance AF', PrintConv => { 'Does not emit' => 'Désactivé', 'Emits' => 'Activé', 'Only ext. flash emits' => 'Uniquement par flash ext.', }, }, 'AFDefocus' => 'Défocalisation AF', 'AFDuringLiveView' => { Description => 'AF pendant la visée directe', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', 'Live mode' => 'Mode visée directe', 'Quick mode' => 'Mode rapide', }, }, 'AFInfo' => 'Info autofocus', 'AFInfo2' => 'Infos AF', 'AFInfo2Version' => 'Version des infos AF', 'AFIntegrationTime' => 'Temps d\'intégration AF', 'AFMicroadjustment' => { Description => 'Micro-ajustement de l\'AF', PrintConv => { 'Adjust all by same amount' => 'Ajuster idem tous obj', 'Adjust by lens' => 'Ajuster par objectif', 'Disable' => 'Désactivé', }, }, 'AFMode' => 'Mode AF', 'AFOnAELockButtonSwitch' => { Description => 'Permutation touche AF/Mémo', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'AFPoint' => { Description => 'Point AF', PrintConv => { 'Bottom' => 'Bas', 'Center' => 'Centre', 'Far Left' => 'Extrème-gauche', 'Far Right' => 'Extrème-droit', 'Left' => 'Gauche', 'Lower-left' => 'Bas-gauche', 'Lower-right' => 'Bas-droit', 'Mid-left' => 'Milieu gauche', 'Mid-right' => 'Milieu droit', 'None' => 'Aucune', 'Right' => 'Droit', 'Top' => 'Haut', 'Upper-left' => 'Haut-gauche', 'Upper-right' => 'Haut-droit', }, }, 'AFPointActivationArea' => { Description => 'Zone activation collimateurs AF', PrintConv => { 'Automatic expanded (max. 13)' => 'Expansion auto (13 max.)', 'Expanded (TTL. of 7 AF points)' => 'Expansion (TTL 7 collimat.)', 'Single AF point' => 'Un seul collimateur AF', }, }, 'AFPointAreaExpansion' => { Description => 'Extension de la zone AF', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', 'Left/right AF points' => 'Activé (gauche/droite collimateurs autofocus d\'assistance)', 'Surrounding AF points' => 'Activée (Collimateurs autofocus d\'assistance environnants)', }, }, 'AFPointAutoSelection' => { Description => 'Sélecition des collimateurs automatique', PrintConv => { 'Control-direct:disable/Main:disable' => 'Contrôle rapide-Directe:désactivé/Principale:désactivé', 'Control-direct:disable/Main:enable' => 'Contrôle rapide-Directe:désactivé/Principale:activé', 'Control-direct:enable/Main:enable' => 'Contrôle rapide-Directe:activé/Principale:activé', }, }, 'AFPointBrightness' => { Description => 'Intensité d\'illumination AF', PrintConv => { 'Brighter' => 'Forte', 'Normal' => 'Normale', }, }, 'AFPointDisplayDuringFocus' => { Description => 'Affichage de point AF pendant mise au point', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', 'On (when focus achieved)' => 'Activé (si mise au point effectuée)', }, }, 'AFPointIllumination' => { Description => 'Eclairage des collimateurs AF', PrintConv => { 'Brighter' => 'Plus brillant', 'Off' => 'Désactivé', 'On' => 'Activé', 'On without dimming' => 'Activé sans atténuation', }, }, 'AFPointMode' => 'Mode de mise au point AF', 'AFPointRegistration' => { Description => 'Validation du point AF', PrintConv => { 'Automatic' => 'Auto', 'Bottom' => 'Bas', 'Center' => 'Centre', 'Extreme Left' => 'Extrême gauche', 'Extreme Right' => 'Extrême droite', 'Left' => 'Gauche', 'Right' => 'Droit', 'Top' => 'Haut', }, }, 'AFPointSelected' => { Description => 'Point AF sélectionné', PrintConv => { 'Automatic Tracking AF' => 'AF en suivi auto', 'Bottom' => 'Bas', 'Center' => 'Centre', 'Face Detect AF' => 'AF en reconnaissance de visage', 'Fixed Center' => 'Fixe au centre', 'Left' => 'Gauche', 'Lower-left' => 'Bas gauche', 'Lower-right' => 'Bas droit', 'Mid-left' => 'Milieu gauche', 'Mid-right' => 'Milieu droit', 'Right' => 'Droit', 'Top' => 'Haut', 'Upper-left' => 'Haut gauche', 'Upper-right' => 'Haut droite', }, }, 'AFPointSelected2' => 'Point AF sélectionné 2', 'AFPointSelection' => 'Méthode sélect. collimateurs AF', 'AFPointSelectionMethod' => { Description => 'Méthode sélection collim. AF', PrintConv => { 'Multi-controller direct' => 'Multicontrôleur direct', 'Normal' => 'Normale', 'Quick Control Dial direct' => 'Molette AR directe', }, }, 'AFPointSpotMetering' => { Description => 'Nombre collimateurs/mesure spot', PrintConv => { '11/Active AF point' => '11/collimateur AF actif', '11/Center AF point' => '11/collimateur AF central', '45/Center AF point' => '45/collimateur AF central', '9/Active AF point' => '9/collimateur AF actif', }, }, 'AFPointsInFocus' => { Description => 'Points AF nets', PrintConv => { 'All' => 'Tous', 'Bottom' => 'Bas', 'Bottom, Center' => 'Bas + centre', 'Bottom-center' => 'Bas centre', 'Bottom-left' => 'Bas gauche', 'Bottom-right' => 'Bas droit', 'Center' => 'Centre', 'Center (horizontal)' => 'Centre (horizontal)', 'Center (vertical)' => 'Centre (vertical)', 'Center+Right' => 'Centre+droit', 'Fixed Center or Multiple' => 'Centre fixe ou multiple', 'Left' => 'Gauche', 'Left+Center' => 'Gauch+centre', 'Left+Right' => 'Gauche+droit', 'Lower-left, Bottom' => 'Bas gauche + bas', 'Lower-left, Mid-left' => 'Bas gauche + milieu gauche', 'Lower-right, Bottom' => 'Bas droit + bas', 'Lower-right, Mid-right' => 'Bas droit + milieu droit', 'Mid-left' => 'Milieu gauche', 'Mid-left, Center' => 'Milieu gauche + centre', 'Mid-right' => 'Milieu droit', 'Mid-right, Center' => 'Milieu droit + centre', 'None' => 'Aucune', 'None (MF)' => 'Aucune (MF)', 'Right' => 'Droit', 'Top' => 'Haut', 'Top, Center' => 'Haut + centre', 'Top-center' => 'Haut centre', 'Top-left' => 'Haut gauche', 'Top-right' => 'Haut droit', 'Upper-left, Mid-left' => 'Haut gauche + milieu gauche', 'Upper-left, Top' => 'Haut gauche + haut', 'Upper-right, Mid-right' => 'Haut droit + milieu droit', 'Upper-right, Top' => 'Haut droit + haut', }, }, 'AFPointsSelected' => 'Points AF sélectionnés', 'AFPointsUnknown1' => { PrintConv => { 'All' => 'Tous', 'Central 9 points' => '9 points centraux', }, }, 'AFPointsUnknown2' => 'Points AF inconnus 2', 'AFPointsUsed' => { Description => 'Points AF utilisés', PrintConv => { 'Bottom' => 'Bas', 'Center' => 'Centre', 'Mid-left' => 'Milieu gauche', 'Mid-right' => 'Milieu droit', 'Top' => 'Haut', }, }, 'AFPredictor' => 'Prédicteur AF', 'AFResponse' => 'Réponse AF', 'AIServoContinuousShooting' => 'Priorité vit. méca. AI Servo', 'AIServoImagePriority' => { Description => '1er Servo Ai/2e priorité déclenchement', PrintConv => { '1: AF, 2: Drive speed' => 'Priorité AF/Priorité cadence vues', '1: AF, 2: Tracking' => 'Priorité AF/Priorité suivi AF', '1: Release, 2: Drive speed' => 'Déclenchement/Priorité cadence vues', }, }, 'AIServoTrackingMethod' => { Description => 'Méthode de suivi autofocus AI Servo', PrintConv => { 'Continuous AF track priority' => 'Priorité suivi AF en continu', 'Main focus point priority' => 'Priorité point AF principal', }, }, 'AIServoTrackingSensitivity' => { Description => 'Sensibili. de suivi AI Servo', PrintConv => { 'Fast' => 'Rapide', 'Medium Fast' => 'Moyenne rapide', 'Medium Slow' => 'Moyenne lent', 'Moderately fast' => 'Moyennement rapide', 'Moderately slow' => 'Moyennement lent', 'Slow' => 'Lent', }, }, 'APEVersion' => 'Version APE', 'ARMIdentifier' => 'Identificateur ARM', 'ARMVersion' => 'Version ARM', 'AToB0' => 'A à B0', 'AToB1' => 'A à B1', 'AToB2' => 'A à B2', 'AccessoryType' => 'Type d\'accessoire', 'ActionAdvised' => { Description => 'Action conseillée', PrintConv => { 'Object Kill' => 'Destruction d\'objet', 'Object Reference' => 'Référence d\'objet', 'Object Replace' => 'Remplacement d\'objet', 'Ojbect Append' => 'Ajout d\'objet', }, }, 'ActiveArea' => 'Zone active', 'ActiveD-Lighting' => { PrintConv => { 'Low' => 'Bas', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ActiveD-LightingMode' => { PrintConv => { 'Low' => 'Bas', 'Normal' => 'Normale', 'Off' => 'Désactivé', }, }, 'AddAspectRatioInfo' => { Description => 'Ajouter info ratio d\'aspect', PrintConv => { 'Off' => 'Désactivé', }, }, 'AddOriginalDecisionData' => { Description => 'Aj. données décis. origine', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AdditionalModelInformation' => 'Modele d\'Information additionnel', 'Address' => 'Adresse', 'AdultContentWarning' => { PrintConv => { 'Unknown' => 'Inconnu', }, }, 'AdvancedRaw' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AdvancedSceneMode' => { PrintConv => { 'Color Select' => 'Désaturation partielle', 'Cross Process' => 'Dévelop. croisé', 'Dynamic Monochrome' => 'Monochrome dynamique', 'Expressive' => 'Expressif', 'High Dynamic' => 'Dynamique haute', 'High Key' => 'Tons clairs', 'Impressive Art' => 'Impressionisme', 'Low Key' => 'Clair-obscur', 'Miniature' => 'Effet miniature', 'Retro' => 'Rétro', 'Sepia' => 'Sépia', 'Soft' => 'Mise au point douce', 'Star' => 'Filtre étoile', 'Toy Effect' => 'Effet jouet', }, }, 'Advisory' => 'Adversité', 'AnalogBalance' => 'Balance analogique', 'Annotations' => 'Annotations Photoshop', 'Anti-Blur' => { PrintConv => { 'Off' => 'Désactivé', 'n/a' => 'Non établie', }, }, 'AntiAliasStrength' => 'Puissance relative du filtre anticrénelage de l\'appareil', 'Aperture' => 'Ouverture', 'ApertureRange' => { Description => 'Régler gamme d\'ouvertures', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'ApertureRingUse' => { Description => 'Utilisation de la bague de diaphragme', PrintConv => { 'Permitted' => 'Autorisée', 'Prohibited' => 'Interdite', }, }, 'ApertureValue' => 'Ouverture', 'ApplicationRecordVersion' => 'Version d\'enregistrement', 'ApplyShootingMeteringMode' => { Description => 'Appliquer mode de prise de vue/de mesure', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'Artist' => 'Artiste', 'ArtworkCopyrightNotice' => 'Notice copyright de l\'Illustration', 'ArtworkCreator' => 'Créateur de l\'Illustration', 'ArtworkDateCreated' => 'Date de création de l\'Illustration', 'ArtworkSource' => 'Source de l\'Illustration', 'ArtworkSourceInventoryNo' => 'No d\'Inventaire du source de l\'Illustration', 'ArtworkTitle' => 'Titre de l\'Illustration', 'AsShotICCProfile' => 'Profil ICC à la prise de vue', 'AsShotNeutral' => 'Balance neutre à la prise de vue', 'AsShotPreProfileMatrix' => 'Matrice de pré-profil à la prise de vue', 'AsShotProfileName' => 'Nom du profil du cliché', 'AsShotWhiteXY' => 'Balance blanc X-Y à la prise de vue', 'AssignFuncButton' => { Description => 'Changer fonct. touche FUNC.', PrintConv => { 'Exposure comp./AEB setting' => 'Correct. expo/réglage AEB', 'Image jump with main dial' => 'Saut image par molette principale', 'Image quality' => 'Changer de qualité', 'LCD brightness' => 'Luminosité LCD', 'Live view function settings' => 'Réglages Visée par l’écran', }, }, 'AssistButtonFunction' => { Description => 'Touche de fonction rapide', PrintConv => { 'Av+/- (AF point by QCD)' => 'Av+/- (AF par mol. AR)', 'FE lock' => 'Mémo expo. au flash', 'Normal' => 'Normale', 'Select HP (while pressing)' => 'Sélect. HP (en appuyant)', 'Select Home Position' => 'Sélect. position origine', }, }, 'Audio' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'AudioDuration' => 'Durée audio', 'AudioOutcue' => 'Queue audio', 'AudioSamplingRate' => 'Taux d\'échantillonnage audio', 'AudioSamplingResolution' => 'Résolution d\'échantillonnage audio', 'AudioType' => { Description => 'Type audio', PrintConv => { 'Mono Actuality' => 'Actualité (audio mono (1 canal))', 'Mono Music' => 'Musique, transmise par elle-même (audio mono (1 canal))', 'Mono Question and Answer Session' => 'Question et réponse (audio mono (1 canal))', 'Mono Raw Sound' => 'Son brut (audio mono (1 canal))', 'Mono Response to a Question' => 'Réponse à une question (audio mono (1 canal))', 'Mono Scener' => 'Scener (audio mono (1 canal))', 'Mono Voicer' => 'Voix (audio mono (1 canal))', 'Mono Wrap' => 'Wrap (audio mono (1 canal))', 'Stereo Actuality' => 'Actualité (audio stéréo (2 canaux))', 'Stereo Music' => 'Musique, transmise par elle-même (audio stéréo (2 canaux))', 'Stereo Question and Answer Session' => 'Question et réponse (audio stéréo (2 canaux))', 'Stereo Raw Sound' => 'Son brut (audio stéréo (2 canaux))', 'Stereo Response to a Question' => 'Réponse à une question (audio stéréo (2 canaux))', 'Stereo Scener' => 'Scener (audio stéréo (2 canaux))', 'Stereo Voicer' => 'Voix (audio stéréo (2 canaux))', 'Stereo Wrap' => 'Wrap (audio stéréo (2 canaux))', 'Text Only' => 'Texte seul (pas de données d\'objet)', }, }, 'Author' => 'Auteur', 'AuthorsPosition' => 'Titre du créateur', 'AutoAperture' => { Description => 'Auto-diaph', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoBracketing' => { Description => 'Bracketing auto', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoExposureBracketing' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoFP' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoFocus' => { Description => 'Auto-Focus', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoISO' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoLightingOptimizer' => { Description => 'Correction auto de luminosité', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Actif', 'Low' => 'Faible', 'Off' => 'Désactivé', 'Strong' => 'Importante', 'n/a' => 'Non établie', }, }, 'AutoLightingOptimizerOn' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'AutoRedEye' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'AutoRotate' => { Description => 'Rotation automatique', PrintConv => { 'None' => 'Aucune', 'Rotate 180' => '180° (bas/droit)', 'Rotate 270 CW' => '90° sens horaire (gauche/bas)', 'Rotate 90 CW' => '90° sens antihoraire (droit/haut)', 'n/a' => 'Inconnu', }, }, 'AuxiliaryLens' => 'Objectif Auxiliaire', 'AvApertureSetting' => 'Réglage d\'ouverture Av', 'AvSettingWithoutLens' => { Description => 'Réglage Av sans objectif', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'BToA0' => 'B à A0', 'BToA1' => 'B à A1', 'BToA2' => 'B à A2', 'BWMode' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'BackgroundColorIndicator' => 'Indicateur de couleur d\'arrière-plan', 'BackgroundColorValue' => 'Valeur de couleur d\'arrière-plan', 'BackgroundTiling' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'BadFaxLines' => 'Mauvaises lignes de Fax', 'BannerImageType' => { PrintConv => { 'None' => 'Aucune', }, }, 'BaseExposureCompensation' => 'Compensation d\'exposition de base', 'BaseURL' => 'URL de base', 'BaselineExposure' => 'Exposition de base', 'BaselineNoise' => 'Bruit de base', 'BaselineSharpness' => 'Accentuation de base', 'BatteryInfo' => 'Source d\'alimentation', 'BatteryLevel' => 'Niveau de batterie', 'BayerGreenSplit' => 'Séparation de vert Bayer', 'Beep' => { PrintConv => { 'High' => 'Bruyant', 'Low' => 'Calme', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'BestQualityScale' => 'Echelle de meilleure qualité', 'BitsPerComponent' => 'Bits par composante', 'BitsPerExtendedRunLength' => 'Bits par « Run Length » étendue', 'BitsPerRunLength' => 'Bits par « Run Length »', 'BitsPerSample' => 'Nombre de bits par échantillon', 'BlackLevel' => 'Niveau noir', 'BlackLevelDeltaH' => 'Delta H du niveau noir', 'BlackLevelDeltaV' => 'Delta V du niveau noir', 'BlackLevelRepeatDim' => 'Dimension de répétition du niveau noir', 'BlackPoint' => 'Point noir', 'BlueBalance' => 'Balance bleue', 'BlueMatrixColumn' => 'Colonne de matrice bleue', 'BlueTRC' => 'Courbe de reproduction des tons bleus', 'BlurWarning' => { PrintConv => { 'None' => 'Aucune', }, }, 'BodyBatteryADLoad' => 'Tension accu boîtier en charge', 'BodyBatteryADNoLoad' => 'Tension accu boîtier à vide', 'BodyBatteryState' => { Description => 'État de accu boîtier', PrintConv => { 'Almost Empty' => 'Presque vide', 'Empty or Missing' => 'Vide ou absent', 'Full' => 'Plein', 'Running Low' => 'En baisse', }, }, 'BracketMode' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'BracketShotNumber' => { Description => 'Numéro de cliché en bracketing', PrintConv => { '1 of 3' => '1 sur 3', '1 of 5' => '1 sur 5', '2 of 3' => '2 sur 3', '2 of 5' => '2 sur 5', '3 of 3' => '3 sur 3', '3 of 5' => '3 sur 5', '4 of 5' => '4 sur 5', '5 of 5' => '5 sur 5', 'n/a' => 'Non établie', }, }, 'Brightness' => 'Luminosité', 'BrightnessValue' => 'Luminosité', 'BulbDuration' => 'Durée du pose longue', 'BurstMode' => { Description => 'Mode Rafale', PrintConv => { 'Infinite' => 'Infini', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ButtonFunctionControlOff' => { Description => 'Fonction de touche si Contrôle Rapide OFF', PrintConv => { 'Disable main, Control, Multi-control' => 'Désactivés principale, Contrôle rapide, Multicontrôleur', 'Normal (enable)' => 'Normale (activée)', }, }, 'By-line' => 'Créateur', 'By-lineTitle' => 'Fonction du créateur', 'CFALayout' => { Description => 'Organisation CFA', PrintConv => { 'Even columns offset down 1/2 row' => 'Organisation décalée A : les colonnes paires sont décalées vers le bas d\'une demi-rangée.', 'Even columns offset up 1/2 row' => 'Organisation décalée B : les colonnes paires sont décalées vers le haut d\'une demi-rangée.', 'Even rows offset left 1/2 column' => 'Organisation décalée D : les rangées paires sont décalées vers la gauche d\'une demi-colonne.', 'Even rows offset right 1/2 column' => 'Organisation décalée C : les rangées paires sont décalées vers la droite d\'une demi-colonne.', 'Rectangular' => 'Plan rectangulaire (ou carré)', }, }, 'CFAPattern' => 'Matrice de filtrage couleur', 'CFAPattern2' => 'Modèle CFA 2', 'CFAPlaneColor' => 'Couleur de plan CFA', 'CFARepeatPatternDim' => 'Dimension du modèle de répétition CFA', 'CMMFlags' => 'Drapeaux CMM', 'CMYKEquivalent' => 'Equivalent CMJK', 'CPUFirmwareVersion' => 'Version de firmware de CPU', 'CPUType' => { PrintConv => { 'None' => 'Aucune', }, }, 'CalibrationDateTime' => 'Date et heure de calibration', 'CalibrationIlluminant1' => { Description => 'Illuminant de calibration 1', PrintConv => { 'Cloudy' => 'Temps nuageux', 'Cool White Fluorescent' => 'Fluorescente type soft', 'Day White Fluorescent' => 'Fluorescente type blanc', 'Daylight' => 'Lumière du jour', 'Daylight Fluorescent' => 'Fluorescente type jour', 'Fine Weather' => 'Beau temps', 'Fluorescent' => 'Fluorescente', 'ISO Studio Tungsten' => 'Tungstène studio ISO', 'Other' => 'Autre source de lumière', 'Shade' => 'Ombre', 'Standard Light A' => 'Lumière standard A', 'Standard Light B' => 'Lumière standard B', 'Standard Light C' => 'Lumière standard C', 'Tungsten (Incandescent)' => 'Tungstène (lumière incandescente)', 'Unknown' => 'Inconnue', 'Warm White Fluorescent' => 'Fluorescent blanc chaud', 'White Fluorescent' => 'Fluorescent blanc', }, }, 'CalibrationIlluminant2' => { Description => 'Illuminant de calibration 2', PrintConv => { 'Cloudy' => 'Temps nuageux', 'Cool White Fluorescent' => 'Fluorescente type soft', 'Day White Fluorescent' => 'Fluorescente type blanc', 'Daylight' => 'Lumière du jour', 'Daylight Fluorescent' => 'Fluorescente type jour', 'Fine Weather' => 'Beau temps', 'Fluorescent' => 'Fluorescente', 'ISO Studio Tungsten' => 'Tungstène studio ISO', 'Other' => 'Autre source de lumière', 'Shade' => 'Ombre', 'Standard Light A' => 'Lumière standard A', 'Standard Light B' => 'Lumière standard B', 'Standard Light C' => 'Lumière standard C', 'Tungsten (Incandescent)' => 'Tungstène (lumière incandescente)', 'Unknown' => 'Inconnue', 'Warm White Fluorescent' => 'Fluorescent blanc chaud', 'White Fluorescent' => 'Fluorescent blanc', }, }, 'CameraCalibration1' => 'Calibration d\'appareil 1', 'CameraCalibration2' => 'Calibration d\'appareil 2', 'CameraCalibrationSig' => 'Signature de calibration de l\'appareil', 'CameraOrientation' => { Description => 'Orientation de l\'image', PrintConv => { 'Horizontal (normal)' => '0° (haut/gauche)', 'Rotate 270 CW' => '90° sens horaire (gauche/bas)', 'Rotate 90 CW' => '90° sens antihoraire (droit/haut)', }, }, 'CameraSerialNumber' => 'Numéro de série de l\'appareil', 'CameraSettings' => 'Réglages de l\'appareil', 'CameraTemperature' => 'Température de l\'appareil', 'CameraType' => 'Type d\'objectif Pentax', 'CanonExposureMode' => { PrintConv => { 'Aperture-priority AE' => 'Priorité ouverture', 'Bulb' => 'Pose B', 'Manual' => 'Manuelle', 'Program AE' => 'Programme d\'exposition automatique', 'Shutter speed priority AE' => 'Priorité vitesse', }, }, 'CanonFirmwareVersion' => 'Version de firmware', 'CanonFlashMode' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', 'Red-eye reduction' => 'Réduction yeux rouges', }, }, 'CanonImageSize' => { PrintConv => { 'Large' => 'Grande', 'Medium' => 'Moyenne', 'Medium 1' => 'Moyenne 1', 'Medium 2' => 'Moyenne 2', 'Medium 3' => 'Moyenne 3', 'Small' => 'Petite', 'Small 1' => 'Petite 1', 'Small 2' => 'Petite 2', 'Small 3' => 'Petite 3', }, }, 'Caption-Abstract' => 'Légende / Description', 'CaptionWriter' => 'Rédacteur', 'CaptureXResolutionUnit' => { PrintConv => { 'um' => 'µm (micromètre)', }, }, 'CaptureYResolutionUnit' => { PrintConv => { 'um' => 'µm (micromètre)', }, }, 'Categories' => 'Catégories', 'Category' => 'Catégorie', 'CellLength' => 'Longueur de cellule', 'CellWidth' => 'Largeur de cellule', 'CenterWeightedAreaSize' => { PrintConv => { 'Average' => 'Moyenne', }, }, 'Certificate' => 'Certificat', 'CharTarget' => 'Cible caractère', 'CharacterSet' => 'Jeu de caractères', 'ChromaBlurRadius' => 'Rayon de flou de chromatisme', 'ChromaticAdaptation' => 'Adaptation chromatique', 'Chromaticity' => 'Chromaticité', 'ChrominanceNR_TIFF_JPEG' => { PrintConv => { 'Low' => 'Bas', 'Off' => 'Désactivé', }, }, 'ChrominanceNoiseReduction' => { PrintConv => { 'Low' => 'Bas', 'Off' => 'Désactivé', }, }, 'CircleOfConfusion' => 'Cercle de confusion', 'City' => 'Ville', 'ClassifyState' => 'Etat de classification', 'CleanFaxData' => 'Données de Fax propres', 'ClipPath' => 'Chemin de rognage', 'CodedCharacterSet' => 'Jeu de caractères codé', 'ColorAberrationControl' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ColorAdjustmentMode' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ColorBalance' => 'Balance des couleurs', 'ColorBalanceAdj' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ColorBooster' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ColorCalibrationMatrix' => 'Table de matrice de calibration de couleur', 'ColorCharacterization' => 'Caractérisation de couleur', 'ColorComponents' => 'Composants colorimétriques', 'ColorEffect' => { Description => 'Effet de couleurs', PrintConv => { 'Black & White' => 'Noir et blanc', 'Cool' => 'Froide', 'Off' => 'Désactivé', 'Sepia' => 'Sépia', 'Warm' => 'Chaude', }, }, 'ColorFilter' => { Description => 'Filtre de couleur', PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'Off' => 'Désactivé', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'ColorHue' => 'Teinte de couleur', 'ColorInfo' => 'Info couleur', 'ColorMap' => 'Charte de couleur', 'ColorMatrix1' => 'Matrice de couleur 1', 'ColorMatrix2' => 'Matrice de couleur 2', 'ColorMode' => { Description => 'Mode colorimétrique', PrintConv => { 'Adobe RGB' => 'AdobeRVB', 'Autumn Leaves' => 'Feuilles automne', 'B&W' => 'Noir & Blanc', 'Clear' => 'Lumineux', 'Deep' => 'Profond', 'Evening' => 'Soir', 'Landscape' => 'Paysage', 'Light' => 'Pastel', 'Natural' => 'Naturel', 'Neutral' => 'Neutre', 'Night Scene' => 'Nocturne', 'Night View' => 'Vision nocturne', 'Night View/Portrait' => 'Portrait nocturne', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'RGB' => 'RVB', 'Sunset' => 'Coucher de soleil', 'Vivid' => 'Vives', }, }, 'ColorMoireReduction' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ColorMoireReductionMode' => { PrintConv => { 'Low' => 'Bas', 'Off' => 'Désactivé', }, }, 'ColorPalette' => 'Palette de couleur', 'ColorRepresentation' => { Description => 'Représentation de couleur', PrintConv => { '3 Components, Frame Sequential in Multiple Objects' => 'Trois composantes, Vue séquentielle dans différents objets', '3 Components, Frame Sequential in One Object' => 'Trois composantes, Vue séquentielle dans un objet', '3 Components, Line Sequential' => 'Trois composantes, Ligne séquentielle', '3 Components, Pixel Sequential' => 'Trois composantes, Pixel séquentiel', '3 Components, Single Frame' => 'Trois composantes, Vue unique', '3 Components, Special Interleaving' => 'Trois composantes, Entrelacement spécial', '4 Components, Frame Sequential in Multiple Objects' => 'Quatre composantes, Vue séquentielle dans différents objets', '4 Components, Frame Sequential in One Object' => 'Quatre composantes, Vue séquentielle dans un objet', '4 Components, Line Sequential' => 'Quatre composantes, Ligne séquentielle', '4 Components, Pixel Sequential' => 'Quatre composantes, Pixel séquentiel', '4 Components, Single Frame' => 'Quatre composantes, Vue unique', '4 Components, Special Interleaving' => 'Quatre composantes, Entrelacement spécial', 'Monochrome, Single Frame' => 'Monochrome, Vue unique', 'No Image, Single Frame' => 'Pas d\'image, Vue unique', }, }, 'ColorResponseUnit' => 'Unité de réponse couleur', 'ColorSequence' => 'Séquence de couleur', 'ColorSpace' => { Description => 'Espace colorimétrique', PrintConv => { 'ICC Profile' => 'Profil ICC', 'RGB' => 'RVB', 'Uncalibrated' => 'Non calibré', 'Wide Gamut RGB' => 'Wide Gamut RVB', 'sRGB' => 'sRVB', }, }, 'ColorSpaceData' => 'Espace de couleur de données', 'ColorTable' => 'Tableau de couleurs', 'ColorTemperature' => 'Température de couleur', 'ColorTone' => { Description => 'Teinte couleur', PrintConv => { 'Normal' => 'Normale', }, }, 'ColorType' => { PrintConv => { 'RGB' => 'RVB', }, }, 'ColorantOrder' => 'Ordre de colorant', 'ColorantTable' => 'Table de coloranté', 'ColorimetricReference' => 'Référence colorimétrique', 'CommandDialsChangeMainSub' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'CommandDialsMenuAndPlayback' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'CommandDialsReverseRotation' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'CommanderGroupAMode' => { PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'CommanderGroupBMode' => { PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'CommanderInternalFlash' => { PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'Comment' => 'Commentaire', 'Comments' => 'Commentaires', 'Compilation' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'ComponentsConfiguration' => 'Signification de chaque composante', 'CompressedBitsPerPixel' => 'Mode de compression d\'image', 'Compression' => { Description => 'Schéma de compression', PrintConv => { 'JBIG Color' => 'JBIG Couleur', 'JPEG' => 'Compression JPEG', 'JPEG (old-style)' => 'JPEG (ancien style)', 'Kodak DCR Compressed' => 'Compression Kodak DCR', 'Kodak KDC Compressed' => 'Compression Kodak KDC', 'Next' => 'Encodage NeXT 2 bits', 'Nikon NEF Compressed' => 'Compression Nikon NEF', 'None' => 'Aucune', 'Pentax PEF Compressed' => 'Compression Pentax PEF', 'SGILog' => 'Encodage Log luminance SGI 32 bits', 'SGILog24' => 'Encodage Log luminance SGI 24 bits', 'Sony ARW Compressed' => 'Compression Sony ARW', 'Thunderscan' => 'Encodage ThunderScan 4 bits', 'Uncompressed' => 'Non compressé', }, }, 'CompressionType' => { PrintConv => { 'None' => 'Aucune', }, }, 'ConditionalFEC' => 'Compensation exposition flash', 'ConnectionSpaceIlluminant' => 'Illuminant d\'espace de connexion', 'ConsecutiveBadFaxLines' => 'Mauvaises lignes de Fax consécutives', 'ContentLocationCode' => 'Code du lieu du contenu', 'ContentLocationName' => 'Nom du lieu du contenu', 'ContinuousDrive' => { PrintConv => { 'Movie' => 'Vidéo', }, }, 'ContinuousShootingSpeed' => { Description => 'Vitesse de prise de vues en continu', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'ContinuousShotLimit' => { Description => 'Limiter nombre de vues en continu', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'Contrast' => { Description => 'Contraste', PrintConv => { 'High' => 'Dur', 'Low' => 'Doux', 'Med High' => 'Assez fort', 'Med Low' => 'Assez faible', 'Medium High' => 'Moyen Haut', 'Medium Low' => 'Moyen Faible', 'Normal' => 'Normale', 'Very High' => 'Très fort', 'Very Low' => 'Très faible', }, }, 'ContrastCurve' => 'Courbe de contraste', 'Contributor' => 'Contributeur', 'ControlMode' => { PrintConv => { 'n/a' => 'Non établie', }, }, 'ConversionLens' => { Description => 'Complément Optique', PrintConv => { 'Off' => 'Désactivé', 'Telephoto' => 'Télé', 'Wide' => 'Grand angulaire', }, }, 'Copyright' => 'Propriétaire du copyright', 'CopyrightNotice' => 'Mention de copyright', 'CopyrightStatus' => { PrintConv => { 'Unknown' => 'Inconnu', }, }, 'Country' => 'Pays', 'Country-PrimaryLocationCode' => 'Code de pays ISO', 'Country-PrimaryLocationName' => 'Pays', 'CountryCode' => 'Code pays', 'Coverage' => 'Couverture', 'CreateDate' => 'Date de la création des données numériques', 'CreationDate' => 'Date de création', 'Creator' => 'Créateur', 'CreatorAddress' => 'Adresse du créateur', 'CreatorCity' => 'Lieu d\'Habitation du créateur', 'CreatorCountry' => 'Pays du créateur', 'CreatorPostalCode' => 'Code postal du créateur', 'CreatorRegion' => 'Région du créateur', 'CreatorTool' => 'Outil de création', 'CreatorWorkEmail' => 'Courriel professionnel du créateur', 'CreatorWorkTelephone' => 'Téléphone professionnel créateur', 'CreatorWorkURL' => 'URL professionnelle du créateur', 'Credit' => 'Fournisseur', 'CropActive' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'CropUnit' => { PrintConv => { 'inches' => 'Pouce', }, }, 'CropUnits' => { PrintConv => { 'inches' => 'Pouce', }, }, 'CurrentICCProfile' => 'Profil ICC actuel', 'CurrentIPTCDigest' => 'Sommaire courant IPTC', 'CurrentPreProfileMatrix' => 'Matrice de pré-profil actuelle', 'Curves' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'CustomRendered' => { Description => 'Traitement d\'image personnalisé', PrintConv => { 'Custom' => 'Traitement personnalisé', 'Normal' => 'Traitement normal', }, }, 'D-LightingHQ' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'D-LightingHQSelected' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'D-LightingHS' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'DNGBackwardVersion' => 'Version DNG antérieure', 'DNGLensInfo' => 'Distance focale minimale', 'DNGVersion' => 'Version DNG', 'DOF' => 'Profondeur de champ', 'DSPFirmwareVersion' => 'Version de firmware de DSP', 'DataCompressionMethod' => 'Fournisseur/propriétaire de l\'algorithme de compression de données', 'DataDump' => 'Vidage données', 'DataImprint' => { PrintConv => { 'None' => 'Aucune', 'Text' => 'Texte', }, }, 'DataType' => 'Type de données', 'DateCreated' => 'Date de création', 'DateDisplayFormat' => { Description => 'Format date', PrintConv => { 'D/M/Y' => 'Jour/Mois/Année', 'M/D/Y' => 'Mois/Jour/Année', 'Y/M/D' => 'Année/Mois/Jour', }, }, 'DateSent' => 'Date d\'envoi', 'DateStampMode' => { PrintConv => { 'Date & Time' => 'Date et heure', 'Off' => 'Désactivé', }, }, 'DateTime' => 'Date de modification du fichier', 'DateTimeCreated' => 'Date/heure de création', 'DateTimeDigitized' => 'Date/heure de la numérisation', 'DateTimeOriginal' => 'Date de la création des données originales', 'DaylightSavings' => { Description => 'Heure d\'été', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'DefaultCropOrigin' => 'Origine de rognage par défaut', 'DefaultCropSize' => 'Taille de rognage par défaut', 'DefaultScale' => 'Echelle par défaut', 'DeletedImageCount' => 'Compteur d\'images supprimées', 'DestinationCity' => 'Ville de destination', 'DestinationCityCode' => 'Code ville de destination', 'DestinationDST' => { Description => 'Heure d\'été de destination', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'DeviceAttributes' => 'Attributs d\'appareil', 'DeviceManufacturer' => 'Fabricant de l\'appareil', 'DeviceMfgDesc' => 'Description du fabricant d\'appareil', 'DeviceModel' => 'Modèle de l\'appareil', 'DeviceModelDesc' => 'Description du modèle d\'appareil', 'DeviceSettingDescription' => 'Description des réglages du dispositif', 'DialDirectionTvAv' => { Description => 'Sens rotation molette Tv/Av', PrintConv => { 'Normal' => 'Normale', 'Reversed' => 'Sens inversé', }, }, 'DigitalCreationDate' => 'Date de numérisation', 'DigitalCreationTime' => 'Heure de numérisation', 'DigitalImageGUID' => 'GUID de l\'image numérique', 'DigitalSourceFileType' => 'Type de fichier de la source numérique', 'DigitalZoom' => { Description => 'Zoom numérique', PrintConv => { 'None' => 'Aucune', 'Off' => 'Désactivé', }, }, 'DigitalZoomOn' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'DigitalZoomRatio' => 'Rapport de zoom numérique', 'Directory' => 'Dossier', 'DirectoryNumber' => 'Numéro de dossier', 'DisplaySize' => { PrintConv => { 'Normal' => 'Normale', }, }, 'DisplayUnits' => { PrintConv => { 'inches' => 'Pouce', }, }, 'DisplayXResolutionUnit' => { PrintConv => { 'um' => 'µm (micromètre)', }, }, 'DisplayYResolutionUnit' => { PrintConv => { 'um' => 'µm (micromètre)', }, }, 'DisplayedUnitsX' => { PrintConv => { 'inches' => 'Pouce', }, }, 'DisplayedUnitsY' => { PrintConv => { 'inches' => 'Pouce', }, }, 'DistortionCorrection' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'DistortionCorrection2' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'DjVuVersion' => 'Version DjVu', 'DocumentHistory' => 'Historique du document', 'DocumentName' => 'Nom du document', 'DocumentNotes' => 'Remarques sur le document', 'DotRange' => 'Étendue de points', 'DriveMode' => { Description => 'Mode de prise de vue', PrintConv => { 'Burst' => 'Rafale', 'Continuous' => 'Continu', 'Continuous High' => 'Continu (ultrarapide)', 'Continuous Shooting' => 'Prise de vues en continu', 'Multiple Exposure' => 'Exposition multiple', 'No Timer' => 'Pas de retardateur', 'Off' => 'Désactivé', 'Remote Control' => 'Télécommande', 'Remote Control (3 s delay)' => 'Télécommande (retard 3 s)', 'Self-timer (12 s)' => 'Retardateur (12 s)', 'Self-timer (2 s)' => 'Retardateur (2 s)', 'Self-timer Operation' => 'Retardateur', 'Shutter Button' => 'Déclencheur', 'Single Exposure' => 'Exposition unique', 'Single-frame' => 'Vue par vue', 'Single-frame Shooting' => 'Prise de vue unique', }, }, 'DriveMode2' => { Description => 'Exposition multiple', PrintConv => { 'Single-frame' => 'Vue par vue', }, }, 'Duration' => 'Durée', 'DynamicRangeExpansion' => { Description => 'Expansion de la dynamique', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'DynamicRangeOptimizer' => { Description => 'Optimiseur Dyna', PrintConv => { 'Advanced Auto' => 'Avancé Auto', 'Advanced Lv1' => 'Avancé Niv1', 'Advanced Lv2' => 'Avancé Niv2', 'Advanced Lv3' => 'Avancé Niv3', 'Advanced Lv4' => 'Avancé Niv4', 'Advanced Lv5' => 'Avancé Niv5', 'Auto' => 'Auto.', 'Off' => 'Désactivé', }, }, 'E-DialInProgram' => { PrintConv => { 'P Shift' => 'Décalage P', 'Tv or Av' => 'Tv ou Av', }, }, 'ETTLII' => { PrintConv => { 'Average' => 'Moyenne', 'Evaluative' => 'Évaluative', }, }, 'EVStepInfo' => 'Info de pas IL', 'EVSteps' => { Description => 'Pas IL', PrintConv => { '1/2 EV Steps' => 'Pas de 1/2 IL', '1/3 EV Steps' => 'Pas de 1/3 IL', }, }, 'EasyExposureCompensation' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'EasyMode' => { PrintConv => { 'Beach' => 'Plage', 'Color Accent' => 'Couleur contrastée', 'Color Swap' => 'Permuter couleur', 'Fireworks' => 'Feu d\'artifice', 'Foliage' => 'Feuillages', 'Indoor' => 'Intérieur', 'Kids & Pets' => 'Enfants & animaux', 'Landscape' => 'Paysage', 'Manual' => 'Manuelle', 'Night' => 'Scène de nuit', 'Night Snapshot' => 'Mode Nuit', 'Snow' => 'Neige', 'Sports' => 'Sport', 'Super Macro' => 'Super macro', 'Underwater' => 'Sous-marin', }, }, 'EdgeNoiseReduction' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'EditStatus' => 'Statut d\'édition', 'EditorialUpdate' => { Description => 'Mise à jour éditoriale', PrintConv => { 'Additional language' => 'Langues supplémentaires', }, }, 'EffectiveLV' => 'Indice de lumination effectif', 'EffectiveMaxAperture' => 'Ouverture effective maxi de l\'Objectif', 'Emphasis' => { PrintConv => { 'None' => 'Aucune', }, }, 'EncodingProcess' => { Description => 'Procédé de codage', PrintConv => { 'Baseline DCT, Huffman coding' => 'Baseline DCT, codage Huffman', 'Extended sequential DCT, Huffman coding' => 'Extended sequential DCT, codage Huffman', 'Extended sequential DCT, arithmetic coding' => 'Extended sequential DCT, codage arithmétique', 'Lossless, Differential Huffman coding' => 'Lossless, codage Huffman différentiel', 'Lossless, Huffman coding' => 'Lossless, codage Huffman', 'Lossless, arithmetic coding' => 'Lossless, codage arithmétique', 'Lossless, differential arithmetic coding' => 'Lossless, codage arithmétique différentiel', 'Progressive DCT, Huffman coding' => 'Progressive DCT, codage Huffman', 'Progressive DCT, arithmetic coding' => 'Progressive DCT, codage arithmétique', 'Progressive DCT, differential Huffman coding' => 'Progressive DCT, codage Huffman différentiel', 'Progressive DCT, differential arithmetic coding' => 'Progressive DCT, codage arithmétique différentiel', 'Sequential DCT, differential Huffman coding' => 'Sequential DCT, codage Huffman différentiel', 'Sequential DCT, differential arithmetic coding' => 'Sequential DCT, codage arithmétique différentiel', }, }, 'Encryption' => 'Chiffrage', 'EndPoints' => 'Points de terminaison', 'EnhanceDarkTones' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Enhancement' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'Off' => 'Désactivé', 'Red' => 'Rouge', }, }, 'EnvelopeNumber' => 'Numéro d\'enveloppe', 'EnvelopePriority' => { Description => 'Priorité d\'enveloppe', PrintConv => { '0 (reserved)' => '0 (réservé pour utilisation future)', '1 (most urgent)' => '1 (très urgent)', '5 (normal urgency)' => '5 (normalement urgent)', '8 (least urgent)' => '8 (moins urgent)', '9 (user-defined priority)' => '9 (priorité définie par l\'utilisateur)', }, }, 'EnvelopeRecordVersion' => 'Version d\'enregistrement', 'Error' => 'Erreur', 'Event' => 'Evenement', 'ExcursionTolerance' => { Description => 'Tolérance d\'excursion ', PrintConv => { 'Allowed' => 'Possible', 'Not Allowed' => 'Non permis (défaut)', }, }, 'ExifByteOrder' => 'Indicateur d\'ordre des octets Exif', 'ExifCameraInfo' => 'Info d\'appareil photo Exif', 'ExifImageHeight' => 'Hauteur d\'image', 'ExifImageWidth' => 'Largeur d\'image', 'ExifOffset' => 'Pointeur Exif IFD', 'ExifToolVersion' => 'Version ExifTool', 'ExifUnicodeByteOrder' => 'Indicateur d\'ordre des octets Unicode Exif', 'ExifVersion' => 'Version Exif', 'ExitPupilPosition' => 'Position de la pupille de sortie', 'ExpandFilm' => 'Extension film', 'ExpandFilterLens' => 'Extension lentille filtre', 'ExpandFlashLamp' => 'Extension lampe flash', 'ExpandLens' => 'Extension objectif', 'ExpandScanner' => 'Extension Scanner', 'ExpandSoftware' => 'Extension logiciel', 'ExpirationDate' => 'Date d\'expiration', 'ExpirationTime' => 'Heure d\'expiration', 'ExposureBracketStepSize' => 'Intervalle de bracketing d\'exposition', 'ExposureBracketValue' => 'Valeur Bracketing Expo', 'ExposureCompensation' => 'Décalage d\'exposition', 'ExposureDelayMode' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ExposureDifference' => 'Correction d\'exposition', 'ExposureIndex' => 'Indice d\'exposition', 'ExposureLevelIncrements' => { Description => 'Paliers de réglage d\'expo', PrintConv => { '1-stop set, 1/3-stop comp.' => 'Réglage 1 valeur, correction 1/3 val.', '1/2 Stop' => 'Palier 1/2', '1/2-stop set, 1/2-stop comp.' => 'Réglage 1/2 valeur, correction 1/2 val.', '1/3 Stop' => 'Palier 1/3', '1/3-stop set, 1/3-stop comp.' => 'Réglage 1/3 valeur, correction 1/3 val.', }, }, 'ExposureMode' => { Description => 'Mode d\'exposition', PrintConv => { 'Aperture Priority' => 'Priorité ouverture', 'Aperture-priority AE' => 'Priorité ouverture', 'Auto' => 'Exposition automatique', 'Auto bracket' => 'Bracketting auto', 'Bulb' => 'Pose B', 'Landscape' => 'Paysage', 'Manual' => 'Exposition manuelle', 'Night Scene / Twilight' => 'Nocturne', 'Shutter Priority' => 'Priorité vitesse', 'Shutter speed priority AE' => 'Priorité vitesse', }, }, 'ExposureModeInManual' => { Description => 'Mode d\'exposition manuelle', PrintConv => { 'Center-weighted average' => 'Centrale pondérée', 'Evaluative metering' => 'Mesure évaluativ', 'Partial metering' => 'Partielle', 'Specified metering mode' => 'Mode de mesure spécifié', 'Spot metering' => 'Spot', }, }, 'ExposureProgram' => { Description => 'Programme d\'exposition', PrintConv => { 'Action (High speed)' => 'Programme action (orienté grandes vitesses d\'obturation)', 'Aperture Priority' => 'Priorité ouverture', 'Aperture-priority AE' => 'Priorité ouverture', 'Creative (Slow speed)' => 'Programme créatif (orienté profondeur de champ)', 'Landscape' => 'Mode paysage', 'Manual' => 'Manuel', 'Not Defined' => 'Non défini', 'Portrait' => 'Mode portrait', 'Program AE' => 'Programme normal', 'Shutter Priority' => 'Priorité vitesse', 'Shutter speed priority AE' => 'Priorité vitesse', }, }, 'ExposureTime' => 'Temps de pose', 'ExposureTime2' => 'Temps de pose 2', 'ExtendedWBDetect' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ExtenderStatus' => { PrintConv => { 'Attached' => 'Attaché', 'Not attached' => 'Non attaché', 'Removed' => 'Retiré', }, }, 'ExternalFlash' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ExternalFlashBounce' => { Description => 'Réflexion flash externe', PrintConv => { 'Bounce' => 'Avec réflecteur', 'No' => 'Non', 'Yes' => 'Oui', 'n/a' => 'Non établie', }, }, 'ExternalFlashExposureComp' => { Description => 'Compensation d\'exposition flash externe', PrintConv => { '-0.5' => '-0.5 IL', '-1.0' => '-1.0 IL', '-1.5' => '-1.5 IL', '-2.0' => '-2.0 IL', '-2.5' => '-2.5 IL', '-3.0' => '-3.0 IL', '0.0' => '0.0 IL', '0.5' => '0.5 IL', '1.0' => '1.0 IL', 'n/a' => 'Non établie (éteint ou modes auto)', 'n/a (Manual Mode)' => 'Non établie (mode manuel)', }, }, 'ExternalFlashGuideNumber' => 'Nombre guide flash externe', 'ExternalFlashMode' => { Description => 'Segment de mesure flash esclave 3', PrintConv => { 'Off' => 'Désactivé', 'On, Auto' => 'En service, auto', 'On, Contrast-control Sync' => 'En service, synchro contrôle des contrastes', 'On, Flash Problem' => 'En service, problème de flash', 'On, High-speed Sync' => 'En service, synchro haute vitesse', 'On, Manual' => 'En service, manuel', 'On, P-TTL Auto' => 'En service, auto P-TTL', 'On, Wireless' => 'En service, sans cordon', 'On, Wireless, High-speed Sync' => 'En service, sans cordon, synchro haute vitesse', 'n/a - Off-Auto-Aperture' => 'N/c - auto-diaph hors service', }, }, 'ExtraSamples' => 'Echantillons supplémentaires', 'FNumber' => 'Nombre F', 'FOV' => 'Champ de vision', 'FaceOrientation' => { PrintConv => { 'Horizontal (normal)' => '0° (haut/gauche)', 'Rotate 180' => '180° (bas/droit)', 'Rotate 270 CW' => '90° sens horaire (gauche/bas)', 'Rotate 90 CW' => '90° sens antihoraire (droit/haut)', }, }, 'FastSeek' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'FaxProfile' => { PrintConv => { 'Unknown' => 'Inconnu', }, }, 'FaxRecvParams' => 'Paramètres de réception Fax', 'FaxRecvTime' => 'Temps de réception Fax', 'FaxSubAddress' => 'Sous-adresse Fax', 'FileFormat' => 'Format de fichier', 'FileInfo' => 'Infos Fichier', 'FileInfoVersion' => 'Version des Infos Fichier', 'FileModifyDate' => 'Date/heure de modification du fichier', 'FileName' => 'Nom de fichier', 'FileNumber' => 'Numéro de fichier', 'FileNumberMemory' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FileNumberSequence' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FileSize' => 'Taille du fichier', 'FileSource' => { Description => 'Source du fichier', PrintConv => { 'Digital Camera' => 'Appareil photo numérique', 'Film Scanner' => 'Scanner de film', 'Reflection Print Scanner' => 'Scanner par réflexion', }, }, 'FileType' => 'Type de fichier', 'FileVersion' => 'Version de format de fichier', 'Filename' => 'Nom du fichier ', 'FillFlashAutoReduction' => { Description => 'Mesure E-TTL', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'FillOrder' => { Description => 'Ordre de remplissage', PrintConv => { 'Normal' => 'Normale', }, }, 'FilmMode' => { Description => 'Mode Film', PrintConv => { 'Dynamic (B&W)' => 'Vives (N & Bà)', 'Dynamic (color)' => 'Couleurs vives', 'Nature (color)' => 'Couleurs naturelles', 'Smooth (B&W)' => 'Pastel (N & B)', 'Smooth (color)' => 'Couleurs pastel', 'Standard (B&W)' => 'Normales (N & B)', 'Standard (color)' => 'Couleurs normales', }, }, 'FilterEffect' => { Description => 'Effet de filtre', PrintConv => { 'Green' => 'Vert', 'None' => 'Aucune', 'Off' => 'Désactivé', 'Red' => 'Rouge', 'Yellow' => 'Jaune', 'n/a' => 'Non établie', }, }, 'FilterEffectMonochrome' => { PrintConv => { 'Green' => 'Vert', 'None' => 'Aucune', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'FinderDisplayDuringExposure' => { Description => 'Affich. viseur pendant expo.', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FirmwareVersion' => 'Version de firmware', 'FixtureIdentifier' => 'Identificateur d\'installation', 'Flash' => { Description => 'Flash ', PrintConv => { 'Auto, Did not fire' => 'Flash non déclenché, mode auto', 'Auto, Did not fire, Red-eye reduction' => 'Auto, flash non déclenché, mode réduction yeux rouges', 'Auto, Fired' => 'Flash déclenché, mode auto', 'Auto, Fired, Red-eye reduction' => 'Flash déclenché, mode auto, mode réduction yeux rouges, lumière renvoyée détectée', 'Auto, Fired, Red-eye reduction, Return detected' => 'Flash déclenché, mode auto, lumière renvoyée détectée, mode réduction yeux rouges', 'Auto, Fired, Red-eye reduction, Return not detected' => 'Flash déclenché, mode auto, lumière renvoyée non détectée, mode réduction yeux rouges', 'Auto, Fired, Return detected' => 'Flash déclenché, mode auto, lumière renvoyée détectée', 'Auto, Fired, Return not detected' => 'Flash déclenché, mode auto, lumière renvoyée non détectée', 'Did not fire' => 'Flash non déclenché', 'Fired' => 'Flash déclenché', 'Fired, Red-eye reduction' => 'Flash déclenché, mode réduction yeux rouges', 'Fired, Red-eye reduction, Return detected' => 'Flash déclenché, mode réduction yeux rouges, lumière renvoyée détectée', 'Fired, Red-eye reduction, Return not detected' => 'Flash déclenché, mode réduction yeux rouges, lumière renvoyée non détectée', 'Fired, Return detected' => 'Lumière renvoyée sur le capteur détectée', 'Fired, Return not detected' => 'Lumière renvoyée sur le capteur non détectée', 'No Flash' => 'Flash non déclenché', 'No flash function' => 'Pas de fonction flash', 'Off' => 'Désactivé', 'Off, Did not fire' => 'Flash non déclenché, mode flash forcé', 'Off, Did not fire, Return not detected' => 'Éteint, flash non déclenché, lumière renvoyée non détectée', 'Off, No flash function' => 'Éteint, pas de fonction flash', 'Off, Red-eye reduction' => 'Éteint, mode réduction yeux rouges', 'On' => 'Activé', 'On, Did not fire' => 'Hors service, flash non déclenché', 'On, Fired' => 'Flash déclenché, mode flash forcé', 'On, Red-eye reduction' => 'Flash déclenché, mode forcé, mode réduction yeux rouges', 'On, Red-eye reduction, Return detected' => 'Flash déclenché, mode forcé, mode réduction yeux rouges, lumière renvoyée détectée', 'On, Red-eye reduction, Return not detected' => 'Flash déclenché, mode forcé, mode réduction yeux rouges, lumière renvoyée non détectée', 'On, Return detected' => 'Flash déclenché, mode flash forcé, lumière renvoyée détectée', 'On, Return not detected' => 'Flash déclenché, mode flash forcé, lumière renvoyée non détectée', }, }, 'FlashBias' => 'Décalage Flash', 'FlashCommanderMode' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FlashCompensation' => 'Compensation flash', 'FlashControlMode' => { Description => 'Mode de Contrôle du Flash', PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'FlashDevice' => { PrintConv => { 'None' => 'Aucune', }, }, 'FlashEnergy' => 'Énergie du flash', 'FlashExposureBracketValue' => 'Valeur Bracketing Flash', 'FlashExposureComp' => 'Compensation d\'exposition au flash', 'FlashExposureCompSet' => 'Réglage de compensation d\'exposition au flash', 'FlashExposureLock' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FlashFired' => { Description => 'Flash utilisé', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'FlashFiring' => { Description => 'Émission de l\'éclair', PrintConv => { 'Does not fire' => 'Désactivé', 'Fires' => 'Activé', }, }, 'FlashFocalLength' => 'Focale Flash', 'FlashFunction' => 'Fonction flash', 'FlashGroupAControlMode' => { PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'FlashGroupBControlMode' => { PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'FlashGroupCControlMode' => { PrintConv => { 'Manual' => 'Manuelle', 'Off' => 'Désactivé', }, }, 'FlashInfo' => 'Information flash', 'FlashInfoVersion' => 'Version de l\'info Flash', 'FlashIntensity' => { PrintConv => { 'High' => 'Haut', 'Low' => 'Bas', 'Normal' => 'Normale', 'Strong' => 'Forte', }, }, 'FlashMeteringSegments' => 'Segments de mesure flash', 'FlashMode' => { Description => 'Mode flash', PrintConv => { 'Auto, Did not fire' => 'Auto, non déclenché', 'Auto, Did not fire, Red-eye reduction' => 'Auto, non déclenché, réduction yeux rouges', 'Auto, Fired' => 'Auto, déclenché', 'Auto, Fired, Red-eye reduction' => 'Auto, déclenché, réduction yeux rouges', 'Did Not Fire' => 'Eclair non-déclenché', 'External, Auto' => 'Externe, auto', 'External, Contrast-control Sync' => 'Externe, synchro contrôle des contrastes', 'External, Flash Problem' => 'Externe, problème de flash ?', 'External, High-speed Sync' => 'Externe, synchro haute vitesse', 'External, Manual' => 'Externe, manuel', 'External, P-TTL Auto' => 'Externe, P-TTL', 'External, Wireless' => 'Externe, sans cordon', 'External, Wireless, High-speed Sync' => 'Externe, sans cordon, synchro haute vitesse', 'Fired, Commander Mode' => 'Eclair déclenché, Mode maître', 'Fired, External' => 'Eclair déclenché, Exterieur', 'Fired, Manual' => 'Eclair déclenché, Manuel', 'Fired, TTL Mode' => 'Eclair déclenché, Mode TTL', 'Internal' => 'Interne', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'Off, Did not fire' => 'Hors service', 'On' => 'Activé', 'On, Did not fire' => 'En service, non déclenché', 'On, Fired' => 'En service', 'On, Red-eye reduction' => 'En service, réduction yeux rouges', 'On, Slow-sync' => 'En service, synchro lente', 'On, Slow-sync, Red-eye reduction' => 'En service, synchro lente, réduction yeux rouges', 'On, Soft' => 'En service, doux', 'On, Trailing-curtain Sync' => 'En service, synchro 2e rideau', 'On, Wireless (Control)' => 'En service, sans cordon (esclave)', 'On, Wireless (Master)' => 'En service, sans cordon (maître)', 'Red-eye Reduction' => 'Réduction yeux rouges', 'Red-eye reduction' => 'Réduction yeux rouges', 'Unknown' => 'Inconnu', 'n/a - Off-Auto-Aperture' => 'N/c - auto-diaph hors service', }, }, 'FlashModel' => { Description => 'Modèle de Flash', PrintConv => { 'None' => 'Aucune', }, }, 'FlashOptions' => { Description => 'Options de flash', PrintConv => { 'Auto, Red-eye reduction' => 'Auto, réduction yeux rouges', 'Normal' => 'Normale', 'Red-eye reduction' => 'Réduction yeux rouges', 'Slow-sync' => 'Synchro lente', 'Slow-sync, Red-eye reduction' => 'Synchro lente, réduction yeux rouges', 'Trailing-curtain Sync' => 'Synchro 2e rideau', 'Wireless (Control)' => 'Sans cordon (contrôleur)', 'Wireless (Master)' => 'Sans cordon (maître)', }, }, 'FlashOptions2' => { Description => 'Options de flash (2)', PrintConv => { 'Auto, Red-eye reduction' => 'Auto, réduction yeux rouges', 'Normal' => 'Normale', 'Red-eye reduction' => 'Réduction yeux rouges', 'Slow-sync' => 'Synchro lente', 'Slow-sync, Red-eye reduction' => 'Synchro lente, réduction yeux rouges', 'Trailing-curtain Sync' => 'Synchro 2e rideau', 'Wireless (Control)' => 'Sans cordon (contrôleur)', 'Wireless (Master)' => 'Sans cordon (maître)', }, }, 'FlashOutput' => 'Puissance de l\'éclair', 'FlashRedEyeMode' => 'Flash mode anti-yeux rouges', 'FlashReturn' => { PrintConv => { 'No return detection' => 'Pas de détection de retour', 'Return detected' => 'Retour détecté', 'Return not detected' => 'Retour non détecté', }, }, 'FlashSetting' => 'Réglages Flash', 'FlashStatus' => { Description => 'Segment de mesure flash esclave 1', PrintConv => { 'External, Did not fire' => 'Externe, non déclenché', 'External, Fired' => 'Externe, déclenché', 'Internal, Did not fire' => 'Interne, non déclenché', 'Internal, Fired' => 'Interne, déclenché', 'Off' => 'Désactivé', }, }, 'FlashSyncSpeedAv' => { Description => 'Vitesse synchro en mode Av', PrintConv => { '1/200 Fixed' => '1/200 fixe', '1/250 Fixed' => '1/250 fixe', '1/300 Fixed' => '1/300 fixe', }, }, 'FlashType' => { Description => 'Type de flash', PrintConv => { 'Built-In Flash' => 'Intégré', 'External' => 'Externe', 'None' => 'Aucune', }, }, 'FlashWarning' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FlashpixVersion' => 'Version Flashpix supportée', 'FlickerReduce' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'FlipHorizontal' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'FocalLength' => 'Focale de l\'objectif', 'FocalLength35efl' => 'Focale de l\'objectif', 'FocalLengthIn35mmFormat' => 'Distance focale sur film 35 mm', 'FocalPlaneResolutionUnit' => { Description => 'Unité de résolution de plan focal', PrintConv => { 'None' => 'Aucune', 'inches' => 'Pouce', 'um' => 'µm (micromètre)', }, }, 'FocalPlaneXResolution' => 'Résolution X du plan focal', 'FocalPlaneYResolution' => 'Résolution Y du plan focal', 'Focus' => { PrintConv => { 'Manual' => 'Manuelle', }, }, 'FocusContinuous' => { PrintConv => { 'Manual' => 'Manuelle', }, }, 'FocusDistance' => 'Distance de mise au point', 'FocusMode' => { Description => 'Mode mise au point', PrintConv => { 'AF-C' => 'AF-C (prise de vue en rafale)', 'AF-S' => 'AF-S (prise de vue unique)', 'Auto, Continuous' => 'Auto, continue', 'Auto, Focus button' => 'Bouton autofocus', 'Continuous' => 'Auto, continue', 'Infinity' => 'Infini', 'Manual' => 'Manuelle', 'Normal' => 'Normale', 'Pan Focus' => 'Hyperfocale', }, }, 'FocusMode2' => { Description => 'Mode mise au point 2', PrintConv => { 'AF-C' => 'AF-C (prise de vue en rafale)', 'AF-S' => 'AF-S (prise de vue unique)', 'Manual' => 'Manuelle', }, }, 'FocusModeSetting' => { PrintConv => { 'AF-C' => 'AF-C (prise de vue en rafale)', 'AF-S' => 'AF-S (prise de vue unique)', 'Manual' => 'Manuelle', }, }, 'FocusPosition' => 'Distance de mise au point', 'FocusRange' => { PrintConv => { 'Infinity' => 'Infini', 'Manual' => 'Manuelle', 'Normal' => 'Normale', 'Pan Focus' => 'Hyperfocale', 'Super Macro' => 'Super macro', }, }, 'FocusTrackingLockOn' => { PrintConv => { 'Normal' => 'Normale', 'Off' => 'Désactivé', }, }, 'FocusingScreen' => 'Verre de visée', 'ForwardMatrix1' => 'Matrice forward 1', 'ForwardMatrix2' => 'Matrice forward 2', 'FrameNumber' => 'Numéro de vue', 'FrameRate' => 'Vitesse', 'FrameSize' => 'Taille du cadre', 'FreeByteCounts' => 'Nombre d\'octets libres', 'FreeOffsets' => 'Offsets libres', 'FujiFlashMode' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', 'Red-eye reduction' => 'Réduction yeux rouges', }, }, 'GIFVersion' => 'Version GIF', 'GPSAltitude' => 'Altitude', 'GPSAltitudeRef' => { Description => 'Référence d\'altitude', PrintConv => { 'Above Sea Level' => 'Au-dessus du niveau de la mer', 'Below Sea Level' => 'En-dessous du niveau de la mer', }, }, 'GPSAreaInformation' => 'Nom de la zone GPS', 'GPSDOP' => 'Précision de mesure', 'GPSDateStamp' => 'Date GPS', 'GPSDateTime' => 'Heure GPS (horloge atomique)', 'GPSDestBearing' => 'Orientation de la destination', 'GPSDestBearingRef' => { Description => 'Référence de l\'orientation de la destination', PrintConv => { 'Magnetic North' => 'Nord magnétique', 'True North' => 'Direction vraie', }, }, 'GPSDestDistance' => 'Distance à la destination', 'GPSDestDistanceRef' => { Description => 'Référence de la distance à la destination', PrintConv => { 'Kilometers' => 'Kilomètres', 'Nautical Miles' => 'Noeuds', }, }, 'GPSDestLatitude' => 'Latitude de destination', 'GPSDestLatitudeRef' => { Description => 'Référence de la latitude de destination', PrintConv => { 'North' => 'Latitude nord', 'South' => 'Latitude sud', }, }, 'GPSDestLongitude' => 'Longitude de destination', 'GPSDestLongitudeRef' => { Description => 'Référence de la longitude de destination', PrintConv => { 'East' => 'Longitude est', 'West' => 'Longitude ouest', }, }, 'GPSDifferential' => { Description => 'Correction différentielle GPS', PrintConv => { 'Differential Corrected' => 'Correction différentielle appliquée', 'No Correction' => 'Mesure sans correction différentielle', }, }, 'GPSImgDirection' => 'Direction de l\'image', 'GPSImgDirectionRef' => { Description => 'Référence pour la direction l\'image', PrintConv => { 'Magnetic North' => 'Direction magnétique', 'True North' => 'Direction vraie', }, }, 'GPSInfo' => 'Pointeur IFD d\'informations GPS', 'GPSLatitude' => 'Latitude', 'GPSLatitudeRef' => { Description => 'Latitude nord ou sud', PrintConv => { 'North' => 'Latitude nord', 'South' => 'Latitude sud', }, }, 'GPSLongitude' => 'Longitude', 'GPSLongitudeRef' => { Description => 'Longitude est ou ouest', PrintConv => { 'East' => 'Longitude est', 'West' => 'Longitude ouest', }, }, 'GPSMapDatum' => 'Données de surveillance géodésique utilisées', 'GPSMeasureMode' => { Description => 'Mode de mesure GPS', PrintConv => { '2-D' => 'Mesure à deux dimensions', '2-Dimensional' => 'Mesure à deux dimensions', '2-Dimensional Measurement' => 'Mesure à deux dimensions', '3-D' => 'Mesure à trois dimensions', '3-Dimensional' => 'Mesure à trois dimensions', '3-Dimensional Measurement' => 'Mesure à trois dimensions', }, }, 'GPSPosition' => 'Position GPS', 'GPSProcessingMethod' => 'Nom de la méthode de traitement GPS', 'GPSSatellites' => 'Satellites GPS utilisés pour la mesure', 'GPSSpeed' => 'Vitesse du récepteur GPS', 'GPSSpeedRef' => { Description => 'Unité de vitesse', PrintConv => { 'km/h' => 'Kilomètres par heure', 'knots' => 'Noeuds', 'mph' => 'Miles par heure', }, }, 'GPSStatus' => { Description => 'État du récepteur GPS', PrintConv => { 'Measurement Active' => 'Mesure active', 'Measurement Void' => 'Mesure vide', }, }, 'GPSTimeStamp' => 'Heure GPS (horloge atomique)', 'GPSTrack' => 'Direction de déplacement', 'GPSTrackRef' => { Description => 'Référence pour la direction de déplacement', PrintConv => { 'Magnetic North' => 'Direction magnétique', 'True North' => 'Direction vraie', }, }, 'GPSVersionID' => 'Version de tag GPS', 'GainControl' => { Description => 'Contrôle de gain', PrintConv => { 'High gain down' => 'Forte atténuation', 'High gain up' => 'Fort gain', 'Low gain down' => 'Faible atténuation', 'Low gain up' => 'Faible gain', 'None' => 'Aucune', }, }, 'GammaCompensatedValue' => 'Valeur de compensation gamma', 'Gapless' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'GeoTiffAsciiParams' => 'Tag de paramètres Ascii GeoTiff', 'GeoTiffDirectory' => 'Tag de répertoire de clé GeoTiff', 'GeoTiffDoubleParams' => 'Tag de paramètres doubles GeoTiff', 'Gradation' => 'Luminosite', 'GrayResponseCurve' => 'Courbe de réponse du gris', 'GrayResponseUnit' => { Description => 'Unité de réponse en gris', PrintConv => { '0.0001' => 'Le nombre représente des millièmes d\'unité', '0.001' => 'Le nombre représente des centièmes d\'unité', '0.1' => 'Le nombre représente des dixièmes d\'unité', '1e-05' => 'Le nombre représente des dix-millièmes d\'unité', '1e-06' => 'Le nombre représente des cent-millièmes d\'unité', }, }, 'GrayTRC' => 'Courbe de reproduction des tons gris', 'GreenMatrixColumn' => 'Colonne de matrice verte', 'GreenTRC' => 'Courbe de reproduction des tons verts', 'GridDisplay' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'GripBatteryADLoad' => 'Tension accu poignée en charge', 'GripBatteryADNoLoad' => 'Tension accu poignée à vide', 'GripBatteryState' => { Description => 'État de accu poignée', PrintConv => { 'Almost Empty' => 'Presque vide', 'Empty or Missing' => 'Vide ou absent', 'Full' => 'Plein', 'Running Low' => 'En baisse', }, }, 'HCUsage' => 'Usage HC', 'HDR' => { Description => 'HDR auto', PrintConv => { 'Off' => 'Désactivée', }, }, 'HalftoneHints' => 'Indications sur les demi-treintes', 'Headline' => 'Titre principal', 'HighISONoiseReduction' => { Description => 'Réduction du bruit en haute sensibilité ISO', PrintConv => { 'Auto' => 'Auto.', 'High' => 'Fort', 'Low' => 'Bas', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'On' => 'Activé', 'Strong' => 'Importante', 'Weak' => 'Faible', 'Weakest' => 'La plus faible', }, }, 'HighlightTonePriority' => { Description => 'Priorité hautes lumières', PrintConv => { 'Disable' => 'Désactivée', 'Enable' => 'Activée', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'History' => 'Récapitulatif', 'HometownCity' => 'Ville de résidence', 'HometownCityCode' => 'Code ville de résidence', 'HometownDST' => { Description => 'Heure d\'été de résidence', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'HostComputer' => 'Ordinateur hôte', 'Hue' => 'Nuance', 'HueAdjustment' => 'Teinte', 'HyperfocalDistance' => 'Distanace hyperfocale', 'ICCProfile' => 'Profil ICC', 'ICCProfileName' => 'Nom du profil ICC', 'ICC_Profile' => 'Profil de couleur ICC d\'entrée', 'ID3Size' => 'Taille ID3', 'IPTC-NAA' => 'Métadonnées IPTC-NAA', 'IPTCBitsPerSample' => 'Nombre de bits par échantillon', 'IPTCImageHeight' => 'Nombre de lignes', 'IPTCImageRotation' => { Description => 'Rotation d\'image', PrintConv => { '0' => 'Pas de rotation', '180' => 'Rotation de 180 degrés', '270' => 'Rotation de 270 degrés', '90' => 'Rotation de 90 degrés', }, }, 'IPTCImageWidth' => 'Pixels par ligne', 'IPTCPictureNumber' => 'Numéro d\'image', 'IPTCPixelHeight' => 'Taille de pixel perpendiculairement à la direction de scan', 'IPTCPixelWidth' => 'Taille de pixel dans la direction de scan', 'ISO' => 'Sensibilité ISO', 'ISOExpansion' => { Description => 'Extension sensibilité ISO', PrintConv => { 'Off' => 'Arrêt', 'On' => 'Marche', }, }, 'ISOExpansion2' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'ISOFloor' => 'Seuil ISO', 'ISOInfo' => 'Info ISO', 'ISOSelection' => 'Choix ISO', 'ISOSetting' => { Description => 'Réglage ISO', PrintConv => { 'Manual' => 'Manuelle', }, }, 'ISOSpeedExpansion' => { Description => 'Extension de sensibilité ISO', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'ISOSpeedIncrements' => { Description => 'Incréments de sensibilité ISO', PrintConv => { '1/3 Stop' => 'Palier 1/3', }, }, 'ISOSpeedRange' => { Description => 'Régler l\'extension de sensibilité ISO', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'IT8Header' => 'En-tête IT8', 'Identifier' => 'Identifiant', 'Illumination' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ImageAdjustment' => 'Ajustement Image', 'ImageAreaOffset' => 'Décalage de zone d\'image', 'ImageAuthentication' => { Description => 'Authentication de l\'image', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ImageBoundary' => 'Cadre Image', 'ImageColorIndicator' => 'Indicateur de couleur d\'image', 'ImageColorValue' => 'Valeur de couleur d\'image', 'ImageCount' => 'Compteur d\'images', 'ImageDataSize' => 'Taille de l\'image', 'ImageDepth' => 'Profondeur d\'image', 'ImageDescription' => 'Description d\'image', 'ImageDustOff' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ImageEditCount' => 'Compteur de traitement d\'image', 'ImageEditing' => { Description => 'Traitement de l\'image', PrintConv => { 'Cropped' => 'Recadré', 'Digital Filter' => 'Filtre numérique', 'Frame Synthesis?' => 'Synthèse de vue ?', 'None' => 'Aucun', }, }, 'ImageHeight' => 'Hauteur d\'image', 'ImageHistory' => 'Historique de l\'image', 'ImageID' => 'ID d\'image', 'ImageLayer' => 'Couche image', 'ImageNumber' => 'Numéro d\'image', 'ImageOptimization' => 'Optimisation d\'image', 'ImageOrientation' => { Description => 'Orientation d\'image', PrintConv => { 'Landscape' => 'Paysage', 'Square' => 'Carré', }, }, 'ImageProcessing' => 'Retouche d\'image', 'ImageQuality' => { PrintConv => { 'Normal' => 'Normale', }, }, 'ImageReview' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ImageRotated' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'ImageSize' => 'Taille de l\'Image', 'ImageSourceData' => 'Données source d\'image', 'ImageStabilization' => { Description => 'Stabilisation d\'image', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', 'On, Mode 1' => 'Enclenché, Mode 1', 'On, Mode 2' => 'Enclenché, Mode 2', }, }, 'ImageTone' => { Description => 'Ton de l\'image', PrintConv => { 'Bright' => 'Brillant', 'Landscape' => 'Paysage', 'Natural' => 'Naturel', }, }, 'ImageType' => 'Type d\'image', 'ImageUniqueID' => 'Identificateur unique d\'image', 'ImageWidth' => 'Largeur d\'image', 'Indexed' => 'Indexé', 'InfoButtonWhenShooting' => { Description => 'Touche INFO au déclenchement', PrintConv => { 'Displays camera settings' => 'Affiche les réglages en cours', 'Displays shooting functions' => 'Affiche les fonctions', }, }, 'InkNames' => 'Nom des encres', 'InkSet' => 'Encrage', 'IntellectualGenre' => 'Genre intellectuel', 'IntelligentAuto' => 'Mode Auto intelligent', 'IntensityStereo' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'InterchangeColorSpace' => { PrintConv => { 'CMY (K) Device Dependent' => 'CMY(K) dépendant de l\'appareil', 'RGB Device Dependent' => 'RVB dépendant de l\'appareil', }, }, 'IntergraphMatrix' => 'Tag de matrice intergraphe', 'Interlace' => 'Entrelacement', 'InternalFlash' => { PrintConv => { 'Fired' => 'Flash déclenché', 'Manual' => 'Manuelle', 'No' => 'Flash non déclenché', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'InternalFlashMode' => { Description => 'Segment de mesure flash esclave 2', PrintConv => { 'Did not fire, (Unknown 0xf4)' => 'Hors service (inconnue 0xF4)', 'Did not fire, Auto' => 'Hors service, auto', 'Did not fire, Auto, Red-eye reduction' => 'Hors service, auto, réduction yeux rouges', 'Did not fire, Normal' => 'Hors service, normal', 'Did not fire, Red-eye reduction' => 'Hors service, réduction yeux rouges', 'Did not fire, Slow-sync' => 'Hors service, synchro lente', 'Did not fire, Slow-sync, Red-eye reduction' => 'Hors service, synchro lente, réduction yeux rouges', 'Did not fire, Trailing-curtain Sync' => 'Hors service, synchro 2e rideau', 'Did not fire, Wireless (Control)' => 'Hors service, sans cordon (contrôleur)', 'Did not fire, Wireless (Master)' => 'Hors service, sans cordon (maître)', 'Fired' => 'Activé', 'Fired, Auto' => 'En service, auto', 'Fired, Auto, Red-eye reduction' => 'En service, auto, réduction yeux rouges', 'Fired, Red-eye reduction' => 'En service, réduction yeux rouges', 'Fired, Slow-sync' => 'En service, synchro lente', 'Fired, Slow-sync, Red-eye reduction' => 'En service, synchro lente, réduction yeux rouges', 'Fired, Trailing-curtain Sync' => 'En service, synchro 2e rideau', 'Fired, Wireless (Control)' => 'En service, sans cordon (contrôleur)', 'Fired, Wireless (Master)' => 'En service, sans cordon (maître)', 'n/a - Off-Auto-Aperture' => 'N/c - auto-diaph hors service', }, }, 'InternalFlashStrength' => 'Segment de mesure flash esclave 4', 'InternalSerialNumber' => 'Numéro de série interne', 'InteropIndex' => { Description => 'Identification d\'interopérabilité', PrintConv => { 'R03 - DCF option file (Adobe RGB)' => 'R03: fichier d\'option DCF (Adobe RGB)', 'R98 - DCF basic file (sRGB)' => 'R98: fichier de base DCF (sRGB)', 'THM - DCF thumbnail file' => 'THM: fichier de vignette DCF', }, }, 'InteropOffset' => 'Indicateur d\'interfonctionnement', 'InteropVersion' => 'Version d\'interopérabilité', 'IptcLastEdited' => 'Derniere edition IPTC', 'JFIFVersion' => 'Version JFIF', 'JPEGACTables' => 'Tableaux AC JPEG', 'JPEGDCTables' => 'Tableaux DC JPEG', 'JPEGLosslessPredictors' => 'Prédicteurs JPEG sans perte', 'JPEGPointTransforms' => 'Transformations de point JPEG', 'JPEGProc' => 'Proc JPEG', 'JPEGQTables' => 'Tableaux Q JPEG', 'JPEGQuality' => { Description => 'Qualité', PrintConv => { 'Extra Fine' => 'Extra fine', 'Standard' => 'Normale', }, }, 'JPEGRestartInterval' => 'Intervalle de redémarrage JPEG', 'JPEGTables' => 'Tableaux JPEG', 'JobID' => 'ID de la tâche', 'JpgRecordedPixels' => { Description => 'Pixels enregistrés JPEG', PrintConv => { '10 MP' => '10 Mpx', '2 MP' => '2 Mpx', '6 MP' => '6 Mpx', }, }, 'Keyword' => 'Mots clé', 'Keywords' => 'Mots-clés', 'LC1' => 'Données d\'objectif', 'LC10' => 'Données mv\' nv\'', 'LC11' => 'Données AVC 1/EXP', 'LC12' => 'Données mv1 Avminsif', 'LC14' => 'Données UNT_12 UNT_6', 'LC15' => 'Données d\'adaptation de flash incorporé', 'LC2' => 'Code de distance', 'LC3' => 'Valeur K', 'LC4' => 'Données de correction d\'aberration à courte distance', 'LC5' => 'Données de correction d\'aberration chromatique', 'LC6' => 'Données d\'aberration d\'ouverture', 'LC7' => 'Données de condition minimale de déclenchement AF', 'LCDDisplayAtPowerOn' => { Description => 'Etat LCD lors de l\'allumage', PrintConv => { 'Display' => 'Allumé', 'Retain power off status' => 'Etat précédent', }, }, 'LCDDisplayReturnToShoot' => { Description => 'Affich. LCD -> Prise de vues', PrintConv => { 'Also with * etc.' => 'Aussi par * etc.', 'With Shutter Button only' => 'Par déclencheur uniq.', }, }, 'LCDIllumination' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'LCDIlluminationDuringBulb' => { Description => 'Éclairage LCD pendant pose longue', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'LCDPanels' => { Description => 'Ecran LCD supérieur/arrière', PrintConv => { 'ISO/File no.' => 'ISO/No. fichier', 'ISO/Remain. shots' => 'ISO/Vues restantes', 'Remain. shots/File no.' => 'Vues restantes/No. fichier', 'Shots in folder/Remain. shots' => 'Vues dans dossier/Vues restantes', }, }, 'LCHEditor' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Language' => 'Langage', 'LanguageIdentifier' => 'Identificateur de langue', 'LeafData' => 'Données Leaf', 'Lens' => 'Objectif ', 'LensAFStopButton' => { Description => 'Fonct. touche AF objectif', PrintConv => { 'AE lock' => 'Verrouillage AE', 'AE lock while metering' => 'Verr. AE posemètre actif', 'AF Stop' => 'Arrêt AF', 'AF mode: ONE SHOT <-> AI SERVO' => 'Mode AF: ONE SHOT <-> AI SERVO', 'AF point: M -> Auto / Auto -> Ctr.' => 'Colli: M -> Auto / Auto -> Ctr.', 'AF point: M->Auto/Auto->ctr' => 'Collim.AF: M->Auto/Auto->ctr', 'AF start' => 'Activation AF', 'AF stop' => 'Arrêt AF', 'IS start' => 'Activation stab. image', 'Switch to registered AF point' => 'Activer le collimateur autofocus enregistré', }, }, 'LensData' => 'Valeur K (LC3)', 'LensDataVersion' => 'Version des Données Objectif', 'LensDriveNoAF' => { Description => 'Pilot. obj. si AF impossible', PrintConv => { 'Focus search off' => 'Pas de recherche du point', 'Focus search on' => 'Recherche du point', }, }, 'LensFStops' => 'Nombre de diaphs de l\'objectif', 'LensID' => 'ID Lens', 'LensIDNumber' => 'Numéro d\'Objectif', 'LensInfo' => 'Infos lens', 'LensKind' => 'Sorte d\'objectif / version (LC0)', 'LensSerialNumber' => 'Numéro de série objectif', 'LensType' => 'Sorte d\'objectif', 'LicenseType' => { PrintConv => { 'Unknown' => 'Inconnu', }, }, 'LightReading' => 'Lecture de la lumière', 'LightSource' => { Description => 'Source de lumière', PrintConv => { 'Cloudy' => 'Temps nuageux', 'Cool White Fluorescent' => 'Fluorescente type soft', 'Day White Fluorescent' => 'Fluorescente type blanc', 'Daylight' => 'Lumière du jour', 'Daylight Fluorescent' => 'Fluorescente type jour', 'Fine Weather' => 'Beau temps', 'Fluorescent' => 'Fluorescente', 'ISO Studio Tungsten' => 'Tungstène studio ISO', 'Other' => 'Autre source de lumière', 'Shade' => 'Ombre', 'Standard Light A' => 'Lumière standard A', 'Standard Light B' => 'Lumière standard B', 'Standard Light C' => 'Lumière standard C', 'Tungsten (Incandescent)' => 'Tungstène (lumière incandescente)', 'Unknown' => 'Inconnue', 'Warm White Fluorescent' => 'Fluorescent blanc chaud', 'White Fluorescent' => 'Fluorescent blanc', }, }, 'LightSourceSpecial' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'LightValue' => 'Luminosite', 'Lightness' => 'Luminosité', 'LinearResponseLimit' => 'Limite de réponse linéaire', 'LinearizationTable' => 'Table de linéarisation', 'Lit' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'LiveViewExposureSimulation' => { Description => 'Simulation d\'exposition directe', PrintConv => { 'Disable (LCD auto adjust)' => 'Désactivée (réglge écran auto)', 'Enable (simulates exposure)' => 'Activée (simulation exposition)', }, }, 'LiveViewShooting' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'LocalizedCameraModel' => 'Nom traduit de modèle d\'appareil', 'Location' => 'Ligne', 'LockMicrophoneButton' => { Description => 'Fonction de touche microphone', PrintConv => { 'Protect (hold:record memo)' => 'Protéger (maintien: enregistrement sonore)', 'Record memo (protect:disable)' => 'Enregistrement sonore (protéger: désactivée)', }, }, 'LongExposureNoiseReduction' => { Description => 'Réduct. bruit longue expo.', PrintConv => { 'Off' => 'Arrêt', 'On' => 'Marche', }, }, 'LookupTable' => 'Table de correspondance', 'LoopStyle' => { PrintConv => { 'Normal' => 'Normale', }, }, 'LuminanceNoiseReduction' => { PrintConv => { 'Low' => 'Bas', 'Off' => 'Désactivé', }, }, 'MCUVersion' => 'Version MCU', 'MIEVersion' => 'Version MIE', 'MIMEType' => 'Type MIME', 'MSStereo' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Macro' => { PrintConv => { 'Manual' => 'Manuelle', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'On' => 'Activé', 'Super Macro' => 'Super macro', }, }, 'MacroMode' => { Description => 'Mode Macro', PrintConv => { 'Normal' => 'Normale', 'Off' => 'Désactivé', 'On' => 'Activé', 'Super Macro' => 'Super macro', 'Tele-Macro' => 'Macro en télé', }, }, 'MagnifiedView' => { Description => 'Agrandissement en lecture', PrintConv => { 'Image playback only' => 'Lecture image uniquement', 'Image review and playback' => 'Aff. inst. et lecture', }, }, 'MainDialExposureComp' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Make' => 'Fabricant', 'MakeAndModel' => 'Fabricant et modèle', 'MakerNote' => 'Données privées DNG', 'MakerNoteSafety' => { Description => 'Sécurité de note de fabricant', PrintConv => { 'Safe' => 'Sûre', 'Unsafe' => 'Pas sûre', }, }, 'MakerNoteVersion' => 'Version des informations spécifiques fabricant', 'MakerNotes' => 'Notes fabricant', 'ManualFlashOutput' => { PrintConv => { 'Low' => 'Bas', 'n/a' => 'Non établie', }, }, 'ManualFocusDistance' => 'Distance de Mise-au-point Manuelle', 'ManualTv' => { Description => 'Régl. Tv/Av manuel pour exp. M', PrintConv => { 'Tv=Control/Av=Main' => 'Tv=Contrôle rapide/Av=Principale', 'Tv=Control/Av=Main w/o lens' => 'Tv=Contrôle rapide/Av=Principale sans objectif', 'Tv=Main/Av=Control' => 'Tv=Principale/Av=Contrôle rapide', 'Tv=Main/Av=Main w/o lens' => 'Tv=Principale/Av=Contrôle rapide sans objectif', }, }, 'ManufactureDate' => 'Date de fabrication', 'Marked' => 'Marqué', 'MaskedAreas' => 'Zones masquées', 'MasterDocumentID' => 'ID du document maître', 'Matteing' => 'Matité', 'MaxAperture' => 'Données Avmin', 'MaxApertureAtMaxFocal' => 'Ouverture à la focale maxi', 'MaxApertureAtMinFocal' => 'Ouverture à la focale mini', 'MaxApertureValue' => 'Ouverture maximale de l\'objectif', 'MaxAvailHeight' => 'Hauteur max Disponible', 'MaxAvailWidth' => 'Largeur max Disponible', 'MaxFocalLength' => 'Focale maxi', 'MaxSampleValue' => 'Valeur maxi d\'échantillon', 'MaxVal' => 'Valeur max', 'MaximumDensityRange' => 'Etendue maximale de densité', 'Measurement' => 'Observateur de mesure', 'MeasurementBacking' => 'Support de mesure', 'MeasurementFlare' => 'Flare de mesure', 'MeasurementGeometry' => { Description => 'Géométrie de mesure', PrintConv => { '0/45 or 45/0' => '0/45 ou 45/0', '0/d or d/0' => '0/d ou d/0', }, }, 'MeasurementIlluminant' => 'Illuminant de mesure', 'MeasurementObserver' => 'Observateur de mesure', 'MediaBlackPoint' => 'Point noir moyen', 'MediaType' => { PrintConv => { 'Normal' => 'Normale', }, }, 'MediaWhitePoint' => 'Point blanc moyen', 'MenuButtonDisplayPosition' => { Description => 'Position début touche menu', PrintConv => { 'Previous' => 'Précédente', 'Previous (top if power off)' => 'Précédente (Haut si dés.)', 'Top' => 'Haut', }, }, 'MenuButtonReturn' => { PrintConv => { 'Previous' => 'Précédente', 'Top' => 'Haut', }, }, 'MetadataDate' => 'Date des metadonnées', 'MeteringMode' => { Description => 'Mode de mesure', PrintConv => { 'Average' => 'Moyenne', 'Center-weighted average' => 'Centrale pondérée', 'Evaluative' => 'Évaluative', 'Multi-segment' => 'Multizone', 'Multi-spot' => 'MultiSpot', 'Other' => 'Autre', 'Partial' => 'Partielle', 'Spot' => 'Grain', 'Unknown' => 'Inconnu', }, }, 'MeteringMode2' => { Description => 'Mode de mesure 2', PrintConv => { 'Multi-segment' => 'Multizone', }, }, 'MeteringMode3' => { Description => 'Mode de mesure (3)', PrintConv => { 'Multi-segment' => 'Multizone', }, }, 'MinAperture' => 'Ouverture mini', 'MinFocalLength' => 'Focale mini', 'MinSampleValue' => 'Valeur mini d\'échantillon', 'MinoltaQuality' => { Description => 'Qualité', PrintConv => { 'Normal' => 'Normale', }, }, 'MirrorLockup' => { Description => 'Verrouillage du miroir', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', 'Enable: Down with Set' => 'Activé: Retour par touche SET', }, }, 'ModDate' => 'Date de modification', 'Model' => 'Modèle d\'appareil photo', 'Model2' => 'Modèle d\'équipement de prise de vue (2)', 'ModelAge' => 'Age du modele', 'ModelTiePoint' => 'Tag de lien d modèle', 'ModelTransform' => 'Tag de transformation de modèle', 'ModelingFlash' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ModifiedPictureStyle' => { PrintConv => { 'Landscape' => 'Paysage', 'None' => 'Aucune', }, }, 'ModifiedSaturation' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'ModifiedSharpnessFreq' => { PrintConv => { 'High' => 'Haut', 'Highest' => 'Plus haut', 'Low' => 'Doux', 'n/a' => 'Non établie', }, }, 'ModifiedToneCurve' => { PrintConv => { 'Manual' => 'Manuelle', }, }, 'ModifiedWhiteBalance' => { PrintConv => { 'Cloudy' => 'Temps nuageux', 'Daylight' => 'Lumière du jour', 'Daylight Fluorescent' => 'Fluorescente type jour', 'Fluorescent' => 'Fluorescente', 'Shade' => 'Ombre', 'Tungsten' => 'Tungstène (lumière incandescente)', }, }, 'ModifyDate' => 'Date de modification de fichier', 'MoireFilter' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'MonochromeFilterEffect' => { PrintConv => { 'Green' => 'Vert', 'None' => 'Aucune', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'MonochromeLinear' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'MonochromeToningEffect' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'None' => 'Aucune', }, }, 'MultiExposure' => 'Infos Surimpression', 'MultiExposureAutoGain' => { Description => 'Auto-expo des surimpressions', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'MultiExposureMode' => { Description => 'Mode de surimpression', PrintConv => { 'Off' => 'Désactivé', }, }, 'MultiExposureShots' => 'Nombre de prises de vue', 'MultiExposureVersion' => 'Version Surimpression', 'MultiFrameNoiseReduction' => { Description => 'Réduc. bruit multi-photos', PrintConv => { 'Off' => 'Désactivée', 'On' => 'Activé(e)', }, }, 'MultipleExposureSet' => { Description => 'Exposition multiple', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Mute' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'MyColorMode' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'NDFilter' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'NEFCompression' => { PrintConv => { 'Uncompressed' => 'Non compressé', }, }, 'NEFLinearizationTable' => 'Table de Linearization', 'Name' => 'Nom', 'NamedColor2' => 'Couleur nommée 2', 'NativeDigest' => 'Sommaire natif', 'NativeDisplayInfo' => 'Information sur l\'affichage natif', 'NewsPhotoVersion' => 'Version d\'enregistrement news photo', 'Nickname' => 'Surnom', 'NikonCaptureData' => 'Données Nikon Capture', 'NikonCaptureVersion' => 'Version Nikon Capture', 'Noise' => 'Bruit', 'NoiseFilter' => { PrintConv => { 'Low' => 'Bas', 'Off' => 'Désactivé', }, }, 'NoiseReduction' => { Description => 'Réduction du bruit', PrintConv => { 'High (+1)' => '+1 (haut)', 'Highest (+2)' => '+2 (le plus haut)', 'Low' => 'Bas', 'Low (-1)' => '-1 (bas)', 'Lowest (-2)' => '-2 (le plus bas)', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'On' => 'Activé', 'Standard' => '±0 (normal)', }, }, 'NoiseReductionApplied' => 'Réduction de bruit appliquée', 'NominalMaxAperture' => 'Ouverture maxi nominal', 'NominalMinAperture' => 'Ouverture mini nominal', 'NumIndexEntries' => 'Nombre d\'entrées d\'index', 'NumberofInks' => 'Nombre d\'encres', 'OECFColumns' => 'Colonnes OECF', 'OECFNames' => 'Noms OECF', 'OECFRows' => 'Lignes OECF', 'OECFValues' => 'Valeurs OECF', 'OPIProxy' => 'Proxy OPI', 'ObjectAttributeReference' => 'Genre intellectuel', 'ObjectCycle' => { Description => 'Cycle d\'objet', PrintConv => { 'Both Morning and Evening' => 'Les deux', 'Evening' => 'Soir', 'Morning' => 'Matin', }, }, 'ObjectFileType' => { PrintConv => { 'None' => 'Aucune', 'Unknown' => 'Inconnu', }, }, 'ObjectName' => 'Titre', 'ObjectPreviewData' => 'Données de la miniature de l\'objet', 'ObjectPreviewFileFormat' => 'Format de fichier de la miniature de l\'objet', 'ObjectPreviewFileVersion' => 'Version de format de fichier de la miniature de l\'objet', 'ObjectTypeReference' => 'Référence de type d\'objet', 'OffsetSchema' => 'Schéma de décalage', 'OldSubfileType' => 'Type du sous-fichier', 'OneTouchWB' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'OpticalZoomMode' => { Description => 'Mode Zoom optique', PrintConv => { 'Extended' => 'Optique EX', 'Standard' => 'Normal', }, }, 'OpticalZoomOn' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Opto-ElectricConvFactor' => 'Facteur de conversion optoélectrique', 'Orientation' => { Description => 'Orientation de l\'image', PrintConv => { 'Horizontal (normal)' => '0° (haut/gauche)', 'Mirror horizontal' => '0° (haut/droit)', 'Mirror horizontal and rotate 270 CW' => '90° sens horaire (gauche/haut)', 'Mirror horizontal and rotate 90 CW' => '90° sens antihoraire (droit/bas)', 'Mirror vertical' => '180° (bas/gauche)', 'Rotate 180' => '180° (bas/droit)', 'Rotate 270 CW' => '90° sens horaire (gauche/bas)', 'Rotate 90 CW' => '90° sens antihoraire (droit/haut)', }, }, 'OriginalRawFileData' => 'Données du fichier raw d\'origine', 'OriginalRawFileDigest' => 'Digest du fichier raw original', 'OriginalRawFileName' => 'Nom du fichier raw d\'origine', 'OriginalTransmissionReference' => 'Identificateur de tâche', 'OriginatingProgram' => 'Programme d\'origine', 'OtherImage' => 'Autre image', 'OutputResponse' => 'Réponse de sortie', 'Owner' => 'Proprietaire', 'OwnerID' => 'ID du propriétaire', 'OwnerName' => 'Nom du propriétaire', 'PDFVersion' => 'Version PDF', 'PEFVersion' => 'Version PEF', 'Padding' => 'Remplissage', 'PageName' => 'Nom de page', 'PageNumber' => 'Page numéro', 'PanasonicExifVersion' => 'Version Exif Panasonic', 'PanasonicRawVersion' => 'Version Panasonic RAW', 'PanasonicTitle' => 'Titre', 'PentaxImageSize' => { Description => 'Taille d\'image Pentax', PrintConv => { '2304x1728 or 2592x1944' => '2304 x 1728 ou 2592 x 1944', '2560x1920 or 2304x1728' => '2560 x 1920 ou 2304 x 1728', '2816x2212 or 2816x2112' => '2816 x 2212 ou 2816 x 2112', '3008x2008 or 3040x2024' => '3008 x 2008 ou 3040 x 2024', 'Full' => 'Pleine', }, }, 'PentaxModelID' => 'Modèle Pentax', 'PentaxVersion' => 'Version Pentax', 'PeripheralLighting' => { Description => 'Correction éclairage périphérique', PrintConv => { 'Off' => 'Désactiver', 'On' => 'Activer', }, }, 'PersonInImage' => 'Personnage sur l\'Image', 'PhaseDetectAF' => 'Auto-Focus', 'PhotoEffect' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'PhotoEffects' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'PhotoEffectsType' => { PrintConv => { 'None' => 'Aucune', }, }, 'PhotometricInterpretation' => { Description => 'Schéma de pixel', PrintConv => { 'BlackIsZero' => 'Zéro pour noir', 'Color Filter Array' => 'CFA (Matrice de filtre de couleur)', 'Pixar LogL' => 'CIE Log2(L) (Log luminance)', 'Pixar LogLuv' => 'CIE Log2(L)(u\',v\') (Log luminance et chrominance)', 'RGB' => 'RVB', 'RGB Palette' => 'Palette RVB', 'Transparency Mask' => 'Masque de transparence', 'WhiteIsZero' => 'Zéro pour blanc', }, }, 'PhotoshopAnnotations' => 'Annotations Photoshop', 'PictureControl' => { Description => 'Optimisation d\'image', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'PictureControlActive' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'PictureControlAdjust' => { Description => 'Ajustement de l\'optimisation d\'image', PrintConv => { 'Default Settings' => 'Paramètres par défault', 'Full Control' => 'Réglages manuels', 'Quick Adjust' => 'Réglages rapides', }, }, 'PictureControlBase' => 'Optimisation d\'image de base', 'PictureControlName' => 'Nom de l\'optimisation d\'image', 'PictureControlQuickAdjust' => 'Optimisation d\'image - Réglages rapides', 'PictureControlVersion' => 'Version de l\'Optimisation d\'image', 'PictureFinish' => { PrintConv => { 'Natural' => 'Naturel', 'Night Scene' => 'Nocturne', }, }, 'PictureMode' => { Description => 'Mode d\'image', PrintConv => { '1/2 EV steps' => 'Pas de 1/2 IL', '1/3 EV steps' => 'Pas de 1/3 IL', 'Aperture Priority' => 'Priorité ouverture', 'Aperture Priority, Off-Auto-Aperture' => 'Priorité ouverture (auto-diaph hors service)', 'Aperture-priority AE' => 'Priorité ouverture', 'Auto PICT (Landscape)' => 'Auto PICT (paysage)', 'Auto PICT (Macro)' => 'Auto PICT (macro)', 'Auto PICT (Portrait)' => 'Auto PICT (portrait)', 'Auto PICT (Sport)' => 'Auto PICT (sport)', 'Auto PICT (Standard)' => 'Auto PICT (standard)', 'Autumn' => 'Automne', 'Blur Reduction' => 'Réduction du flou', 'Bulb' => 'Pose B', 'Bulb, Off-Auto-Aperture' => 'Pose B (auto-diaph hors service)', 'Candlelight' => 'Bougie', 'DOF Program' => 'Programme PdC', 'DOF Program (HyP)' => 'Programme PdC (Hyper-programme)', 'Dark Pet' => 'Animal foncé', 'Digital Filter' => 'Filtre numérique', 'Fireworks' => 'Feux d\'artifice', 'Flash X-Sync Speed AE' => 'Synchro X flash vitesse AE', 'Food' => 'Nourriture', 'Frame Composite' => 'Vue composite', 'Green Mode' => 'Mode vert', 'Half-length Portrait' => 'Portrait (buste)', 'Hi-speed Program' => 'Programme grande vitesse', 'Hi-speed Program (HyP)' => 'Programme grande vitesse (Hyper-programme)', 'Kids' => 'Enfants', 'Landscape' => 'Paysage', 'Light Pet' => 'Animal clair', 'MTF Program' => 'Programme FTM', 'MTF Program (HyP)' => 'Programme FTM (Hyper-programme)', 'Manual' => 'Manuelle', 'Manual, Off-Auto-Aperture' => 'Manuel (auto-diaph hors service)', 'Medium Pet' => 'Animal demi-teintes', 'Museum' => 'Musée', 'Natural Skin Tone' => 'Ton chair naturel', 'Night Scene' => 'Nocturne', 'Night Scene Portrait' => 'Portrait nocturne', 'No Flash' => 'Sans flash', 'Pet' => 'Animaux de compagnie', 'Program' => 'Programme', 'Program (HyP)' => 'Programme AE (Hyper-programme)', 'Program AE' => 'Priorité vitesse', 'Program Av Shift' => 'Décalage programme Av', 'Program Tv Shift' => 'Décalage programme Tv', 'Self Portrait' => 'Autoportrait', 'Sensitivity Priority AE' => 'Priorité sensibilité AE', 'Shutter & Aperture Priority AE' => 'Priorité vitesse et ouverture AE', 'Shutter Speed Priority' => 'Priorité vitesse', 'Shutter speed priority AE' => 'Priorité vitesse', 'Snow' => 'Neige', 'Soft' => 'Doux', 'Sunset' => 'Coucher de soleil', 'Surf & Snow' => 'Surf et neige', 'Synchro Sound Record' => 'Enregistrement de son synchro', 'Text' => 'Texte', 'Underwater' => 'Sous-marine', }, }, 'PictureMode2' => { Description => 'Mode d\'image 2', PrintConv => { 'Aperture Priority' => 'Priorité ouverture', 'Aperture Priority, Off-Auto-Aperture' => 'Priorité ouverture (auto-diaph hors service)', 'Auto PICT' => 'Image auto', 'Bulb' => 'Pose B', 'Bulb, Off-Auto-Aperture' => 'Pose B (auto-diaph hors service)', 'Flash X-Sync Speed AE' => 'Expo auto, vitesse de synchro flash X', 'Green Mode' => 'Mode vert', 'Manual' => 'Manuelle', 'Manual, Off-Auto-Aperture' => 'Manuel (auto-diaph hors service)', 'Program AE' => 'Programme AE', 'Program Av Shift' => 'Décalage programme Av', 'Program Tv Shift' => 'Décalage programme Tv', 'Scene Mode' => 'Mode scène', 'Sensitivity Priority AE' => 'Expo auto, priorité sensibilité', 'Shutter & Aperture Priority AE' => 'Expo auto, priorité vitesse et ouverture', 'Shutter Speed Priority' => 'Priorité vitesse', }, }, 'PictureModeBWFilter' => { PrintConv => { 'Green' => 'Vert', 'Red' => 'Rouge', 'Yellow' => 'Jaune', 'n/a' => 'Non établie', }, }, 'PictureModeTone' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'n/a' => 'Non établie', }, }, 'PictureStyle' => { Description => 'Style d\'image', PrintConv => { 'Faithful' => 'Fidèle', 'High Saturation' => 'Saturation élevée', 'Landscape' => 'Paysage', 'Low Saturation' => 'Faible saturation', 'Neutral' => 'Neutre', 'None' => 'Aucune', }, }, 'PixelIntensityRange' => 'Intervalle d\'intensité de pixel', 'PixelScale' => 'Tag d\'échelle de pixel modèle', 'PixelUnits' => { PrintConv => { 'Unknown' => 'Inconnu', }, }, 'PlanarConfiguration' => { Description => 'Arrangement des données image', PrintConv => { 'Chunky' => 'Format « chunky » (entrelacé)', 'Planar' => 'Format « planar »', }, }, 'PostalCode' => 'Code Postal', 'PowerSource' => { Description => 'Source d\'alimentation', PrintConv => { 'Body Battery' => 'Accu boîtier', 'External Power Supply' => 'Alimentation externe', 'Grip Battery' => 'Accu poignée', }, }, 'Predictor' => { Description => 'Prédicteur', PrintConv => { 'Horizontal differencing' => 'Différentiation horizontale', 'None' => 'Aucun schéma de prédicteur utilisé avant l\'encodage', }, }, 'Preview0' => 'Aperçu 0', 'Preview1' => 'Aperçu 1', 'Preview2' => 'Aperçu 2', 'PreviewApplicationName' => 'Nom de l\'application d\'aperçu', 'PreviewApplicationVersion' => 'Version de l\'application d\'aperçu', 'PreviewColorSpace' => { Description => 'Espace de couleur de l\'aperçu', PrintConv => { 'Unknown' => 'Inconnu', }, }, 'PreviewDateTime' => 'Horodatage d\'aperçu', 'PreviewImage' => 'Aperçu', 'PreviewImageBorders' => 'Limites d\'image miniature', 'PreviewImageData' => 'Données d\'image miniature', 'PreviewImageLength' => 'Longueur d\'image miniature', 'PreviewImageSize' => 'Taille d\'image miniature', 'PreviewImageStart' => 'Début d\'image miniature', 'PreviewImageValid' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'PreviewQuality' => { PrintConv => { 'Normal' => 'Normale', }, }, 'PreviewSettingsDigest' => 'Digest des réglages d\'aperçu', 'PreviewSettingsName' => 'Nom des réglages d\'aperçu', 'PrimaryAFPoint' => { PrintConv => { 'Bottom' => 'Bas', 'C6 (Center)' => 'C6 (Centre)', 'Center' => 'Centre', 'Mid-left' => 'Milieu gauche', 'Mid-right' => 'Milieu droit', 'Top' => 'Haut', }, }, 'PrimaryChromaticities' => 'Chromaticité des couleurs primaires', 'PrimaryPlatform' => 'Plateforme primaire', 'ProcessingSoftware' => 'Logiciel de traitement', 'Producer' => 'Producteur', 'ProductID' => 'ID de produit', 'ProductionCode' => 'L\'appareil est passé en SAV', 'ProfileCMMType' => 'Type de profil CMM', 'ProfileCalibrationSig' => 'Signature de calibration de profil', 'ProfileClass' => { Description => 'Classe de profil', PrintConv => { 'Abstract Profile' => 'Profil de résumé', 'ColorSpace Conversion Profile' => 'Profil de conversion d\'espace de couleur', 'DeviceLink Profile' => 'Profil de liaison', 'Display Device Profile' => 'Profil d\'appareil d\'affichage', 'Input Device Profile' => 'Profil d\'appareil d\'entrée', 'NamedColor Profile' => 'Profil de couleur nommée', 'Nikon Input Device Profile (NON-STANDARD!)' => 'Profil Nikon ("nkpf")', 'Output Device Profile' => 'Profil d\'appareil de sortie', }, }, 'ProfileConnectionSpace' => 'Espace de connexion de profil', 'ProfileCopyright' => 'Copyright du profil', 'ProfileCreator' => 'Créateur du profil', 'ProfileDateTime' => 'Horodatage du profil', 'ProfileDescription' => 'Description du profil', 'ProfileDescriptionML' => 'Description de profil ML', 'ProfileEmbedPolicy' => { Description => 'Règles d\'usage du profil incluses', PrintConv => { 'Allow Copying' => 'Permet la copie', 'Embed if Used' => 'Inclus si utilisé', 'Never Embed' => 'Jamais inclus', 'No Restrictions' => 'Pas de restriction', }, }, 'ProfileFileSignature' => 'Signature de fichier de profil', 'ProfileHueSatMapData1' => 'Données de profil teinte sat. 1', 'ProfileHueSatMapData2' => 'Données de profil teinte sat. 2', 'ProfileHueSatMapDims' => 'Divisions de teinte', 'ProfileID' => 'ID du profil', 'ProfileLookTableData' => 'Données de table de correspondance de profil', 'ProfileLookTableDims' => 'Divisions de teinte', 'ProfileName' => 'Nom du profil', 'ProfileSequenceDesc' => 'Description de séquence du profil', 'ProfileToneCurve' => 'Courbe de ton du profil', 'ProfileVersion' => 'Version de profil', 'ProgramISO' => 'Programme ISO', 'ProgramLine' => { Description => 'Ligne de programme', PrintConv => { 'Depth' => 'Priorité profondeur de champ', 'Hi Speed' => 'Priorité grande vitesse', 'MTF' => 'Priorité FTM', 'Normal' => 'Normale', }, }, 'ProgramMode' => { PrintConv => { 'None' => 'Aucune', 'Sunset' => 'Coucher de soleil', 'Text' => 'Texte', }, }, 'ProgramShift' => 'Décalage Programme', 'ProgramVersion' => 'Version du programme', 'Protect' => 'Protéger', 'Province-State' => 'Région / Département', 'Publisher' => 'Editeur', 'Quality' => { Description => 'Qualité', PrintConv => { 'Best' => 'La meilleure', 'Better' => 'Meilleure', 'Compressed RAW' => 'cRAW', 'Compressed RAW + JPEG' => 'cRAW+JPEG', 'Extra Fine' => 'Extra fine', 'Good' => 'Bonne', 'Low' => 'Bas', 'Normal' => 'Normale', 'RAW + JPEG' => 'RAW+JPEG', }, }, 'QualityMode' => { Description => 'Qualité', PrintConv => { 'Fine' => 'Haute', 'Normal' => 'Normale', }, }, 'QuantizationMethod' => { Description => 'Méthode de quantification', PrintConv => { 'Color Space Specific' => 'Spécifique à l\'espace de couleur', 'Compression Method Specific' => 'Spécifique à la méthode de compression', 'Gamma Compensated' => 'Compensée gamma', 'IPTC Ref B' => 'IPTC réf "B"', 'Linear Density' => 'Densité linéaire', 'Linear Dot Percent' => 'Pourcentage de point linéaire', 'Linear Reflectance/Transmittance' => 'Réflectance/transmittance linéaire', }, }, 'QuickAdjust' => 'Réglages rapides', 'QuickControlDialInMeter' => { Description => 'Molette de contrôle rapide en mesure', PrintConv => { 'AF point selection' => 'Sélection collimateur AF', 'Exposure comp/Aperture' => 'Correction exposition/ouverture', 'ISO speed' => 'Sensibilité ISO', }, }, 'QuickShot' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'RAFVersion' => 'Version RAF', 'RasterPadding' => 'Remplissage raster', 'RasterizedCaption' => 'Légende rastérisée', 'Rating' => 'Évaluation', 'RatingPercent' => 'Rapport en pourcentage', 'RawAndJpgRecording' => { Description => 'Enregistrement RAW et JPEG', PrintConv => { 'JPEG (Best)' => 'JPEG (le meilleur)', 'JPEG (Better)' => 'JPEG (meilleur)', 'JPEG (Good)' => 'JPEG (bon)', 'RAW (DNG, Best)' => 'RAW (DNG, le meilleur)', 'RAW (DNG, Better)' => 'RAW (DNG, meilleur)', 'RAW (DNG, Good)' => 'RAW (DNG, bon)', 'RAW (PEF, Best)' => 'RAW (PEF, le meilleur)', 'RAW (PEF, Better)' => 'RAW (PEF, meilleur)', 'RAW (PEF, Good)' => 'RAW (PEF, bon)', 'RAW+JPEG (DNG, Best)' => 'RAW+JPEG (DNG, le meilleur)', 'RAW+JPEG (DNG, Better)' => 'RAW+JPEG (DNG, meilleur)', 'RAW+JPEG (DNG, Good)' => 'RAW+JPEG (DNG, bon)', 'RAW+JPEG (PEF, Best)' => 'RAW+JPEG (PEF, le meilleur)', 'RAW+JPEG (PEF, Better)' => 'RAW+JPEG (PEF, meilleur)', 'RAW+JPEG (PEF, Good)' => 'RAW+JPEG (PEF, bon)', 'RAW+Large/Fine' => 'RAW+grande/fine', 'RAW+Large/Normal' => 'RAW+grande/normale', 'RAW+Medium/Fine' => 'RAW+moyenne/fine', 'RAW+Medium/Normal' => 'RAW+moyenne/normale', 'RAW+Small/Fine' => 'RAW+petite/fine', 'RAW+Small/Normal' => 'RAW+petite/normale', }, }, 'RawDataOffset' => 'Décalage données Raw', 'RawDataUniqueID' => 'ID unique de données brutes', 'RawDevAutoGradation' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'RawDevPMPictureTone' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', }, }, 'RawDevPM_BWFilter' => { PrintConv => { 'Green' => 'Vert', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'RawDevPictureMode' => { PrintConv => { 'Natural' => 'Naturel', }, }, 'RawDevWhiteBalance' => { PrintConv => { 'Color Temperature' => 'Température de couleur', }, }, 'RawImageCenter' => 'Centre Image RAW', 'RawImageDigest' => 'Digest d\'image brute', 'RawImageHeight' => 'Hauteur de l\'image brute', 'RawImageSize' => 'Taille d\'image RAW', 'RawImageWidth' => 'Largeur de l\'image brute', 'RawJpgQuality' => { PrintConv => { 'Normal' => 'Normale', }, }, 'RecordMode' => { Description => 'Mode d\'enregistrement', PrintConv => { 'Aperture Priority' => 'Priorité ouverture', 'Manual' => 'Manuelle', 'Shutter Priority' => 'Priorité vitesse', }, }, 'RecordingMode' => { PrintConv => { 'Landscape' => 'Paysage', 'Manual' => 'Manuelle', 'Night Scene' => 'Nocturne', }, }, 'RedBalance' => 'Balance rouge', 'RedEyeCorrection' => { PrintConv => { 'Automatic' => 'Auto', 'Off' => 'Désactivé', }, }, 'RedEyeReduction' => { Description => 'Réduction yeux rouges', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'RedMatrixColumn' => 'Colonne de matrice rouge', 'RedTRC' => 'Courbe de reproduction des tons rouges', 'ReductionMatrix1' => 'Matrice de réduction 1', 'ReductionMatrix2' => 'Matrice de réduction 2', 'ReferenceBlackWhite' => 'Paire de valeurs de référence noir et blanc', 'ReferenceDate' => 'Date de référence', 'ReferenceNumber' => 'Numéro de référence', 'ReferenceService' => 'Service de référence', 'RelatedImageFileFormat' => 'Format de fichier image apparenté', 'RelatedImageHeight' => 'Hauteur d\'image apparentée', 'RelatedImageWidth' => 'Largeur d\'image apparentée', 'RelatedSoundFile' => 'Fichier audio apparenté', 'ReleaseButtonToUseDial' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'ReleaseDate' => 'Date de version', 'ReleaseTime' => 'Heure de version', 'RenderingIntent' => { Description => 'Intention de rendu', PrintConv => { 'ICC-Absolute Colorimetric' => 'Colorimétrique absolu', 'Media-Relative Colorimetric' => 'Colorimétrique relatif', 'Perceptual' => 'Perceptif', }, }, 'ResampleParamsQuality' => { PrintConv => { 'Low' => 'Bas', }, }, 'Resaved' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'Resolution' => 'Résolution d\'image', 'ResolutionUnit' => { Description => 'Unité de résolution en X et Y', PrintConv => { 'None' => 'Aucune', 'cm' => 'Pixels/cm', 'inches' => 'Pouce', }, }, 'RetouchHistory' => { Description => 'Historique retouche', PrintConv => { 'None' => 'Aucune', }, }, 'RevisionNumber' => 'Numéro de révision', 'Rights' => 'Droits', 'Rotation' => { PrintConv => { 'Rotate 270 CW' => 'Rotation à 270 ° - sens antihoraire', 'Rotate 90 CW' => 'Rotation 90 ° - sens horaire', }, }, 'RowInterleaveFactor' => 'Facteur d\'entrelacement des lignes', 'RowsPerStrip' => 'Nombre de rangées par bande', 'SMaxSampleValue' => 'Valeur maxi d\'échantillon S', 'SMinSampleValue' => 'Valeur mini d\'échantillon S', 'SPIFFVersion' => 'Version SPIFF', 'SRAWQuality' => { PrintConv => { 'n/a' => 'Non établie', }, }, 'SRActive' => { Description => 'Réduction de bougé active', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'SRFocalLength' => 'Focale de réduction de bougé', 'SRHalfPressTime' => 'Temps entre mesure et déclenchement', 'SRResult' => { Description => 'Stabilisation', PrintConv => { 'Not stabilized' => 'Non stabilisé', }, }, 'SVGVersion' => 'Version SVG', 'SafetyShift' => { Description => 'Décalage de sécurité', PrintConv => { 'Disable' => 'Désactivé', 'Enable (ISO speed)' => 'Activé (sensibilité ISO)', 'Enable (Tv/Av)' => 'Activé (Tv/Av)', }, }, 'SafetyShiftInAvOrTv' => { Description => 'Décalage de sécurité Av ou Tv', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'SampleFormat' => { Description => 'Format d\'échantillon', PrintConv => { 'Complex int' => 'Entier complexe', 'Float' => 'Réel à virgule flottante', 'Signed' => 'Entier signé', 'Undefined' => 'Non défini', 'Unsigned' => 'Entier non signé', }, }, 'SampleStructure' => { Description => 'Structure d\'échantillonnage', PrintConv => { 'CompressionDependent' => 'Définie dans le processus de compression', 'Orthogonal4-2-2Sampling' => 'Orthogonale, avec les fréquences d\'échantillonnage dans le rapport 4:2:2:(4)', 'OrthogonalConstangSampling' => 'Orthogonale, avec les mêmes fréquences d\'échantillonnage relatives sur chaque composante', }, }, 'SamplesPerPixel' => 'Nombre de composantes', 'Saturation' => { PrintConv => { 'High' => 'Forte', 'Low' => 'Faible', 'Med High' => 'Assez forte', 'Med Low' => 'Assez faible', 'None' => 'Non établie', 'Normal' => 'Normale', 'Very High' => 'Très forte', 'Very Low' => 'Très faible', }, }, 'ScanImageEnhancer' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ScanningDirection' => { Description => 'Direction de scannage', PrintConv => { 'Bottom-Top, L-R' => 'De bas en haut, de gauche à droite', 'Bottom-Top, R-L' => 'De bas en haut, de droite à gauche', 'L-R, Bottom-Top' => 'De gauche à droite, de bas en haut', 'L-R, Top-Bottom' => 'De gauche à droite, de haut en bas', 'R-L, Bottom-Top' => 'De droite à gauche, de bas en haut', 'R-L, Top-Bottom' => 'De droite à gauche, de haut en bas', 'Top-Bottom, L-R' => 'De haut en bas, de gauche à droite', 'Top-Bottom, R-L' => 'De haut en bas, de droite à gauche', }, }, 'Scene' => 'Scène', 'SceneAssist' => 'Assistant Scene', 'SceneCaptureType' => { Description => 'Type de capture de scène', PrintConv => { 'Landscape' => 'Paysage', 'Night' => 'Scène de nuit', }, }, 'SceneMode' => { Description => 'Modes scène', PrintConv => { '3D Sweep Panorama' => '3D', 'Anti Motion Blur' => 'Anti-flou de mvt', 'Aperture Priority' => 'Priorité ouverture', 'Auto' => 'Auto.', 'Candlelight' => 'Bougie', 'Cont. Priority AE' => 'AE priorité continue', 'Handheld Night Shot' => 'Vue de nuit manuelle', 'Landscape' => 'Paysage', 'Manual' => 'Manuelle', 'Night Portrait' => 'Portrait nocturne', 'Night Scene' => 'Nocturne', 'Night View/Portrait' => 'Vision/portrait nocturne', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'Shutter Priority' => 'Priorité vitesse', 'Snow' => 'Neige', 'Standard' => '', 'Sunset' => 'Coucher de soleil', 'Super Macro' => 'Super macro', 'Sweep Panorama' => 'Panora. par balayage', 'Text' => 'Texte', }, }, 'SceneModeUsed' => { PrintConv => { 'Aperture Priority' => 'Priorité ouverture', 'Candlelight' => 'Bougie', 'Landscape' => 'Paysage', 'Manual' => 'Manuelle', 'Shutter Priority' => 'Priorité vitesse', 'Snow' => 'Neige', 'Sunset' => 'Coucher de soleil', 'Text' => 'Texte', }, }, 'SceneSelect' => { PrintConv => { 'Night' => 'Scène de nuit', 'Off' => 'Désactivé', }, }, 'SceneType' => { Description => 'Type de scène', PrintConv => { 'Directly photographed' => 'Image photographiée directement', }, }, 'SecurityClassification' => { Description => 'Classement de sécurité', PrintConv => { 'Confidential' => 'Confidentiel', 'Restricted' => 'Restreint', 'Top Secret' => 'Top secret', 'Unclassified' => 'Non classé', }, }, 'SelectableAFPoint' => { Description => 'Collimateurs AF sélectionnables', PrintConv => { '11 points' => '11 collimateurs', '19 points' => '19 collimateurs', '45 points' => '45 collimateurs', 'Inner 9 points' => '9 collimateurs centraux', 'Outer 9 points' => '9 collimateurs périphériques', }, }, 'SelfTimer' => { Description => 'Retardateur', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'SelfTimer2' => 'Retardateur (2)', 'SelfTimerMode' => 'Mode auto-timer', 'SensingMethod' => { Description => 'Méthode de capture', PrintConv => { 'Color sequential area' => 'Capteur couleur séquentiel', 'Color sequential linear' => 'Capteur couleur séquentiel linéaire', 'Monochrome area' => 'Capteur monochrome', 'Monochrome linear' => 'Capteur linéaire monochrome', 'Not defined' => 'Non définie', 'One-chip color area' => 'Capteur monochip couleur', 'Three-chip color area' => 'Capteur trois chips couleur', 'Trilinear' => 'Capteur trilinéaire', 'Two-chip color area' => 'Capteur deux chips couleur', }, }, 'SensitivityAdjust' => 'Réglage de sensibilité', 'SensitivitySteps' => { Description => 'Pas de sensibilité', PrintConv => { '1 EV Steps' => 'Pas de 1 IL', 'As EV Steps' => 'Comme pas IL', }, }, 'SensorCleaning' => { PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'SensorHeight' => 'Hauteur du capteur', 'SensorPixelSize' => 'Taille des pixels du capteur', 'SensorWidth' => 'Largeur du capteur', 'SequenceNumber' => 'Numéro de Séquence', 'SequentialShot' => { PrintConv => { 'None' => 'Aucune', }, }, 'SerialNumber' => 'Numéro de série', 'ServiceIdentifier' => 'Identificateur de service', 'SetButtonCrossKeysFunc' => { Description => 'Réglage touche SET/joypad', PrintConv => { 'Cross keys: AF point select' => 'Joypad:Sélec. collim. AF', 'Normal' => 'Normale', 'Set: Flash Exposure Comp' => 'SET:Cor expo flash', 'Set: Parameter' => 'SET:Changer de paramètres', 'Set: Picture Style' => 'SET:Style d’image', 'Set: Playback' => 'SET:Lecture', 'Set: Quality' => 'SET:Qualité', }, }, 'SetButtonWhenShooting' => { Description => 'Touche SET au déclenchement', PrintConv => { 'Change parameters' => 'Changer de paramètres', 'Default (no function)' => 'Normal (désactivée)', 'Disabled' => 'Désactivée', 'Flash exposure compensation' => 'Correction expo flash', 'ISO speed' => 'Sensibilité ISO', 'Image playback' => 'Lecture de l\'image', 'Image quality' => 'Changer de qualité', 'Image size' => 'Taille d\'image', 'LCD monitor On/Off' => 'Écran LCD On/Off', 'Menu display' => 'Affichage du menu', 'Normal (disabled)' => 'Normal (désactivée)', 'Picture style' => 'Style d\'image', 'Quick control screen' => 'Écran de contrôle rapide', 'Record func. + media/folder' => 'Fonction enregistrement + média/dossier', 'Record movie (Live View)' => 'Enr. vidéo (visée écran)', 'White balance' => 'Balance des blancs', }, }, 'SetFunctionWhenShooting' => { Description => 'Touche SET au déclenchement', PrintConv => { 'Change Parameters' => 'Changer de paramètres', 'Change Picture Style' => 'Style d\'image', 'Change quality' => 'Changer de qualité', 'Default (no function)' => 'Normal (désactivée)', 'Image replay' => 'Lecture de l\'image', 'Menu display' => 'Affichage du menu', }, }, 'ShadingCompensation' => { Description => 'Compensation de l\'ombrage', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ShadingCompensation2' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ShadowScale' => 'Echelle d\'ombre', 'ShakeReduction' => { Description => 'Réduction du bougé (réglage)', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ShakeReductionInfo' => 'Stabilisation', 'Sharpness' => { Description => 'Accentuation', PrintConv => { 'Hard' => 'Dure', 'Med Hard' => 'Assez dure', 'Med Soft' => 'Assez douce', 'Normal' => 'Normale', 'Soft' => 'Douce', 'Very Hard' => 'Très dure', 'Very Soft' => 'Très douce', 'n/a' => 'Non établie', }, }, 'SharpnessFrequency' => { PrintConv => { 'High' => 'Haut', 'Highest' => 'Plus haut', 'Low' => 'Doux', 'n/a' => 'Non établie', }, }, 'ShootingMode' => { Description => 'Télécommande IR', PrintConv => { 'Aerial Photo' => 'Photo aérienne', 'Aperture Priority' => 'Priorité ouverture', 'Baby' => 'Bébé', 'Beach' => 'Plage', 'Candlelight' => 'Eclairage Bougie', 'Color Effects' => 'Effets de couleurs', 'Fireworks' => 'Feu d\'artifice', 'Food' => 'Nourriture', 'High Sensitivity' => 'Haute sensibilité', 'High Speed Continuous Shooting' => 'Déclenchement continu à grande vitesse', 'Intelligent Auto' => 'Mode Auto intelligent', 'Intelligent ISO' => 'ISO Intelligent', 'Manual' => 'Manuel', 'Movie Preview' => 'Prévisualisation vidéo', 'Night Portrait' => 'Portrait de nuit', 'Normal' => 'Normale', 'Panning' => 'Panoramique', 'Panorama Assist' => 'Assistant Panorama', 'Party' => 'Fête', 'Pet' => 'Animal domestique', 'Program' => 'Programme', 'Scenery' => 'Paysage', 'Shutter Priority' => 'Priorité vitesse', 'Snow' => 'Neige', 'Soft Skin' => 'Peau douce', 'Starry Night' => 'Nuit étoilée', 'Sunset' => 'Coucher de soleil', 'Underwater' => 'Subaquatique', }, }, 'ShortDocumentID' => 'ID court de document', 'ShortReleaseTimeLag' => { Description => 'Intertie au déclenchement réduite', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'ShotInfoVersion' => 'Version des Infos prise de vue', 'Shutter-AELock' => { Description => 'Déclencheur/Touche verr. AE', PrintConv => { 'AE lock/AF' => 'Verrouillage AE/autofocus', 'AE/AF, No AE lock' => 'AE/AF, pas de verrou. AE', 'AF/AE lock' => 'Autofocus/verrouillage AE', 'AF/AF lock' => 'Autofocus/verrouillage AF', 'AF/AF lock, No AE lock' => 'AF/verr.AF, pas de verr.AE', }, }, 'ShutterAELButton' => { Description => 'Déclencheur/Touche verr. AE', PrintConv => { 'AE lock/AF' => 'Verrouillage AE/Autofocus', 'AE/AF, No AE lock' => 'AE/AF, pad de verrou. AE', 'AF/AE lock stop' => 'Autofocus/Verrouillage AE', 'AF/AF lock, No AE lock' => 'AF/ver.AF, pad de verr.AE', }, }, 'ShutterButtonAFOnButton' => { Description => 'Déclencheur/Touche AF', PrintConv => { 'AE lock/Metering + AF start' => 'Mémo expo/lct. mesure+AF', 'Metering + AF start' => 'Mesure + lancement AF', 'Metering + AF start/AF stop' => 'Mesure + lancement/arrêt AF', 'Metering + AF start/disable' => 'Lct. mesure+AF/désactivée', 'Metering start/Meter + AF start' => 'Lct. mesure/lct. mesure+AF', }, }, 'ShutterCount' => 'Comptage des déclenchements', 'ShutterCurtainSync' => { Description => 'Synchronisation du rideau', PrintConv => { '1st-curtain sync' => 'Synchronisation premier rideau', '2nd-curtain sync' => 'Synchronisation deuxième rideau', }, }, 'ShutterMode' => { PrintConv => { 'Aperture Priority' => 'Priorité ouverture', }, }, 'ShutterReleaseButtonAE-L' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ShutterReleaseNoCFCard' => { Description => 'Déclench. obtur. sans carte', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'ShutterSpeed' => 'Temps de pose', 'ShutterSpeedRange' => { Description => 'Régler gamme de vitesses', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'ShutterSpeedValue' => 'Vitesse d\'obturation', 'SidecarForExtension' => 'Extension', 'SimilarityIndex' => 'Indice de similarité', 'SlaveFlashMeteringSegments' => 'Segments de mesure flash esclave', 'SlideShow' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'SlowShutter' => { Description => 'Vitesse d\'obturation lente', PrintConv => { 'Night Scene' => 'Nocturne', 'None' => 'Aucune', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'SlowSync' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Software' => 'Logiciel', 'SpatialFrequencyResponse' => 'Réponse spatiale en fréquence', 'SpecialEffectsOpticalFilter' => { PrintConv => { 'None' => 'Aucune', }, }, 'SpectralSensitivity' => 'Sensibilité spectrale', 'SpotMeterLinkToAFPoint' => { Description => 'Mesure spot liée au collimateur AF', PrintConv => { 'Disable (use center AF point)' => 'Désactivée (utiliser collimateur AF central)', 'Enable (use active AF point)' => 'Activé (utiliser collimateur AF actif)', }, }, 'SpotMeteringMode' => { PrintConv => { 'Center' => 'Centre', }, }, 'State' => 'Etat', 'StreamType' => { PrintConv => { 'Text' => 'Texte', }, }, 'StripByteCounts' => 'Octets par bande compressée', 'StripOffsets' => 'Emplacement des données image', 'Sub-location' => 'Lieu', 'SubSecCreateDate' => 'Date de la création des données numériques', 'SubSecDateTimeOriginal' => 'Date de la création des données originales', 'SubSecModifyDate' => 'Date de modification de fichier', 'SubSecTime' => 'Fractions de seconde de DateTime', 'SubSecTimeDigitized' => 'Fractions de seconde de DateTimeDigitized', 'SubSecTimeOriginal' => 'Fractions de seconde de DateTimeOriginal', 'SubTileBlockSize' => 'Taille de bloc de sous-tuile', 'SubfileType' => 'Type du nouveau sous-fichier', 'SubimageColor' => { PrintConv => { 'RGB' => 'RVB', }, }, 'Subject' => 'Sujet', 'SubjectArea' => 'Zone du sujet', 'SubjectCode' => 'Code sujet', 'SubjectDistance' => 'Distance du sujet', 'SubjectDistanceRange' => { Description => 'Intervalle de distance du sujet', PrintConv => { 'Close' => 'Vue rapprochée', 'Distant' => 'Vue distante', 'Unknown' => 'Inconnu', }, }, 'SubjectLocation' => 'Zone du sujet', 'SubjectProgram' => { PrintConv => { 'None' => 'Aucune', 'Sunset' => 'Coucher de soleil', 'Text' => 'Texte', }, }, 'SubjectReference' => 'Code de sujet', 'Subsystem' => { PrintConv => { 'Unknown' => 'Inconnu', }, }, 'SuperMacro' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'SuperimposedDisplay' => { Description => 'Affichage superposé', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'SupplementalCategories' => 'Catégorie d\'appoint', 'SupplementalType' => { Description => 'Type de supplément', PrintConv => { 'Main Image' => 'Non établi', 'Rasterized Caption' => 'Titre rastérisé', 'Reduced Resolution Image' => 'Image de résolution réduite', }, }, 'SvISOSetting' => 'Réglage ISO Sv', 'SwitchToRegisteredAFPoint' => { Description => 'Activer collimateur enregistré', PrintConv => { 'Assist' => 'Touche d\'assistance', 'Assist + AF' => 'Touche d\'assistance + touche AF', 'Disable' => 'Désactivé', 'Enable' => 'Activé', 'Only while pressing assist' => 'Seulement en appuyant touche d\'assistance', }, }, 'T4Options' => 'Bits de remplissage ajoutés', 'T6Options' => 'Options T6', 'TTL_DA_ADown' => 'Segment de mesure flash esclave 6', 'TTL_DA_AUp' => 'Segment de mesure flash esclave 5', 'TTL_DA_BDown' => 'Segment de mesure flash esclave 8', 'TTL_DA_BUp' => 'Segment de mesure flash esclave 7', 'Tagged' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'TargetPrinter' => 'Imprimantte cible', 'Technology' => { Description => 'Technologie', PrintConv => { 'Active Matrix Display' => 'Afficheur à matrice active', 'Cathode Ray Tube Display' => 'Afficheur à tube cathodique', 'Digital Camera' => 'Appareil photo numérique', 'Dye Sublimation Printer' => 'Imprimante à sublimation thermique', 'Electrophotographic Printer' => 'Imprimante électrophotographique', 'Electrostatic Printer' => 'Imprimante électrostatique', 'Film Scanner' => 'Scanner de film', 'Flexography' => 'Flexographie', 'Ink Jet Printer' => 'Imprimante à jet d\'encre', 'Offset Lithography' => 'Lithographie offset', 'Passive Matrix Display' => 'Afficheur à matrice passive', 'Photo CD' => 'CD photo', 'Photo Image Setter' => 'Cadre photo', 'Photographic Paper Printer' => 'Imprimante à papier photo', 'Projection Television' => 'Téléviseur à projection', 'Reflective Scanner' => 'Scanner à réflexion', 'Silkscreen' => 'Ecran de soie', 'Thermal Wax Printer' => 'Imprimante thermique à cire', 'Video Camera' => 'Caméra vidéo', 'Video Monitor' => 'Moniteur vidéo', }, }, 'Teleconverter' => { PrintConv => { 'None' => 'Aucune', }, }, 'Text' => 'Texte', 'TextStamp' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Thresholding' => 'Seuil', 'ThumbnailHeight' => 'Hauteur de la vignette', 'ThumbnailImage' => 'Vignette', 'ThumbnailImageSize' => 'Taille des miniatures', 'ThumbnailWidth' => 'Hauteur de la vignette', 'TileByteCounts' => 'Nombre d\'octets d\'élément', 'TileDepth' => 'Profondeur d\'élément', 'TileLength' => 'Longueur d\'élément', 'TileOffsets' => 'Décalages d\'élément', 'TileWidth' => 'Largeur d\'élément', 'Time' => 'Heure', 'TimeCreated' => 'Heure de création', 'TimeScaleParamsQuality' => { PrintConv => { 'Low' => 'Bas', }, }, 'TimeSent' => 'Heure d\'envoi', 'TimeSincePowerOn' => 'Temps écoulé depuis la mise en marche', 'TimeZone' => 'Fuseau horaire', 'TimeZoneOffset' => 'Offset de zone de date', 'TimerLength' => { Description => 'Durée du retardateur', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'Title' => 'Titre', 'ToneComp' => 'Correction de tonalité', 'ToneCurve' => { Description => 'Courbe de ton', PrintConv => { 'Manual' => 'Manuelle', }, }, 'ToneCurveActive' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'ToneCurves' => 'Courbes de ton', 'ToningEffect' => { Description => 'Virage', PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'None' => 'Aucune', 'Red' => 'Rouge', 'Yellow' => 'Jaune', 'n/a' => 'Non établie', }, }, 'ToningEffectMonochrome' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'None' => 'Aucune', }, }, 'ToningSaturation' => 'Saturation du virage', 'TransferFunction' => 'Fonction de transfert', 'TransferRange' => 'Intervalle de transfert', 'Transformation' => { PrintConv => { 'Horizontal (normal)' => '0° (haut/gauche)', 'Mirror horizontal' => '0° (haut/droit)', 'Mirror horizontal and rotate 270 CW' => '90° sens horaire (gauche/haut)', 'Mirror horizontal and rotate 90 CW' => '90° sens antihoraire (droit/bas)', 'Mirror vertical' => '180° (bas/gauche)', 'Rotate 180' => '180° (bas/droit)', 'Rotate 270 CW' => '90° sens horaire (gauche/bas)', 'Rotate 90 CW' => '90° sens antihoraire (droit/haut)', }, }, 'TransmissionReference' => 'Référence transmission', 'TransparencyIndicator' => 'Indicateur de transparence', 'TrapIndicator' => 'Indicateur de piège', 'Trapped' => { Description => 'Piégé', PrintConv => { 'False' => 'Faux', 'True' => 'Vrai', 'Unknown' => 'Inconnu', }, }, 'TravelDay' => 'Date du Voyage', 'TvExposureTimeSetting' => 'Réglage de temps de pose Tv', 'URL' => 'URL ', 'USMLensElectronicMF' => { Description => 'MF électronique à objectif USM', PrintConv => { 'Always turned off' => 'Toujours débrayé', 'Disable after one-shot AF' => 'Désactivée après One-Shot AF', 'Disable in AF mode' => 'Désactivée en mode AF', 'Enable after one-shot AF' => 'Activée après AF One-Shot', 'Turns off after one-shot AF' => 'Débrayé aprés One-Shot AF', 'Turns on after one-shot AF' => 'Activé aprés One-Shot AF', }, }, 'Uncompressed' => { Description => 'Non.comprimé', PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'UniqueCameraModel' => 'Nom unique de modèle d\'appareil', 'UniqueDocumentID' => 'ID unique de document', 'UniqueObjectName' => 'Nom Unique d\'Objet', 'Unknown' => 'Inconnu', 'Unsharp1Color' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'RGB' => 'RVB', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'Unsharp2Color' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'RGB' => 'RVB', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'Unsharp3Color' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'RGB' => 'RVB', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'Unsharp4Color' => { PrintConv => { 'Blue' => 'Bleu', 'Green' => 'Vert', 'RGB' => 'RVB', 'Red' => 'Rouge', 'Yellow' => 'Jaune', }, }, 'UnsharpMask' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'Urgency' => { Description => 'Urgence', PrintConv => { '0 (reserved)' => '0 (réservé pour utilisation future)', '1 (most urgent)' => '1 (très urgent)', '5 (normal urgency)' => '5 (normalement urgent)', '8 (least urgent)' => '8 (moins urgent)', '9 (user-defined priority)' => '9 (réservé pour utilisation future)', }, }, 'UsableMeteringModes' => { Description => 'Sélectionner modes de mesure', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'UsableShootingModes' => { Description => 'Sélectionner modes de prise de vue', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activée', }, }, 'UsageTerms' => 'Conditions d\'Utilisation', 'UserComment' => 'Commentaire utilisateur', 'UserDef1PictureStyle' => { PrintConv => { 'Landscape' => 'Paysage', }, }, 'UserDef2PictureStyle' => { PrintConv => { 'Landscape' => 'Paysage', }, }, 'UserDef3PictureStyle' => { PrintConv => { 'Landscape' => 'Paysage', }, }, 'VRDVersion' => 'Version VRD', 'VRInfo' => 'Information stabilisateur', 'VRInfoVersion' => 'Info Version VR', 'VR_0x66' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'VariProgram' => 'Variprogramme', 'VibrationReduction' => { Description => 'Reduction des vibrations', PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', 'n/a' => 'Non établie', }, }, 'VideoCardGamma' => 'Gamma de la carte vidéo', 'ViewInfoDuringExposure' => { Description => 'Infos viseur pendant exposition', PrintConv => { 'Disable' => 'Désactivé', 'Enable' => 'Activé', }, }, 'ViewfinderWarning' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'ViewingCondDesc' => 'Description des conditions de visionnage', 'ViewingCondIlluminant' => 'Illuminant des conditions de visionnage', 'ViewingCondIlluminantType' => 'Type d\'illuminant des conditions de visionnage', 'ViewingCondSurround' => 'Environnement des conditions de visionnage', 'VignetteControl' => { Description => 'Controle du vignettage', PrintConv => { 'High' => 'Haut', 'Low' => 'Bas', 'Normal' => 'Normale', 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'VoiceMemo' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'WBAdjLighting' => { PrintConv => { 'Daylight' => 'Lumière du jour', 'None' => 'Aucune', }, }, 'WBBlueLevel' => 'Niveau Bleu Balance des Blancs', 'WBBracketMode' => { PrintConv => { 'Off' => 'Désactivé', }, }, 'WBFineTuneActive' => { PrintConv => { 'No' => 'Non', 'Yes' => 'Oui', }, }, 'WBGreenLevel' => 'Niveau Vert Balance des Blancs', 'WBMediaImageSizeSetting' => { Description => 'Réglage de balance des blancs + taille d\'image', PrintConv => { 'LCD monitor' => 'Écran LCD', 'Rear LCD panel' => 'Panneau LCD arrièr', }, }, 'WBRedLevel' => 'Niveau Rouge Balance des Blancs', 'WBShiftAB' => 'Décalage Balance Blancs ambre-bleu', 'WBShiftGM' => 'Décalage Balance Blancs vert-magenta', 'WB_GBRGLevels' => 'Niveaux BB VBRV', 'WB_GRBGLevels' => 'Niveaux BB VRBV', 'WB_GRGBLevels' => 'Niveaux BB VRVB', 'WB_RBGGLevels' => 'Niveaux BB RBVV', 'WB_RBLevels' => 'Niveaux BB RB', 'WB_RBLevels3000K' => 'Niveaux BB RB 3000K', 'WB_RBLevels3300K' => 'Niveaux BB RB 3300K', 'WB_RBLevels3600K' => 'Niveaux BB RB 3600K', 'WB_RBLevels3900K' => 'Niveaux BB RB 3800K', 'WB_RBLevels4000K' => 'Niveaux BB RB 4000K', 'WB_RBLevels4300K' => 'Niveaux BB RB 4300K', 'WB_RBLevels4500K' => 'Niveaux BB RB 4500K', 'WB_RBLevels4800K' => 'Niveaux BB RB 4800K', 'WB_RBLevels5300K' => 'Niveaux BB RB 5300K', 'WB_RBLevels6000K' => 'Niveaux BB RB 6000K', 'WB_RBLevels6600K' => 'Niveaux BB RB 6600K', 'WB_RBLevels7500K' => 'Niveaux BB RB 7500K', 'WB_RBLevelsCloudy' => 'Niveaux BB RB nuageux', 'WB_RBLevelsShade' => 'Niveaux BB RB ombre', 'WB_RBLevelsTungsten' => 'Niveaux BB RB tungstène', 'WB_RGBGLevels' => 'Niveaux BB RVBV', 'WB_RGBLevels' => 'Niveaux BB RVB', 'WB_RGBLevelsCloudy' => 'Niveaux BB RVB nuageux', 'WB_RGBLevelsDaylight' => 'Niveaux BB RVB lumière jour', 'WB_RGBLevelsFlash' => 'Niveaux BB RVB flash', 'WB_RGBLevelsFluorescent' => 'Niveaux BB RVB fluorescent', 'WB_RGBLevelsShade' => 'Niveaux BB RVB ombre', 'WB_RGBLevelsTungsten' => 'Niveaux BB RVB tungstène', 'WB_RGGBLevels' => 'Niveaux BB RVVB', 'WB_RGGBLevelsCloudy' => 'Niveaux BB RVVB nuageux', 'WB_RGGBLevelsDaylight' => 'Niveaux BB RVVB lumière jour', 'WB_RGGBLevelsFlash' => 'Niveaux BB RVVB flash', 'WB_RGGBLevelsFluorescent' => 'Niveaux BB RVVB fluorescent', 'WB_RGGBLevelsFluorescentD' => 'Niveaux BB RVVB fluorescent', 'WB_RGGBLevelsFluorescentN' => 'Niveaux BB RVVB fluo N', 'WB_RGGBLevelsFluorescentW' => 'Niveaux BB RVVB fluo W', 'WB_RGGBLevelsShade' => 'Niveaux BB RVVB ombre', 'WB_RGGBLevelsTungsten' => 'Niveaux BB RVVB tungstène', 'WCSProfiles' => 'Profil Windows Color System', 'Warning' => 'Attention', 'WebStatement' => 'Relevé Web', 'WhiteBalance' => { Description => 'Balance des blancs', PrintConv => { 'Auto' => 'Equilibrage des blancs automatique', 'Black & White' => 'Monochrome', 'Cloudy' => 'Temps nuageux', 'Color Temperature/Color Filter' => 'Temp.Couleur / Filtre couleur', 'Cool White Fluorescent' => 'Fluorescente type soft', 'Custom' => 'Personnalisée', 'Custom 1' => 'Personnalisée 1', 'Custom 2' => 'Personnalisée 2', 'Custom 3' => 'Personnalisée 3', 'Custom 4' => 'Personnalisée 4', 'Day White Fluorescent' => 'Fluorescente type blanc', 'Daylight' => 'Lumière du jour', 'Daylight Fluorescent' => 'Fluorescente type jour', 'Fluorescent' => 'Fluorescente', 'Manual' => 'Manuelle', 'Manual Temperature (Kelvin)' => 'Température de couleur (Kelvin)', 'Shade' => 'Ombre', 'Tungsten' => 'Tungstène (lumière incandescente)', 'Unknown' => 'Inconnu', 'User-Selected' => 'Sélectionnée par l\'utilisateur', 'Warm White Fluorescent' => 'Fluorescent blanc chaud', 'White Fluorescent' => 'Fluorescent blanc', }, }, 'WhiteBalanceAdj' => { PrintConv => { 'Cloudy' => 'Temps nuageux', 'Daylight' => 'Lumière du jour', 'Fluorescent' => 'Fluorescente', 'Off' => 'Désactivé', 'On' => 'Activé', 'Shade' => 'Ombre', 'Tungsten' => 'Tungstène (lumière incandescente)', }, }, 'WhiteBalanceBias' => 'Décalage de Balance des blancs', 'WhiteBalanceFineTune' => 'Balance des blancs - Réglage fin', 'WhiteBalanceMode' => { Description => 'Mode de balance des blancs', PrintConv => { 'Auto (Cloudy)' => 'Auto (nuageux)', 'Auto (Day White Fluorescent)' => 'Auto (fluo jour)', 'Auto (Daylight Fluorescent)' => 'Auto (fluo lum. jour)', 'Auto (Daylight)' => 'Auto (lumière du jour)', 'Auto (Flash)' => 'Auto (flash)', 'Auto (Shade)' => 'Auto (ombre)', 'Auto (Tungsten)' => 'Auto (tungstène)', 'Auto (White Fluorescent)' => 'Auto (fluo blanc)', 'Unknown' => 'Inconnu', 'User-Selected' => 'Sélectionnée par l\'utilisateur', }, }, 'WhiteBalanceSet' => { Description => 'Réglage de balance des blancs', PrintConv => { 'Cloudy' => 'Temps nuageux', 'Day White Fluorescent' => 'Fluorescent blanc jour', 'Daylight' => 'Lumière du jour', 'Daylight Fluorescent' => 'Fluorescente type jour', 'Manual' => 'Manuelle', 'Set Color Temperature 1' => 'Température de couleur définie 1', 'Set Color Temperature 2' => 'Température de couleur définie 2', 'Set Color Temperature 3' => 'Température de couleur définie 3', 'Shade' => 'Ombre', 'Tungsten' => 'Tungstène (lumière incandescente)', 'White Fluorescent' => 'Fluorescent blanc', }, }, 'WhiteLevel' => 'Niveau blanc', 'WhitePoint' => 'Chromaticité du point blanc', 'WideRange' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, 'WorldTime' => 'Fuseau horaire', 'WorldTimeLocation' => { Description => 'Position en temps mondial', PrintConv => { 'Home' => 'Départ', 'Hometown' => 'Résidence', }, }, 'Writer-Editor' => 'Auteur de la légende / description', 'XClipPathUnits' => 'Unités de chemin de rognage en X', 'XMP' => 'Métadonnées XMP', 'XPAuthor' => 'Auteur', 'XPComment' => 'Commentaire', 'XPKeywords' => 'Mots clé', 'XPSubject' => 'Sujet', 'XPTitle' => 'Titre', 'XPosition' => 'Position en X', 'XResolution' => 'Résolution d\'image horizontale', 'YCbCrCoefficients' => 'Coefficients de la matrice de transformation de l\'espace de couleurs', 'YCbCrPositioning' => { Description => 'Positionnement Y et C', PrintConv => { 'Centered' => 'Centré', 'Co-sited' => 'Côte à côte', }, }, 'YCbCrSubSampling' => 'Rapport de sous-échantillonnage Y à C', 'YClipPathUnits' => 'Unités de chemin de rognage en Y', 'YPosition' => 'Position en Y', 'YResolution' => 'Résolution d\'image verticale', 'Year' => 'Année', 'ZoneMatching' => { Description => 'Ajustage de la zone', PrintConv => { 'High Key' => 'Hi', 'ISO Setting Used' => 'Désactivée', 'Low Key' => 'Lo', }, }, 'ZoneMatchingOn' => { PrintConv => { 'Off' => 'Désactivé', 'On' => 'Activé', }, }, ); 1; # end __END__ =head1 NAME Image::ExifTool::Lang::fr.pm - ExifTool French language translations =head1 DESCRIPTION This file is used by Image::ExifTool to generate localized tag descriptions and values. =head1 AUTHOR Copyright 2003-2014, Phil Harvey (phil at owl.phy.queensu.ca) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 ACKNOWLEDGEMENTS Thanks to Jens Duttke, Bernard Guillotin, Jean Glasser, Jean Piquemal and Harry Nizard for providing this translation. =head1 SEE ALSO L<Image::ExifTool(3pm)|Image::ExifTool>, L<Image::ExifTool::TagInfoXML(3pm)|Image::ExifTool::TagInfoXML> =cut
pericles-project/pet
nativeTools/exiftool_OSX/lib/Image/ExifTool/Lang/fr.pm
Perl
apache-2.0
161,290
#------------------------------------------------------------------------------ # File: Audible.pm # # Description: Read metadata from Audible audio books # # Revisions: 2015/04/05 - P. Harvey Created # # References: 1) https://github.com/jteeuwen/audible # 2) https://code.google.com/p/pyaudibletags/ # 3) http://wiki.multimedia.cx/index.php?title=Audible_Audio #------------------------------------------------------------------------------ package Image::ExifTool::Audible; use strict; use vars qw($VERSION); use Image::ExifTool qw(:DataAccess :Utils); $VERSION = '1.02'; sub ProcessAudible_meta($$$); sub ProcessAudible_cvrx($$$); %Image::ExifTool::Audible::Main = ( GROUPS => { 2 => 'Audio' }, NOTES => q{ ExifTool will extract any information found in the metadata dictionary of Audible .AA files, even if not listed in the table below. }, # tags found in the metadata dictionary (chunk 2) pubdate => { Name => 'PublishDate', Groups => { 2 => 'Time' } }, pub_date_start => { Name => 'PublishDateStart', Groups => { 2 => 'Time' } }, author => { Name => 'Author', Groups => { 2 => 'Author' } }, copyright => { Name => 'Copyright', Groups => { 2 => 'Author' } }, # also seen (ref PH): # product_id, parent_id, title, provider, narrator, price, description, # long_description, short_title, is_aggregation, title_id, codec, HeaderSeed, # EncryptedBlocks, HeaderKey, license_list, CPUType, license_count, <12 hex digits>, # parent_short_title, parent_title, aggregation_id, short_description, user_alias # information extracted from other chunks _chapter_count => { Name => 'ChapterCount' }, # from chunk 6 _cover_art => { # from chunk 11 Name => 'CoverArt', Groups => { 2 => 'Preview' }, Binary => 1, }, ); # 'tags' atoms observed in Audible .m4b audio books (ref PH) %Image::ExifTool::Audible::tags = ( GROUPS => { 0 => 'QuickTime', 2 => 'Audio' }, NOTES => 'Information found in "tags" atom of Audible M4B audio books.', meta => { Name => 'Audible_meta', SubDirectory => { TagTable => 'Image::ExifTool::Audible::meta' }, }, cvrx => { Name => 'Audible_cvrx', SubDirectory => { TagTable => 'Image::ExifTool::Audible::cvrx' }, }, tseg => { Name => 'Audible_tseg', SubDirectory => { TagTable => 'Image::ExifTool::Audible::tseg' }, }, ); # 'meta' information observed in Audible .m4b audio books (ref PH) %Image::ExifTool::Audible::meta = ( PROCESS_PROC => \&ProcessAudible_meta, GROUPS => { 0 => 'QuickTime', 2 => 'Audio' }, NOTES => 'Information found in Audible M4B "meta" atom.', Album => 'Album', ALBUMARTIST => { Name => 'AlbumArtist', Groups => { 2 => 'Author' } }, Artist => { Name => 'Artist', Groups => { 2 => 'Author' } }, Comment => 'Comment', Genre => 'Genre', itunesmediatype => { Name => 'iTunesMediaType', Description => 'iTunes Media Type' }, SUBTITLE => 'Subtitle', Title => 'Title', TOOL => 'CreatorTool', Year => { Name => 'Year', Groups => { 2 => 'Time' } }, track => 'ChapterName', # (found in 'meta' of 'tseg' atom) ); # 'cvrx' information observed in Audible .m4b audio books (ref PH) %Image::ExifTool::Audible::cvrx = ( PROCESS_PROC => \&ProcessAudible_cvrx, GROUPS => { 0 => 'QuickTime', 2 => 'Audio' }, NOTES => 'Audible cover art information in M4B audio books.', VARS => { NO_ID => 1 }, CoverArtType => 'CoverArtType', CoverArt => { Name => 'CoverArt', Groups => { 2 => 'Preview' }, Binary => 1, }, ); # 'tseg' information observed in Audible .m4b audio books (ref PH) %Image::ExifTool::Audible::tseg = ( GROUPS => { 0 => 'QuickTime', 2 => 'Audio' }, tshd => { Name => 'ChapterNumber', Format => 'int32u', ValueConv => '$val + 1', # start counting from 1 }, meta => { Name => 'Audible_meta2', SubDirectory => { TagTable => 'Image::ExifTool::Audible::meta' }, }, ); #------------------------------------------------------------------------------ # Process Audible 'meta' tags from M4B files (ref PH) # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref # Returns: 1 on success sub ProcessAudible_meta($$$) { my ($et, $dirInfo, $tagTablePtr) = @_; my $dataPt = $$dirInfo{DataPt}; my $dataPos = $$dirInfo{DataPos}; my $dirLen = length $$dataPt; return 0 if $dirLen < 4; my $num = Get32u($dataPt, 0); $et->VerboseDir('Audible_meta', $num); my $pos = 4; my $index; for ($index=0; $index<$num; ++$index) { last if $pos + 3 > $dirLen; my $unk = Get8u($dataPt, $pos); # ? (0x80 or 0x00) last unless $unk == 0x80 or $unk == 0x00; my $len = Get16u($dataPt, $pos + 1); # tag length $pos += 3; last if $pos + $len + 6 > $dirLen or not $len; my $tag = substr($$dataPt, $pos, $len); # tag ID my $ver = Get16u($dataPt, $pos + $len); # version? last unless $ver == 0x0001; my $size = Get32u($dataPt, $pos + $len + 2);# data size $pos += $len + 6; last if $pos + $size > $dirLen; my $val = $et->Decode(substr($$dataPt, $pos, $size), 'UTF8'); unless ($$tagTablePtr{$tag}) { my $name = Image::ExifTool::MakeTagName(($tag =~ /[a-z]/) ? $tag : lc($tag)); AddTagToTable($tagTablePtr, $tag, { Name => $name }); } $et->HandleTag($tagTablePtr, $tag, $val, DataPt => $dataPt, DataPos => $dataPos, Start => $pos, Size => $size, Index => $index, ); $pos += $size; } return 1; } #------------------------------------------------------------------------------ # Process Audible 'cvrx' cover art atom from M4B files (ref PH) # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref # Returns: 1 on success sub ProcessAudible_cvrx($$$) { my ($et, $dirInfo, $tagTablePtr) = @_; my $dataPt = $$dirInfo{DataPt}; my $dataPos = $$dirInfo{DataPos}; my $dirLen = length $$dataPt; return 0 if 0x0a > $dirLen; my $len = Get16u($dataPt, 0x08); return 0 if 0x0a + $len + 6 > $dirLen; my $size = Get32u($dataPt, 0x0a + $len + 2); return 0 if 0x0a + $len + 6 + $size > $dirLen; $et->VerboseDir('Audible_cvrx', undef, $dirLen); $et->HandleTag($tagTablePtr, 'CoverArtType', undef, DataPt => $dataPt, DataPos => $dataPos, Start => 0x0a, Size => $len, ); $et->HandleTag($tagTablePtr, 'CoverArt', undef, DataPt => $dataPt, DataPos => $dataPos, Start => 0x0a + $len + 6, Size => $size, ); return 1; } #------------------------------------------------------------------------------ # Read information from an Audible .AA file # Inputs: 0) ExifTool ref, 1) dirInfo ref # Returns: 1 on success, 0 if this wasn't a valid AA file sub ProcessAA($$) { my ($et, $dirInfo) = @_; my $raf = $$dirInfo{RAF}; my ($buff, $toc, $entry, $i); # check magic number return 0 unless $raf->Read($buff, 16) == 16 and $buff=~/^.{4}\x57\x90\x75\x36/s; # check file size if (defined $$et{VALUE}{FileSize}) { # first 4 bytes of the file should be the filesize unpack('N', $buff) == $$et{VALUE}{FileSize} or return 0; } $et->SetFileType(); SetByteOrder('MM'); my $bytes = 12 * Get32u(\$buff, 8); # table of contents size in bytes $bytes > 0xc00 and $et->Warn('Invalid TOC'), return 1; # read the table of contents $raf->Read($toc, $bytes) == $bytes or $et->Warn('Truncated TOC'), return 1; my $tagTablePtr = GetTagTable('Image::ExifTool::Audible::Main'); # parse table of contents (in $toc) for ($entry=0; $entry<$bytes; $entry+=12) { my $type = Get32u(\$toc, $entry); next unless $type == 2 or $type == 6 or $type == 11; my $offset = Get32u(\$toc, $entry + 4); my $length = Get32u(\$toc, $entry + 8) or next; $raf->Seek($offset, 0) or $et->Warn("Chunk $type seek error"), last; if ($type == 6) { # offset table next if $length < 4 or $raf->Read($buff, 4) != 4; # only read the chapter count $et->HandleTag($tagTablePtr, '_chapter_count', Get32u(\$buff, 0)); next; } # read the chunk $length > 100000000 and $et->Warn("Chunk $type too big"), next; $raf->Read($buff, $length) == $length or $et->Warn("Chunk $type read error"), last; if ($type == 11) { # cover art next if $length < 8; my $len = Get32u(\$buff, 0); my $off = Get32u(\$buff, 4); next if $off < $offset + 8 or $off - $offset + $len > $length; $et->HandleTag($tagTablePtr, '_cover_art', substr($buff, $off-$offset, $len)); next; } # parse metadata dictionary (in $buff) $length < 4 and $et->Warn('Bad dictionary'), next; my $num = Get32u(\$buff, 0); $num > 0x200 and $et->Warn('Bad dictionary count'), next; my $pos = 4; # dictionary starts immediately after count require Image::ExifTool::HTML; # (for UnescapeHTML) $et->VerboseDir('Audible Metadata', $num); for ($i=0; $i<$num; ++$i) { my $tagPos = $pos + 9; # position of tag string $tagPos > $length and $et->Warn('Truncated dictionary'), last; # (1 unknown byte ignored at start of each dictionary entry) my $tagLen = Get32u(\$buff, $pos + 1); # tag string length my $valLen = Get32u(\$buff, $pos + 5); # value string length my $valPos = $tagPos + $tagLen; # position of value string my $nxtPos = $valPos + $valLen; # position of next entry $nxtPos > $length and $et->Warn('Bad dictionary entry'), last; my $tag = substr($buff, $tagPos, $tagLen); my $val = substr($buff, $valPos, $valLen); unless ($$tagTablePtr{$tag}) { my $name = Image::ExifTool::MakeTagName($tag); $name =~ s/_(.)/\U$1/g; # change from underscore-separated to mixed case AddTagToTable($tagTablePtr, $tag, { Name => $name }); } # unescape HTML character references and convert from UTF-8 $val = $et->Decode(Image::ExifTool::HTML::UnescapeHTML($val), 'UTF8'); $et->HandleTag($tagTablePtr, $tag, $val, DataPos => $offset, DataPt => \$buff, Start => $valPos, Size => $valLen, Index => $i, ); $pos = $nxtPos; # step to next dictionary entry } } return 1; } 1; # end __END__ =head1 NAME Image::ExifTool::Audible - Read meta information from Audible audio books =head1 SYNOPSIS This module is used by Image::ExifTool =head1 DESCRIPTION This module contains definitions required by Image::ExifTool to read meta information from Audible audio books. =head1 AUTHOR Copyright 2003-2020, Phil Harvey (philharvey66 at gmail.com) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 REFERENCES =over 4 =item L<https://github.com/jteeuwen/audible> =item L<https://code.google.com/p/pyaudibletags/> =item L<http://wiki.multimedia.cx/index.php?title=Audible_Audio> =back =head1 SEE ALSO L<Image::ExifTool::TagNames/Audible Tags>, L<Image::ExifTool(3pm)|Image::ExifTool> =cut
mkjanke/Focus-Points
focuspoints.lrdevplugin/bin/exiftool/lib/Image/ExifTool/Audible.pm
Perl
apache-2.0
11,795
use Apache2::Const -compile => qw(NOT_FOUND); my $r = shift; $r->status(Apache2::Const::NOT_FOUND); $r->print("Content-type: text/plain\n\n");
gitpan/mod_perl
ModPerl-Registry/t/cgi-bin/status_change.pl
Perl
apache-2.0
144
=pod =head1 NAME EVP_MD-SM3 - The SM3 EVP_MD implementations =head1 DESCRIPTION Support for computing SM3 digests through the B<EVP_MD> API. =head2 Identity This implementation is only available with the default provider, and is identified with the name "SM3". =head2 Gettable Parameters This implementation supports the common gettable parameters described in L<EVP_MD-common(7)>. =head1 SEE ALSO L<provider-digest(7)>, L<OSSL_PROVIDER-default(7)> =head1 COPYRIGHT Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
jens-maus/amissl
openssl/doc/man7/EVP_MD-SM3.pod
Perl
bsd-3-clause
795
package DateTime::TimeZone::OffsetOnly; { $DateTime::TimeZone::OffsetOnly::VERSION = '1.46'; } use strict; use warnings; use parent 'DateTime::TimeZone'; use DateTime::TimeZone::UTC; use Params::Validate qw( validate SCALAR ); sub new { my $class = shift; my %p = validate( @_, { offset => { type => SCALAR }, } ); my $offset = DateTime::TimeZone::offset_as_seconds( $p{offset} ); die "Invalid offset: $p{offset}\n" unless defined $offset; return DateTime::TimeZone::UTC->new unless $offset; my $self = { name => DateTime::TimeZone::offset_as_string($offset), offset => $offset, }; return bless $self, $class; } sub is_dst_for_datetime {0} sub offset_for_datetime { $_[0]->{offset} } sub offset_for_local_datetime { $_[0]->{offset} } sub is_utc {0} sub short_name_for_datetime { $_[0]->name } sub category {undef} sub STORABLE_freeze { my $self = shift; return $self->name; } sub STORABLE_thaw { my $self = shift; my $cloning = shift; my $serialized = shift; my $class = ref $self || $self; my $obj; if ( $class->isa(__PACKAGE__) ) { $obj = __PACKAGE__->new( offset => $serialized ); } else { $obj = $class->new( offset => $serialized ); } %$self = %$obj; return $self; } 1; # ABSTRACT: A DateTime::TimeZone object that just contains an offset =pod =head1 NAME DateTime::TimeZone::OffsetOnly - A DateTime::TimeZone object that just contains an offset =head1 VERSION version 1.46 =head1 SYNOPSIS my $offset_tz = DateTime::TimeZone->new( name => '-0300' ); =head1 DESCRIPTION This class is used to provide the DateTime::TimeZone API needed by DateTime.pm, but with a fixed offset. An object in this class always returns the same offset as was given in its constructor, regardless of the date. =head1 USAGE This class has the same methods as a real time zone object, but the C<category()> method returns undef. =head2 DateTime::TimeZone::OffsetOnly->new ( offset => $offset ) The value given to the offset parameter must be a string such as "+0300". Strings will be converted into numbers by the C<DateTime::TimeZone::offset_as_seconds()> function. =head2 $tz->offset_for_datetime( $datetime ) No matter what date is given, the offset provided to the constructor is always used. =head2 $tz->name() =head2 $tz->short_name_for_datetime() Both of these methods return the offset in string form. =head1 AUTHOR Dave Rolsky <autarch@urth.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Dave Rolsky. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__
leighpauls/k2cro4
third_party/perl/perl/vendor/lib/DateTime/TimeZone/OffsetOnly.pm
Perl
bsd-3-clause
2,790
#------------------------------------------------------------------------------ # File: GIMP.pm # # Description: Read meta information from GIMP XCF images # # Revisions: 2010/10/05 - P. Harvey Created # # References: 1) GIMP source code # 2) http://svn.gnome.org/viewvc/gimp/trunk/devel-docs/xcf.txt?view=markup #------------------------------------------------------------------------------ package Image::ExifTool::GIMP; use strict; use vars qw($VERSION); use Image::ExifTool qw(:DataAccess :Utils); $VERSION = '1.02'; sub ProcessParasites($$$); # GIMP XCF properties (ref 2) %Image::ExifTool::GIMP::Main = ( GROUPS => { 2 => 'Image' }, VARS => { ALPHA_FIRST => 1 }, NOTES => q{ The GNU Image Manipulation Program (GIMP) writes these tags in its native XCF (eXperimental Computing Facilty) images. }, header => { SubDirectory => { TagTable => 'Image::ExifTool::GIMP::Header' } }, 17 => { Name => 'Compression', Format => 'int8u', PrintConv => { 0 => 'None', 1 => 'RLE Encoding', 2 => 'Zlib', 3 => 'Fractal', }, }, 19 => { Name => 'Resolution', SubDirectory => { TagTable => 'Image::ExifTool::GIMP::Resolution' }, }, 21 => { Name => 'Parasites', SubDirectory => { TagTable => 'Image::ExifTool::GIMP::Parasite' }, }, ); # information extracted from the XCF file header (ref 2) %Image::ExifTool::GIMP::Header = ( GROUPS => { 2 => 'Image' }, PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, 9 => { Name => 'XCFVersion', Format => 'string[5]', PrintConv => { 'file' => '0', 'v001' => '1', 'v002' => '2', }, }, 14 => { Name => 'ImageWidth', Format => 'int32u' }, 18 => { Name => 'ImageHeight', Format => 'int32u' }, 22 => { Name => 'ColorMode', Format => 'int32u', PrintConv => { 0 => 'RGB Color', 1 => 'Grayscale', 2 => 'Indexed Color', }, }, ); # XCF resolution data (property type 19) (ref 2) %Image::ExifTool::GIMP::Resolution = ( GROUPS => { 2 => 'Image' }, PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, FORMAT => 'float', 0 => 'XResolution', 1 => 'YResolution', ); # XCF "Parasite" data (property type 21) (ref 1/PH) %Image::ExifTool::GIMP::Parasite = ( GROUPS => { 2 => 'Image' }, PROCESS_PROC => \&ProcessParasites, 'gimp-comment' => { Name => 'Comment', Format => 'string', }, 'exif-data' => { Name => 'ExifData', SubDirectory => { TagTable => 'Image::ExifTool::Exif::Main', ProcessProc => \&Image::ExifTool::ProcessTIFF, Start => 6, # starts after "Exif\0\0" header }, }, 'jpeg-exif-data' => { # (deprecated, untested) Name => 'JPEGExifData', SubDirectory => { TagTable => 'Image::ExifTool::Exif::Main', ProcessProc => \&Image::ExifTool::ProcessTIFF, Start => 6, }, }, 'iptc-data' => { # (untested) Name => 'IPTCData', SubDirectory => { TagTable => 'Image::ExifTool::IPTC::Main' }, }, 'icc-profile' => { Name => 'ICC_Profile', SubDirectory => { TagTable => 'Image::ExifTool::ICC_Profile::Main' }, }, 'icc-profile-name' => { Name => 'ICCProfileName', Format => 'string', }, 'gimp-metadata' => { Name => 'XMP', SubDirectory => { TagTable => 'Image::ExifTool::XMP::Main', Start => 10, # starts after "GIMP_XMP_1" header }, }, ); #------------------------------------------------------------------------------ # Read information in a GIMP XCF parasite data (ref PH) # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) tag table ref # Returns: 1 on success sub ProcessParasites($$$) { my ($et, $dirInfo, $tagTablePtr) = @_; my $unknown = $et->Options('Unknown') || $et->Options('Verbose'); my $dataPt = $$dirInfo{DataPt}; my $pos = $$dirInfo{DirStart} || 0; my $end = length $$dataPt; $et->VerboseDir('Parasites', undef, $end); for (;;) { last if $pos + 4 > $end; my $size = Get32u($dataPt, $pos); # length of tag string $pos += 4; last if $pos + $size + 8 > $end; my $tag = substr($$dataPt, $pos, $size); $pos += $size; $tag =~ s/\0.*//s; # trim at null terminator # my $flags = Get32u($dataPt, $pos); (ignore flags) $size = Get32u($dataPt, $pos + 4); # length of data $pos += 8; last if $pos + $size > $end; if (not $$tagTablePtr{$tag} and $unknown) { my $name = $tag; $name =~ tr/-_A-Za-z0-9//dc; $name =~ s/^gimp-//; next unless length $name; $name = ucfirst $name; $name =~ s/([a-z])-([a-z])/$1\u$2/g; $name = "GIMP-$name" unless length($name) > 1; AddTagToTable($tagTablePtr, $tag, { Name => $name, Unknown => 1 }); } $et->HandleTag($tagTablePtr, $tag, undef, DataPt => $dataPt, Start => $pos, Size => $size, ); $pos += $size; } return 1; } #------------------------------------------------------------------------------ # Read information in a GIMP XCF document # Inputs: 0) ExifTool ref, 1) dirInfo ref # Returns: 1 on success, 0 if this wasn't a valid XCF file sub ProcessXCF($$) { my ($et, $dirInfo) = @_; my $raf = $$dirInfo{RAF}; my $buff; return 0 unless $raf->Read($buff, 26) == 26; return 0 unless $buff =~ /^gimp xcf /; my $tagTablePtr = GetTagTable('Image::ExifTool::GIMP::Main'); my $verbose = $et->Options('Verbose'); $et->SetFileType(); SetByteOrder('MM'); # process the XCF header $et->HandleTag($tagTablePtr, 'header', $buff); # loop through image properties for (;;) { $raf->Read($buff, 8) == 8 or last; my $tag = Get32u(\$buff, 0) or last; my $size = Get32u(\$buff, 4); $verbose and $et->VPrint(0, "XCF property $tag ($size bytes):\n"); unless ($$tagTablePtr{$tag}) { $raf->Seek($size, 1); next; } $raf->Read($buff, $size) == $size or last; $et->HandleTag($tagTablePtr, $tag, undef, DataPt => \$buff, DataPos => $raf->Tell() - $size, Size => $size, ); } return 1; } 1; # end __END__ =head1 NAME Image::ExifTool::GIMP - Read meta information from GIMP XCF images =head1 SYNOPSIS This module is used by Image::ExifTool =head1 DESCRIPTION This module contains definitions required by Image::ExifTool to read meta information from GIMP (GNU Image Manipulation Program) XCF (eXperimental Computing Facility) images. This is the native image format used by the GIMP software. =head1 AUTHOR Copyright 2003-2015, Phil Harvey (phil at owl.phy.queensu.ca) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 REFERENCES =over 4 =item L<GIMP source code> =item L<http://svn.gnome.org/viewvc/gimp/trunk/devel-docs/xcf.txt?view=markup> =back =head1 SEE ALSO L<Image::ExifTool::TagNames/GIMP Tags>, L<Image::ExifTool(3pm)|Image::ExifTool> =cut
mudasobwa/exifice
vendor/Image-ExifTool-10.02/lib/Image/ExifTool/GIMP.pm
Perl
mit
7,482
+{ locale_version => 0.88, # schwa doesn't require tailoring entry => <<'ENTRY', # for DUCET v6.1.0 00E7 ; [.1603.0020.0002.00E7] # LATIN SMALL LETTER C WITH CEDILLA 0063 0327 ; [.1603.0020.0002.00E7] # LATIN SMALL LETTER C WITH CEDILLA 00C7 ; [.1603.0020.0008.00C7] # LATIN CAPITAL LETTER C WITH CEDILLA 0043 0327 ; [.1603.0020.0008.00C7] # LATIN CAPITAL LETTER C WITH CEDILLA 011F ; [.1677.0020.0002.011F] # LATIN SMALL LETTER G WITH BREVE 0067 0306 ; [.1677.0020.0002.011F] # LATIN SMALL LETTER G WITH BREVE 011E ; [.1677.0020.0008.011E] # LATIN CAPITAL LETTER G WITH BREVE 0047 0306 ; [.1677.0020.0008.011E] # LATIN CAPITAL LETTER G WITH BREVE 0131 ; [.16B1.0020.0002.0131] # LATIN SMALL LETTER DOTLESS I 0049 ; [.16B1.0020.0008.0049] # LATIN CAPITAL LETTER I 00CC ; [.16B1.0020.0008.0049][.0000.0035.0002.0300] # LATIN CAPITAL LETTER I WITH GRAVE 00CD ; [.16B1.0020.0008.0049][.0000.0032.0002.0301] # LATIN CAPITAL LETTER I WITH ACUTE 00CE ; [.16B1.0020.0008.0049][.0000.003C.0002.0302] # LATIN CAPITAL LETTER I WITH CIRCUMFLEX 00CF ; [.16B1.0020.0008.0049][.0000.0047.0002.0308] # LATIN CAPITAL LETTER I WITH DIAERESIS 012A ; [.16B1.0020.0008.0049][.0000.005B.0002.0304] # LATIN CAPITAL LETTER I WITH MACRON 012C ; [.16B1.0020.0008.0049][.0000.0037.0002.0306] # LATIN CAPITAL LETTER I WITH BREVE 012E ; [.16B1.0020.0008.0049][.0000.0059.0002.0328] # LATIN CAPITAL LETTER I WITH OGONEK 0130 ; [.16B2.0020.0008.0130] # LATIN CAPITAL LETTER I WITH DOT ABOVE 0049 0307 ; [.16B2.0020.0008.0130] # LATIN CAPITAL LETTER I WITH DOT ABOVE 00F6 ; [.1757.0020.0002.00F6] # LATIN SMALL LETTER O WITH DIAERESIS 006F 0308 ; [.1757.0020.0002.00F6] # LATIN SMALL LETTER O WITH DIAERESIS 00D6 ; [.1757.0020.0008.00D6] # LATIN CAPITAL LETTER O WITH DIAERESIS 004F 0308 ; [.1757.0020.0008.00D6] # LATIN CAPITAL LETTER O WITH DIAERESIS 022B ; [.1757.0020.0002.00F6][.0000.005B.0002.0304] # LATIN SMALL LETTER O WITH DIAERESIS AND MACRON 022A ; [.1757.0020.0008.00D6][.0000.005B.0002.0304] # LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON 015F ; [.17D9.0020.0002.015F] # LATIN SMALL LETTER S WITH CEDILLA 0073 0327 ; [.17D9.0020.0002.015F] # LATIN SMALL LETTER S WITH CEDILLA 015E ; [.17D9.0020.0008.015E] # LATIN CAPITAL LETTER S WITH CEDILLA 0053 0327 ; [.17D9.0020.0008.015E] # LATIN CAPITAL LETTER S WITH CEDILLA 00FC ; [.181C.0020.0002.00FC] # LATIN SMALL LETTER U WITH DIAERESIS 0075 0308 ; [.181C.0020.0002.00FC] # LATIN SMALL LETTER U WITH DIAERESIS 00DC ; [.181C.0020.0008.00DC] # LATIN CAPITAL LETTER U WITH DIAERESIS 0055 0308 ; [.181C.0020.0008.00DC] # LATIN CAPITAL LETTER U WITH DIAERESIS 01DC ; [.181C.0020.0002.00FC][.0000.0035.0002.0300] # LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE 01DB ; [.181C.0020.0008.00DC][.0000.0035.0002.0300] # LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE 01D8 ; [.181C.0020.0002.00FC][.0000.0032.0002.0301] # LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE 01D7 ; [.181C.0020.0008.00DC][.0000.0032.0002.0301] # LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE 01D6 ; [.181C.0020.0002.00FC][.0000.005B.0002.0304] # LATIN SMALL LETTER U WITH DIAERESIS AND MACRON 01D5 ; [.181C.0020.0008.00DC][.0000.005B.0002.0304] # LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON 01DA ; [.181C.0020.0002.00FC][.0000.0041.0002.030C] # LATIN SMALL LETTER U WITH DIAERESIS AND CARON 01D9 ; [.181C.0020.0008.00DC][.0000.0041.0002.030C] # LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON 0071 ; [.16E5.0020.0002.0071] # LATIN SMALL LETTER Q 0051 ; [.16E5.0020.0008.0051] # LATIN CAPITAL LETTER Q 0078 ; [.169A.0020.0002.0078] # LATIN SMALL LETTER X 0058 ; [.169A.0020.0008.0058] # LATIN CAPITAL LETTER X ENTRY };
leighpauls/k2cro4
third_party/perl/perl/lib/Unicode/Collate/Locale/az.pl
Perl
bsd-3-clause
3,801
#!/usr/bin/perl -w my $emp_line_cnt = 0; my %result; my $namespace_filter = @ARGV >= 1 ? $ARGV[0] : 0; while (<STDIN>) { my $line = $_; chomp($line); if ($line =~ /^$/) { $emp_line_cnt++; if ($emp_line_cnt == 2) { last; } } elsif ($emp_line_cnt == 1 && $line =~ /^ *([0-9.]+) +[^ ]+ +[^ ]+ +[^ ]+ +[^ ]+ +[^ ]+ +([^ ].+)$/) { my $percentage = 0.0 + $1; if ($percentage == 0) { next; } my $name = $2; my $namespace = 'none'; $name =~ s/const\s*$//; $name =~ s/\(([^()]++|(?R))\)//g; $name =~ s/<([^<>]++|(?R))>//g; $name =~ s/ *$//g; $name =~ s/^[^ ]* //g; if ($name =~ s/(.*):://) { $namespace = $1; $namespace =~ s/<.*$//; } $result{$namespace} = ($result{$namespace} or 0) + $percentage; if ($namespace_filter and ($namespace eq $namespace_filter)) { printf "%s\n", $line; } } } if (!$namespace_filter) { foreach my $key (keys(%result)) { printf "%2.2f %s\n", $result{$key}, $key; } }
sunfish-shogi/sunfish3
tools/analyze_prof.pl
Perl
mit
951
#!/usr/bin/perl -w use strict; use warnings; use Best qw[ YAML::XS YAML::Syck YAML ]; my $data = { a => 'b', c => [ qw(d e f) ], g => { h => 'i', j => [ qw(k l m) ], }, }; $data->{g}{n} = $data->{c}; sub ::Y { Dump(@_) } sub ::YY { require Carp; Carp::confess(::Y(@_)) } print ::Y($data); printf "YAML version: %s\n", Best->which('YAML::XS');
gaal/best
example/debug_dump.pl
Perl
mit
362
#-*-Mode:perl;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*- # ex: set ft=perl fenc=utf-8 sts=4 ts=4 sw=4 et nomod: # # MIT License # # Copyright (c) 2014-2017 Michael Truog <mjtruog at protonmail dot com> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # package CloudI::InvalidInputException; use strict; use warnings; use parent 'Erlang::Exception'; sub new { my $class = shift; return $class->SUPER::new('Invalid Input'); } 1;
CloudI/CloudI
src/api/perl/CloudI/InvalidInputException.pm
Perl
mit
1,470
package Response; use File::Basename; my $dirname = dirname(__FILE__); use lib "$dirname/Response"; my $path = "$dirname/Response/*.pm"; my @files = < $path >; foreach my $fullname (@files) { # TO LOG: system("echo \"**** $mod requiring $fullname\" >> log_module_Response"); require $fullname; } 1; __END__
open-ch/contagent
perl/Response.pm
Perl
mit
320
package Utils::Redis; use strict; use warnings; use Log::Log4perl (); use Redis (); # Utils::Redis - Redis wrapper module # # Author - Georgios Davaris # # This module acts like a wrapper to Redis.pm. # It is a dependency to Throttle.pm and Utils::Semaphore. # # The module implements the Redis blpop, del, get, getset, # incr, lpush and set commands. my $conn; sub connection() { return $conn if ($conn); $conn = Redis->new( 'reconnect' => 60, ); return $conn; } sub blpop($$;$) { my ($db, $key, $timeout) = @_; $timeout ||= 0; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless($key); $conn->select($db); $logger->trace("Blocking list call for key '$key'"); my $value = $conn->blpop($key, $timeout); $logger->trace("BLPOP returned:"); $logger->trace({ 'filter' => \&Data::Dumper::Dumper, 'value' => $value, }); return $value; } sub del($@) { my ($db, @keys) = @_; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless(scalar(@keys)); $conn->select($db); $logger->trace("Deleting keys"); $logger->trace({ 'filter' => \&Data::Dumper::Dumper, 'value' => \@keys }); foreach (@keys) { $conn->del($_); } return; } sub get($$) { my ($db, $key) = @_; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless($key); $conn->select($db); $logger->trace("GET key '$key'"); my $value = $conn->get($key); $logger->trace("Get value: $value") if ($value); return $value; } sub getset($$$) { my ($db, $key, $value) = @_; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless($key && $value); $conn->select($db); $logger->trace("GETSET on key '$key'"); my $old_value = $conn->getset($key, $value); if ($old_value) { $logger->trace("GetSet value: $old_value"); } else { $logger->trace("Key was undefined"); } return $old_value; } sub incr($$) { my ($db, $key) = @_; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless($key); $conn->select($db); $logger->trace("Incrementing key '$key'"); my $value = $conn->incr($key); $logger->trace("Value: $value"); return $value; } sub lpush($$@) { my ($db, $key, @values) = @_; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless($key); $conn->select($db); $logger->debug("Left Push on key '$key'"); $conn->lpush($key, @values); $logger->trace("LPUSH complete"); return; } sub set($$$) { my ($db, $key, $value) = @_; my $conn = connection(); my $logger = Log::Log4perl->get_logger(); return undef unless($key); $conn->select($db); $logger->trace("Setting key '$key' => $value"); return $conn->set($key, $value); } 1;
davarisg/distributed-throttle
lib/Utils/Redis.pm
Perl
mit
3,074
go:- nl,write('Enter list : '), read(L), sumlist(L,Sum), write('Sum : '), write(Sum). sumlist([],0). sumlist([X|T], Res) :- sumlist(T,R1), Res is X + R1.
jatin69/lab-codes
artificial-intelligence/practicals/q19.pl
Perl
mit
175
#!/usr/bin/perl -w =head1 DESCRIPTION =head1 SYNOPSIS =head1 AUTHOR Charles Tilford <podmail@biocode.fastmail.fm> //Subject __must__ include 'Perl' to escape mail filters// =head1 LICENSE Copyright 2014 Charles Tilford http://mit-license.org/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =cut my $isBeta; my $VERSION = ' $Id: mapLocReporter.pl,v 1.8 2014/01/02 15:50:27 tilfordc Exp $ '; use strict; use BMS::SnpTracker::MapLoc; use BMS::FriendlyGraph; use BMS::ArgumentParser; use BMS::SnpTracker::MapLoc::Reporter; use BMS::SnpTracker::MapLoc::PopulationFilter; use Math::Trig ':pi'; srand( time() ^ ($$ + ($$<<15)) ); my $pfile = ""; foreach my $try ('/tmp', '/scratch', $ENV{HOME}) { if ($try && -d $try) { $pfile = $try; last; } } if ($pfile) { my $user = $ENV{'REMOTE_USER'} || $ENV{'LDAP_USER'} || $ENV{'USER'} || $ENV{'HTTP_CN'} || $ENV{'LOGNAME'} || "DefaultUser"; $pfile .= sprintf("/MapLocPrefs-%s.param", $user); } my $args = BMS::ArgumentParser->new ( -nocgi => $ENV{HTTP_HOST} ? 0 : 1, -mode => 'auto', -minimize => 1, -splitfeat => 0, -noanonfeat => 1, -maxfeatlen => 20, -fastSort => 10000, # -noensembl => 85, -tallywin => 36, -tallymin => 1.5, -tallydec => 0, -assignmode => 'Query if possible', -build => 'GRCh37', -errormail => 'charles.tilford@bms.com', -slop => 5000, -nodbsnpundef => 1, -instance => 'maploc2', -minfreq => undef, -range => 500, -casesensitive => 0, -paramfile => [ $pfile, 'BMS::SnpTracker::MapLoc'], -paramalias => { asnmode => [qw(assgnmode assignmode)], clean => [qw(pure)], exononly => [qw(nointron)], explain => [qw(explainsql)], freq => [qw(minfreq impactfreq)], fullhtml => [qw(forcehtml)], htmltmp => [qw(htmltemp)], maxfeat => [qw(maxfeatlength maxfeatlen)], output => [qw(outfile)], vb => [qw(verbose)], forcebld => [qw(forcebuild)], showbench => [qw(bench dobench benchmark)], splitfeat => [qw(splitfeature)], pretty => [qw(ispretty)], query => [qw(id ids input snp snps poly polys loc location var variant rna rnas transcript transcripts gene genes locus loci pop population populations cell line lines cells cellline celllines footprint showrna showgene)], }, ); $args->xss_protect('all'); # These are arguments which can not be changed via GET or POST: my @protectedArgs = qw(cxurl toolurl errormail htmltmp favicon imagedir urlmap pgport pghost tiddlywiki); $args->default_only(@protectedArgs); $args->debug->skip_key( [qw(MAPLOC sequences PARENT)], 'global' ); my $nocgi = $args->val(qw(nocgi)); my $vb = $args->val('vb'); $vb = 1 if (!defined $vb && $nocgi); my $mode = &_stnd_mode($args->val(qw(mode))); my $buildReq = $args->val(qw(build)) || ""; my $forceBld = $args->val('forcebld') ? $buildReq : undef; my $limit = $args->val(qw(limit)) || 0; my $compact = $args->val(qw(compact)); my $explSQL = $args->val('explain') || 0; my $dumpSQL = $args->val(qw(dumpsql)) || $explSQL || 0; my $slop = $args->val(qw(slop)) || 0; my $range = $args->val(qw(range)); my $query = $args->rawval(qw(query)) || ""; my $splitAcc = $args->val(qw(splitacc)) || 0; my $exonOnly = $args->val(qw(exononly)) || 0; my $toolUrl = $args->val(qw(toolurl)) || "mapLocReporter.pl"; my $splitFeat = $args->val('splitfeat') || 0; my $noAnonFeat = $args->val(qw(noanonfeat)) ? 1 : 0; my $maxFeatLen = $args->val(qw(maxfeat)) || ""; my $clobber = $args->val(qw(clobber)); my $isPretty = $args->val('pretty'); my $mlInt = $args->val(qw(instance)); my $minFreq = $args->val('freq'); my $onlyHigh = $args->val(qw(highonly onlyhigh)); my $outFile = $args->val(qw(output)); my $howbad = $args->val(qw(howbad)) || 0; my $drawTab = $args->val(qw(drawtable showtable)) || 0; my $showBench = $args->val(qw(showbench)); my $assgnMode = $args->val('asnmode'); my $keepNull = 1; my $showRNA = $args->val(qw(showrna)) || ""; my $tallyAll = $args->val(qw(tallyall alltally)) || 0; my @ccParam = qw(customcolor customcolors custcol); my $custColor = $args->val(@ccParam) || ""; my $debug = $args->val(qw(debug)); my $cxDebug = $args->val(qw(cxdebug)); my $noEns = $args->val(qw(noens noensembl)) || 0; my $tallWin = $args->val(qw(tallywindow tallywin)) || 0; my $tallMin = !$tallWin ? 0 : $args->val(qw(tallyminimum tallymin)) || 0; my $tallDec = $args->val(qw(tallydecrease tallydec)) || 0; my $isCS = $args->val(qw(casesensitive)); my $noDbAlleles = $args->val(qw(nodballeles)); my $fh = *STDOUT; my $domName = $args->val(qw(showdomain)); my $htmlTmp = $args->val(qw(htmltmp)); my $fullHTML = $args->val('fullhtml') ? 1 : 0; my $clean = ($args->val('pure') || $mode eq 'Object Report' || $nocgi) ? 1 : 0; my $noHTML = 0; my $allowEns; my $allowEnsText = ""; my $toolUrlDir = $toolUrl; $toolUrlDir =~ s/\/?[^\/]+$//; # Category key aliases: my $catKeyMap = { w => 'w', weight => 'w', priority => 'w', imp => 'imp', impact => 'imp', freq => 'freq', minfreq => 'freq', nullok => 'nullok', oknull => 'nullok', nofilter => 'nofilter', showall => 'nofilter', track => 'track', ignore => 'ignore', mask => 'ignore', }; if (my $aeReq = $args->val(qw(allowensembl allowens))) { my @reqs = ref($aeReq) ? @{$aeReq} : ($aeReq); my @found; foreach my $req (@reqs) { foreach my $line (split(/[\n\r]+/, lc($req || ""))) { $line =~ s/_/ /g; $line =~ s/\s+/ /; $line =~ s/^ //; $line =~ s/ $//; push @found, $line if ($line); } } if ($#found != -1) { $allowEns = { map { $_ => 1 } @found }; $allowEnsText = join("\n", @found); } } my $hidePop; # my $mltest = &maploc(); die join(" + ", $mltest->impact_list()); my $urlMap; $args->url_callback( sub { my $path = shift; if ($path =~ /^\/stf\/(.+)/) { return "/$1"; } elsif ($path =~ /^\/home\/(.+)\/public_html\/(.+)/) { return "/~$1/$2"; } elsif ($path =~ /^\/home\/(tilfordc\/people\/.+)/) { return "http://bioinformatics.bms.com/~$1"; } if ($path =~ /^\/stf(.+)/) { return $1; } return undef; }); my $format = &_stnd_format( $args->val(qw(mode)) ); if (!$format && $outFile && $outFile ne 'STDERR' && $outFile =~ /\.([^\.]+)$/) { # Determine format from output suffix $format = &_stnd_format( $1 ); } $format ||= $nocgi ? 'Text' : 'HTML'; if ($format =~ /^(CanvasXpress)$/) { $noHTML = 1; } if ($outFile) { if ($outFile eq 'STDERR') { $fh = *STDERR; $outFile = ""; } elsif ($format eq 'Excel') { # Handle this with ExcelHelper } elsif (open(OUTPUT, ">$outFile")) { $fh = *OUTPUT; } else { $args->death("Failed to write output", $outFile, $!); } } my $rejFile; if ($rejFile = $args->val(qw(rejectfile))) { if ($rejFile eq '1') { if ($outFile) { $rejFile = $outFile . "-Reject.tsv"; } else { $rejFile = "Rejected_Locations.tsv"; } } if (open( REJ, ">$rejFile")) { print REJ "# Rejection details\n"; close REJ; } else { $args->err("Failed to clear reject file", $rejFile, $!); } } my ($categorySets, %excel, $twHash, %mergedCategories); my @catParents = ('Polymorphism', 'Mutation'); my $uncatCat = "Uncategorized"; my $usedMinFreq = $minFreq; my $outFH = *STDOUT; my $rv = { errors => {}, }; my ($maploc, $sortFields, $tmpPrfx, %tmpFiles, $ad, %popcache, %stuff, $srpt, %tally, %userQueries, $impAliases, %filteredObjects, %filterCache ); my ($bulkPopCat); my $survivingMafData = {}; my $popFilterObj = {}; my $bulkFrequencies = {}; my $cachedPopulationFilter = {}; my $bulkImpFilter = {}; my $popInfo = {}; # Relates category filter native keys to human readable information: # [Human label, Tiddlywiki key, UI column order, reporting column order] my $cfColDat = { cat => ['Variant Source', 'VariantSource', 1, 2, "A category of variant"], freq => ['MAF', 'MinimumMAF', 5, 4, "Minimum allowed minor allele frequency"], imp => ['Impact Filter', 'ImpactFilter', 7, 0, "Required or prohibited ('!') impact codes"], nullok => ['NOK', 'NullOk', 6, 5, "If variants with no frequency data are allowed"], track => ['Track', 'VariantTrack', 3, 3, "Graphical track to place variants in"], w => ['Priority', 'VariantPriority', 4, 1, "How filters in this category 'compete' with others"], keep => ['Required Impact', 'RequiredImpact', 0, 6, "Only variants with these codes will be shown"], toss => ['Forbidden Impact', 'ForbiddenImpact', 0, 7, "Variants with these codes will be excluded"], nofilter => ['No Filters', 'NoFilter', 2, 0, "Force all variants in this category to be displayed"], }; my $htmlEnv = $nocgi ? 0 : $clean ? 0 : 1; my $mime = 'plain'; if ($mode eq 'Object Report') { $mime = 'plain'; } elsif ($format =~ /^(HTML|CanvasXpress|Excel|Network)$/) { $mime = 'html'; } if ($nocgi) { $args->shell_colors(); $mime = ""; } else { if ($mime) { $args->set_mime( -mime => $mime ); if ($mime eq 'html' || $fullHTML || $outFile) { $htmlEnv = 1; } else { $htmlEnv = 0; } } if ($format eq 'JSON') { $SIG{__WARN__} = sub { print STDERR join("\n", @_) }; } if ($mime eq 'plain') { $clean ||= 1; $args->manage_callback('FormatCallback', sub { my $self = shift; return shift; }, 'isGlobal'); } } # print "$mode = $format [$mime]\n"; &HTML_START(*STDOUT); # my $m = &maploc(); print "<p>".join(' ', map { $m->impact_html_token($_) } qw(DEL FRM STP NON SYN INT SP3 SP5 UT3 UT5 NCR UNK))."</p>"; if ($args->val(qw(setdefault))) { if (open(PFILE, ">$pfile")) { &_category_settings(); map { $args->blockquote($_, 1) } qw(defaultfilter customcolors); print PFILE $args->to_text ( -ignore => [qw(pause nocgi setdefault cxurl), qw(paramfile valuefile PARAMFILE_ERR), qw(gene genes rna rnas footprint), qw(format), qw(snp var snps poly polys) ]); close PFILE; chmod(0666, $pfile); $args->msg("Your defaults have been set and will be used to set up future analyses.","You may now close this window, or <a href='$toolUrl'>start a new analysis</a>."); &HTML_END(*STDOUT); exit; } else { $args->err("Failed to create parameter file", $pfile, $!); } } my $doPerma = &process(); &extra(); &HTML_PERMALINK() if ($doPerma); &HTML_FORM(); &HTML_END(*STDOUT); if ($outFile) { close OUTPUT unless ($format eq 'Excel'); $args->msg("[OUT]", "Output written to file", $outFile); } sub _stnd_mode { my $req = lc(shift || ""); if (!$req || $req =~ /auto/) { return "Automatic"; } elsif ($req =~ /obj.*report/) { return "Object Report"; } elsif ($req =~ /(gene|loc)/) { if ($req =~ /(samp|pat)/) { return "Locus-Sample"; } else { return "Locus"; } } elsif ($req =~ /(rna|trans)/) { return "RNA"; } elsif ($req =~ /(geno)/) { return "Genome"; } elsif ($req =~ /(report)/) { return "Report"; } elsif ($req =~ /(coord)/) { return "Coordinates"; } elsif ($req =~ /(foobar)/) { } $args->msg("[?]","Unknown report mode request '$req'"); return ""; } sub _stnd_format { my $req = lc(shift || ""); return "" unless ($req && $req !~ /auto/); if ($req =~ /(htm|browse)/) { return 'HTML'; } elsif ($req =~ /te?xt/) { return 'Text'; } elsif ($req =~ /(net|graph)/) { return 'Network'; } elsif ($req =~ /(can|xpr|cx)/) { return 'CanvasXpress'; } elsif ($req =~ /(xls|excel|sheet)/) { return 'Excel'; } elsif ($req =~ /(debug|dump)/) { return 'Debug'; } elsif ($req =~ /(json)/) { return 'JSON'; } elsif ($req =~ /(tsv|tab)/) { return 'TSV'; } $args->msg("[?]","Unknown format request '$req'"); return ""; } sub extra { my @efiles; foreach my $eType (sort keys %excel) { my $eh = $excel{$eType}; next unless ($eh); $eh->close(); my $url = $eh->url(); push @efiles, $url; if ($#efiles == 0) { # print $fh "<script>document.location = '".$args->esc_url_keep_slash($url)."'</script>\n"; my $eurl = $args->esc_url_keep_slash($url); if ($nocgi || !$eurl) { $args->msg("[FILE]","Spreadsheet report created", $eh->file_path()); } else { print $fh "<p>Spreadsheet can be found at <a href='$eurl'>$eurl</a></p>\n"; print $fh "<script>window.onload = function() { document.location = '$eurl' }</script>\n"; } } } if ($maploc && $showBench) { my $bm = $maploc->showbench ( -minfrac => $showBench == 1 ? 0.01 : $showBench, -class => 'tab', -shell => $mime ? 0 : 1, -html => ($nocgi || $mime eq 'plain') ? 0 : 1); if ($nocgi) { $args->msg("[BENCH]", $bm); } else { print $bm; #"<pre>$bm</pre>"; } } } sub rna_panel { my ($rna, $locs) = @_; my $ml = &maploc(); my $su = $ml->sequtils(); $ml->bench_start(); $rna->read(); print $fh &usage(); print $fh &locus_information( $rna ); my (@alns, %alnByAnchor); foreach my $aln ($rna->alignments_from_parameters ({ BUILD => $forceBld || 'best', HOWBAD => $howbad})) { next if (&_rna_filter($rna, $aln)); push @alns, $aln; push @{$alnByAnchor{ $aln->chr_acc_ids() || ""}}, $aln; } if ($#alns == -1) { print $fh "<p class='note'>No locations found on $buildReq</p>\n"; &panel_details(); $ml->bench_end(); return; } my %tracks; my @ex = $rna->cx_exon_part( -align => \@alns ); map { $_->{hideName} = 1 } @ex; push @{$tracks{Exons}}, @ex; my @feats = $rna->cx_local_feature_parts ( -maxfrac => $maxFeatLen, -featfilter => \&_feature_filter); &add_features( \@feats, \%tracks ); &collapse_features( \%tracks, $ml ); my $rnaAccId = $rna->accession_id; my $rnaAcc = $rna->accession; my $rid = $rna->pkey(); map { $_->anchor_to_genome() } @alns; while (my ($lid, $dat) = each %{$locs || {}}) { my ($loc, $imp, $pop, $oim, $cx, $track) = @{$dat}; my $locid = $loc->pkey(); my $locAnc = $loc->anchor_id(); if (my $isQry = $userQueries{$loc->handle()}) { if ($isQry < 0) { $filteredObjects{"variant"}{""}{"User Excluded"}++; next; } } # Locations are being collected in exon-centric coordinates. A # single variant might have multiple exon-centric # coordinates. This can happen when an RNA is placed several # times in a tandem repeat cluster. Generally such a case will # only happen if -howbad is not zero (ie, suboptimal locations # are allowed): # --- RnaCopy1 ------ RnaCopy2 ---------- RnaCopy3 --- # ^ VAR # In the above case, so long as HowBad is liberal enough there # will be three alignment objects for the RNA on the same # chromosome. The variation VAR is exonic or intronc to # RnaCopy1, but genomic to 2 and 3 my %dHash; my @locAlns = @{$alnByAnchor{ $locAnc } || []}; foreach my $aln (@locAlns) { my ($int, $isoA, $isoB) = $aln->intersect ( -hsp => $loc->hsp(), -isob => 1 ); if ($int) { my $iStr = $int->strand(); my $gind2 = $int->seqindex($rnaAccId) * 2; my @data; foreach my $coord ($int->coordinates()) { push @data, join('..', $coord->[$gind2], $coord->[$gind2+1] ); } if ($#data != -1) { my $dkey = join("\t", @data); push @{$dHash{$iStr}{$dkey}}, $aln; } } elsif ($isoB && $#{$isoB} == 0) { if (my $fdat = $isoB->[0][3]) { if (my $hsp = $fdat->{$rnaAccId}) { # We were able to slot the SNP in as non-exonic my $dkey = "$hsp->[1]..$hsp->[0]"; push @{$dHash{0}{$dkey}}, $aln; } } } } my @istrs = keys %dHash; if ($#istrs > 0) { # There are more than one strand represented. # Delete the zero strand (if there). Rational is to # present the variant just inside the query delete $dHash{0}; } my @dataLocs; while (my ($iStr, $keyH) = each %dHash) { while (my ($hspTxt, $alnArr) = each %{$keyH}) { my $hsps = [map {[ split(/\.\./, $_) ]} split(/\t/, $hspTxt)]; push @dataLocs, [ $iStr, $hsps, $alnArr ]; } } if ($#dataLocs == -1) { # &preprint($loc->to_one_line()); next; } elsif ($#dataLocs != 0) { warn "\n\nVariant assigned to multiple exon-centric locations:\n". join(" + ", map { join('/', @{$_->[1]}) } @dataLocs); } $cx ||= $loc->cx_genome_part ( -impdata => $imp, -popdata => $pop, -ovidata => $oim, -freq => $usedMinFreq, -tosspop => $hidePop, -rnafilter => \&_rna_filter, -keepnull => $keepNull, ); my $isAnchored; my @cxs; $track ||= &_pick_variant_track( $cx); next unless ($track); foreach my $dbit (@dataLocs) { my $lcx = $#dataLocs == 0 ? $cx : { %{$cx} }; my ($iStr, $hsps) = @{$dbit}; if ($#{$hsps} == 0 && $hsps->[0][0] == $hsps->[0][1] + 1) { $hsps = [[$hsps->[0][1],$hsps->[0][0]]]; $lcx->{insertion} = 1; } $isAnchored ||= $iStr; $lcx->{data} = $hsps; if ($iStr < 0) { &add_cx_revcom($lcx, $su); } else { &remove_cx_revcom($lcx); } &_variant_extras( $lcx ); push @cxs, $lcx; } if ($isAnchored) { map { &_tally_observations( $_ ) } @cxs; } # We should re-scale the variance metrics depending on the track # that we are displaying the data in. &add_cx_to_tracks( $cx, \%tracks, $track); } &_add_tally_track(\%tracks); my ($maxC) = sort { $b <=> $a } map { $_->{data}[-1][1] } @{$tracks{'Genome'} || []}; my ($cxHtml, $legend) = $maploc->cx_genome_panel_html ( -canvasid => 0, -width => 900, -pretty => $isPretty, -params => { setMin => -10, setMax => $maxC ? $maxC + 10 : undef, }, &_standard_confs(), -tracks => \%tracks ); print $fh $cxHtml; print $fh &panel_details( $legend ); } sub locus_information { my ($obj, $via) = @_; return "" if ($noHTML); my $acc = $obj->accession(); # &preprint($obj->to_text()); my $uqt = "<span class='small qrynear'>(near query)</span>"; if (my $uq = &_is_user_query($acc)) { if ($uq >= 1) { $uqt = "<span class='qry'>(query)</span>"; } elsif ($uq < 0) { $uqt = "<span class='small qryexc'>(excluded query)</span>"; } else { $uqt = "<span class='small qryrel'>(query related)</span>"; } } my @info; if (my $t = $obj->list_of_values('Symbol')) { push @info, "<span class='sym'>$t</span>"; } if (my $t = $obj->simple_value('Description')) { push @info, "<span class='desc'>$t</span>"; } if (my $ts = &taxa_span($obj->list_of_values('Taxa'))) { push @info, $ts; } push @info, "<i>found by $via</i>" if ($via && $acc !~ /^\Q$via\E/); push @info, "<a class='small' href='$toolUrl?query=$acc&mode=Gene'>Gene View</a>" if ($obj->can('obj_type') && $obj->obj_type() ne 'Gene'); push @info, "<a class='small' href='$toolUrl?query=$acc&mode=Genome'>Genomic View</a>"; my $ibits = ""; my $afterbit = ""; if ($clean) { $ibits = join(" | ", @info) || ""; } else { $ibits = join(" |\n", @info) || ""; } my $html = "<h3>$acc $uqt $ibits</h3>\n$afterbit"; return $html; } sub _is_user_query { my $req = uc(shift || ""); return 0 unless ($req); my @try = ($req); if ($req =~ /^(\S{5,})\.\d{1,2}$/) { # Presumptive versioned ID push @try, $1; } my $rv; foreach my $t (@try) { $rv = $userQueries{$t} if (!$rv || $rv < $userQueries{$t}); } return $rv || 0; } sub taxa_span { my $tax = shift; return "" unless ($tax); $maploc ||= &maploc(); my $col = $maploc->pastel_text_color($tax); return "<span class='small taxa' style='background-color: #444; color:$col'>[$tax]</span>"; } sub panel_details { my ($legend) = @_; return "" if ($noHTML); my $toss = &report_toss(); my @bits; push @bits, 'legend' if ($legend); push @bits, 'excluded data' if ($toss); my $details = "<br style='clear:left;' /><div class='toggle' onclick='toggle_hide(this)'>Click to see ".join(' and ', @bits)."</div><div class='hide' style=''>"; $details .= $legend || ""; $details .= $toss; $details .= "</div>\n"; return $details; } sub process { return 0 if (!$query || $query =~ /^[\s\n\r]*$/); &_category_settings(); my $ml = &maploc(); my $input = $ml->classify_requests( -request => $query, -build => $buildReq, -howbad => $howbad, -sensitive => $isCS, ); my $pickMode = $mode eq 'Automatic' ? "" : $mode; my @foundRows; my $kfTags = { '1' => ['&#10003;', 'text-align: center; color:green'], '-1' => ['&times;', 'text-align: center; color:red'], '0' => ['?', 'text-align: center; font-weight: bold; background-color:silver'], }; my $ifTxt = "<b>All alleles</b> will contribute to impact calculations, regardless of how rare they are."; if ($minFreq) { $ifTxt = "Alleles will only contribute to impact calculations if they represent <b>at least ".sprintf("%.1f%%", $minFreq * 100)."</b> of their assigned population"; } elsif ($usedMinFreq) { my @freqs = sort {$a <=> $b} values %{$usedMinFreq}; my ($minF, $maxF) = map { int(0.5 + 1000 * $_) / 10 } ($freqs[0], $freqs[-1]); my $rng = ($minF == $maxF) ? "is $minF%" : "ranges from $minF% to $maxF%"; $ifTxt = "Your <b>population-specific category filters</b> will be used to determine if an allele can contribute to an impact calculation. For your specified categories this $rng"; } my $doObj = $pickMode eq 'Object Report' ? 1 : 0; my $doCoord = $pickMode eq 'Coordinates' ? [] : 0; my $sparam = { }; unless ($doCoord || $doObj) { $sparam->{"Location Limit"} = ['QueryLimit', $limit ? "At most <b>$limit</b> locations will be recovered" : "<b>No limit</b>, all matching locations will be reported"]; $sparam->{"Impact Frequency"} = ['ImpactFrequency', $ifTxt]; } if ($howbad) { $sparam->{"Suboptimal RNAs"} = ['HowBad', "Suboptimal RNA-to-genome alignments will be considered within $howbad percentage points of the best genome alignment"]; } if ($noDbAlleles) { $sparam->{"No Database Alleles"} = ['UserOnly', "Request to only consider explicit alleles provided in query"]; } if ($allowEnsText) { $sparam ||= {}; $sparam->{"Ensembl RNAs"} = ['AllowedEnsembl', "Ensembl RNAs will be ignored unless their Status and BioType are one of:<br />".join("<br />", map { "<span class='smalllabel'>$_</span>" } split(/[\n\r]+/, $allowEnsText))]; } my @typeOrder = ('Gene', 'RNA', 'Protein', 'Range', 'Location', 'Population', 'Unknown'); my %typeCount = map { $_ => 0 } @typeOrder; my (%fetchHSP, @explicitLocation, %rnaConnections, %popReq); my @keyMethods = qw(acc handle pkey unversioned_accession each_gene_name each_rna_name); # $ml->prebranch($input); my $foundObj = 0; foreach my $type (@typeOrder) { my @handles = sort keys %{$input->{$type} || {}}; my $showType = $type; foreach my $hand (@handles) { my $dat = $input->{$type}{$hand}; unless ($dat) { warn "Hmmm... nothing in $type '$hand'"; next; } my ($via, $kf, $obj, $tagVal) = @{$dat}; if ($tagVal) { while (my ($tag, $vH) = each %{$tagVal}) { map { $obj->set_transient_tag($tag, $_) } keys %{$vH}; $obj->set_transient_tag("Useful Tag", $tag); } } # warn "$type : $hand = $via"; my $viaHtml = join("<br />", map { $args->esc_xml($_) } @{$via}); if ($type eq 'Unknown') { push @foundRows, [ $viaHtml, $kfTags->{'0'}, $showType, '', "<i>Unrecognized</i>" ]; next; } unless ($obj) { if (my $meth = $ml->can('get_'.lc($type))) { $obj = &{$meth}($ml, $hand); } else { $args->msg_once("Can not recover '$type' objects"); next; } } $foundObj++; if ($doObj) { print $obj->to_text(); next; } elsif ($doCoord) { push @{$doCoord}, $obj; next; } $obj->read(); # &preprint($obj->to_text()); # print "<pre>".$args->esc_xml($obj->to_xml())."</pre>" if ($obj->can('to_xml')); my ($xreq, $xfnd) = ("", ""); if ($obj->can('extra_alleles')) { if (my $xh = $obj->extra_alleles()) { $xreq .= "<br /><span class='xtra'>Alleles += ". join('/', sort keys %{$xh})."</span>"; } } if ($obj->is_transient()) { $xfnd .= "<br /><span class='transient'>User-defined transient</span>"; } my $desc = $obj->description(); if ($obj->can('taxa')) { if (my $ts = &taxa_span($obj->taxa())) { $desc .= " ". $ts; } } if ($type eq 'Location') { if ($obj->is_transient() && $obj->width() > 3 && !$obj->extra_alleles()) { # This is a custom 'wide' location, treat as range request $showType = 'Range'; } } if ($showType eq 'Range') { my $bld = $obj->build(); my $chr = $obj->chr(); my $targ = $fetchHSP{$kf || 1}{$bld}{$chr} ||= []; # Pass explicit zeroes in [2] and [3] to suppress adding # flanks push @{$targ}, [$obj->lft, $obj->rgt, 0, 0, [@{$via}]]; my $nm = sprintf("Chr%s [%s] %d bp", $chr, $bld, $obj->width); #&preprint($obj->to_text()); push @foundRows, [$viaHtml.$xreq, $nm, $showType, $kfTags->{$kf || '0'} || $kfTags->{'0'}, "$desc = User-supplied range request"]; $typeCount{$showType}++ if ($kf > 0); next; } push @foundRows, [$viaHtml.$xreq, $obj->name(), $obj->obj_type(), $kfTags->{$kf || '0'} || $kfTags->{'0'}, $desc]; if ($type eq 'Gene' || $type eq 'RNA') { # Register the related RNA names to this gene foreach my $name ($obj->each_rna_name()) { $rnaConnections{$name} = 1; if ($name =~ /(.+)\.\d{1,3}$/) { $rnaConnections{$1} = 1; } } } $kf ||= 1; $typeCount{$showType}++ if ($kf > 0); foreach my $meth ( @keyMethods ) { if (my $cb = $obj->can($meth)) { foreach my $key (&{$cb}($obj)) { next unless ($key); # warn $obj->name()." $meth = $key\n"; $key = uc($key); my @keys = ($key); if ($key =~ /(.+)\.\d{1,3}$/) { push @keys, $1; } foreach my $uk (@keys) { $userQueries{$uk} = $kf if (!$userQueries{$uk} || $userQueries{$uk} < $kf); } } } } # &preprint($obj->to_text()); if ($showType eq 'Location') { push @explicitLocation, $obj if ($kf > 0); } elsif ($showType eq 'Population') { my $v = ($kf < 0 ? '!' : '') . $obj->pkey(); push @{$popReq{ '-pops' }}, $v; } elsif ($obj->can('chr_hsps')) { $sparam ||= {}; $sparam->{"RNA Queries"} ||= ['ExonOnly', "Genome searches via RNAs will use <b>".($exonOnly ? "only exon" : "both exon and intron")."</b> regions"]; my $hdat = $obj->chr_hsps( -howbad => $howbad, -exononly => $exonOnly, -build => $forceBld || 'best'); # &prebranch($hdat); while (my ($build, $cH) = each %{$hdat}) { while (my ($chr, $hsps) = each %{$cH}) { my $targ = $fetchHSP{$kf}{$build}{$chr} ||= []; foreach my $hsp (@{$hsps}) { push @{$targ}, [$hsp->[0], $hsp->[1], undef, undef, [@{$via}]]; } # push @{$fetchHSP{$kf}{$build}{$chr}}, @{$hsps}; } } } elsif ($showType eq 'Gene') { } } } if ($doObj) { exit unless ($foundObj); return 0; } if ($doCoord) { my $num = $#{$doCoord} + 1; if ($num) { push @foundRows, [ sprintf("<i>%d entr%s", $num, $num == 1 ? 'y' : 'ies'), "", "User Request", '', "Collected for query coordinate reporting" ]; } } elsif ($#foundRows == -1) { # No queries passed return 0; } if (!$pickMode) { # Make an automatic assignment based on the kind of queries submitted $typeCount{"BioAccessions"} = $typeCount{Gene} + $typeCount{RNA} + $typeCount{Protein}; my $maxBio = 5; if ($typeCount{"BioAccessions"} > $maxBio) { $format = "Excel"; $sparam->{"Visualization Mode"} = ['AutoMode', "<b>Excel Report</b> - more than $maxBio biological accessions requested" ]; } elsif ($typeCount{Gene}) { $pickMode = 'Locus'; $sparam->{"Visualization Mode"} = ['AutoMode', "<b>$pickMode</b> - User request for locus identifiers" ]; } elsif ($typeCount{RNA} || $typeCount{RNA}) { $pickMode = 'RNA'; $sparam->{"Visualization Mode"} = ['AutoMode', "<b>$pickMode</b> - User request for transcript identifiers" ]; } elsif ($typeCount{Location}) { $pickMode = "Genome"; $sparam->{"Visualization Mode"} = ['AutoMode', "<b>$pickMode</b> - User request for polymorphism/mutation identifiers/positions" ]; } elsif ($typeCount{Range}) { $pickMode = "Genome"; $sparam->{"Visualization Mode"} = ['AutoMode', "<b>$pickMode</b> - User request for one or more genomic ranges" ]; } else { $pickMode = "Genome"; $format = "Excel"; $sparam->{"Visualization Mode"} = ['AutoMode', "<b>Excel Report</b> - User intent uncertain from query, and unsure how many discrete genomic locations will result" ]; } } my ($segments, %queryRanges); if (my $hspDat = $fetchHSP{'1'}) { # There are locations defined to keep my $flank = $maploc->default_loc_to_rna_distance(); my $expCount = 0; while (my ($build, $chrH) = each %{$hspDat}) { while (my ($chr, $hsps) = each %{$chrH}) { if ($flank) { foreach my $hsp (@{$hsps}) { # Store left/right flank for each HSP. We do this # so we can discard flank if an edge gets # subtracted unless (defined $hsp->[2]) { $hsp->[2] = $hsp->[3] = $flank; $expCount++; } } } my $keepHsp = $maploc->add_hsps( $hsps ); # $args->msg("[KEEP]", "$chr [$build]"); &pre_branch({in => $hsps, out => $keepHsp}); if (my $delHsp = $fetchHSP{'-1'}{$build}{$chr}) { push @{$queryRanges{'-1'}{$build}{$chr}}, @{$delHsp}; my $disc; ($keepHsp, $disc) = $maploc->subtract_hsps( $keepHsp, $delHsp ); if ($#{$disc} != -1) { push @{$queryRanges{'-2'}{$build}{$chr}}, @{$disc}; } # $args->msg("[TOSS]", "$chr [$build]"); &pre_branch({ toss => $delHsp, survive => $keepHsp}); next if ($#{$keepHsp} == -1); } $segments ||= {}; $segments->{$build}{$chr} = $keepHsp; push @{$queryRanges{'1'}{$build}{$chr}}, @{$keepHsp}; #print "$chr [$build]<br />"; &prebranch($keepHsp); } } $sparam->{"Expanded Search"} ||= ['RnaRange', "Genome searches are <b>".($expCount ? "expanded by ".$ml->comma_number($flank)." bp on each side for $expCount of your queries" : "exact" )."</b>"]; } if (!$pickMode || $pickMode eq 'Locus' || $pickMode eq 'RNA') { my @allRnas = keys %rnaConnections; my $noRnas = $#allRnas == -1 ? 1 : 0; my $amHtml = ""; if ($assgnMode =~ /all/i) { $assgnMode = "All"; $amHtml = "Locations will be assigned to all impacted RNAs"; } elsif ($assgnMode =~ /(query|qry)/i && $assgnMode =~ /(only)/i) { $assgnMode = "Query only"; $amHtml = "Locations will only be attached to <span class='qry'>query</span> RNAs, otherwise they will be ignored"; $amHtml .= ". <span class='warn'>CAUTION - this means no results will be shown, as no query RNAs/genes could be recognized</span>" if ($noRnas); } elsif (!$noRnas || ($assgnMode =~ /(query|qry)/i && $assgnMode =~ /(possible)/i)) { $assgnMode = "Query if possible"; $amHtml = "Locations will be attached <i>exclusively</i> to <span class='qry'>query</span> RNAs if available, otherwise will be attached to all impacted RNAs"; } else { $assgnMode = "All"; $amHtml = "Locations will be assigned to all impacted RNAs"; } $sparam->{"Location Assignment"} = ['LocationAssignment', "<b>$assgnMode</b> - $amHtml" ]; } $sparam->{"Genome Build"} ||= ['BuildToken', $forceBld ? "All results must be from genome build <b>$forceBld</b>" : $buildReq ? "Ambiguous queries (eg symbols) will be from genome build <b>$buildReq</b>, others will use the most recent build" : "Your searches will report hits on all encountered genome builds" ]; my @ps = sort keys %{$sparam || {}}; my $tw = &tw_hash(); my $infofh = $fullHTML ? $fh : *STDOUT; if ($clean && !$fullHTML) { # No details } elsif ($nocgi && !$fullHTML) { foreach my $param (@ps) { my ($twn, $desc) = @{$sparam->{$param}}; $desc =~ s/<[^>]+>/ /g; $desc =~ s/\s+/ /g; $desc =~ s/^ //; $desc =~ s/ $//; $args->msg("[-]", $param, $desc); } } elsif ($htmlEnv) { print $infofh "<table class='tab'>\n"; print $infofh "<tbody>\n"; print $infofh " <tr><th colspan='5' style='color:#390; text-align:left'>$tw->{UserQuery}User search terms</th></tr>\n"; print $infofh " <tr>".join("", map { "<th>$_</th>" }("Request", "Found in DB", "Type", "Keep?","Description"))."</tr>\n"; foreach my $fr (@foundRows) { print $infofh "<tr>"; foreach my $c (@{$fr}) { my $sty = ""; if (ref($c)) { ($c, $sty) = @{$c}; $sty = $sty ? " style='$sty'" : ""; } print $infofh "<td$sty>$c</td>"; } print $infofh "</tr>\n"; } if (my $errs = $input->{Error}) { print $infofh "<tr><th>Error</th><td colspan='4'>".join("<br />", map { $_->[0]} @{$errs})."</td></tr>\n"; } print $infofh " <tr><th colspan='5' style='color:#390; text-align:left'>Search Parameters</th></tr>\n"; print $infofh " <tr><td colspan='5'>"; unless ($#ps == -1) { print $infofh "<table><tbody>\n"; foreach my $param (@ps) { my ($twn, $desc) = @{$sparam->{$param}}; print $infofh " <tr><th style='text-align:right'>$param$tw->{$twn}</th><td>$desc</td></tr>\n"; } print $infofh " </tbody></table>\n"; } if (my $cs = &cat_settings_html('hide')) { print $infofh "<div class='toggle' onclick='toggle_hide(this)'>Click to show Category Filters</div>$cs" unless ($doCoord); } print $infofh "</td></tr>\n"; print $infofh "</tbody>\n"; print $infofh "</table>\n"; } if ($doCoord) { return &format_coordinates( $doCoord ); } # &prebranch($segments); my $lq = $maploc->location_query ( -segments => $segments, %popReq, -dumpsql => $dumpSQL, -limit => $limit, ); my $locids = $lq->{loc_id} || []; foreach my $expLoc (@explicitLocation) { if (my $pkey = $expLoc->pkey()) { push @{$locids}, $pkey; } } my $locNum = $#{$locids} + 1; #$#explicitLocation + 2; unless ($locNum || ($#explicitLocation + 1)) { $args->msg("No variant locations were found with your query"); return 1; } # $args->msg("[DEBUG]","Primary query: ".($#{$locids} + 1)." loci"); $locids = &filter_locations( $locids ); # $args->msg("[DEBUG]","Fast Filter: ".($#{$locids} + 1)." loci"); my $unkPid = $ml->_unknown_pop_id(); my (@locs, @reject, %done); # Now calculate the precise impact of each location. Previously, # locations inside exons were just treated as impact 'RNA' # Now we invest the time to decvonvolute to NON, SYN, UT3 etc # &prebranch($survivingMafData); foreach my $req (@explicitLocation, @{$locids}) { my $loc = $req; unless (ref($loc)) { # loc_id $loc = $ml->get_location($req); } next if ($done{$loc->handle()}++); # &preprint( "$req\n" . $loc->to_text() ); $loc->lock_alleles() if ($noDbAlleles); $loc->read(); my $hand = $loc->handle(); my $isQry = &_is_user_query($hand); if ($isQry < 0) { $filteredObjects{"variant"}{""}{"User Excluded"}++; next; } my $imp = $loc->impact( -freq => $usedMinFreq, -keepnull => $keepNull, -tosspop => $hidePop, -rnafilter => \&_rna_filter, ); my $pop = $loc->each_population_id( -tosspop => $hidePop,); my $oim = $loc->overall_impact( -impdata => $imp, -tosspop => $hidePop, -popdata => $pop ); # Detailed impact filtering is a bit of a problem. Consider a # SNP location with two populations, each having two alleles: # Pop1: AAT/AAC = Asn/Asn # Pop2: AAA/AAG = Lys/Lys # Considered from only one of either populations, the location # is synonymous. However, considering all alleles from both # populations, the location is non-synonymous. Another case: # Pop3: TGT/TGC = Cys/Cys # Pop4: TGA/TGG = * /Trp # Location::impact() will calculate an 'overall' worst-case # impact, as well as overall impacts for each overlapping # RNA. However, it will not calculate per-population impacts, # which could be different from the overall impact, or could # be different between different populations. # I feel that more nuanced population-specific impact # filtration should be put in place. However, it is not clear # how to do so. If the user is excluding SYN variants, then # the first example would be filtered out by a per-population # filter, yet the location as a whole is non-synonymous and # probably of interest to them. Using a global calculation # that considers all available alleles should result in fewer # populations being excluded, presuming that the user is # interested in "impactful" variants. # So for the moment the global impact will be used. HOWEVER, # per-population filters will be applied, so if Pop1 allowed # SYN variants, but Pop2 does not, then Pop2 would be # excluded. my $tok = $oim->{impToken} || "UNK"; my ($smds, $refilter) = @{$survivingMafData->{$hand} || [[]]}; my %impResults; # my $mafs = $loc->population_maf(); &prebranch($mafs); if ($#{$smds} != -1) { # We have data that have passed the first filter # Collate it and refilter, if neccesary foreach my $smd (@{$smds}) { my ($pid, $maf, $pf) = @{$smd}; my $r = ($refilter && $pf) ? $pf->test_impact( $tok ) : ""; $pf ||= &_user_request_filter(); my $w = $pf->weight(); push @{$impResults{$w}}, [$r, $pf, $pid, $maf]; # args->msg_once("$tok != ".$pf->name()) if ($r); } } else { # If we are here it should mean a manually provided location # Keep everything my $pf = &_user_request_filter(); my $mafs = $loc->population_maf(); my @ir; while (my ($pid, $maf) = each %{$mafs}) { push @ir, ["", $pf, $pid, $maf]; } if ($#ir == -1) { push @ir, ["", $pf, $ml->_temporary_pop_id(), -1]; } $impResults{0} = \@ir; } # Find the highest-weighted category(ies) my ($topW) = sort { $b <=> $a } keys %impResults; my %topResults; foreach my $smd (@{$impResults{$topW || 0} || []}) { my $pf = $smd->[1]; push @{$topResults{$smd->[0]}{$pf->name()}}, $smd; } if ($isQry) { # User request, always keep } elsif (!exists $topResults{""}) { # None of the top-weighted populations passed the more precise # impact test. Reject the location &_reject_location( \%topResults, \@reject, $hand ); next; } # The location is "fully surviving" # We now need to find what tracks it should be assigned to, and # what MAF to use for each track my ($okPids, $track); # &prebranch(\%topResults); while (my ($w, $res) = each %impResults) { # Use 1 for the top-weighted categories, -1 for others my $tok = ($w == $topW) ? 1 : -1; foreach my $rd (@{$res}) { next if ($rd->[0]); # Passed the filter, make note of it: $okPids ||= {}; my $pid = $rd->[2]; $okPids->{$pid} = $tok; if ($tok > 0) { # This is a top-weighted category, note which # track(s) to record it into, and keep the best MAF my $maf = $rd->[3]; my @cats = $rd->[1]->categories(); @cats = ('Uncategorized') if ($#cats == -1); $track ||= {}; foreach my $cat (@cats) { $track->{$cat} = $maf if (!defined $track->{$cat} || $track->{$cat} < $maf); } } } } $track ||= { "Unknown" => -1 }; unless ($isQry) { my %okTrk = %{$track}; if (exists $okTrk{Discard}) { # A discard request will cause the location to always be excluded &_reject_location( { "User request to filter out category" => {"Discard Filter" => []}}, \@reject, $hand ); next; } if (exists $okTrk{Ignore}) { # An ignored location can be kept so long as at least one other # track is available delete $okTrk{Ignore}; my @remain = keys %okTrk; if ($#remain == -1) { &_reject_location({ "Passed, but only in ignored categories" => {"Ignore Filter" => []}}, \@reject, $hand); next; } } } my @trks = keys %{$track}; # Calculate the CX object here for filtering my $cx = $loc->cx_genome_part ( -impdata => $imp, -popdata => $pop, -ovidata => $oim, -freq => $usedMinFreq, -tosspop => $hidePop, #-revcom => $iStr < 0 ? 1 : 0, -rnafilter => \&_rna_filter, -keepnull => $keepNull, ); $cx->{okPids} = $okPids if ($okPids); # $track ||= &_pick_variant_track( $cx); #unless ($track) { # if ($userQueries{$hand}) { # $track = ["User Variant"]; # } else { # next; # } #} push @locs, [$loc, $imp, $pop, $oim, $cx, $track]; } # $args->msg("[DEBUG]","Careful Filter: ".($#locs + 1)." locations"); &_note_rejections( \@reject, "Precise impact filters" ); if ($format eq 'Network') { return &format_network( \@locs ); } elsif ($format eq 'Text') { return &format_text( \@locs ); } elsif ($format eq 'TSV') { return &format_tsv( \@locs ); } elsif ($format eq 'Excel') { return &format_excel( \@locs ); } # We are going to be generating a graphical display print $fh &usage(); # Genome is easy unless ($pickMode =~ /(Locus|RNA)/i) { return &show_on_genome( \@locs, \%queryRanges ); } # Expand names / IDs in the RNA connections hash #foreach my $k (keys %rnaConnections) { # my $nk; # if ($k =~ /^(\d+)$/) { # $nk = $maploc->pkey_to_text($k); # } else { # $nk = $maploc->text_to_pkey($k); # } # $rnaConnections{$nk} ||= $rnaConnections{$k} if ($nk); #} # Otherwise, we need to figure out the objects that are going to # hold the locations my (%useRna, %orphan); foreach my $dat (@locs) { my ($loc, $imp) = @{$dat}; my $pkey = $loc->pkey(); my @found; # See first if impact can lead us to the right RNAs my @checkIds = keys %{$imp}; # If no impacts are reported, consider all the RNAs under the location: @checkIds = $loc->each_rna_id() if ($#checkIds == -1); if ($#checkIds == -1) { # No nearby RNAs my $targ = $orphan{$pkey} ||= { loc => $loc }; $targ->{reason}{"No nearby RNAs"}++; next; } my @useIds; if ($assgnMode eq 'All') { # Locations are assigned to every RNA @useIds = @checkIds; } else { # If any of the IDs are associated with a query, use them foreach my $id (@checkIds) { my ($acc) = $maploc->rna_ids_to_cached_accessions( $id ); # $args->msg_once("FOO acc_id=$id : $acc"); next unless ($acc); if ($rnaConnections{$acc}) { push @useIds, $id; } elsif ($acc =~ /(.+)\.\d{1,3}$/) { push @useIds, $id if ($rnaConnections{$1}); } } if ($#useIds == -1) { # Could not relate to a queried gene / RNA if ($assgnMode eq 'Query if possible' || &_is_user_query($pkey)) { # Either it is ok to use every RNA, or the variant # is itself a query @useIds = @checkIds; } else { my $targ = $orphan{$pkey} ||= { loc => $loc }; $targ->{reason}{"Not associated with a query"}++; } } } map { $useRna{$_}{$pkey} ||= $dat } @useIds; } if ($pickMode eq 'Locus') { # We need to convert the RNAs to genes my (%useGenes, %missing, %mapped); while (my ($rid, $pH) = each %useRna) { my ($racc) = $maploc->rna_ids_to_cached_accessions( $rid ); my $uq = $userQueries{$racc} || 0; my @gaccs = $maploc->rna_accession_to_gene_accessions( $racc ); while (my ($pkey, $dat) = each %{$pH}) { if ($#gaccs == -1) { $missing{$pkey} ||= $dat; } else { $mapped{$pkey}++; foreach my $gacc (@gaccs) { $useGenes{$gacc}{$pkey} ||= $dat; $userQueries{$gacc} = $uq if (! defined $userQueries{$gacc} || $userQueries{$gacc} < $uq); } } } } while (my ($pkey, $dat) = each %missing) { next if ($mapped{$pkey}); my $loc = $dat->[0]; my $targ = $orphan{$loc->pkey()} ||= { loc => $loc }; $targ->{reason}{"Unable to map over to Gene"}++; } my @gaccs = &sort_accessions( keys %useGenes ); foreach my $gacc (@gaccs) { my $gene = $maploc->get_gene($gacc); &gene_panel( $gene, $useGenes{$gacc} ); } } else { my @rids = &sort_accessions( keys %useRna ); foreach my $rid (@rids) { my $rna = $maploc->get_rna_by_id($rid); &rna_panel( $rna, $useRna{$rid} ); } # &show_on_genome( \@locs, \%queryRanges ); } # &prebranch(\%userQueries); return 1 if ($noHTML); my @orphs = values %orphan; my $oNum = $#orphs + 1; if ($oNum) { print $fh "<i>$oNum location".($oNum == 1 ? '' : 's')." could not be placed on your requested framework. </i><span class='toggle' onclick='toggle_hide(this)'>Show Orphan Locations</span><pre class='hide'>"; foreach my $targ (@orphs) { print $fh $targ->{loc}->to_one_line()." (".join(', ', sort keys %{$targ->{reason}}).")\n"; } print "</pre>\n"; } return 1; } sub sort_accessions { my @sorter; foreach my $acc (@_) { next unless ($acc); push @sorter, [$acc, $userQueries{$acc} || 0, $acc =~ /^ENS/ ? 0 : 1, uc($acc) ]; } return map { $_->[0] } sort { $b->[1] <=> $a->[1] || $b->[2] <=> $a->[2] || $a cmp $b } @sorter; } sub gene_panel { my ($gene, $locs) = @_; my $ml = &maploc(); my $su = $ml->sequtils(); $ml->bench_start(); $gene->read(); print $fh &usage(); print $fh &locus_information( $gene ); my @ehsps = $gene->exon_footprints( -build => $forceBld ); if ($#ehsps == -1) { if ($noHTML) { } else { print $fh "<p class='note'>No locations found". ($buildReq ? " on $buildReq" : "")."</p>\n"; $ml->bench_end(); } return; } if ($buildReq && $#ehsps != 0) { my $num = $#ehsps + 1; print $fh "<p class='note'>$num locations found on $buildReq</p>\n" unless ($noHTML); } my $gid = $gene->pkey(); foreach my $aln (@ehsps) { my $chr = $aln->chr_name(); my $build = $aln->chr_build(); my $str = $aln->str(); my ($cs, $ce) = $aln->chr_start_end(); my $nstr = $str > 0 ? "+$str" : $str || '?'; my @lidList = keys %{$locs || {}}; unless ($noHTML) { print $fh "<h4>$chr.$build"; print $fh " <span class='coord'>$cs..$ce</span>"; print $fh " <span class='str'>[$nstr]</span>"; my $lnum = $#lidList + 1; my $ltxt = sprintf("%d variant%s", $lnum, $lnum == 1 ? '' : 's'); print $fh " <span class='count'>$ltxt</span>"; print $fh "</h4>\n"; } my $tracks = $gene->cx_exon_parts( -aln => $aln ); foreach my $lid (@lidList) { if (my $isQry = $userQueries{$lid}) { if ($isQry < 0) { $filteredObjects{"variant"}{""}{"User Excluded"}++; next; } } my $dat = $locs->{$lid}; my ($loc, $imp, $pop, $oim, $cx, $track) = @{$dat}; my ($int, $isoA, $isoB) = $aln->intersect ( -hsp => $loc->hsp(), -isob => 1 ); my $iStr = 1; my @data; my $isAnchored; if ($int) { $iStr = $int->strand(); my $gind2 = $int->seqindex($gid) * 2; foreach my $coord ($int->coordinates()) { push @data, [ $coord->[$gind2], $coord->[$gind2+1] ]; } $isAnchored ||= $iStr; } elsif ($isoB && $#{$isoB} == 0) { if (my $fdat = $isoB->[0][3]) { if (my $hsp = $fdat->{$gid}) { # We were able to slot the SNP in as non-exonic push @data, $hsp; } } } if ($#data == -1) { next; } $cx ||= $loc->cx_genome_part ( -impdata => $imp, -popdata => $pop, -ovidata => $oim, -freq => $usedMinFreq, -tosspop => $hidePop, # -revcom => $iStr < 0 ? 1 : 0, -rnafilter => \&_rna_filter, -keepnull => $keepNull, ); $track ||= &_pick_variant_track( $cx); next unless ($track); if ($#data == 0 && $data[0][0] == $data[0][1] + 1) { @data = ([$data[0][1],$data[0][0]]); $cx->{insertion} = 1; } $cx->{data} = \@data; if ($iStr < 0) { &add_cx_revcom($cx, $su); } else { &remove_cx_revcom($cx); } &_variant_extras( $cx ); &_tally_observations( $cx ) if ($isAnchored); &add_cx_to_tracks( $cx, $tracks, $track); } &_add_tally_track($tracks); my ($maxC) = sort { $b <=> $a } map { $_->{data}[-1][1] } @{$tracks->{'Genome'} || []}; my ($cxHtml, $legend) = $maploc->cx_genome_panel_html ( -canvasid => 0, -width => 900, -pretty => $isPretty, -params => { setMin => -10, setMax => $maxC ? $maxC + 10 : undef, }, &_standard_confs(), -tracks => $tracks ); print $fh $cxHtml; print $fh &panel_details( $legend ); } } sub add_cx_to_tracks { my ($cx, $tracks, $trackMaf) = @_; while (my ($tname, $maf) = each %{$trackMaf}) { # We need to make a local copy of each CX object # This is because different tracks will be representing # different populations, which will have different MAFs my %lcx = %{$cx}; if (defined $maf) { $maf = 0 if ($maf < 0); my $sh = int(0.5 + 100 * $maf) / 100; $sh = 0.1 if ($sh < 0.1); $lcx{scaleHeight} = $sh; $lcx{MAF} = int(0.5 + 1000 * $maf) / 10; } push @{$tracks->{$tname}}, \%lcx; } } sub add_cx_revcom { my ($cx, $su) = @_; my $aArr = $cx->{alleles}; return undef unless ($aArr); return $cx->{revcom} if ($cx->{revcom}); my $rcH = $cx->{revcom} = {}; foreach my $al (@{$aArr->[0] || []}) { my $rc = $su->revcom($al); $rcH->{$al} = $rc; } $cx->{alleles} = [[ sort values %{$rcH} ]]; return $rcH; } sub remove_cx_revcom { my ($cx) = @_; my $rcH = $cx->{revcom}; return unless ($rcH); delete $cx->{revcom}; $cx->{alleles} = [[ keys %{$rcH} ]]; return $rcH; } sub show_on_genome { my ($locData, $queryRanges) = @_; my $maploc = &maploc(); my $flank = $maploc->default_loc_to_rna_distance(); my $allVers = $args->val(qw(allvers allversions)); my %locByChr; foreach my $ldat (@{$locData}) { my $loc = $ldat->[0]; push @{$locByChr{$loc->build}{$loc->chr}}, $ldat; } print $fh &ref_diff_key(); my $wsUrl = $maploc->web_support_url(); foreach my $build (sort keys %locByChr) { &html_xtra("<h5>Genome Build $build</h5>\n"); my @allC = sort keys %{$locByChr{$build}}; for my $ac (0..$#allC) { my $chr = $allC[$ac]; $maploc->bench_start('Render CX Panel'); my @locs = @{$locByChr{$build}{$chr}}; if ($#locs == -1) { $args->msg("[CODE ERROR]", "Weird - no locations for $chr"); next; } my $chrAnc = $locs[0][0]->location_accession; # Tabulate all the observed populations my (%pidH, @cols, %tracks ); my @locRange = map { [ $_->[0]->lft - $flank, $_->[0]->rgt + $flank ] } @locs; my $chrID = $locs[0][0]->loc_acc_id(); my ($keptLoc, $minC, $maxC) = (0, 10 ** 15, -10); for my $li (0..$#locs) { my ($loc, $imp, $pop, $oim, $cx, $track) = @{$locs[$li]}; $cx ||= $loc->cx_genome_part ( -impdata => $imp, -popdata => $pop, -ovidata => $oim, -tosspop => $hidePop, -freq => $usedMinFreq, -rnafilter => \&_rna_filter, -keepnull => $keepNull, ); $track ||= &_pick_variant_track( $cx); unless ($track) { $filteredObjects{"variant"}{"Failed to find track"}{""}++; } &_variant_extras( $cx ); my $hand = $loc->handle(); if (my $isQry = $userQueries{$hand}) { if ($isQry < 0) { $filteredObjects{"variant"}{""}{"User Excluded"}++; next; } } &_tally_observations( $cx ); &add_cx_to_tracks( $cx, \%tracks, $track); $keptLoc++; my ($s, $e) = ($loc->start, $loc->end); $minC = $s if ($minC > $s); $maxC = $e if ($maxC < $e); } if ($queryRanges) { while (my ($kf, $bH) = each %{$queryRanges}) { next unless (exists $bH->{$build} && $bH->{$build}); my $cH = $bH->{$build}; next unless (exists $cH->{$chr} && $cH->{$chr}); if (my $cxq = $maploc->cx_query_part ( -hsps => $cH->{$chr}, -flag => $kf )) { push @{$tracks{Query}}, @{$cxq}; push @locRange, map { [$_->[0], $_->[1] ] } @{$cH->{$chr}}; } } } if (1) { # Instead of using isolated ranges, use the whole span @locRange = sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] } @locRange; @locRange = ([ $locRange[0][0], $locRange[-1][1] ]); } my $rnaRows = $maploc->overlapping_rnas_for_flanks ( $chrID, \@locRange); my %rnas; foreach my $rr (@{$rnaRows}) { my ($alnId, $seqId, $sc, $ptl, $ptr, $rId) = @{$rr}; my $rna = $maploc->get_rna_by_id( $rId ); my $accV = $rna->acc(); my $accU = $accV; my $vers = 0; if (!$allVers && $accV =~ /(.+)\.([^\.]+)$/) { ($accU, $vers) = ($1, $2); } push @{$rnas{$accU}{$vers}}, [ $rna, $alnId ]; } # &prebranch(\%rnas); while (my ($accU, $vH) = each %rnas) { my ($vers) = sort { $b <=> $a } keys %{$vH}; my $rns = $accU =~ /ENS/ ? 'Ensembl' : 'RefSeq'; foreach my $dat (@{$rnas{$accU}{$vers}}) { my ($rna, $alnId) = @{$dat}; my $aln = $maploc->get_alignment( $alnId ); # next if ($aln->howbad > $howbad); next if (&_rna_filter($rna, $aln)); $rna->read(); foreach my $cx ($rna->cx_genome_part($alnId)) { # next if ($cx->{anchor} ne $chrAnc); $cx->{hideName} = 1 if ($rns eq 'Ensembl' && !$cx->{tags}{"Official Symbol"}); # &prebranch($cx); push @{$tracks{$rns}}, $cx; } my @feats = $rna->cx_feature_parts ( -aln => $aln, -maxfrac => $maxFeatLen); &add_features( \@feats, \%tracks ); } } foreach my $rns ('RefSeq', 'Ensembl') { next unless (exists $tracks{$rns}); my @sorter; foreach my $dat (@{$tracks{$rns}}) { my $sk = sprintf("%06.2f", $dat->{howbad} || 0); if (my $lab = $dat->{label}) { if ($lab =~ /(.+) \([^\d]+(\d+)/) { $sk .= sprintf("%s ZZZZZ %09d", $1, $2); } else { $sk .= $lab; } } else { my $id = $dat->{id}; if ($id =~ /^[^\d]+(\d+)/) { $sk .= sprintf("ZZZZZ %09d", $1); } else { $sk .= "ZZZZZ $id"; } } push @sorter, [ uc($sk), $dat ]; } $tracks{$rns} = [ map { $_->[1] } sort { $a->[0] cmp $b->[0] } @sorter ]; } &collapse_features( \%tracks, $maploc ); &_add_tally_track(\%tracks); my $hBar = "<h3>Chromosome $chr $chrAnc"; $hBar .= sprintf( " <span class='mini'>%d locations</span>", $keptLoc); $hBar .= "</h3>\n"; &html_xtra($hBar); my ($cxHtml, $legend) = $maploc->cx_genome_panel_html ( -canvasid => $noHTML ? undef : 0, -width => 900, -pretty => $isPretty, -params => { setMin => $minC - 10, setMax => $maxC + 10, }, &_standard_confs(), -tracks => \%tracks ); print $fh $cxHtml; print $fh &panel_details( $legend ); my $brk = $clean ? "" : $ac == $#allC ? "<a target='_blank' title='Powered by CanvasXpress' href='http://canvasxpress.org'><img src='$wsUrl/images/CXbanner10pxTrans.png' /></a>" : "&hearts;"; print $fh "<h4 style='text-align:center; clear:both'>$brk</h4>\n"; $maploc->bench_end('Render CX Panel'); } } } sub html_xtra { return unless ($htmlEnv); print $fh join("\n", @_); } sub _find_rnas { my $vv = shift; my $acc = $vv; my $what = "unversioned"; my @rnas; my $ml = &maploc(); if ($acc =~ /(.+)\.(\d+)$/) { # Versioned accesion $what = "versioned"; @rnas = $ml->get_rnas( $acc ); } else { # Find best version currently known my @accIds = $ml->text_search("$acc.%" , 'wc'); my %vers; foreach my $va (@accIds) { if ($va =~ /^\Q$acc\E\.(\d+)$/) { $vers{$1} = $va; } } # Take the highest version with information: foreach my $v (sort { $b <=> $a } keys %vers) { my $accV = $vers{$v}; @rnas = $ml->get_rnas( $accV ); last unless ($#rnas == -1); } } return (\@rnas, $what); } sub format_coordinates { my $objs = shift; my @cols = ("Name", "Type", "DB ID", "Build", "Chr", "Start", "End", "Width", "Symbols", "Description" ); my $widths = { "Name" => 16, "Type" => 10, "DB ID" => 8, "Build" => 8, "Chr" => 8, "Start" => 12, "End" => 12, "Width" => 6, "Symbols" => 10, "Description" => 20, }; my %addCol; my $cMap = { "Name" => 'name', "Type" => 'obj_type', "DB ID" => 'pkey', "Build" => 'chr_build', "Chr" => 'chr_names', "Start" => 'chr_start', "End" => 'chr_end', "Width" => 'chr_width', "Description" => 'description', "Symbols" => ['all_symbols'], }; my @nullOut = ("DB ID"); my @rows; my $joiner = ' / '; foreach my $obj (@{$objs}) { my %data; while (my ($col, $cbName) = each %{$cMap}) { my $isArray = 0; if (ref($cbName)) { $isArray = 1; $cbName = $cbName->[0]; } if (my $cb = $obj->can($cbName)) { if ($isArray) { # Get as array my @vals = &{$cb}($obj); $data{$col} = join($joiner, @vals); } else { $data{$col} = &{$cb}($obj); } } } foreach my $tag ($obj->tag_values("Useful Tag")) { my @vals = $obj->tag_values($tag); unless ($#vals == -1) { unless ($widths->{$tag}) { push @cols, $tag; $widths->{$tag} = 15; } $data{$tag} = join($joiner, @vals); } } map { $data{$_} ||= "" } @nullOut; my @row = map { defined $_ ? $_ : "" } map { $data{$_} } @cols; push @rows, \@row; # $obj->maploc->prebranch($obj); die; # print "<pre>".$obj->to_text()."</pre>"; } if ($format eq 'HTML') { print $fh "<table class='tab'>\n"; print $fh " <caption>Coordinate report for your queries</caption>\n"; print $fh " <tbody>\n"; print $fh " <tr>".join("", map { "<th>$_</th>" } @cols)."</tr>\n"; foreach my $row (@rows) { print $fh " <tr>".join("", map {"<td>$_</td>"} @{$row})."</tr>\n"; } print $fh "</tbody></table>\n"; } elsif ($format eq 'Excel') { my $sname = "Coordinate Report"; my $eh = $excel{$sname}; unless ($eh) { $outFile ||= sprintf ("%s/Coordinates-%d-%d.xls", $htmlTmp, time, $$); $eh = $excel{$sname} = BMS::ExcelHelper->new( $outFile ); my $url = $args->path2url($outFile); $eh->url($url); my $sheet = $eh->sheet( -name => $sname, -freeze => 1, -width => [ map { $widths->{$_} || 10 } @cols], # -formats => \@fmts, -columns => \@cols, ); } map { $eh->add_row($sname, $_) } @rows; } else { print "<pre>" if ($htmlEnv); map { print $fh join("\t", @{$_})."\n" } ( \@cols, @rows ); print "</pre>\n" if ($htmlEnv); } return 1; } sub format_text { my $locdata = shift; my $lnum = $#{$locdata} + 1; $args->msg("[>]", "Exporting $lnum location".($lnum == 1 ? '':'s')." to Text"); print "<pre style='background-color:#cc9'>" unless ($nocgi); foreach my $ldat (@{$locdata}) { my ($loc, $imp, $pop, $oim) = @{$ldat}; print $fh $loc->to_text(); } print "<pre>" unless ($nocgi); return 1; } sub format_network { my $locdata = shift; $args->msg("[!!]","Network not implemented", "I need to come up with an objective way to identify the samples / populations / individuals that are 'unusual'"); return; my $ml = &maploc(); my %geneIdLookup; foreach my $ldat (@{$locdata}) { my ($loc, $imp, $pop, $oim, $cx, $track) = @{$ldat}; my %gids; while (my ($rid, $idat) = each %{$cx->{impact}}) { my $gid = $geneIdLookup{$rid}; unless (defined $gid) { $gid = 0; if (my $rna = $ml->get_rna_by_id( $rid )) { my @genes = $rna->each_gene; $gid = $genes[0]->pkey() if ($#genes == 0); } $geneIdLookup{$rid} = $gid; } $gids{$gid}{$idat->{imp}}++ if ($gid); } } return 1; } sub format_excel { my $locdata = shift; my $lnum = $#{$locdata} + 1; $args->msg("[>]", "Exporting $lnum location".($lnum == 1 ? '':'s'). " to Excel"); my $ml = &maploc(); my $srpt = &reporter(); my (%rnaLocs, %geneLocs, @allLocs); foreach my $ldat (@{$locdata}) { my ($loc, $imp, $pop, $oim, $cx) = @{$ldat}; $cx ||= $loc->cx_genome_part ( -impdata => $imp, -popdata => $pop, -tosspop => $hidePop, -ovidata => $oim, -freq => $usedMinFreq, -rnafilter => \&_rna_filter, -keepnull => $keepNull, ); my $lc = [$loc, $cx]; push @allLocs, $lc; while (my ($rId, $rImp) = each %{$cx->{impact}}) { my $aln = $rImp->{align}; push @{$rnaLocs{$rId}{$aln}}, $lc; } } my @varRows = $srpt->tally_locations ( -locs => \@allLocs, -chooserna => 1); my @rnaRows; while (my ($rid, $alnH) = each %rnaLocs) { my $rna = $srpt->rna_obj($rid, 'isID'); my $acc = $rna->accession(); next unless ($acc =~ /^[NX][MR]_/); my $loc = $rna->unique_value('LL'); my $ldat = $geneLocs{$loc} ||= {}; push @{$ldat->{rnas}}, $acc; while (my ($alnId, $rlocs) = each %{$alnH}) { my $aln = $ml->get_alignment( $alnId ); $ldat->{alns}{$acc}{$alnId} = $aln; push @{$ldat->{locs}}, @{$rlocs}; my $rrow = $srpt->rna_detail_table ( -rna => $rna, -locs => $rlocs, -alns => [$aln]); push @rnaRows, @{$rrow}; } } my @locRows; while (my ($loc, $ldat) = each %geneLocs) { next unless ($loc); my %u = map { $_->[0]->pkey() => $_ } @{$ldat->{locs}}; my $lrow = $srpt->locus_detail_table ( -locus => $loc, -rnas => $ldat->{rnas}, -alns => $ldat->{alns}, -locs => [ values %u ] ); push @locRows, @{$lrow}; } my $eh = &eh($outFile, "Location Report"); $srpt->add_variant_excel(\@varRows, $eh); $srpt->add_rna_excel(\@rnaRows, $eh); $srpt->add_gene_excel(\@locRows, $eh); return 1; } sub format_tsv { my $locdata = shift; my $lnum = $#{$locdata} + 1; $args->msg("[>]", "Exporting $lnum location".($lnum == 1 ? '':'s')." to TSV"); my $srpt = &reporter(); my $ml = &maploc(); my @rows; foreach my $ldat (@{$locdata}) { my ($loc, $imp, $pop, $oim) = @{$ldat}; my $cx = $loc->cx_genome_part ( -impdata => $imp, -popdata => $pop, -ovidata => $oim, -tosspop => $hidePop, -freq => $usedMinFreq, -rnafilter => \&_rna_filter, -keepnull => $keepNull, ); push @rows, $srpt->tally_locations ( -locs => [[$loc, $cx]], -chooserna => 1); } @rows = sort { $a->{Chr} cmp $b->{Chr} || $a->{ChrLft} <=> $b->{ChrLft} || $a->{ChrRgt} <=> $b->{ChrRgt} } @rows; print $fh $srpt->table_to_tsv ( -rows => \@rows, -type => 'variant' ); if (my $toss = &report_toss()) { $toss =~ s/<[^>]+>//g; } return 1; } sub add_features { my ($feats, $tracks) = @_; foreach my $cx (@{$feats}) { delete $cx->{hideName} if ($domName); if ($splitFeat && $#{$cx->{data}} > 0) { $args->msg_once("Features spanning multiple locations will be broken into isolated parts"); foreach my $loc (@{$cx->{data}}) { my %cpy = %{$cx}; $cpy{data} = [ $loc ]; push @{$tracks->{feature}}, \%cpy; } } else { push @{$tracks->{feature}}, $cx; } } } sub collapse_features { my ($tracks, $ml) = @_; return unless (exists $tracks->{feature}); my @group = $ml->collapse_cx_set( $tracks->{feature} ); $tracks->{feature} = \@group; } sub _feature_filter { my ($rng) = @_; return 1 unless ($rng); my $name = $rng->name(); return 1 unless ($name); if ($name =~ /^[A-Z]{2,6}\:\d+$/) { # HPRD:04264, CDD:1234 etc my $ml = &maploc(); my $obj = $ml->get_text( $name ); $obj->read_tags(); my $tags = $obj->all_tag_values(); if (my $desc = $tags->{Description}) { # A description has been set, we will assume it's return 0; } $filteredObjects{"feature"}{"No meaningful description"}{"$name"} = -1; return 1; } return 0; } sub _rna_filter { my ($rna, $aln) = @_; return 1 unless ($rna); my $accV = $rna->acc(); if (my $isQry = $userQueries{uc($accV)}) { if ($isQry < 0) { $filteredObjects{"RNA"}{"User Excluded"}{$accV}++; return $filterCache{$accV} = 1; } else { return $filterCache{$accV} = 0; } } if ($aln) { # Alignment specific filtration if ($forceBld) { my $bld = $aln->chr_build(); return 1 if (!$bld || uc($bld) ne uc($forceBld)); } if ($aln->howbad > $howbad) { my $tag = $howbad ? "Genome match > ${howbad}% worse than best" : "Sub-optimal genome match"; $filteredObjects{"RNA"}{$tag}{$accV} = -1; return 1; } } return $filterCache{$accV} if (defined $filterCache{$accV}); # Keep if it is not Ensembl: return $filterCache{$accV} = 0 unless ($accV =~ /^ENS/); if ($allowEns) { # We are only keeping certain status and biotype combinations $rna->read_tags(); my @bts = map { lc($_) } $rna->tag_values('Ensembl Biotype'); my @ess = map { lc($_) } $rna->tag_values('Ensembl Status'); map { s/_/ /g } @bts; my @flags; # Calculate the combined flags foreach my $es (@ess) { foreach my $bt (@bts) { push @flags, "$es $bt"; } } # Also allow the flags by themselves push @flags, @bts, @ess; my $ok = 0; map { $ok++ if ($allowEns->{$_} ) } @flags; unless ($ok) { my $fail = $flags[0] ? "'$flags[0]'" : "-Not Defined-"; $filteredObjects{"RNA"}{"Status + BioType is $fail"}{$accV} = -1; return $filterCache{$accV} = 1; } } # Keep if no Ensembl filtering: return $filterCache{$accV} = 0 unless ($noEns); my $filtTag = "Less than ${noEns}% match to RefSeq"; # Keep if it is an explicit query: my $accU = $accV; $accU =~ s/\.\d+$//; return $filterCache{$accV} = 0 if (&_is_user_query($accV, $accU)); my $near = $rna->nearby_rnas( -align => $aln, -howbad => $howbad ); return $filterCache{$accV} = 1 unless ($near); while (my ($gtag, $data) = each %{$near}) { foreach my $nb (@{$data->{nearby}}) { last if ($nb->{match} < $noEns); return $filterCache{$accV} = 0 if ($nb->{acc} =~ /^[NX][MR]/); } } $filteredObjects{"RNA"}{$filtTag}{$accV} = -1; return $filterCache{$accV} = 1; } sub cat_settings_html { my ($cls) = @_; my $maploc = &maploc(); &_category_settings(); my $html = ""; my @filtRows; my %filtCols; my @show = qw(w cat freq nullok track); foreach my $cs (values %{$categorySets}) { my %row = ( w => -1, cat => '' ); foreach my $key (@show) { my $v = $cs->{$key}; next if (!defined $v || $v eq ''); if ($key eq 'nullok') { $v = $v ? ['&#10003;', 'text-align: center; color:green'] : ['&times;', 'text-align: center; color:red']; } $row{$key} = $v; $filtCols{$key}++; } if (my $ih = $cs->{_impHash}) { while (my ($flag, $hash) = each %{$ih}) { my $key = $flag ? 'keep' : 'toss'; my @bits = map { $maploc->impact_html_token($_) } sort keys %{$hash}; unless ($#bits == -1) { $row{$key} = join(' ', @bits); $filtCols{$key}++; } } } push @filtRows, \%row; } return $html if ($#filtRows == -1); my $tw = &tw_hash(); my @colOrder = sort { $cfColDat->{$a}[3] <=> $cfColDat->{$b}[3] } keys %filtCols; $cls ||= ""; $html .= "<table class='tab $cls'><tbody>\n"; $html .= " <tr>"; foreach my $tok (@colOrder) { my $cfd = $cfColDat->{$tok}; $html .= sprintf("<th style='align:center' title='%s'>%s<br />%s</th>", $args->esc_xml_attr($cfd->[4]), $cfd->[0], $tw->{$cfd->[1]}); } $html .= "</tr>\n"; my $naTok = ['N/A', 'color:gray']; my %notAp = map { $_ => $naTok } qw(freq imp nullok keep toss); foreach my $row (sort { $b->{w} <=> $a->{w} || $a->{cat} cmp $b->{cat} } @filtRows) { my %using = %{$row}; $html .= " <tr>\n"; foreach my $tok (@colOrder) { $html .= " <td"; my $v = $using{$tok}; if (!defined $v) { $v = ""; } elsif (ref($v)) { $html .= " style='$v->[1]'"; $v = $v->[0]; } elsif ($tok eq 'track') { my $sty; if ($v eq 'Ignore') { $sty = "color:white; background-color: black;" } elsif ($v eq 'Discard') { $sty = "color:yellow; background-color: red;" } if ($sty) { $html .= " style='$sty'"; while (my ($kk, $vv) = each %notAp) { $using{$kk} = $vv; } } } $html .= ">$v</td>\n"; } $html .= " </tr>\n"; } $html .= "</tbody></table>\n"; return $html; } sub _category_settings { my $cat = shift || ""; unless ($categorySets) { my $ml = &maploc(); $ml->bench_start("Parse Category Filters"); # Find out if explicit values have been passed, or if we should # use defaults $categorySets = {}; # First cycle through "bulk text" parameters # These can be large chunks of multiline text via textarea # or selected options # TCGA | w:5 | freq: 0.1 foreach my $param (qw( defaultfilter catfilt catfilter categoryfilter advancedfilter)) { my @catFilt = $args->each_split_val( $param ); $args->clear_param( $param ); next if ($#catFilt == -1); # $args->msg("[DEBUG]","Category Param: $param"); foreach my $catDat (@catFilt) { next unless ($catDat); my @bits = split(/\s*\|\s*/, $catDat); my $cat = &_stnd_cat_name( shift @bits ); next unless ($cat); foreach my $bit (@bits) { if ($bit =~ /([^\:]+)\s*\:\s*(.+)/) { &_set_category_keyval($ml, $cat, $1, $2); } } } } # Now cycle through named parameters. foreach my $param ($args->each_param()) { if ($param =~ /^cat(egory)?filt(er)?_(.+)_(.+)$/) { my ($cat, $key) = (&_stnd_cat_name($3), $catKeyMap->{lc($4)} || lc($4)); if ($cat && $key) { my $val = $args->val($param); &_set_category_keyval($ml, $cat, $key, $val); } $args->clear_param( $param ); } } my %catPar; foreach my $cName (@catParents, "Region") { my $cPar = "$cName Categories"; my $cat = $ml->get_text( $cPar ); $cat->read(); foreach my $pop ($cat->tag_values("Member")) { $catPar{$pop} = $cName; } } my $userSet = 0; foreach my $td (values %{$categorySets}) { #if ($td->{track} =~ /^(discard|ignore)$/i) { # # $td->{w} = 0; # # push @ignoreCat, $td->{cat}; # next; #} $userSet++; } # Set default values for the parent categories: foreach my $cat (@catParents) { my %defs; if ($cat eq 'Polymorphism') { %defs = ( freq => 0.05, imp => '!Ugly !NonCoding' ); } else { %defs = ( freq => 0.05, imp => '!Ugly !GEN !INT !UTR' ); } $defs{track} = $cat; while (my ($k, $v) = each %defs) { &_set_category_keyval($ml, $cat, $k, $v, 1); } } &_set_category_keyval($ml, $uncatCat, 'track', 'Polymorphism', 1); while (my ($pop, $cName) = each %catPar) { &_set_category_keyval($ml, $pop, 'track', $cName, 1); } my ($freqHash); # Let parent categories pass on values to children: foreach my $td (values %{$categorySets}) { my $cat = $td->{cat}; if (my $cName = $catPar{$cat}) { # The parent of this category is defined if (my $pd = $categorySets->{ $cName } || $categorySets->{ "$cName Categories" }) { $td->{par} = $cName; # Transfer any parent values to the children while (my ($key, $val) = each %{$pd}) { $td->{$key} = $val unless (defined $td->{$key}); } } } else { # No population? Hm. $td->{par} = "Unknown"; $td->{imp} ||= '!Ugly !NonCoding'; $td->{freq} = 0.05; } if ($td->{nofilter}) { # Clear all filters for this category $td->{freq} = 0; $td->{imp} = 'ALL'; $td->{nullok} = 1; $td->{w} = 10; $td->{track} = $td->{cat}; } unless (defined $td->{w} && $td->{w} ne '') { # No weight set if ($td->{cat} eq $uncatCat) { $td->{w} = 1; } elsif (!$td->{par}) { $td->{par} = 'Unknown'; $td->{w} = 2; } elsif ($td->{par} eq 'Unknown') { $td->{w} = 2; } elsif ($td->{par} eq 'Polymorphism') { $td->{w} = 4; } else { $td->{w} = 5; } } my @pkeys = ($td->{tid}); if (my $pop = $ml->get_population($cat)) { # This category is (or is also) a population my $pid = $td->{pid} = $pop->pkey(); push @pkeys, $pid; } push @pkeys, 0 if ($cat eq $uncatCat); if (defined $td->{freq}) { # Build frequency hash keyed to object ID # This will be used by each_allele() for allele filtering $freqHash ||= {}; foreach my $pk (@pkeys) { $freqHash->{ $pk } = $td->{freq} if (!defined $freqHash->{ $pk } || $freqHash->{ $pk } < $td->{freq}); } } } $usedMinFreq = $freqHash if (!defined $usedMinFreq); my $catSer = ""; my $aliTxt = $args->val(qw(impactalias)) || "Ugly UNK COD\nNonCoding GEN INT NCR UTR UT3 UT5"; if ($aliTxt) { my @reqs = ref($aliTxt) ? @{$aliTxt} : ($aliTxt); foreach my $req (@reqs) { next unless ($req); foreach my $line (split(/[\n\r]+/, $req)) { next unless ($line); my @bits = split(/\s+/, uc($line)); my $ali = shift @bits; push @{$impAliases->{$ali}}, @bits; } } } my %noSerial = map { $_ => 1 } qw(cat cname par tid); foreach my $cat (sort { uc($a) cmp uc($b) } keys %{$categorySets}) { $catSer .= "$cat"; my $td = $categorySets->{$cat}; if ($td->{ignore}) { delete $categorySets->{$cat}; next; } foreach my $k (sort keys %{$td}) { next if ($noSerial{$k}); my $v = $td->{$k}; next unless (defined $v && $v ne ""); $v =~ s/\://g; $catSer .= " | $k: $v"; } $catSer .= "\n"; my $imp = $td->{imp}; if ($imp && $imp !~ /^\s*all\s*$/i) { my $ih = $td->{_impHash} = {}; my $txt = uc($imp); foreach my $tt (split(/\s+/, uc($imp))) { my $k = '1'; if ($tt =~ /^\!(\S+)/) { ($k, $tt) = (0, $1); } my @toks = ($tt); if (my $ali = $impAliases->{$tt}) { @toks = @{$ali}; } foreach my $tok (@toks) { my $id = $ml->impact_details($tok); if (my $tk = $id->{token}) { $ih->{$k}{$tk} = $id->{name}; } else { $args->msg_once("[?]", "Unrecognized impact token '$tok'"); } } } &_add_coarse_filter($td); } } $args->set_param('DefaultFilter', $catSer); $ml->bench_end("Parse Category Filters"); #&prebranch($categorySets->{'MGP Polymorphisms'}) } my $rv = exists $categorySets->{$cat} ? $categorySets->{$cat} : { w => 0, track => "" }; return $rv; } sub _stnd_cat_name { my $name = shift || ""; my $lcNm = lc($name); if ($lcNm =~ /^ignored?$/) { $name = "Ignore"; } elsif ($lcNm =~ /^discard(ed|ing)?$/) { $name = "Discard"; } return $name; } sub _set_category_keyval { my ($ml, $cat, $kreq, $val, $noReWrite) = @_; return unless ($cat); my @tids = $ml->text_to_known_pkey( $cat ); if ($#tids < 1) { # Not typo, should be < 1, not < 0 $args->msg_once("Category filter for unrecognized request '$cat'"); return; } unless ($tids[0]) { # Normalize the case, since the query did not match $cat = $ml->pkey_to_text( $tids[0] = $tids[1] ); } my $key = $catKeyMap->{lc($kreq)}; unless ($key) { $args->msg_once("Unrecognized category filter parameter '$kreq'"); return; } my $cd = $categorySets->{ $cat }; unless ($cd) { $cd = $categorySets->{ $cat } ||= { cat => $cat, cname => $cat, tid => $tids[0], track => "", nofilter => "", }; } if (defined $cd->{$key} && $cd->{$key} ne "") { return if ($noReWrite); #$args->msg("[?]","Category filter for '$cat' has redefined:", # "$key:'$cd->{$key}' to $key:'$val'", # "Verify that this is what you desired") # if ($cd->{$key} ne $val); } # $args->msg("[DEBUG]", "Category $cat : $key = '$val'"); $cd->{$key} = $val; } sub filter_locations { my ($lids) = @_; my %uLidH = map { $_ => undef } @{$lids || []}; my @uLids = keys %uLidH; my $ml = &maploc(); $ml->bench_start(); my $lidTab = $ml->dbh->list_to_temp_table($lids, 'integer'); my $newPids = $ml->bulk_MAF_for_location_ids( \@uLids, $bulkFrequencies ); $ml->bulk_tag_values( \@uLids, 'textToo' ); #$lidTab, 'textToo' ); $ml->bulk_population_criteria( $newPids ); # Not using $rRows or $rTab my ($imps, $rRows, $rTab, $rids) = $ml->bulk_rnas_for_location_ids( \@uLids, undef, $howbad ); $ml->bulk_features_for_object_ids( $rids, 'textToo'); my $unkPid = $ml->_unknown_pop_id(); my (@keep, @rejF, %popFilter, %done); foreach my $lid (@uLids) { my $isQry = &_is_user_query( $lid ); if ($isQry && $isQry < 0) { $filteredObjects{"variant"}{""}{"User Excluded"}++; next; } next if ($done{$lid}++); # Frequency filters get applied on a per-population level, so # we test each population independently my $ldat = $bulkFrequencies->{$lid}; my @allPids = keys %{$ldat}; if ($#allPids == -1) { # Location with no population push @allPids, $unkPid; } # We are not considering alleles here, so the loosely-calculated impact # will be the same for all populations my $predImp = "GEN"; if (my $impDat = $imps->{$lid}) { # TO DO: This should be parameterized for user control... # Preferentially use the more conservative RefSeq impact: $predImp = $impDat->{imp}{RSR} || $impDat->{imp}{ALL} || $predImp; } my %freqResults; foreach my $pid (@allPids) { my $pf = $popFilter{$pid} ||= &_population_filter( $pid ); # To decide whether we will display this location at all # we will consider only the top-weighted population(s). # However, if the location is ultimately kept, it may be # displayed in multiple tracks. In those cases, we may # need to provide different formatting in some tracks # (based on MAF) or exclude it all together in some. my $w = $pf->weight(); my $f = $ldat->{$pid}; my $r = $pf->test_loose($f, $predImp); # $args->msg_once("$predImp --> $r") if ($r); push @{$freqResults{$w}}, [ $r, $pf, $pid, $f ]; } # &dump_freqResults(\%freqResults) if ($lid == 9027787); my ($topW) = sort { $b <=> $a } keys %freqResults; my %topResults; map { $topResults{$_->[0]}{$_->[1]->name()} = 1 } @{$freqResults{$topW}}; if ($isQry) { # User request, always keep } elsif (!exists $topResults{""}) { # None of the top-weighted populations passed the frequency test # We will reject this location &_reject_location( \%topResults, \@rejF, $lid ); next; } # The location is good! push @keep, $lid; # We need to note the categories that survived filtration. # They will be used once more for one more round of strict # impact filtering (if the impact here was 'RNA'), to # determine which tracks will display the location, and to # adjust MAF-based visualizations on those tracks my $smd = $survivingMafData->{$lid} ||= [ [], $predImp eq 'RNA' ? 1 : 0]; foreach my $pfdats (values %freqResults) { foreach my $pfdat (@{$pfdats}) { if (!$pfdat->[0]) { my ($pid, $maf, $pf) = ($pfdat->[2], $pfdat->[3], $pfdat->[1]); $maf = -1 unless (defined $maf); push @{$smd->[0]}, [ $pid, $maf, $pf ]; } } } } # warn scalar(@keep)." locations kept, filtered:\n";&prebranch(\%filteredObjects); &_note_rejections( \@rejF, "Frequency and loose impact filters" ); $ml->bulk_accessions_for_object_ids( \@keep ); $ml->bench_end(); return \@keep; } sub dump_freqResults { my $fr = shift; my $txt = ""; foreach my $w (sort { $b <=> $a } keys %{$fr}) { $txt .= "WEIGHT $w:\n"; foreach my $sd (sort { $a->[2] <=> $b->[2] } @{$fr->{$w}}) { $txt .= sprintf(" %10d %8s [%s] %s\n", $sd->[2], defined $sd->[3] ? int(0.5 + 1000 * $sd->[3])/10 : '--', $sd->[1]->name(), $sd->[0]); } } &preprint($txt); } sub _reject_location { my ($results, $rejectArray, $lid) = @_; my %rcats; while (my ($r, $fnH) = each %{$results}) { foreach my $fname (keys %{$fnH}) { $rcats{$fname}{$r} = 1; } } while (my ($fname, $rH) = each %rcats) { my $r = join(', ', sort keys %{$rH}); $filteredObjects{"variant"}{$fname}{$r}++; push @{$rejectArray}, [$lid, $r, $fname]; } } sub _population_filter { my $pid = shift; unless ($popFilterObj->{$pid}) { my $ml = &maploc(); $ml->bench_start("Create Population Filter"); my $pdat = $bulkPopCat->{$pid}; unless ($pdat) { $ml->bulk_population_criteria( [$pid] ); $pdat = $bulkPopCat->{$pid}; } my @cats = @{$pdat->[0]{cat} || []}; push @cats, @{$pdat->[0]{name} || []}; my %popCatDat; foreach my $cat (@cats) { if (my $td = &_category_settings( $cat ) ) { # Using a hash to avoid duplication # Probably not needed if ($td->{cat}) { # Ignore the default filter $popCatDat{$td} ||= $td; } } } # Sort the relevant categories by user-defined weight my @useCat = values %popCatDat; @useCat = (&_category_settings($uncatCat)) if ($#useCat == -1); $popFilterObj->{$pid} = &_make_filter_object( @useCat ); $ml->bench_end("Create Population Filter"); } return $popFilterObj->{$pid}; } sub _filter_for_pid { my $pid = shift; unless ($cachedPopulationFilter->{$pid}) { my $pdat = $bulkPopCat->{$pid}; unless ($pdat) { my $ml = &maploc(); $ml->bulk_population_criteria( [$pid] ); $pdat = $bulkPopCat->{$pid}; } my @cats = @{$pdat->[0]{cat} || []}; push @cats, @{$pdat->[0]{name} || []}; my %popCatDat; foreach my $cat (@cats) { if (my $td = &_category_settings( $cat ) ) { # Using a hash to avoid duplication # Probably not needed if ($td->{cat}) { # Ignore the default filter $popCatDat{$td} ||= $td; } } } # Sort the relevant categories by user-defined weight my @useCat = values %popCatDat; @useCat = (&_category_settings($uncatCat)) if ($#useCat == -1); $cachedPopulationFilter->{$pid} = &_merge_filters( @useCat ); } return $cachedPopulationFilter->{$pid}; } sub _user_request_filter { unless ($popFilterObj->{-1}) { my $ml = &maploc(); my $pf = $popFilterObj->{-1} = BMS::SnpTracker::MapLoc::PopulationFilter->new ( -maploc => $ml ); $pf->name("Category Filter for User Requests"); $pf->null_ok( 1 ); $pf->weight( 99 ); $pf->categories( [ "User Variant" ] ); } return $popFilterObj->{-1}; } sub _make_filter_object { # This function is called for a specific population (pop_id), # called by _filter_for_pid(). It is supplied with one or more # hash structures in @useCat. Each structure defines a set of # filter criteria that determine if allelic data for the # population at a specific location should be included in a query # result. # The structures are either defined by the defaults or set by the # user, and are keyed either to specific populations or to broad # categories - of which a population may belong to zero or # more. So it is possible for one population to have two or more # filter structures assigned to it. The code below is designed to # federate the potentially conflicting filter dictates to a single # set of values. my @useCat = sort { $b->{w} <=> $a->{w} || $a->{cat} cmp $b->{cat} } @_; my @consider; foreach my $cat (@useCat) { # We will only use the top ranked filter set(s). last if ($cat->{w} < $useCat[0]{w}); push @consider, $cat; } my @names = map { $_->{cat} || "Unspecified" } @consider; my $mergeCats = "PF::".(join("+", @names) || "CodeError!"); my $pf; unless ($pf = $mergedCategories{$mergeCats}) { # Need to make a new filter object my $ml = &maploc(); $pf = $mergedCategories{$mergeCats} = BMS::SnpTracker::MapLoc::PopulationFilter->new ( -maploc => $ml ); # The weight will be the largest one from the categories $pf->weight( $consider[0]{w} || 0 ); $pf->name("Category Filter for ".join(' + ', @names)); my %tracks = map { ($_->{track} || "Unspecified") => 1 } @consider; $pf->categories( [ sort keys %tracks ] ); my ($impNum, %imps, @freqs, $nullOk) = (0); foreach my $td (@consider) { push @freqs, $td->{freq} if (defined $td->{freq}); if (my $ih = $td->{_impHash}) { $impNum++; while (my ($flag, $hash) = each %{$ih}) { while (my ($tok, $name) = each %{$hash}) { push @{$imps{$flag}{$tok}}, $name; } } } $nullOk++ if ($td->{nullok}); } # Take the most generous frequency my ($f) = sort { $a <=> $b } @freqs; $pf->min_maf( $f ); # If any of the categories allowed null frequencies, we will allow them $pf->null_ok( $nullOk ); if ($impNum) { # Take the most generous intersection of impacts $impNum--; while (my ($flag, $hash) = each %imps) { my %common; while (my ($tok, $arr) = each %{$hash}) { if ($flag == 1 || $#{$arr} == $impNum) { # Either this is a keep flag, or ALL filter # structures agreed to exclude this impact $common{$tok} = 1; } } my @ctok = keys %common; if ($flag == 1) { $pf->require_impact( \@ctok ); } else { $pf->forbid_impact( \@ctok ); } } } # $ml->preprint($pf->to_text); } return $pf; } sub _merge_filters { return $_[0] if ($#_ == 0); my @useCat = sort { $b->{w} <=> $a->{w} || $a->{cat} cmp $b->{cat} } @_; my $mergeCats = join("+", map { $_->{cat} || "UNK" } @useCat) || ""; my $rv; unless ($rv = $mergedCategories{$mergeCats}) { $maploc->bench_start(); $rv = $mergedCategories{$mergeCats} = { w => -1, via => $mergeCats }; my $topWeight = $rv->{w} = $useCat[0]{w}; my ($impNum, %imps, @freqs) = (0); foreach my $td (@useCat) { last if ($td->{w} < $topWeight); push @freqs, $td->{freq} if (defined $td->{freq}); if (my $ih = $td->{_impHash}) { $impNum++; while (my ($flag, $hash) = each %{$ih}) { while (my ($tok, $name) = each %{$hash}) { push @{$imps{$flag}{$tok}}, $name; } } } if (my $cat = $td->{cat}) { my @cats = ref($cat) ? keys %{$cat} : ($cat); map { $rv->{cat}{$_} = 1 } @cats; } } # Take the most generous frequency my ($f) = sort { $a <=> $b } @freqs; $rv->{freq} = $f; $rv->{cname} = join(',', sort keys %{$rv->{cat}}) || "Unknown Category"; if ($impNum) { # Take the most generous intersection of impacts $impNum--; while (my ($flag, $hash) = each %imps) { while (my ($tok, $arr) = each %{$hash}) { if ($flag == 1 || $#{$arr} == $impNum) { # Either this is a keep flag, or # All agree to filter on this item $rv->{_impHash}{$flag}{$tok} = $arr->[0]; } } } } &_add_coarse_filter($rv); # &prebranch($rv); &prebranch(\@useCat); $maploc->bench_end(); } return $rv; } sub _add_coarse_filter { my $mf = shift; my $ih = $mf->{_impHash}; return unless ($ih); $maploc->bench_start(); while (my ($flag, $hash) = each %{$ih}) { my $targ = $mf->{_impCoarse}{$flag} ||= {}; while (my ($tok, $name) = each %{$hash}) { $targ->{$tok} = $name; } if ($flag > 0) { # Keep rules $targ->{SPL} = $maploc->impact_name('SPL') if ($targ->{SP3} || $targ->{SP5}); $targ->{UTR} = $maploc->impact_name('UTR') if ($targ->{UT3} || $targ->{UT5}); my $rnaCount = 0; map { $rnaCount++ if ($targ->{$_}) } qw(CPX FRM STP DEL NON SYN COD UT5 UT3 UTR NCR LOC); $targ->{RNA} = $maploc->impact_name('RNA') if ($rnaCount); } else { # Discard rules $targ->{SPL} = $maploc->impact_name('SPL') if ($targ->{SP3} && $targ->{SP5}); $targ->{UTR} = $maploc->impact_name('UTR') if ($targ->{UT3} && $targ->{UT5}); } } $maploc->bench_end(); } sub _filter_lid_vs_impact { my ($lid, $predImp, $td, $noRequire) = @_; return () unless ($predImp && $td); # It is advantageous to do a quick-and-dirty initial impact # calcualtion That breaks the variants into simply GEN, INT, RNA # (genomic, intronic, somewhere in an RNA) In such cases, we do # not want to exclude variants that lack a particular impact (eg # NON, SYN) becuase they have not been computed yet. The coarse # hash takes generic impacts into account my $impH = $noRequire ? $td->{_impCoarse} : $td->{_impHash}; if (my $t = $impH->{1}) { unless ($t->{$predImp}) { # We failed to match a required impact my $req = join(',', sort values %{$t}); my $r = sprintf("Impact $predImp does not match %s", $req); # warn "$lid : $r" if ($predImp eq 'GEN' && !$noRequire); # $args->msg_once( "$predImp = $r [$td->{cname}]"); return ($td->{cname}, $r); } # $args->msg_once( "$predImp = $r [$rcat]"); } # Do not apply exclude filters if full impact not yet calculated: return () if ($noRequire); if (my $t = $impH->{0}) { # &prebranch({pred => $predImp, td => $td }) if ($lid == 44030822); if (my $req = $t->{$predImp}) { # We matched an excluded impact my $r = sprintf("Impact matches %s", $req); return ($td->{cname}, $r); } } return (); } sub _note_rejections { my ($arr, $note) = @_; return unless ($rejFile); my $num = $#{$arr} + 1; return unless ($num); if (open( REJ, ">>$rejFile")) { print REJ "\n# $note :\n" if ($note); foreach my $rd (@{$arr}) { $rd->[0] = "loc_id=".$rd->[0]; print REJ join("\t", @{$rd})."\n"; } close REJ; my $msg = "$num rejected locations "; $msg .= "($note) " if ($note); $msg .= "written to file"; $args->msg("[#]", $msg ); $args->msg_once("[OUT]", $rejFile); } else { $args->err("Failed to write reject file", $rejFile, $!); } } sub _pick_variant_track { my ($cx) = @_; my $ml = &maploc(); $ml->bench_start(); my @found = { w => -1, track => "Unknown" }; my @cats = @{$cx->{cats} || []}; push @cats, $uncatCat if ($#cats == -1); foreach my $cat (@cats) { if (my $td = &_category_settings($cat)) { push @found, $td; } } @found = sort { $b->{w} <=> $a->{w} } @found; # die $args->branch(\@found) unless ($#found == -1); my $slop = 0; my $weight = $found[0]{w}; my (%tracks, $reason); foreach my $td (@found) { last if ($td->{w} + $slop < $weight); my $track = $td->{track}; next unless ($track); if (my $r = &_filter_track( $cx, $td )) { $reason ||= [$track, $r]; next; } $tracks{$track} = 1; } delete $tracks{Ignore}; my @t = keys %tracks; if ($#t == -1) { my $key = uc($cx->{pkey} || $cx->{handle} || ""); if ($userQueries{$key}) { push @t, "User Variant"; } else { my ($track, $reas) = @{$reason || []}; # warn "($track, $reas)"; # &prebranch({ found => \@found, cats => \@cats }) unless ($reas); $reas ||= "No track for ".join(', ', @cats); $filteredObjects{"variant"}{$track || ""}{$reas}++; $ml->bench_end(); return undef; } } $ml->bench_end(); return \@t; } sub _filter_track { my ($cx, $td) = @_; return 0 if &_is_user_query($cx->{loc_id}); if (my $ih = $td->{_impHash}) { my $tok = $cx->{impToken} || "UNK"; if (my $name = $ih->{0}{$tok}) { return "Impact matches $name"; } elsif (my $req = $ih->{1}) { unless ($req->{$tok}) { return "Impact $tok not required"; } } } return 0; } sub report_toss { my $rv = ""; return $rv if ($rejFile); my $ml = &maploc(); foreach my $cat (sort keys %filteredObjects) { my $cH = $filteredObjects{$cat}; my @types = sort keys %{$cH}; next if ($#types == -1); my $tot = 0; my $txt = ""; foreach my $t (@types) { my $rH = $cH->{$t}; my @bits; foreach my $reason (sort { $rH->{$b} <=> $rH->{$a} || $a cmp $b } keys %{$rH}) { my $n = $rH->{$reason}; next unless ($n); $reason = $ml->esc_xml($reason); if ($n == -1) { $tot++; if ($cat eq 'feature') { push @bits, sprintf("<a href='http://www.google.com/search?q=%s' target='_blank'>%s</a>", $reason, $reason); } elsif ($cat eq 'RNA') { push @bits, sprintf("<a href='$toolUrl?gene=%s&mode=genome' target='_blank'>%s</a>", $reason, $reason); } else { push @bits, $reason; } } else { push @bits, "<br />&rarr; $reason <span class='mono blue'>($n)</span>"; $tot += $n; } } my $bnum = $#bits + 1; next unless ($bnum); $txt .= "<span class='red'>&times; "; $txt .= "<b>".$ml->esc_xml($t)."</b>: " if ($t); $txt .= "</span>".($bnum <= 10 ? join(', ', @bits) : "$bnum transcripts"). "<br />\n"; } $rv .= sprintf("<span class='desc'>A total of <span class='mono blue'>%d</span> %s%s were excluded:</span><br />\n", $tot, $cat, $tot == 1 ? '' : 's'); $rv .= $txt; } %filteredObjects = (); %filterCache = (); return $rv; } sub _freqs_for_category { my ($cx, $cat, $min) = @_; my %alleles; while (my ($pid, $fd) = each %{$cx->{freqs} || {}}) { my $pdat = &popCache( $pid ); next unless ($pdat->{cat}{$cat}); while (my ($al, $v) = each %{$fd}) { push @{$alleles{$al}}, defined $v->[0] ? $v->[0] : 1; } } my $pass = 0; while (my ($al, $vs) = each %alleles) { my ($max) = sort {$b <=> $a} @{$vs}; next if ($max < $min); $pass++; } return $pass; } sub _standard_confs { my @rv = ( -refseqconf => { name => 'RefSeq RNAs', subtracksMax => 25, trackType => 'rna', }, -rnaconf => { name => 'Transcripts', subtracksMax => 50, trackType => 'rna', }, -genomeconf => { # hideName => 1, name => 'Genome', outline => '#ff99ff', }, -ensemblconf => { name => 'Ensembl RNAs', height => 7, trackType => 'rna', subtracksMax => 25, }, -featureconf => { height => 3, name => 'Protein Domains', trackType => 'feature', }, -queryconf => { height => 3, name => 'Query', trackType => 'information', }, -populationsconf => { height => 3, name => 'Cell Lines', trackType => 'feature', noLegend => 1, }, -observationsconf => { }, -tissuesconf => { height => 3, noLegend => 1, }, ); my @sort = ('tally', 'feat', 'var', 'exons', 'refseq','tiss','pop','ensembl'); &_category_settings(); my $tCats = $tally{CATS}; my $ml = &maploc(); my @tCols = map { $ml->pastel_text_color($_) } @{$tCats}; my @oCols = map { $ml->rgba_color( $_, 0 ) } @tCols; my @lCols = map { $ml->rgba_color( $_, 0.6 ) } @tCols; my $tallyConf = { height => 15, displayedFeatures => 1, totalFeatures => 1, trackType => 'information', honorType => 1, briefLen => 1, names => $tCats, }; push @rv, ( -tallyconf => { type => "bar", width => 2, fill => \@tCols, outline => \@oCols, %{$tallyConf}, }, -windowed_tallyconf => { type => "line", setMaxY => 10, outline => \@lCols, fill => \@tCols, autowidth => 1, window => 1 + 2 * $tallWin, %{$tallyConf}, }); %tally = (); foreach my $td (sort { $a->{w} <=> $b->{w} } values %{$categorySets}) { my $track = $td->{track}; next unless ($track); my $key = lc("-${track}conf"); $key =~ s/\s+/_/g; push @rv, ( $key, { name => $track, trackType => 'polymorphism', bumpSpace => 1, honorType => 1, }); unshift @sort, $track; } push @rv, (-sort => \@sort); return @rv; } sub _tally_observations { my ($cx) = @_; my $ml = &maploc(); my ($s, $e) = ($cx->{data}[0][0], $cx->{data}[-1][1]); my $show = $ml->comma_number($s, $e, $cx->{w} == 0 ? '^' : '-'); my $pos = $cx->{data}[0][0]; my $okPids = $cx->{okPids}; # &prebranch($cx->{freqs} || {}); while (my ($pid, $fd) = each %{$cx->{freqs} || {}}) { # Do not consider this population if it has failed a filter: next if ($okPids && !$okPids->{$pid}); my $pdat = &popCache( $pid ); foreach my $t (@{$pdat->{tally}}) { my $td = $tally{$pos} ||= { pos => $pos, imp => $cx->{impToken}, cls => {}, show => {}, }; $td->{cls}{$t}++; $td->{show}{$show} = 1; } } } sub _add_tally_track { my ($tracks) = @_; my @pos = sort { $a->{pos} <=> $b->{pos} } values %tally; return if ($#pos == -1); my %clsH = map { $_ => 1 } map { keys %{$_->{cls}} } @pos; my @cls = sort keys %clsH; my @clInd = (0..$#cls); $tally{CATS} = \@cls; my $talTrk = "Tally"; my %byPos; foreach my $td (@pos) { my @data; my $num = 0; my $pos = $td->{pos}; # print "<p>$pos</p>" unless (int($pos) == $pos); for my $ci (0..$#cls) { my $cnt = $td->{cls}{$cls[$ci]} || 0; push @data, $cnt || undef; $num += $cnt; $byPos{$pos}[$ci] += $cnt || 0; } my $show = join('<br />', sort keys %{$td->{show}}); push @{$tracks->{$talTrk}}, { hideName => 1, info => sprintf("%dbp : %d Observation%s", $pos, $num, $num == 1 ? '' : 's'), #fill => [$rgb], #outline => [$rgb], id => $pos, offset => $pos, data => \@data, show => $show, impToken => $td->{imp}, }; } return unless ($tallMin); # See if windowed tallies can be made # 100 points along an arbitrary binomial distribution: my @binom = (1, 0.999999, 0.998571, 0.995717, 0.99145, 0.985784, 0.978742, 0.970352, 0.960647, 0.949668, 0.937457, 0.924064, 0.909541, 0.893948, 0.877345, 0.859797, 0.841371, 0.822139, 0.802171, 0.781542, 0.760327, 0.738602, 0.716442, 0.693924, 0.671122, 0.648111, 0.624962, 0.601748, 0.578536, 0.555393, 0.532382, 0.509564, 0.486996, 0.464732, 0.442821, 0.421311, 0.400244, 0.379659, 0.35959, 0.340068, 0.32112, 0.302769, 0.285034, 0.267931, 0.251471, 0.235663, 0.220512, 0.206021, 0.192187, 0.179007, 0.166476, 0.154584, 0.143321, 0.132673, 0.122627, 0.113167, 0.104275, 0.095932, 0.08812, 0.080818, 0.074006, 0.067662, 0.061765, 0.056294, 0.051227, 0.046543, 0.042221, 0.03824, 0.03458, 0.03122, 0.028143, 0.025328, 0.022759, 0.020418, 0.018288, 0.016355, 0.014602, 0.013017, 0.011585, 0.010294, 0.009132, 0.008088, 0.007152, 0.006314, 0.005565, 0.004897, 0.004303, 0.003774, 0.003305, 0.002889, 0.002522, 0.002198, 0.001912, 0.00166, 0.00144, 0.001246, 0.001077, 0.000929, 0.0008, 0.000688); # There is likely a more elegant way of doing this my %win; my @ap = keys %byPos; my $winWid = 1 + 2 * $tallWin; my @dists = ((0-$tallWin)..$tallWin); my $denom = 0; my @mults; foreach my $dist (@dists) { #my $m = (1 - ($tallDec || 0)) ** abs($dist); # $m = 0.1 if ($m < 0.1); # Silly semicircle: # my $m = sin(pi * ( 1 - abs($dist) / $tallWin) / 2); my $bnInd = int($#binom * abs($dist) / $tallWin); my $m = $binom[$bnInd]; push @mults, $m; $denom += $m; } # &pre_branch({denom => $denom, dists => \@dists, mults => \@mults }); foreach my $pos (@ap) { my $bp = $byPos{$pos}; for my $d (0..$#dists) { my $p = $pos + $dists[$d]; my $m = $mults[$d]; map { $win{$p}[$_] += $m * $bp->[$_] } @clInd; } } my $winTrk = "Windowed Tally"; my $minNorm = $tallMin; # * $denom; @ap = sort { $a <=> $b } keys %win; my %sums; foreach my $pos (@ap) { my $dat = $win{$pos}; my $num = 0; foreach my $ci (@clInd) { my $c = $dat->[$ci]; $num += $c; $dat->[$ci] = int(0.5 + 100 * $c ) / 100; } next if ($num < $minNorm); my $targ = $tracks->{$winTrk} ||= []; my $data = $targ->[-1]; if (!$data || ($data->{offset} + $#{$data->{data}[0]} + 1) < $pos) { $data = { hideName => 1, offset => $pos, data => [], sum => 0, }; push @{$targ}, $data; } # push @{$data->{data}}, $num; next; my $ind = $pos - $data->{offset}; for my $d (0..$#cls) { $data->{data}[$d][$ind] = $dat->[$d]; } } my $trk =$tracks->{$winTrk}; return unless ($trk); my $ml = &maploc(); foreach my $data (@{$trk}) { # $data->{window} = $denom; my $dat = $data->{data}; my $wid = $data->{width} = $#{$dat->[0]} + 1; my $s = $data->{offset}; my $e = $s + $wid - 1; my $show = $ml->comma_number($s, $e, '-'); my $cnts = $data->{counts} = []; $data->{show} = $data->{id} = $show; $data->{caption} = "${winWid}bp-windowed tally over ${wid}bp"; # map { $cnts->[0] += $_ } @{$dat}; for my $i (0..$#cls) { my $cdat = $dat->[$i]; my $count = 0; for my $ind (0..$#{$cdat}) { $cdat->[$ind] = $win{ $ind + $s}[$i] unless (defined $cdat->[$ind]); $count += $cdat->[$ind]; } $dat->[$i] = [] unless ($count); $cnts->[$i] = int(0.5 + 100 * $count /($denom))/100; } } } sub _variant_extras { my ($cx) = @_; if ($noAnonFeat) { if (my $feats = $cx->{features}) { my @ids = keys %{$feats}; foreach my $id (@ids) { my $feat = $feats->{$id}; delete $feats->{$id} if ($id =~ /^[A-Z]{2,6}\:\d+$/ && ! $feat->{name}); } } } } sub usage { my $rv = ""; my @mbits; my $filt = &report_toss(); if ((!$nocgi || $fullHTML) && $filt) { $rv .= $filt; push @mbits, "filtered locations"; } unless ($nocgi || $stuff{UsageDone}++) { $rv .= "<div style='border: blue solid 1px; font-size:0.8em; width:30em;'>".join ("<br />", "<span style='font-style:italic; font-weight: bold;'>Usage Instructions</span>", "Think 'Google Maps': <b>Click-and-drag</b> to pan left/right, <b>mouse wheel</b> to zoom in/out. <b>Shift-click-drag</b> to draw a box, which will expand when mouse released. <b>Hover</b> over feature for details, <b>click</b> to 'pin' details. <b>Escape key</b> resets view.", &help('SoftwareOverview','[FullUsage Instructions]')). "</div>"; push @mbits, "usage instructions"; } $rv = "<div class='toggle' onclick='toggle_hide(this)'>Click for ".join (' and ', @mbits)."</div><div class='hide'>$rv</div>" if ($rv); return $rv; } sub popCache { my $pid = shift; unless ($popcache{$pid}) { my $ml = &maploc(); $ml->bench_start('Get Population'); my $pop = $ml->get_population($pid); $pop->read(); my $name = $pop->name(); my $pdat = $popcache{$pid} = { name => $name, pop => $pop, cat => {}, }; foreach my $cat ($pop->tag_values("Category")) { $pdat->{cat}{$cat} = 1; } my @tallied = $pop->tag_values("Tally"); if ($#tallied == -1 && $tallyAll) { my ($ctag) = $pop->colored_tag(); push @tallied, $ctag; } $pdat->{tally} = \@tallied; $ml->bench_end('Get Population'); } return $popcache{$pid}; } sub HTML_PERMALINK { return unless ($htmlEnv); my $runfile = &temp_file("Parameters", 'param'); if (open(RUNFILE, ">$runfile")) { map { $args->blockquote($_, 1) } qw(catfilt); print RUNFILE $args->to_text ( -ignore => [@protectedArgs, 'pause', 'paramfile', 'valuefile'], -blockquote => ['DefaultFilter']); close RUNFILE; chmod(0666, $runfile); print $fh "<span style='color: gray ! important; font-size:0.6em;'>Links to this analysis - may be copied for email: <a href='$toolUrl?valuefile=$runfile'>Run</a> or <a href='$toolUrl?pause=1&valuefile=$runfile'>Allow Changes</a>. You can also <a target='_blank' href='$toolUrl?setDefault=1&valuefile=$runfile'>make these settings your default</a>.</span><br />"; } else { $args->err("Failed to create parameter file", $runfile, $!); } } sub temp_file { my ($tag, $sfx) = @_; $tag ||= "Data"; $sfx ||= "unk"; unless ($tmpPrfx) { $tmpPrfx = "/tmp/MapLoc/MapLoc-$$-".time; $args->assure_dir($tmpPrfx, 1); } my $counter = -1; my $path; do { $counter++; $path = sprintf("%s-%s%s.%s", $tmpPrfx, $tag, $counter || "", $sfx); } while ($tmpFiles{$path}++); return $path; } sub ref_diff_key { my $html = ""; return $html if (!$drawTab || $noHTML); $html .= "<table class='tab freqtab'>\n"; $html .= " <caption>Color Key: Difference relative to normal control</caption><tbody>\n"; $html .= "<tr>\n"; for my $rd (0..10) { my $cl = sprintf(" norm%d", $rd); $html .= sprintf(" <td class='norm%s' title='%d%% relative to control'>%s/100</td>", $cl, 10 * $rd, 10 * $rd); } $html .= "</tr>\n"; $html .= "</tbody></table>\n"; return $html; } sub prebranch { print $args->branch( @_ ); } sub preprint { my $txt = join("\n", map { defined $_ ? $_ : "" } @_); return "" unless ($txt); if ($nocgi) { warn "$txt\n"; } else { $txt = join("\n", map { $args->esc_xml($_) } map { defined $_ ? $_ : "" } @_); print $fh "<pre style='border: solid blue 1px; margin:3px; background-color:#eee;'>$txt</pre>"; } return ""; } sub collapse_ranges { my $rangeReq = shift; # Nucleate with the first HSP: my @sorted = sort { $a->[0] <=> $b->[0] } @{$rangeReq}; my @rv = ( [ @{shift @sorted} ] ); foreach my $r (@sorted) { if ($r->[0] <= $rv[-1][1]) { # Overlap - extend the HSP if needed $rv[-1][1] = $r->[1] if ( $rv[-1][1] < $r->[1]); } else { # Non overlap, push @rv, $r; } } return wantarray ? @rv : \@rv; } sub split_req { my $text = shift || ""; my @reqs; foreach my $line (split(/[\n\r\,]+/, $text)) { $line =~ s/^\s+//; $line =~ s/\s+$//; next if ($line =~ /^\s*$/); push @reqs, [split(/\s+/, $line)]; } return @reqs; } sub HTML_START { return unless ($htmlEnv); my $bxtra = ""; my $url = $args->val(qw(cxurl)) || ""; my $hxtra = ""; if ($debug) { $url =~ s/\.min\./\.debug\./; $hxtra .= " <script type='text/javascript' src='http://xpress.pri.bms.com/JAVASCRIPT/canvas/js/canvasXpress.public.min.js'></script>\n"; } if ($format =~ /(xpress|canvas|cx|html)/i) { if ($url) { my $ieKludge = $url; $ieKludge =~ s/\/[^\/]+$//; $hxtra .= <<EOF; <!--[if IE]> <script type='text/javascript' src='$ieKludge/flashcanvas.js'></script> <![endif]--> <script type='text/javascript' src='$url'></script> EOF } else { $bxtra .= "<p class='err'>Could not find URL for canvasXpress</p>\n"; } } my $ml = &maploc(); my ($mlH, $mlB) = $ml->cx_support_links(); $bxtra .= $mlB; $hxtra .= $mlH; if (my $ico = $args->val(qw(favicon))) { $hxtra .= sprintf('<link rel="shortcut icon" href="%s">', $ico); } print $fh <<EOF; <!DOCTYPE HTML> <html> <head> <title>MapLoc Data Explorer</title> <meta http-equiv="X-UA-Compatible" content="chrome=1"> $hxtra </head> <body>$bxtra EOF } sub help { return $args->tiddly_link( @_); } sub tw_hash { unless ($twHash) { my @twTopics = qw (FindGenes OnlyExons FindCellLines FindSNPs OnlyHigh RnaMatchQuality OutputFormat BuildToken VariantTable RnaView FilterEnsembl ValidationStringency CategoryFilter PopulationFilter VisualMode TrackConfiguration CustomColors ExcludeEnsembl TallyAll QueryLimit RnaRange UserQuery LocationAssignment DebugLevel SplitFeatures BenchMarks MaxFeatLen NoAnonFeat VariantSource VariantTrack VariantPriority MinimumMAF NullOk ImpactFilter ExonOnly AllowedEnsembl AutoMode UserOnly HowBad ImpactFrequency NoFilter ForceBuild ShowPopulation AdvancedSettings ); push @twTopics , map { $_->[1] } values %{$cfColDat}; $twHash = {}; map { $twHash->{$_} ||= &help($_) } @twTopics; } return $twHash; } sub HTML_FORM { return unless ($htmlEnv); my $ml = &maploc(); $ml->bench_start(); my $impExamp = ""; my %chk = ( exononly => $exonOnly ? "CHECKED " : "", drawtab => $drawTab ? "CHECKED " : "", splitfeat => $splitFeat ? "CHECKED " : "", showbench => $showBench ? "CHECKED " : "", onlyhigh => $onlyHigh ? "CHECKED " : "", noanonfeat => $noAnonFeat ? "CHECKED " : "", tallyall => $tallyAll ? "CHECKED " : "", forcebld => $forceBld ? "CHECKED " : "", ); my $tw = &tw_hash(); &_category_settings(); my %cpri = ( 'Polymorphism' => 10, 'Mutation' => 20, 'Region' => 30 ); my @cats = sort { ($cpri{$a->{par} || ""} || 100) <=> ($cpri{$b->{par} || ""} || 100) || ($b->{w} || 0) <=> ($a->{w} || 0) || lc($a->{cat} || 'zzz') cmp lc($b->{cat} || 'zzz') } values %{$categorySets}; my @catTab; my %isPar = map { $_ => 1 } @catParents; foreach my $td (@cats) { my $pop = $td->{cat}; # Full name of category next if ($pop =~ /Categories/); my $cName = $td->{par} || ""; # High-level category parent my $lab = $pop; # Pretty name of category $lab =~ s/\s*${cName}s?\s*/ /gi if ($cName); $lab =~ s/\s+/ /g; $lab =~ s/\s+$//; next if ($pop eq $cName || $lab eq $cName); my $slab = $lab; $slab .= " <i>(others)</i>" if ($isPar{$pop} && $cName eq 'Unknown'); my ($defW, $defT) = ($td->{w} || 1, $td->{track} || "Ignore"); my %row = ( cat => $slab); my @options = ( $cName, $lab, "Ignore", "Discard"); # Track Selector: my $trSel = "<select name='catfilter'>\n"; foreach my $track (@options) { $trSel .= " <option value='$pop | track:$track'"; if (lc($track) eq lc($defT)) { $trSel .= " selected='SELECTED'"; $defT = ""; } $trSel .= ">$track</option>\n"; } $trSel .= " <option value='$pop | track:$defT' selected='SELECTED'>$defT</option>\n" if ($defT); $trSel .= "</select>"; $row{track} = $trSel; # Weight Selector: my $wSel = "<select name='catfilter'>\n"; foreach my $w (1..9) { $wSel .= " <option value='$pop | w:$w'"; if (lc($w) eq lc($defW)) { $wSel .= " selected='SELECTED'"; $defW = ""; } $wSel .= ">$w</option>\n"; } $wSel .= " <option value='$pop | w:$defW' selected='SELECTED'>$defW</option>\n" if ($defW); $wSel .= "</select>"; $row{w} = $wSel; # Frequency filter my $ff = defined $td->{freq} ? $td->{freq} : ""; $row{freq} = "<input type='text' style='width:3em;' name='catfilt_${pop}_freq' value='$ff' />"; # Null Ok flag $row{nullok} = "<input type='checkbox' name='catfilt_${pop}_nullok' value='1' ".($td->{nullok} ? 'CHECKED' : '')."/>"; $row{nofilter} = "<input type='checkbox' name='catfilt_${pop}_nofilter' value='1' ".($td->{nofilter} ? 'CHECKED' : '')."/>"; # Impact filter my $imf = defined $td->{imp} ? $td->{imp} : ""; $row{imp} = "<input type='text' style='width:15em;' name='catfilt_${pop}_imp' value='$imf' />"; push @catTab, \%row; } my @colOrder; while (my ($tok, $cfd) = each %{$cfColDat}) { if (my $cn = $cfd->[2]) { $colOrder[$cn-1] = $tok; } } my $catHTML = "<table class='tab'><tbody>\n"; $catHTML .= " <tr>"; foreach my $tok (@colOrder) { my $cfd = $cfColDat->{$tok}; my $nm = $cfd->[0]; $nm = '&infin;' if ($tok eq 'nofilter'); $catHTML .= sprintf("<th style='align:center' title='%s'>%s<br />%s</th>", $args->esc_xml_attr($cfd->[4]), $nm, $tw->{$cfd->[1]}); } $catHTML .= "</tr>\n"; foreach my $cr (@catTab) { my @row; for my $c (0..$#colOrder) { my $tag = $c ? 'td' : 'th'; # warn $colOrder[$c]."\n"; push @row, "<$tag>".$cr->{$colOrder[$c]}."</$tag>"; } $catHTML .= " <tr>".join('', @row)."</tr>\n"; } $catHTML .= "</tbody></table>\n"; foreach my $ali (sort keys %{$impAliases || {}}) { $catHTML .= "<b>$ali</b> = ".join(" ", map { $ml->impact_html_token($_) } @{$impAliases->{$ali}}). "<br />\n"; } my $defFilter = $args->val(qw(defaultfilter)) || ""; my $selHTML = "$tw->{OutputFormat}<span class='param'>Format:</span> ". "<select name='format'>\n"; foreach my $f ('Text', 'HTML', 'CanvasXpress', 'Excel', 'Debug') { $selHTML .= sprintf(" <option value='%s'%s>%s</option>\n", $f, (lc($f) eq lc($format)) ? " selected='SELECTED'" : "", $f); } $selHTML .= "</select><br />\n"; # Overriding - putting this all into mode $selHTML = ""; my $modeHTML = "$tw->{VisualMode}<span class='param'>Report Format:</span> ". "<select name='mode'>\n"; my $chosenMode = ""; foreach my $md ('Auto', 'Genome Browser', 'Locus Browser', 'RNA Browser', 'Excel Report', 'Coordinate Excel', 'Gene-Sample Network', 'Text Report') { my $sel = ""; my $chkMd = &_stnd_mode($md); if ($chkMd eq $mode) { my $chkFmt = &_stnd_format($md); if ($chkFmt eq $format) { $sel = " SELECTED"; $chosenMode = $md; } } $modeHTML .= sprintf (" <option value='%s'%s>%s</option>\n", $md, $sel, $md); } unless ($chosenMode) { # The user choice was not one of the standard ones $modeHTML .= sprintf (" <option value='%s'%s>%s</option>\n", $mode," SELECTED", $mode); } $modeHTML .= "</select><br />\n"; my $buildHTML = "$tw->{BuildToken}<span class='param'>For non-accessioned queries use build:</span> ". "<select name='build'>\n"; foreach my $bld ('', $maploc->all_builds()) { $buildHTML .= sprintf (" <option value='%s'%s>%s</option>\n", $bld, ($buildReq eq $bld) ? " SELECTED" : "", $bld || "All"); } $buildHTML .= "</select><br />\n"; $buildHTML .= "$tw->{ForceBuild}<input type='checkbox' name='forcebld' value='1' $chk{forcebld}/>Also force the above build for all queries<br />"; my $dbHTML = "<span class='param'>Debug:</span> ". "<select name='dumpsql'>\n"; foreach my $ds ([0,'Quiet'], [1,'Show SQL'], [2, 'Explain SQL']) { my ($v, $n) = @{$ds}; $dbHTML .= sprintf (" <option value='%s'%s>%s</option>\n", $v, ($v eq $dumpSQL) ? " SELECTED" : "", $n); } $dbHTML .= "</select><br />\n"; my $qtxt = $query; if (ref($qtxt) && ref($qtxt) eq 'ARRAY') { $qtxt = join("\n", @{$qtxt}); } my $showPopText = join("\n", $args->each_split_val( 'showpop' )) || ""; print $fh <<EOF; <form method='post'> <table><tbody><tr><td> <b>$tw->{UserQuery}Your Query</b> <span class='ifaceNote'>One per line; SNPs, Genes, RNAs, etc</span><br /> <textarea spellcheck='false' rows='10' cols='40' name='query' style='background-color:#afa'>$qtxt</textarea><br /> </td><td style='vertical-align:top;'> $selHTML $modeHTML <input type='submit' style='background-color:lime; font-weight: bold; font-size: 1.5em;' value='Search' /> </td></tr></tbody></table> <div class='toggle' onclick='toggle_hide(this)'>$tw->{AdvancedSettings} Click for advanced settings</div><span class='hide spanDiv' style='background-color:#eef;'> $tw->{CategoryFilter}<i>Choose how to organize variants, and relative priority to give to different categories:</i> $catHTML $tw->{CustomColors}<span class='param'>Custom Colors</span> <span class='note'>eg: "phosphorylation site DarkOliveGreen"</span> <a class='toggle' target='_blank' href='http://en.wikipedia.org/wiki/Web_colors#X11_color_names'>Valid Colors</a><br /> <textarea spellcheck='false' rows='5' cols='70' name='customcolors' wrap='off' style='background-color:#ff9'>$custColor</textarea><br /> $buildHTML <input type='hidden' name='splitfeat' value='0' /> $tw->{SplitFeatures}<input type='checkbox' name='splitfeat' value='1' $chk{splitfeat}/> Break large features into pieces<br /> <input type='hidden' name='noanonfeat' value='0' /> $tw->{NoAnonFeat}<input type='checkbox' name='noanonfeat' value='1' $chk{noanonfeat}/> Ignore features without descriptions<br /> $tw->{MaxFeatLen}Disregard features longer than <input style='width:2em' type='text' name='maxfeatlen' value='$maxFeatLen' />% of their hosting RNA.<br /> $tw->{QueryLimit}Recover at most <input style='width:4em' type='text' name='limit' value='$limit' /> results for any given query.<br /> $tw->{RnaMatchQuality}Consider RNA matches up to <input type='text' name='howbad' value='$howbad' style='width:2em' />% worse than best genome match.<br /> $tw->{RnaRange}Extend search by <input type='text' name='range' value='$range' style='width:5em' /> bp around RNA/Gene queries.<br /> $tw->{ExonOnly}<input type='checkbox' name='exononly' value='1' $chk{exononly}/> RNA/Gene queries should search the genome only around exons (will still be extended by above value).<br /> $tw->{AllowedEnsembl}Only consider the following Ensembl status / biotypes: <br /><textarea spellcheck='false' rows='3' cols='40' name='allowens' wrap='off' style='background-color:#0ff'>$allowEnsText</textarea><br /> <input type='hidden' name='allowens' value='0' /> $tw->{ShowPopulation}In Excel Report, add MAF columns for these populations: <br /><textarea spellcheck='false' rows='3' cols='40' name='showpop' wrap='off' style='background-color:#ff0'>$showPopText</textarea><br /> $tw->{TallyAll}<input type='checkbox' name='tallyall' value='1' $chk{tallyall}/> Force tallies for all SNP categories<br /> <i>Nerd Settings</i><br /> $tw->{DebugLevel}$dbHTML $tw->{BenchMarks}<input type='checkbox' name='showbench' value='1' $chk{showbench}/>Show program timing benchmarks<br /> <input type='submit' style='background-color:lime; font-weight: bold; font-size: 1.5em;' value='Search' /> </span> </form> EOF $ml->bench_end(); } sub HTML_END { return unless ($htmlEnv); print $fh <<EOF; </body> </html> EOF } sub maploc { return $maploc if ($maploc); $maploc = BMS::SnpTracker::MapLoc->new ( -build => $args->val(qw(build)), -noenv => $args->val(qw(noenvironment noenv)), -instance => $mlInt, ); if ($nocgi) { # For statically created files, we probably need to make URLs # absolute. my $wsu = $maploc->web_support_url(); $maploc->web_support_url("$toolUrlDir/$wsu"); } foreach my $assure ($uncatCat, @catParents) { $maploc->text_to_pkey($assure); } my %cx_global = ( debug => $cxDebug ); if (my $idir = $args->val(qw(imagedir))) { $cx_global{imageDir} = $idir; } $maploc->cx_panel_settings( \%cx_global ); $maploc->verbosity( $vb || 0); $maploc->default_howbad( $howbad ); $maploc->default_loc_to_rna_distance( $range ); # $maploc->population_js_extender( \&_extend_pop_json ); $custColor = ""; my @errs; foreach my $cc ($args->each_split_val(@ccParam)) { next unless $cc; $custColor .= "$cc\n"; if ($cc =~ /^\s*(.+?)\s+(\S+)\s*$/) { my ($text, $col) = ($1, $2); my $hex = $maploc->hex_color( $col ); unless ($hex) { push @errs, "'$text' = $col"; next; } $maploc->user_text_color($text, $hex); } } map { $args->clear_param( $_ ) } @ccParam; $args->set_param('CustomColors', $custColor); $args->msg_once("[!]","Some color assignments could not be recognized", sort @errs) unless ($#errs == -1); $bulkPopCat = $maploc->bulk_cache_source( 'popcat' ); if ($args->val(qw(nodbsnpundef noundefdbsnp))) { if (my $ppk = $maploc->population_name_to_pkey('Unvalidated dbSNP')) { $hidePop ||= []; push @{$hidePop}, $ppk; } } return $maploc; } sub reporter { unless ($srpt) { $srpt = BMS::SnpTracker::MapLoc::Reporter->new( &maploc ); $srpt->bulk_frequencies( $bulkFrequencies ); $srpt->base_url($toolUrl); foreach my $typ (qw(gene rna variant)) { if (my $st = $args->val($typ.'showtag')) { foreach my $tag (split(/\s*[\n\r]+\s*/, $st)) { $srpt->enumerate_tag( $typ, $tag ); } } } foreach my $req ($args->each_split_val( 'showpop' )) { $srpt->add_population_column( $req ); } } return $srpt; } sub eh { my $path = shift; my $type = shift || "Excel Report"; my $isNew = 0; my $eh; unless ($eh = $excel{$type}) { my $srpt = &reporter(); $path ||= sprintf("%s/%d-%d.xlsx", $htmlTmp, time, $$); $args->assure_dir($path, 'isFile'); $isNew = 1; my $url = $args->path2url($path); $eh = $excel{$type} ||= $srpt-> excel_helper( -path => $path, -addgo => 1 ); $eh->url($url); } return wantarray ? ($eh, $isNew) : $eh; } sub pre_branch { print "<pre>".$args->branch(@_)."</pre>"; }
VCF/MapLoc
BMS/SnpTracker/MapLoc/mapLocReporter.pl
Perl
mit
144,078
use Win32::OLE 'in'; use Win32::OLE::Const; my $Locator=Win32::OLE->new("WbemScripting.SWbemLocator"); %wd = %{Win32::OLE::Const->Load($Locator)}; my %types; while (($type,$nr)=each (%wd)){ if ($type=~/Cimtype/){ $type=~s/wbemCimtype//g; $types{$nr}=$type; } } my $ComputerName = "."; my $NameSpace = "root/cimv2"; #my $ClassName = $ARGV[0]; my $ClassName = "Win32_SubDirectory"; my $WbemServices = $Locator->ConnectServer($ComputerName, $NameSpace); my $Class=$WbemServices->Get($ClassName); print $ClassName, " bevat ", $Class->{Properties_}->{Count}," properties en ", $Class->{SystemProperties_}->{Count}," systemproperties : \n\n"; foreach my $prop (in $Class->{Properties_}, $Class->{SystemProperties_}){ print "\t",$prop->{Name}," (",$prop->{CIMType}, "/", $types{$prop->{CIMType}} , ($prop->{Isarray} ? " - is array" : ""),")\n"; }
VDBBjorn/Besturingssystemen-III
Labo/reeks4/Reeks4_13.pl
Perl
mit
899
#!/usr/bin/perl open(SIG, $ARGV[0]) || die "open $ARGV[0]: $!"; $n = sysread(SIG, $buf, 1000); if($n > 510){ print STDERR "boot block too large: $n bytes (max 510)\n"; exit 1; } print STDERR "boot block is $n bytes (max 510)\n"; $buf .= "\0" x (510-$n); $buf .= "\x55\xAA"; open(SIG, ">$ARGV[0]") || die "open >$ARGV[0]: $!"; print SIG $buf; close SIG;
chaoys/os
kernel/bootloader/sign.pl
Perl
mit
367
#!/sw/bin/perl =head1 NAME B<combine replicates> =head1 DESCRIPTION Combine counts from individual condition/replicate/lane files into multicolumn files. Genes in all files B<must> be in the same order. Warning: replicate and lane number and file name templates hardcoded in the script (sorry...) Usage: combine_replicates.pl -indir=<input dir> -outdir=<output dir> -bioreps -bioreps tells the script to do biological replicates instead of lanes. =cut use strict; use warnings; use Getopt::Long; use Pod::Usage; use PDL; use PDL::NiceSlice; use CompBio::Tools; use GRNASeq; $| = 1; Stamp(); my @conds = qw(WT Snf2); my @reps = (1 .. 48); my @lanes = (1..7); my $post = 'tophat2.0.5_genes'; my $filter = '(no_feature|ambiguous|too_low_aQual|not_aligned|alignment_not_unique)'; my ($help, $man); my ($indir, $outdir); my ($bioreps, $fpkm); GetOptions( 'indir=s' => \$indir, 'outdir=s' => \$outdir, 'post=s' => \$post, bioreps => \$bioreps, fpkm => \$fpkm, help => \$help, man => \$man ); pod2usage(-verbose => 2) if $man; pod2usage(-verbose => 1) if $help; die "Need -indir\n" unless defined $indir; die "Need -outdir\n" unless defined $outdir; #$indir = "$topdir/analysis/$indir"; #$outdir = "$topdir/analysis/$outdir"; die "Cannot find $indir\n" unless -d $indir; die "Cannot find $outdir\n" unless -d $outdir; my $N = scalar @conds * scalar @reps * scalar @lanes; my $ext = ($fpkm) ? 'fpkm' : 'tsv'; my $form_replane = "%s/%s_rep%02d_lane%1d%s.$ext"; my $form_rep = "%s/%s_rep%02d_allLanes_%s.$ext"; my ($col, $skip); if($fpkm) { $col = 9; # column with counts $skip = 1; # lines to skip at the start of the file } else { $col = 1; $skip = 0; } if($bioreps) { CombineBioReplicates(); } else { CombineLanes(); CombineLaneReplicates(); } ##################################### sub CombineLanes { my $firstfile = sprintf $form_replane, $indir, $conds[0], 1, 1, $post; die "Cannot find $firstfile\n" unless -e $firstfile; my @genes = ReadGeneList($firstfile, $skip); my $cnt = 1 ; print "Combining lanes... "; for my $cond (@conds) { for my $rep (@reps) { my @d = (); for my $lane (@lanes) { Percent1(($cnt++)/$N); my $file = sprintf $form_replane, $indir, $cond, $rep, $lane, $post; my $x = QuickReadCountFile($file); push @d, $x } my $d = pdl(@d)->transpose(); my ($cols, $rows) = dims $d; my $out = sprintf "%s/%s_rep%02d_raw.tsv", $outdir, $cond, $rep; my $no = sprintf "%s/%s_rep%02d_nogene.tsv", $outdir, $cond, $rep; local (*F, *N); open F, ">$out" or die; open N, ">$no" or die; for my $i (0 .. $rows - 1) { my $row = $genes[$i] . "\t" . join("\t", list($d(,$i;-))); if($genes[$i] =~ /$filter/) {print N "$row\n"} else {print F "$row\n"} } close F; } } print "\b\b\b\b\b\b\b done \n"; } ##################################### sub CombineLaneReplicates { my $firstfile = sprintf $form_replane, $indir, $conds[0], 1, 1, $post; die "Cannot find $firstfile\n" unless -e $firstfile; my @genes = ReadGeneList($firstfile, $skip); my $cnt = 1; print "Combining replicates... "; for my $cond (@conds) { my @c = (); for my $rep (@reps) { my @d = (); for my $lane (@lanes) { Percent1(($cnt++)/$N); my $file = sprintf $form_replane, $indir, $cond, $rep, $lane, $post; my $x = QuickReadCountFile($file); push @d, $x } my $d = pdl(@d)->transpose(); my $s = sumover($d); push @c, $s; } my $c = pdl(@c)->transpose(); my ($cols, $rows) = dims $c; my $out = sprintf "%s/%s_raw.tsv", $outdir, $cond; my $no = sprintf "%s/%s_nogene.tsv", $outdir, $cond; local (*F, *N); open F, ">$out" or die; open N, ">$no" or die; open F, ">$out" or die; for my $i (0 .. $rows - 1) { my $row = $genes[$i] . "\t" . join("\t", list($c(,$i;-))); if($genes[$i] =~ /$filter/) {print N "$row\n"} else {print F "$row\n"} } close F; } print "\b\b\b\b\b\b\b done \n"; } ##################################### sub CombineBioReplicates { my $firstfile = sprintf $form_rep, $indir, $conds[0], 1, $post; die "Cannot find $firstfile\n" unless -e $firstfile; my @genes = ReadGeneList($firstfile, $skip); my $b = "\b" x 7; my $cnt = 1 ; print "Combining biological replicates... "; for my $cond (@conds) { my @c = (); for my $rep (@reps) { #Percent1(($cnt++)/$N); printf "$b%4s %2d", $cond, $rep; my $file = sprintf $form_rep, $indir, $cond, $rep, $post; my $x = QuickReadCountFile($file); push @c, $x } my $c = pdl(@c)->transpose(); my ($cols, $rows) = dims $c; my $out = sprintf "%s/%s_raw.tsv", $outdir, $cond; my $no = sprintf "%s/%s_nogene.tsv", $outdir, $cond; local (*F, *N); open F, ">$out" or die; open N, ">$no" or die; for my $i (0 .. $rows - 1) { my $row = $genes[$i] . "\t" . join("\t", list($c(,$i;-))); if($genes[$i] =~ /$filter/) {print N "$row\n"} else {print F "$row\n"} } close F; } print "${b} done \n"; } ##################################### # # Careful: we assume genes in all files are in the same order! # # sub QuickReadCountFile { my ($file) = @_; die "Missing file $file\n" unless -e $file; my $x = rcols $file, $col, {LINES=>"$skip:-1"} }
bartongroup/profDGE48
General/combine_replicates.pl
Perl
mit
5,581
#!/usr/bin/perl use strict; use warnings; use DBI; my $db = DBI->connect_cached("DBI:mysql:time:db.host", "user", "pass"); my $accounts = $db->selectall_arrayref(" SELECT * FROM accounts WHERE active = 1 AND admin = 0 ", { Slice => {} }); my $employees = $db->selectall_hashref(" SELECT * FROM employees WHERE active = 1 ", "employee_id"); my $update = $db->prepare("UPDATE accounts SET access = ? WHERE account_id = ?"); for my $a (@$accounts) { my @cleanAccess; for (split(/,/, $a->{access})) { push(@cleanAccess, $_) if (exists($employees->{$_})); } $update->execute(join(",", @cleanAccess), $a->{account_id}); }
ryanzachry/timeclock
manager/scripts/clean_access.pl
Perl
mit
631
#!/usr/bin/perl -w use strict; my $sUsage = qq( perl $0 A/B/D ); die $sUsage unless @ARGV; my $subgenome = shift; my @accs = qw(Grandin ID0444 Jaypee Jupateco Steele Stephens Truman); my %record_hash; foreach my $acc (@accs) { my $notNA_file = $acc . "_" . $subgenome . "_notNA.txt"; my $silen_file = $acc . "_" . $subgenome . "_SILENCE.txt"; my %notNA_list = read_file($notNA_file); my %silen_list = read_file($silen_file); map{$record_hash{$acc}{$_} = exists $silen_list{$_}?0:1} keys %notNA_list; } # output my %total_genes; foreach (keys %record_hash) { map{ $total_genes{$_}=1 } keys %{$record_hash{$_}}; } print "Gene\t", join("\t", @accs), "\n"; foreach my $g (keys %total_genes) { my @arr; foreach (@accs) { push @arr, exists $record_hash{$_}{$g}?$record_hash{$_}{$g}:"NA"; } print join("\t", ($g, @arr)), "\n"; } # Subroutines sub read_file { my $file = shift; my %return; open (IN, $file) or die "can't open file $file \n"; while(<IN>) { chomp; $return{$_}=1; } close IN; return %return; }
swang8/Perl_scripts_misc
extract_silenced_gene_matrix.pl
Perl
mit
1,032
#!/usr/bin/env perl # find genes that are druggable from dgidb.org. Script taken from that site. #You may need to install the CPAN JSON package before this script will work #http://www.cpan.org/modules/INSTALL.html #On a mac you can do the following: # First configure the 'cpan' tool # % sudo cpan # Then at a cpan prompt: # % get JSON # % make JSON # % install JSON # % q use strict; use warnings; use JSON; use HTTP::Request::Common; use LWP::UserAgent; use Getopt::Long; use Data::Dumper qw(Dumper); my $domain = 'http://dgidb.genome.wustl.edu/'; my $api_path = '/api/v1/interactions.json'; my $genes; my $interaction_sources; my $gene_categories; my $interaction_types; my $source_trust_levels; my $anti_neoplastic_only = ''; my $help; my %properties = ( genes => \$genes, interaction_sources => \$interaction_sources, interaction_types => \$interaction_types, gene_categories => \$gene_categories, source_trust_levels => \$source_trust_levels ); my $ua = LWP::UserAgent->new; parse_opts(); my $resp = $ua->request(POST $domain . $api_path, get_params_for_request()); if ($resp->is_success) { print_response(decode_json($resp->content)); } else { print "Something went wrong! Did you specify any genes?\n"; exit 1; } sub parse_opts { GetOptions ( 'genes=s' => \$genes, 'interaction_sources:s' => \$interaction_sources, 'interaction_types:s' => \$interaction_types, 'gene_categories:s' => \$gene_categories, 'source_trust_levels:s' => \$source_trust_levels, 'antineoplastic_only' => \$anti_neoplastic_only, 'help' => \$help, ); if (!$genes || $help){ print "\n\nFor complete API documentation refer to http://dgidb.genome.wustl.edu/api"; print "\n\nRequired parameters:"; print "\n--genes (List of gene symbols. Use offical entrez symbols for best results)"; print "\n\nOptional parameters:"; print "\n--interaction_sources (Limit results to those from particular data sources. e.g. 'DrugBank', 'PharmGKB', 'TALC', 'TEND', 'TTD', 'MyCancerGenome')"; print "\n--interaction_types (Limit results to interactions with drugs that have a particular mechanism of action. e.g. 'inhibitor', 'antibody', etc.)"; print "\n--gene_categories (Limit results to genes with a particular druggable gene type. e.g. 'KINASE', 'ION CHANNEL', etc.)"; print "\n--source_trust_levels (Limit results based on trust level of the interaction source. e.g. 'Expert curated' or 'Non-curated')"; print "\n--antineoplastic_only (Limit results to anti-cancer drugs only)"; print "\n--help (Show this documentation)"; print "\n\nExample usage:"; print "\n./perl_example.pl --genes='FLT3'"; print "\n./perl_example.pl --genes='FLT3,EGFR,KRAS'"; print "\n./perl_example.pl --genes='FLT3,EGFR' --interaction_sources='TALC,TEND'"; print "\n./perl_example.pl --genes='FLT3,EGFR' --gene_categories='KINASE'"; print "\n./perl_example.pl --genes='FLT3,EGFR' --interaction_types='inhibitor'"; print "\n./perl_example.pl --genes='FLT3,EGFR' --source_trust_levels='Expert curated'"; print "\n./perl_example.pl --genes='FLT3,EGFR' --antineoplastic_only"; print "\n./perl_example.pl --genes='FLT3,EGFR,KRAS' --interaction_sources='TALC,TEND,MyCancerGenome' --gene_categories='KINASE' --interaction_types='inhibitor' --antineoplastic_only"; print "\n\n"; exit 1; } } sub get_params_for_request { my %params; for (keys %properties) { $params{$_} = ${$properties{$_}} if ${$properties{$_}}; } if ($anti_neoplastic_only) { $params{drug_types} = 'antineoplastic'; } return \%params; } sub print_response { my $json_ref = shift; my %response_body = %{$json_ref}; print "gene_name\tdrug_name\tinteraction_type\tsource\tgene_categories\n"; #loop over each search term that was definitely matched for (@{$response_body{matchedTerms}}) { my $gene_name = $_->{geneName}; my @gene_categories = @{$_->{geneCategories}}; my @gene_categories_sort = sort @gene_categories; my $gene_categories = join(",", @gene_categories_sort); $gene_categories = lc($gene_categories); #loop over any interactions for this gene foreach my $interaction(@{$_->{interactions}}){ my $source = $interaction->{'source'}; my $drug_name = $interaction->{'drugName'}; my $interaction_type = $interaction->{'interactionType'}; print "$gene_name\t$drug_name\t$interaction_type\t$source\t$gene_categories\n"; } } #loop over each search term that wasn't matched definitely #and print suggestions if it was ambiguous for (@{$response_body{unmatchedTerms}}) { print "\n" . 'Unmatched search term: ', $_->{searchTerm}, "\n"; print 'Possible suggestions: ', join(",", @{$_->{suggestions}}), "\n"; } }
chrisamiller/bioinfoSnippets
dgidb.pl
Perl
mit
5,034
# # You may distribute this module under the same terms as perl itself # # POD documentation - main docs before the code =pod =head1 NAME Bio::EnsEMBL::Compara::RunnableDB::BlastComparaPepAcross =cut =head1 SYNOPSIS my $db = Bio::EnsEMBL::Compara::DBAdaptor->new($locator); my $blast = Bio::EnsEMBL::Compara::RunnableDB::BlastComparaPepAcross->new ( -db => $db, -input_id => $input_id -analysis => $analysis ); $blast->fetch_input(); #reads from DB $blast->run(); $blast->output(); $blast->write_output(); #writes to DB =cut =head1 DESCRIPTION This object wraps Bio::EnsEMBL::Analysis::Runnable::Blast to add functionality to read and write to databases. The appropriate Bio::EnsEMBL::Analysis object must be passed for extraction of appropriate parameters. A Bio::EnsEMBL::Analysis::DBSQL::Obj is required for databse access. =cut =head1 CONTACT Contact Jessica Severin on module implemetation/design detail: jessica@ebi.ac.uk Contact Abel Ureta-Vidal on EnsEMBL/Compara: abel@ebi.ac.uk Contact Ewan Birney on EnsEMBL in general: birney@sanger.ac.uk =cut =head1 APPENDIX The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ =cut package Bio::EnsEMBL::Compara::RunnableDB::BlastComparaPepAcross; use strict; use warnings; use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor; use Bio::EnsEMBL::Analysis::Runnable; use Bio::EnsEMBL::Analysis::Runnable::Blast; use Bio::EnsEMBL::Analysis::Tools::BPliteWrapper; use Bio::EnsEMBL::Analysis::Tools::FilterBPlite; use Bio::EnsEMBL::Hive::Process; use Bio::EnsEMBL::Hive::URLFactory; # Blast_reuse use Bio::EnsEMBL::Compara::PeptideAlignFeature; # Blast_reuse use File::Basename; use vars qw(@ISA); @ISA = qw(Bio::EnsEMBL::Hive::Process); # # our @ISA = qw(Bio::EnsEMBL::Analysis::RunnableDB::Blast); my $g_BlastComparaPep_workdir; =head2 fetch_input Title : fetch_input Usage : $self->fetch_input Function: Fetches input data for repeatmasker from the database Returns : none Args : none =cut sub fetch_input { my( $self) = @_; $self->throw("No input_id") unless defined($self->input_id); ## Get the query (corresponds to the member with a member_id = input_id) $self->{'comparaDBA'} = Bio::EnsEMBL::Compara::DBSQL::DBAdaptor->new(-DBCONN=>$self->db->dbc); $self->{'comparaDBA'}->dbc->disconnect_when_inactive(0); my $member_id = $self->input_id; my $member = $self->{'comparaDBA'}->get_MemberAdaptor->fetch_by_dbID($member_id); $self->throw("No member in compara for member_id = $member_id") unless defined($member); if (10 > $member->bioseq->length) { $self->input_job->incomplete(0); # to say "the execution completed successfully, but please record the thown message" die "Peptide is too short for BLAST"; } my $query = $member->bioseq(); $self->throw("Unable to make bioseq for member_id = $member_id") unless defined($query); $self->{query} = $query; $self->{member} = $member; my $p = eval($self->analysis->parameters); if (defined $p->{'analysis_data_id'}) { my $analysis_data_id = $p->{'analysis_data_id'}; my $ada = $self->db->get_AnalysisDataAdaptor; my $new_params = eval($ada->fetch_by_dbID($analysis_data_id)); if (defined $new_params) { $p = $new_params; } } $self->{p} = $p; $self->{null_cigar} = $p->{null_cigar} if (defined($p->{null_cigar})); # We get the list of genome_dbs to execute, then go one by one with this member # Hacky, the list is from the Cluster analysis my $cluster_analysis; $cluster_analysis = $self->analysis->adaptor->fetch_by_logic_name('PAFCluster'); $cluster_analysis = $self->analysis->adaptor->fetch_by_logic_name('HclusterPrepare') unless (defined($cluster_analysis)); my $cluster_parameters = eval($cluster_analysis->parameters); if (!defined($cluster_parameters)) { my $message = "cluster_parameters is undef in analysis_id=" . $cluster_analysis->dbID; throw ("$message"); } my @gdbs; foreach my $gdb_id (@{$cluster_parameters->{species_set}}) { my $genomeDB = $self->{'comparaDBA'}->get_GenomeDBAdaptor->fetch_by_dbID($gdb_id); push @gdbs, $genomeDB; } print STDERR "Found ", scalar(@gdbs), " genomes to blast this member against.\n" if ($self->debug); $self->{cross_gdbs} = \@gdbs; return 1; } =head2 runnable Arg[1] : (optional) Bio::EnsEMBL::Analysis::Runnable $runnable Example : $self->runnable($runnable); Function : Getter/setter for the runnable Returns : Bio::EnsEMBL::Analysis::Runnable $runnable Exceptions : none =cut sub runnable { my $self = shift(@_); if (@_) { $self->{_runnable} = shift; } return $self->{_runnable}; } =head2 run Arg[1] : -none- Example : $self->run; Function : Runs the runnable set in fetch_input Returns : 1 on succesfull completion Exceptions : dies if runnable throws an unexpected error =cut sub run { my $self = shift; my $p = $self->{p}; my $member = $self->{member}; my $query = $self->{query}; my $cross_pafs; foreach my $gdb (@{$self->{cross_gdbs}}) { my $fastafile .= $gdb->name() . "_" . $gdb->assembly() . ".fasta"; $fastafile =~ s/\s+/_/g; # replace whitespace with '_' characters $fastafile =~ s/\/\//\//g; # converts any // in path to / my $self_dbfile = $self->analysis->db_file; my ($file,$path,$type) = fileparse($self_dbfile); my $dbfile = "$path"."$fastafile"; # Here we can look at a previous build and try to reuse the blast # results for this query peptide against this hit genome my $reusable_pafs = $self->try_reuse_blast($p,$gdb->dbID,$member) if (defined $p->{reuse_db}); if (defined($reusable_pafs)) { foreach my $reusable_paf (@$reusable_pafs) { push @{$cross_pafs->{$gdb->dbID}}, $reusable_paf; } } else { ## Define the filter from the parameters my ($thr, $thr_type, $options); if (defined $p->{'-threshold'} && defined $p->{'-threshold_type'}) { $thr = $p->{-threshold}; $thr_type = $p->{-threshold_type}; } else { $thr_type = 'PVALUE'; $thr = 1e-10; } if (defined $p->{'options'}) { $options = $p->{'options'}; } else { $options = ''; } ## Create a parser object. This Bio::EnsEMBL::Analysis::Tools::FilterBPlite ## object wraps the Bio::EnsEMBL::Analysis::Tools::BPliteWrapper which in ## turn wraps the Bio::EnsEMBL::Analysis::Tools::BPlite (a port of Ian ## Korf's BPlite from bioperl 0.7 into ensembl). This parser also filter ## the results according to threshold_type and threshold. my $regex = '^(\S+)\s*'; if ($p->{'regex'}) { $regex = $p->{'regex'}; } my $parser = Bio::EnsEMBL::Analysis::Tools::FilterBPlite->new (-regex => $regex, -query_type => "pep", -input_type => "pep", -threshold_type => $thr_type, -threshold => $thr, ); ## Create the runnable with the previous parser. The filter is not required my $runnable = Bio::EnsEMBL::Analysis::Runnable::Blast->new (-query => $query, -database => $dbfile, -program => $self->analysis->program_file, -analysis => $self->analysis, -options => $options, -parser => $parser, -filter => undef, ); $self->runnable($runnable); # Only run if the blasts are not being reused $self->{'comparaDBA'}->dbc->disconnect_when_inactive(1); ## call runnable run method in eval block eval { $self->runnable->run(); }; ## Catch errors if any if ($@) { printf(STDERR ref($self->runnable)." threw exception:\n$@$_"); if($@ =~ /"VOID"/) { printf(STDERR "this is OK: member_id=%d doesn't have sufficient structure for a search\n", $self->input_id); } else { die("$@$_"); } } $self->{'comparaDBA'}->dbc->disconnect_when_inactive(0); #since the Blast runnable takes in analysis parameters rather than an #analysis object, it creates new Analysis objects internally #(a new one for EACH FeaturePair generated) #which are a shadow of the real analysis object ($self->analysis) #The returned FeaturePair objects thus need to be reset to the real analysis object foreach my $feature (@{$self->output}) { if($feature->isa('Bio::EnsEMBL::FeaturePair')) { $feature->analysis($self->analysis); $feature->{null_cigar} = 1 if (defined($self->{null_cigar})); } push @{$cross_pafs->{$gdb->dbID}}, $feature; } } } $self->{cross_pafs} = $cross_pafs; return 1; } sub write_output { my( $self) = @_; print STDERR "Inserting PAFs...\n" if ($self->debug); foreach my $gdb_id (keys %{$self->{cross_pafs}}) { $self->{'comparaDBA'}->get_PeptideAlignFeatureAdaptor->store(@{$self->{cross_pafs}{$gdb_id}}); } } sub output { my ($self, @args) = @_; throw ("Cannot call output without a runnable") if (!defined($self->runnable)); return $self->runnable->output(@args); } sub global_cleanup { my $self = shift; if($g_BlastComparaPep_workdir) { unlink(<$g_BlastComparaPep_workdir/*>); rmdir($g_BlastComparaPep_workdir); } return 1; } ########################################## # # internal methods # ########################################## # using the genome_db and longest peptides subset, create a fasta # file which can be used as a blast database sub dumpPeptidesToFasta { my $self = shift; my $startTime = time(); my $params = eval($self->analysis->parameters); my $genomeDB = $self->{'comparaDBA'}->get_GenomeDBAdaptor->fetch_by_dbID($params->{'genome_db_id'}); # create logical path name for fastafile my $species = $genomeDB->name(); $species =~ s/\s+/_/g; # replace whitespace with '_' characters #create temp directory to hold fasta databases $g_BlastComparaPep_workdir = "/tmp/worker.$$/"; mkdir($g_BlastComparaPep_workdir, 0777); my $fastafile = $g_BlastComparaPep_workdir. $species . "_" . $genomeDB->assembly() . ".fasta"; $fastafile =~ s/\/\//\//g; # converts any // in path to / return $fastafile if(-e $fastafile); print("fastafile = '$fastafile'\n"); # write fasta file to local /tmp/disk my $subset = $self->{'comparaDBA'}->get_SubsetAdaptor()->fetch_by_dbID($params->{'subset_id'}); $self->{'comparaDBA'}->get_SubsetAdaptor->dumpFastaForSubset($subset, $fastafile); # configure the fasta file for use as a blast database file my $blastdb = new Bio::EnsEMBL::Analysis::Runnable::BlastDB ( -dbfile => $fastafile, -type => 'PROTEIN'); $blastdb->run; print("registered ". $blastdb->dbname . " for ".$blastdb->dbfile . "\n"); printf("took %d secs to dump database to local disk\n", (time() - $startTime)); return $fastafile; } sub try_reuse_blast { my $self = shift; my $p = shift; my $gdb_id = shift; my $member = shift; # 1 - Check that both the query and hit genome are reusable - ie # they are the same in the old version and so were added in # the reuse_gdb array in the configuration file foreach my $reusable_gdb (@{$p->{reuse_gdb}}) { $self->{reusable_gdb}{$reusable_gdb} = 1; } my $hit_genome_db_id = $gdb_id; return undef unless (defined($self->{reusable_gdb}{$hit_genome_db_id}) && defined($self->{reusable_gdb}{$member->genome_db_id})); $self->{'comparaDBA_reuse'} = Bio::EnsEMBL::Hive::URLFactory->fetch($p->{reuse_db} . ';type=compara'); my $paf_adaptor = $self->{'comparaDBA_reuse'}->get_PeptideAlignFeatureAdaptor; my $member_adaptor = $self->{'comparaDBA_reuse'}->get_MemberAdaptor; my $member_reuse = $member_adaptor->fetch_by_source_stable_id('ENSEMBLPEP',$member->stable_id); return undef unless (defined $member_reuse); # 2 - Check that the query member is an identical sequence in both dbs unless ($member_reuse->sequence eq $member->sequence) { print STDERR "Different query sequence for ", $member->stable_id ," when trying to reuse blast from previous build.\n" if ($self->debug); return undef; } my $pafs = $paf_adaptor->fetch_all_by_qmember_id_hgenome_db_id($member_reuse->member_id,$hit_genome_db_id); my @new_pafs; foreach my $paf (@$pafs) { my $hit_member_reuse = $paf->hit_member; my $hit_member = $self->{'comparaDBA'}->get_MemberAdaptor->fetch_by_source_stable_id('ENSEMBLPEP',$hit_member_reuse->stable_id); # 3 - Check that the hit member is an identical sequence in both dbs unless (defined ($hit_member)) { return undef; } unless ($hit_member_reuse->sequence eq $hit_member->sequence) { print STDERR "Different hit sequence for ", $hit_member->stable_id ," when trying to reuse blast from previous build.\n" if ($self->debug); return undef; } print STDERR "Reusing ", $hit_member->member_id, " ", $hit_member->stable_id, " - ", $member->member_id, " ", $member->stable_id, " (",$hit_member->genome_db_id, ":", $member->genome_db_id, ")", " from previous build.\n" if ($self->debug); # Now we can reuse this paf my $new_paf = new Bio::EnsEMBL::Compara::PeptideAlignFeature; $new_paf->query_genome_db_id($member->genome_db_id); $new_paf->query_member($member); $new_paf->hit_genome_db_id($hit_member->genome_db_id); $new_paf->hit_member($hit_member); $new_paf->qstart($paf->qstart); $new_paf->hstart($paf->hstart); $new_paf->qend($paf->qend); $new_paf->hend($paf->hend); $new_paf->score($paf->score); $new_paf->evalue($paf->evalue); $new_paf->cigar_line($paf->cigar_line); $new_paf->alignment_length($paf->alignment_length); $new_paf->positive_matches($paf->positive_matches); $new_paf->identical_matches($paf->identical_matches); $new_paf->perc_ident($paf->perc_ident); $new_paf->perc_pos($paf->perc_pos); $new_paf->cigar_line('') if (defined($self->{null_cigar})); push @new_pafs, $new_paf; } return \@new_pafs; } 1;
adamsardar/perl-libs-custom
EnsemblAPI/ensembl-compara/modules/Bio/EnsEMBL/Compara/RunnableDB/BlastComparaPepAcross.pm
Perl
apache-2.0
14,252
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package network::redback::snmp::mode::components::temperature; use strict; use warnings; # In MIB 'RBN-ENVMON.mib' my $mapping = { rbnEntityTempDescr => { oid => '.1.3.6.1.4.1.2352.2.4.1.6.1.2' }, rbnEntityTempCurrent => { oid => '.1.3.6.1.4.1.2352.2.4.1.6.1.3' }, }; my $oid_rbnEntityTempSensorEntry = '.1.3.6.1.4.1.2352.2.4.1.6.1'; sub load { my ($self) = @_; push @{$self->{request}}, { oid => $oid_rbnEntityTempSensorEntry }; } sub check { my ($self) = @_; $self->{output}->output_add(long_msg => "Checking temperatures"); $self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0}; return if ($self->check_filter(section => 'temperature')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rbnEntityTempSensorEntry}})) { next if ($oid !~ /^$mapping->{rbnEntityTempCurrent}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rbnEntityTempSensorEntry}, instance => $instance); next if ($self->check_filter(section => 'temperature', instance => $instance)); $self->{components}->{temperature}->{total}++; $self->{output}->output_add(long_msg => sprintf("'%s' temperature is %dC [instance: %s].", $result->{rbnEntityTempDescr}, $result->{rbnEntityTempCurrent}, $instance)); my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{rbnEntityTempCurrent}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("Temperature '%s' is %sC", $result->{rbnEntityTempDescr}, $result->{rbnEntityTempCurrent})); } $self->{output}->perfdata_add( label => "temp", unit => 'C', nlabel => 'hardware.temperature.celsius', instances => $instance, value => $result->{rbnEntityTempCurrent}, warning => $warn, critical => $crit ); } } 1;
centreon/centreon-plugins
network/redback/snmp/mode/components/temperature.pm
Perl
apache-2.0
3,049
# # Copyright 2016 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package centreon::common::dell::powerconnect3000::mode::globalstatus; use base qw(centreon::plugins::mode); use strict; use warnings; my %states = ( 3 => ['ok', 'OK'], 4 => ['non critical', 'WARNING'], 5 => ['critical', 'CRITICAL'], ); sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '1.0'; $options{options}->add_options(arguments => { }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); } sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; my $oid_productStatusGlobalStatus = '.1.3.6.1.4.1.674.10895.3000.1.2.110.1'; my $oid_productIdentificationDisplayName = '.1.3.6.1.4.1.674.10895.3000.1.2.100.1'; my $oid_productIdentificationBuildNumber = '.1.3.6.1.4.1.674.10895.3000.1.2.100.5'; my $oid_productIdentificationServiceTag = '.1.3.6.1.4.1.674.10895.3000.1.2.100.8.1.4'; my $result = $self->{snmp}->get_multiple_table(oids => [ { oid => $oid_productStatusGlobalStatus, start => $oid_productStatusGlobalStatus }, { oid => $oid_productIdentificationDisplayName, start => $oid_productIdentificationDisplayName }, { oid => $oid_productIdentificationBuildNumber, start => $oid_productIdentificationBuildNumber }, { oid => $oid_productIdentificationServiceTag, start => $oid_productIdentificationServiceTag }, ], nothing_quit => 1 ); my $globalStatus = $result->{$oid_productStatusGlobalStatus}->{$oid_productStatusGlobalStatus . '.0'}; my $displayName = $result->{$oid_productIdentificationDisplayName}->{$oid_productIdentificationDisplayName . '.0'}; my $buildNumber = $result->{$oid_productIdentificationBuildNumber}->{$oid_productIdentificationBuildNumber . '.0'}; my $serviceTag; foreach my $key ($self->{snmp}->oid_lex_sort(keys %{$result->{$oid_productIdentificationServiceTag}})) { next if ($key !~ /^$oid_productIdentificationServiceTag\.(\d+)$/); if (!defined($serviceTag)) { $serviceTag = $result->{$oid_productIdentificationServiceTag}->{$oid_productIdentificationServiceTag . '.' . $1}; } else { $serviceTag .= ',' . $result->{$oid_productIdentificationServiceTag}->{$oid_productIdentificationServiceTag . '.' . $1}; } } $self->{output}->output_add(severity => ${$states{$globalStatus}}[1], short_msg => sprintf("Overall global status is '%s' [Product: %s] [Version: %s] [Service Tag: %s]", ${$states{$globalStatus}}[0], $displayName, $buildNumber, $serviceTag)); $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check the overall status of Dell Powerconnect 3000. =over 8 =back =cut
bcournaud/centreon-plugins
centreon/common/dell/powerconnect3000/mode/globalstatus.pm
Perl
apache-2.0
3,990
package DDG::Spice::Xkcd::Display; # ABSTRACT: Displays an xkcd comic use strict; use DDG::Spice; name "xkcd"; description "Get the latest xkcd comic"; source "xkcd"; primary_example_queries "xkcd"; secondary_example_queries "xkcd 102"; category "special"; topics "entertainment", "geek", "special_interest"; icon_url "/i/xkcd.com.ico"; code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Xkcd/Display.pm"; attribution github => ["https://github.com/sdball", "Stephen Ball"], twitter => ["https://twitter.com/StephenBallNC", "Stephen Ball"], github => ["https://github.com/andrey-p", "Andrey Pissantchev"]; triggers startend => "xkcd"; spice to => 'http://xkcd.com/$1/info.0.json'; spice wrap_jsonp_callback => 1; spice alt_to => { latest => { to => 'http://xkcd.com/info.0.json' } }; handle remainder => sub { if ($_ =~ /^(\d+|r(?:andom)?)$/) { return int rand 1122 if $1 =~ /r/; return $1; } return '' if $_ eq ''; return; }; 1;
tagawa/zeroclickinfo-spice
lib/DDG/Spice/Xkcd/Display.pm
Perl
apache-2.0
1,034
# # Copyright 2021 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package network::evertz::FC7800::snmp::plugin; use strict; use warnings; use base qw(centreon::plugins::script_snmp); sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '1.0'; %{$self->{modes}} = ( 'hardware' => 'network::evertz::FC7800::snmp::mode::hardware', ); return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check 7800 Frame Controller in SNMP. =cut
Tpo76/centreon-plugins
network/evertz/FC7800/snmp/plugin.pm
Perl
apache-2.0
1,257
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package centreon::common::foundry::snmp::mode::components::fan; use strict; use warnings; use centreon::common::foundry::snmp::mode::components::resources qw($map_status); my $mapping = { snChasFan2Description => { oid => '.1.3.6.1.4.1.1991.1.1.1.3.2.1.3' }, snChasFan2OperStatus => { oid => '.1.3.6.1.4.1.1991.1.1.1.3.2.1.4', map => $map_status } }; my $oid_snChasFan2Entry = '.1.3.6.1.4.1.1991.1.1.1.3.2.1'; sub load { my ($self) = @_; push @{$self->{request}}, { oid => $oid_snChasFan2Entry, start => $mapping->{snChasFan2Description}->{oid} }; } sub check { my ($self) = @_; $self->{output}->output_add(long_msg => 'checking fans'); $self->{components}->{fan} = { name => 'fans', total => 0, skip => 0 }; return if ($self->check_filter(section => 'fan')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_snChasFan2Entry}})) { next if ($oid !~ /^$mapping->{snChasFan2OperStatus}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_snChasFan2Entry}, instance => $instance); next if ($self->check_filter(section => 'fan', instance => $instance)); $self->{components}->{fan}->{total}++; $self->{output}->output_add( long_msg => sprintf( "fan '%s' status is '%s' [instance = %s]", $result->{snChasFan2Description}, $result->{snChasFan2OperStatus}, $instance ) ); my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{snChasFan2OperStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add( severity => $exit, short_msg => sprintf( "fan '%s' status is '%s'", $result->{snChasFan2Description}, $result->{snChasFan2OperStatus} ) ); } } } 1;
centreon/centreon-plugins
centreon/common/foundry/snmp/mode/components/fan.pm
Perl
apache-2.0
2,843
false :- main_verifier_error. verifier_error(A,B,C) :- A=0, B=0, C=0. verifier_error(A,B,C) :- A=0, B=1, C=1. verifier_error(A,B,C) :- A=1, B=0, C=1. verifier_error(A,B,C) :- A=1, B=1, C=1. fibo2(A,B,C,D,E) :- A=1, B=1, C=1. fibo2(A,B,C,D,E) :- A=0, B=1, C=1. fibo2(A,B,C,D,E) :- A=0, B=0, C=0. fibo2__1(A) :- true. fibo2___0(A,B) :- fibo2__1(B), B<1, A=0. fibo2__3(A) :- fibo2__1(A), A>=1. fibo2___0(A,B) :- fibo2__3(B), B=1, A=1. fibo2__5(A) :- fibo2__3(A), A<1. fibo2__5(A) :- fibo2__3(A), A>1. fibo2___0(A,B) :- fibo2__5(B), A=C+D. fibo2__split(A,B) :- fibo2___0(A,B). fibo2(A,B,C,D,E) :- A=1, B=0, C=0, fibo2__split(E,D). main_entry :- true. main__un :- main_entry, A<3. main__un :- main_entry, A>3. main_verifier_error :- main__un.
bishoksan/RAHFT
benchmarks_scp/SVCOMP15/svcomp15-clp/fibo_2calls_4_true-unreach-call.c.pl
Perl
apache-2.0
883
use Search::Kino03::KinoSearch; 1; __END__ __AUTO_XS__ my $synopsis = <<'END_SYNOPSIS'; my $foo_and_maybe_bar = Search::Kino03::KinoSearch::Search::RequiredOptionalQuery->new( required_query => $foo_query, optional_query => $bar_query, ); my $hits = $searcher->hits( query => $foo_and_maybe_bar ); ... END_SYNOPSIS my $constructor = <<'END_CONSTRUCTOR'; my $reqopt_query = Search::Kino03::KinoSearch::Search::RequiredOptionalQuery->new( required_query => $foo_query, # required optional_query => $bar_query, # required ); END_CONSTRUCTOR { "Search::Kino03::KinoSearch::Search::RequiredOptionalQuery" => { bind_methods => [ qw( Get_Required_Query Set_Required_Query Get_Optional_Query Set_Optional_Query ) ], make_constructors => ["new"], make_pod => { methods => [ qw( get_required_query set_required_query get_optional_query set_optional_query ) ], synopsis => $synopsis, constructor => { sample => $constructor }, }, }, } __COPYRIGHT__ Copyright 2005-2009 Marvin Humphrey This program is free software; you can redistribute it and/or modify under the same terms as Perl itself.
robertkrimen/Search-Kino03
lib/Search/Kino03/KinoSearch/Search/RequiredOptionalQuery.pm
Perl
apache-2.0
1,322
package Google::Ads::AdWords::v201809::RegionCodeError::Reason; use strict; use warnings; sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201809'}; # derivation by restriction use base qw( SOAP::WSDL::XSD::Typelib::Builtin::string); 1; __END__ =pod =head1 NAME =head1 DESCRIPTION Perl data type class for the XML Schema defined simpleType RegionCodeError.Reason from the namespace https://adwords.google.com/api/adwords/cm/v201809. The reasons for the validation error. This clase is derived from SOAP::WSDL::XSD::Typelib::Builtin::string . SOAP::WSDL's schema implementation does not validate data, so you can use it exactly like it's base type. # Description of restrictions not implemented yet. =head1 METHODS =head2 new Constructor. =head2 get_value / set_value Getter and setter for the simpleType's value. =head1 OVERLOADING Depending on the simple type's base type, the following operations are overloaded Stringification Numerification Boolification Check L<SOAP::WSDL::XSD::Typelib::Builtin> for more information. =head1 AUTHOR Generated by SOAP::WSDL =cut
googleads/googleads-perl-lib
lib/Google/Ads/AdWords/v201809/RegionCodeError/Reason.pm
Perl
apache-2.0
1,121
# # Copyright 2018 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package storage::emc::isilon::snmp::mode::components::power; use strict; use warnings; my $mapping = { powerSensorName => { oid => '.1.3.6.1.4.1.12124.2.55.1.2' }, powerSensorDescription => { oid => '.1.3.6.1.4.1.12124.2.55.1.3' }, powerSensorValue => { oid => '.1.3.6.1.4.1.12124.2.55.1.4' }, }; my $oid_powerSensorEntry = '.1.3.6.1.4.1.12124.2.55.1'; sub load { my ($self) = @_; push @{$self->{request}}, { oid => $oid_powerSensorEntry }; } sub check { my ($self) = @_; $self->{output}->output_add(long_msg => "Checking power"); $self->{components}->{power} = {name => 'power', total => 0, skip => 0}; return if ($self->check_filter(section => 'power')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_powerSensorEntry}})) { next if ($oid !~ /^$mapping->{powerSensorValue}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_powerSensorEntry}, instance => $instance); next if ($self->check_filter(section => 'power', instance => $instance)); $self->{components}->{power}->{total}++; $self->{output}->output_add(long_msg => sprintf("Power '%s' sensor is %s [instance = %s] [description = %s]", $result->{powerSensorName}, $result->{powerSensorValue}, $instance, $result->{powerSensorDescription})); my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{powerSensorValue}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("Power '%s' sensor is %s (Volt or Amp)", $result->{powerSensorName}, $result->{powerSensorValue})); } $self->{output}->perfdata_add(label => 'power_' . $result->{powerSensorName}, value => $result->{powerSensorValue}, warning => $warn, critical => $crit, ); } } 1;
wilfriedcomte/centreon-plugins
storage/emc/isilon/snmp/mode/components/power.pm
Perl
apache-2.0
3,097
use utf8; package EpiRR::Schema::Result::Archive; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE =head1 NAME EpiRR::Schema::Result::Archive =cut use strict; use warnings; use base 'DBIx::Class::Core'; =head1 TABLE: C<archive> =cut __PACKAGE__->table("archive"); =head1 ACCESSORS =head2 archive_id data_type: 'integer' extra: {unsigned => 1} is_auto_increment: 1 is_nullable: 0 =head2 name data_type: 'varchar' is_nullable: 0 size: 10 =head2 full_name data_type: 'varchar' is_nullable: 1 size: 128 =cut __PACKAGE__->add_columns( "archive_id", { data_type => "integer", extra => { unsigned => 1 }, is_auto_increment => 1, is_nullable => 0, }, "name", { data_type => "varchar", is_nullable => 0, size => 10 }, "full_name", { data_type => "varchar", is_nullable => 1, size => 128 }, ); =head1 PRIMARY KEY =over 4 =item * L</archive_id> =back =cut __PACKAGE__->set_primary_key("archive_id"); =head1 UNIQUE CONSTRAINTS =head2 C<full_name> =over 4 =item * L</full_name> =back =cut __PACKAGE__->add_unique_constraint("full_name", ["full_name"]); =head2 C<name> =over 4 =item * L</name> =back =cut __PACKAGE__->add_unique_constraint("name", ["name"]); =head1 RELATIONS =head2 raw_datas Type: has_many Related object: L<EpiRR::Schema::Result::RawData> =cut __PACKAGE__->has_many( "raw_datas", "EpiRR::Schema::Result::RawData", { "foreign.archive_id" => "self.archive_id" }, { cascade_copy => 0, cascade_delete => 0 }, ); # Created by DBIx::Class::Schema::Loader v0.07037 @ 2014-09-04 09:49:17 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hzLtJwpGUua3XeAVPub2vQ # Copyright 2013 European Molecular Biology Laboratory - European Bioinformatics Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. 1;
EMBL-EBI-GCA/EpiRR
lib/EpiRR/Schema/Result/Archive.pm
Perl
apache-2.0
2,352
=head1 NAME Workarounds for some known bugs in browsers. =head1 Description Unfortunately for web programmers, browser bugs are not uncommon, and sometimes we have to deal with them; refer to this chapter for some known bugs and how you can work around them. =head1 Same Browser Requests Serialization The following feature/bug mostly affects developers. Certain browsers will serialize requests to the same URL if accessed from different windows. For example if you have a CGI script that does: for (1..100) { print "$$: $_\n"; warn "$$: $_\n"; sleep 1; } And two concurrent requests are issued from different windows of the same browser (for those browsers that have this bug/feature), the browser will actually issue only one request and won't run the second request till the first one is finished. The debug printing to the error_log file helps to understand the serialization issue. Solution? Find a UA that doesn't have this feature, especially if a command line UA will do (LWP comes to mind). As of this writing, opera 6, mozilla 1.0 on linux have this problem, whereas konqueror 3 and lynx don't. =head1 Preventing QUERY_STRING from getting corrupted because of &entity key names In a URL which contains a query string, if the string has multiple parts separated by ampersands and it contains a key named "reg", for example C<http://example.com/foo.pl?foo=bar&reg=foobar>, then some browsers will interpret &reg as an SGML entity and encode it as C<&reg;>. This will result in a corrupted C<QUERY_STRING>. The behavior is actually correct, and the problem is that you have not correctly encoded your ampersands into entities in your HTML. What you should have in the source of your HTML is C<http://example.com/foo.pl?foo=bar&amp;reg=foobar>. A much better, and recommended solution is to separate parameter pairs with C<;> instead of C<&>. C<CGI.pm>, C<Apache::Request> and C<$r-E<gt>args()> support a semicolon instead of an ampersand as a separator. So your URI should look like this: C<http://example.com/foo.pl?foo=bar;reg=foobar>. Note that this is only an issue within HTML documents when you are building your own URLs with query strings. It is not a problem when the URL is the result of submitting a form because the browsers have to get that right. It is also not a problem when typing URLs directly into the address bar of the browser. Reference: http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 =head1 IE 4.x does not re-post data to a non-port-80 URL One problem with publishing 8080 port numbers (or so I have been told) is that IE 4.x has a bug when re-posting data to a non-port-80 URL. It drops the port designator and uses port 80 anyway. See L<Publishing Port Numbers other than 80|guide::config/Publishing_Port_Numbers_other_than_80>. =head1 Internet Explorer disregards your ErrorDocuments Many users stumble upon a common problem related to MS Internet Explorer: if your error response, such as when using C<ErrorDocument 500> or C<$r-E<gt>custom_response>, is too short (which might often be the case because you aren't very inspired when writing error messages), Internet Explorer completely disregards it and replaces it with its own standard error page, even though everything has been sent correctly by the server and received by the browser. The solution to this is quite simple: your content needs to be at least 512 bytes. Microsoft describes some solutions to this I<problem> here: http://support.microsoft.com/support/kb/articles/Q294/8/07.ASP . The easiest solution under Perl is to do something like this: # write your HTML headers print "<!-- ", "_" x 513, " -->"; # write out the rest of your HTML Effectively, your content will be long enough, but the user won't notice any additional content. If you're doing this with static pages, just insert a long enough comment inside your file to make it large enough, which will have the same effect. =head1 Maintainers Maintainer is the person(s) you should contact with updates, corrections and patches. =over =item * Stas Bekman [http://stason.org/] =back =head1 Authors =over =item * Stas Bekman [http://stason.org/] =back Only the major authors are listed above. For contributors see the Changes file. =cut
Distrotech/mod_perl
docs/src/docs/tutorials/client/browserbugs/browserbugs.pod
Perl
apache-2.0
4,302
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2020] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut package EnsCloud::Image::VolumeBundle::Volume; use Moose; use Data::Dumper; has 'tag' => ( isa => 'Str', is => 'rw' ); has 'species' => ( isa => 'Str', is => 'rw', required => 1 ); has 'total_size' => ( traits => ['Number'], is => 'rw', # isa => 'Int', default => 0, handles => { add_size => 'add', } ); has 'volume_id' => ( isa => 'Str', is => 'rw' ); has 'ensembl_release' => ( isa => 'Int', is => 'rw' ); has 'snapshot_id' => ( isa => 'Str', is => 'rw' ); has 'status' => ( isa => 'Str', is => 'rw', required =>1 , default => 'no snapshot' ); has 'device' => ( isa => 'Str', is => 'rw' ); has 'dbs' => ( traits => ['Array'], handles => { all_dbs => 'elements', add_db => 'push', next_db => 'shift', sort_in_place_curried => [sort_in_place => sub {$_[0]->type cmp $_[1]->type}] }, isa => 'ArrayRef[EnsCloud::Image::VolumeBundle::Volume::DatabaseDetails]', ); 1; __END__
james-monkeyshines/ensembl
misc-scripts/cloud/EnsCloud/Image/VolumeBundle/Volume.pm
Perl
apache-2.0
1,694
# # Copyright 2018 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package centreon::common::emc::navisphere::mode::spcomponents::memory; use strict; use warnings; sub load { }; sub check { my ($self) = @_; $self->{output}->output_add(long_msg => "Checking dimm"); $self->{components}->{dimm} = {name => 'dimm', total => 0, skip => 0}; return if ($self->check_filter(section => 'dimm')); # Enclosure SPE DIMM Module A State: Present while ($self->{response} =~ /^Enclosure\s+(\S+)\s+DIMM\s+Module\s+(\S+)\s+State:\s+(.*)$/mgi) { my $instance = "$1.$2"; my $state = $3; next if ($self->check_filter(section => 'dimm', instance => $instance)); $self->{components}->{dimm}->{total}++; $self->{output}->output_add(long_msg => sprintf("Dimm '%s' state is %s.", $instance, $state) ); my $exit = $self->get_severity(section => 'dimm', value => $state); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("dimm '%s' state is %s", $instance, $state)); } } } 1;
wilfriedcomte/centreon-plugins
centreon/common/emc/navisphere/mode/spcomponents/memory.pm
Perl
apache-2.0
2,069
package Paws::IAM::EnableMFADevice; use Moose; has AuthenticationCode1 => (is => 'ro', isa => 'Str', required => 1); has AuthenticationCode2 => (is => 'ro', isa => 'Str', required => 1); has SerialNumber => (is => 'ro', isa => 'Str', required => 1); has UserName => (is => 'ro', isa => 'Str', required => 1); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'EnableMFADevice'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::API::Response'); class_has _result_key => (isa => 'Str', is => 'ro'); 1; ### main pod documentation begin ### =head1 NAME Paws::IAM::EnableMFADevice - Arguments for method EnableMFADevice on Paws::IAM =head1 DESCRIPTION This class represents the parameters used for calling the method EnableMFADevice on the AWS Identity and Access Management service. Use the attributes of this class as arguments to method EnableMFADevice. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to EnableMFADevice. As an example: $service_obj->EnableMFADevice(Att1 => $value1, Att2 => $value2, ...); Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. =head1 ATTRIBUTES =head2 B<REQUIRED> AuthenticationCode1 => Str An authentication code emitted by the device. The format for this parameter is a string of 6 digits. Submit your request immediately after generating the authentication codes. If you generate the codes and then wait too long to submit the request, the MFA device successfully associates with the user but the MFA device becomes out of sync. This happens because time-based one-time passwords (TOTP) expire after a short period of time. If this happens, you can resync the device. =head2 B<REQUIRED> AuthenticationCode2 => Str A subsequent authentication code emitted by the device. The format for this parameter is a string of 6 digits. Submit your request immediately after generating the authentication codes. If you generate the codes and then wait too long to submit the request, the MFA device successfully associates with the user but the MFA device becomes out of sync. This happens because time-based one-time passwords (TOTP) expire after a short period of time. If this happens, you can resync the device. =head2 B<REQUIRED> SerialNumber => Str The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN. This parameter allows (per its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@:/- =head2 B<REQUIRED> UserName => Str The name of the IAM user for whom you want to enable the MFA device. This parameter allows (per its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@- =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method EnableMFADevice in L<Paws::IAM> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/IAM/EnableMFADevice.pm
Perl
apache-2.0
3,475
# # Copyright 2015 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package network::f5::bigip::mode::connections; use base qw(centreon::plugins::mode); use strict; use warnings; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '1.0'; $options{options}->add_options(arguments => { "warning-client:s" => { name => 'warning_client' }, "critical-client:s" => { name => 'critical_client' }, "warning-server:s" => { name => 'warning_server' }, "critical-server:s" => { name => 'critical_server' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); if (($self->{perfdata}->threshold_validate(label => 'warning-client', value => $self->{option_results}->{warning_client})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong warning-client threshold '" . $self->{option_results}->{option_results}->{warning_client} . "'."); $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'critical-client', value => $self->{option_results}->{critical_client})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong critical-client threshold '" . $self->{option_results}->{critical_client} . "'."); $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'warning-server', value => $self->{option_results}->{warning_server})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong warning-server threshold '" . $self->{option_results}->{warning_client} . "'."); $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'critical-server', value => $self->{option_results}->{critical_server})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong critical-server threshold '" . $self->{option_results}->{critical_client} . "'."); $self->{output}->option_exit(); } } sub run { my ($self, %options) = @_; # $options{snmp} = snmp object $self->{snmp} = $options{snmp}; if ($self->{snmp}->is_snmpv1()) { $self->{output}->add_option_msg(short_msg => "Need to use SNMP v2c or v3."); $self->{output}->option_exit(); } my $oid_sysStatClientCurConns = '.1.3.6.1.4.1.3375.2.1.1.2.1.8.0'; my $oid_sysStatServerCurConns = '.1.3.6.1.4.1.3375.2.1.1.2.1.15.0'; my $oid_sysClientsslStatCurConns = '.1.3.6.1.4.1.3375.2.1.1.2.9.2.0'; my $oid_sysServersslStatCurConns = '.1.3.6.1.4.1.3375.2.1.1.2.10.2.0'; my $result = $self->{snmp}->get_leef(oids => [$oid_sysStatClientCurConns, $oid_sysStatServerCurConns, $oid_sysClientsslStatCurConns, $oid_sysServersslStatCurConns], nothing_quit => 1); my $sysStatClientCurConns = $result->{$oid_sysStatClientCurConns}; my $sysStatServerCurConns = $result->{$oid_sysStatServerCurConns}; my $sysClientsslStatCurConns = $result->{$oid_sysClientsslStatCurConns}; my $sysServersslStatCurConns = $result->{$oid_sysServersslStatCurConns}; my $exit1 = $self->{perfdata}->threshold_check(value => $sysStatClientCurConns, threshold => [ { label => 'critical-client', 'exit_litteral' => 'critical' }, { label => 'warning-client', exit_litteral => 'warning' } ]); my $exit2 = $self->{perfdata}->threshold_check(value => $sysStatServerCurConns, threshold => [ { label => 'critical-server', 'exit_litteral' => 'critical' }, { label => 'warning-server', exit_litteral => 'warning' } ]); my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); $self->{output}->output_add(severity => $exit, short_msg => sprintf("Current connections : Client = %d (SSL: %d) , Server = %d (SSL: %d)", $sysStatClientCurConns, $sysClientsslStatCurConns, $sysStatServerCurConns, $sysServersslStatCurConns)); $self->{output}->perfdata_add(label => "Client", unit => 'con', value => $sysStatClientCurConns, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-client'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-client'), ); $self->{output}->perfdata_add(label => "Server", unit => 'con', value => $sysStatServerCurConns, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-server'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-server'), ); $self->{output}->perfdata_add(label => "ClientSSL", unit => 'con', value => $sysClientsslStatCurConns); $self->{output}->perfdata_add(label => "ServerSSL", unit => 'con', value => $sysServersslStatCurConns); $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check current connections on F5 BIG IP device. =over 8 =item B<--warning-client> Threshold warning (current client connection number) =item B<--critical-client> Threshold critical (current client connection number) =item B<--warning-server> Threshold warning (current server connection number) =item B<--critical-server> Threshold critical (current server connection number) =back =cut
s-duret/centreon-plugins
network/f5/bigip/mode/connections.pm
Perl
apache-2.0
6,536
package Paws::API::Builder::EC2 { use Data::Printer; use Data::Dumper; use autodie; use Moose; extends 'Paws::API::Builder'; has response_role => (is => 'ro', lazy => 1, default => sub { 'Paws::Net::XMLResponse' }); has '+parameter_role' => ( default => sub { return "Paws::Net::EC2Caller" }, ); has '+flattened_arrays' => (default => '1'); has callargs_class_template => (is => 'ro', isa => 'Str', default => q# [%- operation = c.operation(op_name) %] [%- shape = c.input_for_operation(op_name) %] package [% c.api %]::[% operation.name %]; use Moose; [% FOREACH param_name IN shape.members.keys.sort -%] [%- member = c.shape(shape.members.$param_name.shape) -%] has [% param_name %] => (is => 'ro', isa => '[% member.perl_type %]' [%- IF (shape.members.${param_name}.locationName) %], traits => ['NameInRequest'], request_name => '[% shape.members.${param_name}.locationName %]' [% END %] [%- IF (shape.members.$param_name.streaming == 1) %], traits => ['ParamInBody'][% END %] [%- IF (c.required_in_shape(shape,param_name)) %], required => 1[% END %]); [% END %] use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => '[% op_name %]'); class_has _returns => (isa => 'Str', is => 'ro', default => ' [%- IF (operation.output.keys.size) -%] [%- c.api %]::[% c.shapename_for_operation_output(op_name) -%] [%- ELSE -%]Paws::API::Response[% END -%]'); class_has _result_key => (isa => 'Str', is => 'ro'); 1; [% c.callclass_documentation_template | eval %] #); has callresult_class_template => (is => 'ro', isa => 'Str', default => q# [%- operation = c.result_for_operation(op_name) %] [%- shape = c.result_for_operation(op_name) %] [%- IF (shape) %] package [% c.api %]::[% c.shapename_for_operation_output(op_name) %]; use Moose; [% FOREACH param_name IN shape.members.keys.sort -%] [%- traits = [] -%] [%- member_shape_name = shape.members.$param_name.shape %] [%- member = c.shape(member_shape_name) -%] has [% param_name %] => (is => 'ro', isa => '[% member.perl_type %]' [%- IF (shape.members.${param_name}.locationName); traits.push('NameInRequest') %], request_name => '[% shape.members.${param_name}.locationName %]'[% END %] [%- IF (shape.members.$param_name.streaming == 1); traits.push('ParamInBody'); END %] [%- encoder = c.encoders_struct.$member_shape_name; IF (encoder); traits.push('Base64Attribute') %], decode_as => '[% encoder.encoding %]', method => '[% param_name %]'[% END %] [%- IF (member.members.xmlname and (member.members.xmlname != 'item')) %], traits => ['NameInRequest'], request_name => '[% member.members.xmlname %]'[% END %] [%- IF (traits.size) %], traits => [[% FOREACH trait=traits %]'[% trait %]',[% END %]][% END -%] [%- IF (c.required_in_shape(shape,param_name)) %], required => 1[% END %]); [% END %] has _request_id => (is => 'ro', isa => 'Str'); [%- END %] 1; [% c.class_documentation_template | eval %] #); has service_class_template => (is => 'ro', isa => 'Str', default => q# [%- IF (c.enums.size) -%] use Moose::Util::TypeConstraints; [%- FOR enum_name IN c.enums.keys.sort %] enum '[% enum_name %]', [[% FOR val IN c.enums.$enum_name %]'[% val %]',[% END %]]; [%- END %] [%- END -%] package [% c.api %]; use Moose; sub service { '[% c.service %]' } sub version { '[% c.version %]' } sub flattened_arrays { [% c.flattened_arrays %] } has max_attempts => (is => 'ro', isa => 'Int', default => [% c.service_max_attempts %]); has retry => (is => 'ro', isa => 'HashRef', default => sub { { base => '[% c.service_retry.base %]', type => '[% c.service_retry.type %]', growth_factor => [% c.service_retry.growth_factor %] } }); has retriables => (is => 'ro', isa => 'ArrayRef', default => sub { [ [%- FOREACH key IN c.retry.policies.keys %] [%- policy = c.retry.policies.$key.applies_when.response %] [%- IF (policy.service_error_code) %] sub { defined $_[0]->http_status and $_[0]->http_status == [% policy.http_status_code %] and $_[0]->code eq '[% policy.service_error_code %]' }, [%- ELSIF (policy.crc32body) %] sub { $_[0]->code eq 'Crc32Error' }, [%- ELSE %] [% THROW 'Unknown retry type' %] [%- END %] [%- END %] ] }); with 'Paws::API::Caller', '[% c.endpoint_role %]', '[% c.signature_role %]', '[% c.parameter_role %]', '[% c.response_role %]'; [%- c.service_endpoint_rules %] [% FOR op IN c.api_struct.operations.keys.sort %] [%- op_name = c.api_struct.operations.$op.name %] sub [% op_name %] { my $self = shift; my $call_object = $self->new_with_coercions('[% c.api %]::[% op_name %]', @_); return $self->caller->do_call($self, $call_object); } [%- END %] [%- c.paginator_template | eval %] sub operations { qw/[% FOR op IN c.api_struct.operations.keys.sort; op _ ' '; END %]/ } 1; [% c.service_documentation_template | eval %] #); has object_template => (is => 'ro', isa => 'Str', default => q# [%- -%] package [% inner_class %]; use Moose; [% FOREACH param_name IN shape.members.keys.sort -%] [%- traits = [] -%] [%- member_shape_name = shape.members.$param_name.shape %] [%- member = c.shape(member_shape_name) -%] has [% param_name %] => (is => 'ro', isa => '[% member.perl_type %]' [%- IF (shape.members.${param_name}.locationName); traits.push('NameInRequest') %], request_name => '[% shape.members.${param_name}.locationName %]'[% END %] [%- IF (shape.members.$param_name.streaming == 1); traits.push('ParamInBody'); END %] [%- encoder = c.encoders_struct.$member_shape_name; IF (encoder); traits.push('Base64Attribute') %], decode_as => '[% encoder.encoding %]', method => '[% encoder.alias %]'[% END %] [%- IF (member.members.xmlname and (member.members.xmlname != 'item')) %], traits => ['NameInRequest'], request_name => '[% member.members.xmlname %]'[% END %] [%- IF (traits.size) %], traits => [[% FOREACH trait=traits %]'[% trait %]'[% IF (NOT loop.last) %],[% END %][% END %]][% END -%] [%- IF (c.required_in_shape(shape,param_name)) %], required => 1[% END %]); [% END -%] 1; [% c.innerclass_documentation_template | eval %] [%- -%] #); } 1;
ioanrogers/aws-sdk-perl
builder-lib/Paws/API/Builder/EC2.pm
Perl
apache-2.0
6,181
#!/usr/local/bin/perl if (@ARGV < 1) { die "usage:\tmadx2placet.pl FILE 1 (:take apertures from madX (0 apertures 1 m)) 1 (: for wakefield studies) 1 unsplitted elements \n"; } open(FILE, $ARGV[0]) or die "Could not open file $ARGV[0]\n"; @names = (); @line = (); @elemnames = (); @elemleng = (); @key = (); @a_x = (); @a_y = (); @til = (); @k0 = (); @k1 = (); @k2 = (); @k3 = (); @k4 = (); @k5 = (); @k6 = (); @ang = (); @e1 = (); @e2 = (); @type = (); @skip_lines = (); sub search_index # $i = search_index("ENERGY"); $energy = $line[$i]; { my $name = $_[0]; my $i; for ($i = 0; $i < @names; $i++) { if ($names[$i] eq $name) { last; } } return $i; } sub search_value # $energy = search_value("ENERGY"); { return $line[search_index($_[0])]; } sub check_name { my $name = $_[0]; my $jj = $_[1]; my $chk_nm = 1; for ($j =$jj-2; $j<$jj; $j++) { if(@elemnames[$j] eq $name) { $chk_nm = 0; last; } } return $chk_nm; } sub check_leng { my $name = $_[0]; my $j = $_[1]; my $chk_lg = 1; $elemleng = @elemleng; if($j > 1) { if((@elemleng[$j-1] eq 0 && @elemnames[$j-2] eq $name) || (@elemleng[$j-1] eq 0 && @elemleng[$j-2] eq 0 && @elemnames[$j-3] eq $name)) { $chk_lg = 0; } } return $chk_lg; } sub check_same_line { my $name = $_[0]; my $jj = $_[1]; my $kk = $_[2]; my $nl = 1; for ($k=$jj+1;$k<$jj+5; $k++) { if(@elemnames[$k] eq $name && @elemleng[$k] eq @elemleng[$jj] && ($kk eq $k0[$jj] || $kk eq $k1[$jj] || $kk eq $k2[$jj] || $kk eq $k3[$jj] || $kk eq $k4[$jj]) ) { $nl++; @skip_lines[$k] = 1; } elsif (@elemleng[$k] != 0) { last; } } return $nl; } sub check_merror { my $name = $_[0]; my $jj = $_[1]; my $ki = 0; for ($k=$jj+1;$k<$jj+3; $k++) { if( $key[$k]=~ /MULTIPOLE/ && @elemleng[$k] == 0 && ($k0[$k] ne 0 || $k1[$k] ne 0 || $k2[$k] ne 0 || $k3[$k] ne 0 || $k4[$k] ne 0 || $k5[$k] ne 0 || $k6[$k] ne 0) ) { @skip_lines[$k] = 1; $ki = $k; } } return $ki; } my $aper = $ARGV[1]; my $coll = $ARGV[2]; my $split = $ARGV[3]; # ==========================>>>>>>>>>>>read file my $count = 0; while ($lines = <FILE>) { if ($lines =~ /^\*/) { @line = split(" ", $lines); for ($i=1;$i<@line;$i++) { push(@names, $line[$i]); } } elsif ($lines !~ /^[@\*\$]/) { @line = split(" ", $lines); my $keyword = search_value("KEYWORD"); my $length = search_value("L"); my $name = search_value("NAME"); my $apx = 1.0; # beware, this is in meters my $apy = 1.0; # beware, this is in meters if($aper == 1) { $apx = search_value("APER_1"); # beware, this is in meters $apy = search_value("APER_2"); # beware, this is in meters } my $tilt = search_value("TILT"); my $k0l = search_value("K0L"); my $k1l = search_value("K1L"); my $k2l = search_value("K2L"); my $k3l = search_value("K3L"); my $k4l = search_value("K4L"); my $k5l = search_value("K5L"); my $k6l = search_value("K6L"); my $angle = search_value("ANGLE"); push(@key,$keyword); push(@elemleng,$length); push(@elemnames,"$name"); push(@a_x,$apx); push(@a_y,$apy); push(@til,$tilt); push(@k0,$k0l); push(@k1,$k1l); push(@k2,$k2l); push(@k3,$k3l); push(@k4,$k4l); push(@k5,$k5l); push(@k6,$k6l); push(@ang,$angle); push(@skip_lines,0); $count++; } } close(FILE); # ==================================>>>>>>>> write file for ($i=0;$i<$count; $i++) { if (@skip_lines[$i] == 1) { next; } my $name = $elemnames[$i]; my $keyword= $key[$i]; my $apx = $a_x[$i]; my $apy = $a_y[$i]; my $tilt = $til[$i]; my $k0l = $k0[$i]; my $k1l = $k1[$i]; my $k2l = $k2[$i]; my $k3l = $k3[$i]; my $k4l = $k4[$i]; my $k5l = $k5[$i]; my $k6l = $k6[$i]; my $angle = $ang[$i]; my $length = $elemleng[$i]; my $chk = check_name($name,$jj); my $chl = check_leng($name,$i); if ($keyword =~ /DRIFT/) { # This part is commented because in some lattice after a drift a series of multipoles may come 09/03/2010 # if( $key[$i+1] =~ /MULTIPOLE/ && $elemleng[$i+1] == 0 && ( $k0[$i+1] != 0 || $k1[$i+1] != 0 || $k2[$i+1] != 0 || $k3[$i+1] != 0 || $k4[$i+1] != 0 || $k5[$i+1] != 0 || $k6[$i+1] != 0) ){ # if( $key[$i+1] =~ /MULTIPOLE/ && $elemleng[$i+1] == 0 ){ # # $elemleng[$i+1] = $length; # } # else { # if($chl) { if ($length != 0) { print "Girder\n"; } # } print "Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } # } } elsif ($keyword =~ /QUADRUPOLE/) { if($split) { if($chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k1l); my $chk_me = check_merror($name,$i); my $streng = $chk_nl*$k1l; my $lengt = $chk_nl*$length; print "Quadrupole -name $name -synrad \$quad_synrad -length $lengt -strength \[expr $streng*\$e0\]"; } else { if ($length != 0) { print "Girder\n"; } print "Quadrupole -name $name -synrad \$quad_synrad -length $length -strength \[expr $k1l*\$e0\]"; } # if( $chk_nl >1 && $chk_me ) # { # if ($k1[$chk_me] ne 0){ # my $str = $k1[$chk_me]; # print " -type 2 -Kn \[expr $str*\$e0\]"; # } elsif ($k2[$chk_me] ne 0 && $k2[$chk_me] != 0){ # my $str = $k2[$chk_me]; # print " -type 3 -Kn \[expr $str*\$e0\]"; # } elsif ($k3[$chk_me] ne 0 && $k3[$chk_me] != 0){ # my $str = $k3[$chk_me]; # print " -type 4 -Kn \[expr -1.0*$str*\$e0\]"; # } elsif ($k4[$chk_me] ne 0 && $k4[$chk_me] != 0){ # my $str = $k4[$chk_me]; # print " -type 5 -Kn \[expr $str*\$e0\]"; # } elsif ($k5[$chk_me] ne 0 && $k5[$chk_me] != 0 ){ # my $str = $k5[$chk_me]; # print " -type 6 -Kn \[expr -1.0*$str*\$e0\]"; # } elsif ($k6[$chk_me] ne 0 && $k6[$chk_me] != 0 ){ # my $str = $k6[$chk_me]; # print " -type 7 -Kn \[expr $str*\$e0\]"; # } # } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($keyword =~ /SEXTUPOLE/) { my $tilt = -1.0 * $tilt; if($split){ if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k2l); my $streng = $chk_nl*$k2l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Multipole -name $name -synrad \$mult_synrad -type 3 -length $lengt -strength \[expr $streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Multipole -name $name -synrad \$mult_synrad -type 3 -length $length -strength \[expr $k2l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($keyword =~ /OCTUPOLE/) { my $tilt = -1.0 * $tilt; if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k3l); my $streng = $chk_nl*$k3l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Multipole -name $name -synrad \$mult_synrad -type 4 -length $lengt -strength \[expr -1.0*$streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Multipole -name $name -synrad \$mult_synrad -type 4 -length $length -strength \[expr -1.0*$k3l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($keyword =~ /MULTIPOLE/) { my $tilt = -1.0 * $tilt; if ($k0l != 0) { if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k0l); my $streng = $chk_nl*$k0l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Dipole -name $name -synrad 0 -length $lengt -strength \[expr -1.0*$streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Dipole -name $name -synrad 0 -length $length -strength \[expr -1.0*$k0l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($k1l != 0) { if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k1l); my $streng = $chk_nl*$k1l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Quadrupole -name $name -synrad \$quad_synrad -length $lengt -strength \[expr -1.0*$streng*\$e0\] -steps $stp"; # to be check } else { if ($length != 0) { print "Girder\n"; } print "Quadrupole -name $name -synrad \$quad_synrad -length $length -strength \[expr -1.0*$k1l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($k2l != 0) { if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k2l); my $streng = $chk_nl*$k2l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Multipole -name $name -synrad \$mult_synrad -type 3 -length $lengt -strength \[expr $streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Multipole -name $name -synrad \$mult_synrad -type 3 -length $length -strength \[expr $k2l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($k3l != 0) { if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k3l); my $streng = $chk_nl*$k3l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Multipole -name $name -synrad \$mult_synrad -type 4 -length $lengt -strength \[expr -1.0*$streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Multipole -name $name -synrad \$mult_synrad -type 4 -length $length -strength \[expr -1.0*$k3l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($k4l != 0) { if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k4l); my $streng = $chk_nl*$k4l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Multipole -name $name -synrad \$mult_synrad -type 5 -length $lengt -strength \[expr $streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Multipole -name $name -synrad \$mult_synrad -type 5 -length $length -strength \[expr $k4l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($k5l != 0) { if($split) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } my $chk_nl = check_same_line($name,$i,$k5l); my $streng = $chk_nl*$k5l; my $lengt = $chk_nl*$length; my $stp = $chk_nl*5; print "Multipole -name $name -synrad \$mult_synrad -type 6 -length $lengt -strength \[expr -1.0*$streng*\$e0\] -steps $stp"; } else { if ($length != 0) { print "Girder\n"; } print "Multipole -name $name -synrad \$mult_synrad -type 6 -length $length -strength \[expr -1.0*$k5l*\$e0\]"; } if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } else { print "# WARNING: Multipole options not defined. Multipole type 0 with 0."; print "\n"; if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } print "#Multipole -name $name -synrad \$mult_synrad -type 0 -length $length -strength \[expr 0.0*\$e0\]"; if ($tilt != 0) { print " -tilt $tilt"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } } elsif ($keyword =~ /RBEND/) { my $half_angle = $angle * 0.5; my $radius = $length / sin($half_angle) / 2; my $arc_length = $angle * $radius; print "# WARNING: putting a Sbend instead of a Rbend. Arc's length is : angle * L / sin(angle/2) / 2\n"; print "# WARNING: original length was $length\n"; # if($chk) { # I comment it for the moment because the bend always have the same names if ($length != 0) { print "Girder\n"; } # } print "Sbend -name $name -synrad \$sbend_synrad -length $arc_length -angle $angle -e0 \$e0 -E1 $half_angle -E2 $half_angle"; if ($k1l != 0.0) { print " -K \[expr $k1l*\$e0\]"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($keyword =~ /SBEND/) { my $half_angle = $angle * 0.5; # if($chk) { # I comment it for the moment because the bend always have the same names if ($length != 0) { print "Girder\n"; } # } print "Sbend -name $name -synrad \$sbend_synrad -length $length -angle $angle -e0 \$e0 -E1 $half_angle -E2 $half_angle"; if ($k1l != 0.0) { print " -K \[expr $k1l*\$e0\]"; } if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } print "set e0 \[expr \$e0-14.1e-6*$angle*$angle/$length*\$e0*\$e0*\$e0*\$e0*\$sbend_synrad\]\n"; } elsif ($keyword =~ /MATRIX/) { } elsif ($keyword =~ /LCAVITY/) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } print "Cavity -name $name -length $length\n"; } elsif ($keyword =~ /TWCAVITY/) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } # print "Cavity -name $name -length $length\n"; print "Drift -name $name -length $length\n"; } elsif ($keyword =~ /RCOLLIMATOR/) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } if($coll!=0){ print "# WARNING: for the collimator wakefield studies you need to add more info ==> Adding a Collimator commented \n"; print "# Collimator -name $name -length $length \n"; } else { print "Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape rectangular -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape rectangular -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape rectangular -aperture_x 0.008 -aperture_y 0.008\n"; } } } elsif ($keyword =~ /ECOLLIMATOR/) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } if($coll!=0){ print "# WARNING: for the collimator wakefield studies you need to add more info ==> Adding a Collimator commented \n"; print "# Collimator -name $name -length $length \n"; } else { print "Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } } elsif ($keyword =~ /HKICKER/) { # print "Girder\n"; print "# HCORRECTOR -name $name -length $length\n"; if($chk && $chl) { if ($length != 0) { print "Girder\n"; print "Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } } } elsif ($keyword =~ /VKICKER/) { # print "Girder\n"; print "# VCORRECTOR -name $name -length $length\n"; if($chk && $chl) { if ($length != 0) { print "Girder\n"; print "Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } } } elsif ($keyword =~ /MARKER/) { if($chk && $chl) { if ($length != 0) { print "#Girder\n"; } } print "#Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } elsif ($keyword =~ /MONITOR/) { if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } print "Bpm -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } else { print "# UNKNOWN: @line\n"; if($chk && $chl) { if ($length != 0) { print "Girder\n"; } } print "Drift -name $name -length $length"; if($apx !=0 && $apy !=0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apy\n"; } elsif($apx !=0 && $apy ==0){ print " -aperture_shape elliptic -aperture_x $apx -aperture_y $apx\n"; } else { print " -aperture_shape elliptic -aperture_x 0.008 -aperture_y 0.008\n"; } } }
pymad/cpymad
src/cern/cpymad/_models/repdata/CLICr/MainBeam/BDS/v_10_10_11/madx2placet_bds.pl
Perl
apache-2.0
21,249
package VMOMI::VmFailedToPowerOffEvent; use parent 'VMOMI::VmEvent'; use strict; use warnings; our @class_ancestors = ( 'VmEvent', 'Event', 'DynamicData', ); our @class_members = ( ['reason', 'LocalizedMethodFault', 0, ], ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
stumpr/p5-vmomi
lib/VMOMI/VmFailedToPowerOffEvent.pm
Perl
apache-2.0
463
#!/usr/bin/perl use Digest::MD5 qw(md5 md5_hex md5_base64); @testfiles = (); sub findfiles { my $path = shift; opendir(my $dh, $path) || die "Can't opendir: $!"; while (my $filename = readdir($dh)) { if (($filename =~ m/_tests\.c$/i) && -f "$path/$filename") { push @testfiles, "$path/$filename"; } elsif (!($filename =~ m/(^bin$)|(^obj$)|(^\.)/i) && -d "$path/$filename") { findfiles("$path/$filename"); } } closedir $dh; } findfiles("."); print "Updating test suite include files.\r\n"; $updated = 0; @testsuites = (); foreach $filename (@testfiles) { # Figure out a suitable output filename. $outputname = $filename; $outputname =~ s/_tests\.c$/_tests.generated.inc/i; # Load the source file. open SOURCE, "<$filename"; my @lines = <SOURCE>; close SOURCE; # Compute a hash of the source file. $currentHash = md5_hex(join("\n", @lines)); # Read the first few lines of the output file to find # the source hash, if there is one. $lastHash = ""; if (open GEN, "<$outputname") { while (<GEN>) { if (m/^\/\/\s*SourceHash:\s*([a-zA-Z0-9]+)/i) { $lastHash = $1; last; } if (m/^[^\/]/) { # Got a line that's not a comment, so we're # not in the comment header anymore and can # skip the rest of the file. last; } } close GEN; } # Record the names of any test suites we find, since the summary # file will need all of them even if this set didn't change. foreach $line (@lines) { if ($line =~ m/^\s*TEST_SUITE\((\w+)\)/i) { $name = $1; push @testsuites, $name; } } # If the source file hasn't changed, don't bother updating the # output file. if ($lastHash eq $currentHash) { next; } # Generate a new output file. print "Writing $outputname\r\n"; open DEST, ">$outputname"; print DEST "// This file was auto-generated. Do not edit!\r\n"; print DEST "//\r\n"; print DEST "// SourceHash: $currentHash\r\n"; my $last_suite = 0; foreach $line (@lines) { if ($line =~ m/^\s*TEST_SUITE\((\w+)\)/i) { $name = $1; if ($last_suite) { print DEST "}\r\n" . "END_TEST_SUITE($last_suite)\r\n"; } print DEST "\r\nSTART_TEST_SUITE($name)\r\n" . "{\r\n"; $last_suite = $name; } elsif ($line =~ m/^\s*START_TEST\((\w+)\)/i) { $test = $1; print DEST "\t$test,\r\n"; } } if ($last_suite) { print DEST "}\r\n" . "END_TEST_SUITE($last_suite)\r\n"; } print DEST "\r\n"; close DEST; $updated++; } print "$updated files changed.\r\n"; if ($updated > 0) { print "Writing testsuites.generated.inc.\r\n"; open DEST, ">testsuites.generated.inc"; print DEST "// This file was auto-generated. Do not edit!\r\n\r\n"; @testsuites = sort @testsuites; foreach $testsuite (@testsuites) { print DEST "EXTERN_TEST_SUITE($testsuite);\r\n"; } print DEST "\r\n" . "TestSuiteResults *RunAllTests()\r\n" . "{\r\n" . "\tTestSuiteResults *results = CreateEmptyTestSuiteResults();\r\n" . "\r\n"; foreach $testsuite (@testsuites) { print DEST "\tRUN_TEST_SUITE(results, $testsuite);\r\n"; } print DEST "\r\n" . "\tDisplayTestSuiteResults(results);\r\n" . "\r\n" . "\treturn results;\r\n" . "}\r\n" . "\r\n"; print DEST "\r\n" . "const char *TestSuiteNames[] = {\r\n"; foreach $testsuite (@testsuites) { print DEST "\t\"$testsuite\",\r\n"; } print DEST "};\r\n" . "\r\n"; print DEST "\r\n" . "int NumTestSuites = " . @testsuites . ";\r\n" . "\r\n"; close DEST; }
seanofw/smile
smilelibtests/gentests.pl
Perl
apache-2.0
3,448
#!/usr/bin/env perl # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute # Copyright [2016-2020] EMBL-European Bioinformatics Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. =head1 NAME load_refseq_synonyms.pl =head1 SYNOPSIS load_refseq_synonyms.pl [arguments] =head1 DESCRIPTION NCBI RefSeq gff files use RefSeq's own identifiers instead of INSDC identifiers for contig/scaffold/chromosome since they do their own fixes to the sequence. Currently we do not store the RefSeq accession in the seq_region_synonym table therefore we have no 'hook' onto a slice in the database. This script will populate the seq_region_synonym table with a mapping between INSDC and RefSeq genomic identifiers. Usage: perl load_refseq_synonyms.pl -workdir /dir/ \ -host hostname \ -dbname dbname \ -port port \ -user username \ -pass password \ -verbose \ -species scientific_name \ -cleanup -workdir location used for downloading and writing logfile to -verbose turn on more verbose logging -species run on a single species formatted thus: anolis_carolinensis -cleanup clean up files after use =head1 AUTHOR Daniel Barrell <dbarrell@ebi.ac.uk>, Ensembl genebuild team =head1 CONTACT Please post comments/questions to the Ensembl development list <http://lists.ensembl.org/mailman/listinfo/dev> =cut use strict; use warnings; use Bio::EnsEMBL::DBSQL::DBAdaptor; use Bio::EnsEMBL::Registry; use Net::FTP; use Getopt::Long; use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::UnmappedObject; my $workdir = ''; my $verbose = ''; my $species = ''; my $dbhost = ''; my $dbname = ''; my $dbport = '3306'; my $dbuser = 'ensro'; my $dbpass = ''; my $help = 0; my $cleanup = 0; my $ass_checked = 0; my $cs = 'toplevel'; &GetOptions( 'workdir:s' => \$workdir, 'verbose!' => \$verbose, 'species:s' => \$species, 'dbhost:s' => \$dbhost, 'dbuser:s' => \$dbuser, 'dbname:s' => \$dbname, 'dbpass:s' => \$dbpass, 'dbport:n' => \$dbport, 'help' => \$help, 'cleanup' => \$cleanup, 'coord_system|cs:s' => \$cs, # undocumented, only used for debugging ); if (!$workdir or !$species or !$dbhost or !$dbname or !$dbuser or !$dbpass or $help) { &usage; exit(1); } my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor( -port => $dbport, -user => $dbuser, -host => $dbhost, -dbname => $dbname, -pass => $dbpass ); my $sa = $db->get_SliceAdaptor; my $refseq_external_db_id = get_refseq_external_db_id(); printf STDERR "# External DB ID for RefSeq is: %s\n", $refseq_external_db_id if $verbose; my $ensembl_assembly_version = get_assembly_name_from_ensembl(); printf STDERR "# Assembly in Ensembl is: %s\n", $ensembl_assembly_version if $verbose; my $ftphost = "ftp.ncbi.nlm.nih.gov"; my $ftpuser = "anonymous"; my $ftppassword = ""; my $f = Net::FTP->new($ftphost) or die "Can't open $ftphost\n"; $f->login($ftpuser, $ftppassword) or die "Can't log $ftpuser in\n"; # hash lookup of RefSeq identifiers given an INSDC identifier. my %INSDC2RefSeq; $species = ucfirst($species); unless(-e $workdir) { my $cmd = "mkdir -p ".$workdir."/".$species; my $return = system($cmd); if($return) { die("Could not create dir for $species\n.Commandline used:\n".$cmd); } } printf STDERR "Looking for %s accession mapping files\n", $species; # Scaffold_names file. Always look for this file whether we have # assembled chromosomes or not. We always look here first to check that we # are using the same assembly, if we do not then there is no point in continuing my $fdir = "/genomes/".$species; if ($f->cwd($fdir)) { local $, = ','; my @files = $f->ls; print STDERR " Found files:\n ", @files, "\n" if $verbose; foreach my $file_to_get ( @files ) { next unless $file_to_get =~ /^scaffold_names$/; print STDERR " Downloading $file_to_get...\n"; my $local_file_location = $workdir.'/'.$species.'/'.$file_to_get; $f->get($file_to_get, $local_file_location) or throw("Can't get $file_to_get from $fdir\n"); print STDERR " Download complete.\n" if $verbose; #TODO change: at the moment you need to be in the workdir open(ACC,"<",$local_file_location) or throw("Could not open $local_file_location"); while(<ACC>) { my $line = $_; next if $line =~ /^#/; my ($ass, $insdc, $refseq) = ('',''); if ($line =~ /^(.*)\t.*\t(.*)\t(.*)\t.*$/) { ($ass, $refseq, $insdc) = ($1, $2, $3); unless ($ass_checked) { $ass_checked = "true"; $ass =~ s/[^1-9]//g; # to ensure matching of RNOR5 and Rnor_5.0 if ($ass ne $ensembl_assembly_version) { throw("Assembly in Ensembl ($ensembl_assembly_version) is different to what RefSeq has annotated ($ass)") } } $INSDC2RefSeq{$insdc} = $refseq unless exists $INSDC2RefSeq{$insdc}; } else { throw ("line malformed:\n",$line) } } close ACC; } } else { printf STDERR "%s: No scaffold_name file found - This species not on RefSeq ftp site?\n",$species; } # Does this organism have assembled chromosomes? $fdir = "/genomes/".$species."/Assembled_chromosomes"; if ($f->cwd($fdir)) { # there are assembled chromosomes available for this species local $, = ','; my @files = $f->ls; if ($verbose) { print STDERR " Found files:\n ", @files, "\n"; } foreach my $file_to_get ( @files ) { next unless $file_to_get =~ /^.*_accessions_.*$/; print STDERR " Downloading $file_to_get...\n"; my $local_file_location = $workdir.'/'.$species.'/'.$file_to_get; $f->get($file_to_get, $local_file_location) or die "Can't get $file_to_get from $fdir\n"; print STDERR " Download complete.\n" if $verbose; open(ACC,"<",$local_file_location) or throw("Could not open $local_file_location"); while(<ACC>) { my $line = $_; next if $line =~ /^#/; my ($insdc, $refseq) = ('',''); if ($line =~ /^\S+\t(\S+)\t\S+\t(\S+)\t\S+$/) { ($refseq, $insdc) = ($1, $2); $INSDC2RefSeq{$insdc} = $refseq unless exists $INSDC2RefSeq{$insdc}; } else { throw ("line malformed:\n",$line) } } close ACC; } } else { printf STDERR "%s: No Asssembled_chromosome folder on refseq ftp site\n",$species; } if ($cleanup) { `rm -rf $species`; print STDERR "Removed mapping directory\n"; } $f->quit; # Now we have a mapping, update the database: foreach my $insdc (keys %INSDC2RefSeq) { my $refseq = $INSDC2RefSeq{$insdc}; # For anolis everything had a version except AAWZ.* strip the version for these $insdc =~ s/\.\d+$// if $insdc =~ /^AAWZ.*/; next if $insdc =~ /^EU.*/; # basically, skip it # TODO we may not want to skip MT for some species my $slice = $sa->fetch_by_region($cs, $insdc); # some accesions found are not on the assembly we have loaded, if so, report and move on if (!defined $slice) { print "Warning: " . $insdc . " not found in the assembly that is loaded in " . $dbname . "\n"; next; } # TODO may be the case that some species do not have chromosome accessions. # write the synonyms directly to the database $slice->add_synonym($refseq, $refseq_external_db_id); $sa->update($slice); } exit 0; # SUBS # not necessarily needed - external db id should be constant sub get_refseq_external_db_id { my $sth_refseq = $db->dbc->prepare('SELECT external_db_id FROM external_db WHERE db_name = "RefSeq_genomic"'); $sth_refseq->execute(); my ($refseq_db_id) = $sth_refseq->fetchrow_array; throw("No RefSeq DB in Ensembl") unless defined $refseq_db_id; return $refseq_db_id; } # Sometimes NCBI has a different version of the assembly - we # need to check and to skip these, since it would be a waste of time sub get_assembly_name_from_ensembl { my $sth_assembly = $db->dbc->prepare('SELECT meta_value FROM meta WHERE meta_key = "assembly.name"'); $sth_assembly->execute(); my ($assembly_version) = $sth_assembly->fetchrow_array; throw("No Assembly version in Ensembl meta table") unless defined $assembly_version; $assembly_version =~ s/[^1-9]//g; # to ensure matching of RNOR5 and Rnor_5.0 return $assembly_version; } sub usage { print <<EOF Usage: $0 -workdir <workdir> -sqlfile <sqlfile> -species <scientific_name> -dbhost <dbhost> [-dbport <dbport>] -dbname <dbname> -dbuser <dbuser> -dbpass <dbpass> [-verbose] [-help] -workdir Local path where work will take place -species which species to run e.g. 'homo_sapiens' -dbhost host name where the reference database will be created -dbport what port to connect (default 3306) -dbname name for the new reference db that will be created -dbuser what username to connect as -dbpass what password to use -verbose Use this option to get more print statements to follow the script. Set to 0 (not verbose) by default to get only the final summary. -help Show usage. -cleanup Remove files downloaded and species directory after creation of mapping Example: bsub -M 1000 -R 'select[mem>1000] rusage[mem=1000]' -o refseq_synonym.out -e refseq_synonym.err "perl load_refseq_synonyms.pl -workdir ./refseq_synonyms -species anolis_carolinensis -dbhost host -dbname anolis_carolinensis_core_75_2 -dbuser *** -dbpass *** -verbose" EOF } 1;
Ensembl/ensembl-pipeline
scripts/refseq_import/load_refseq_synonyms.pl
Perl
apache-2.0
10,601
#!/usr/bin/perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../../lib"; use lib "$FindBin::Bin/../../lib/Grids/VM/Memory/lib"; use lib "$FindBin::Bin/../../lib/Grids/VM/Memory/blib/arch/auto/Grids/VM/Memory"; use lib "$FindBin::Bin/../../lib/Grids/VM/Register/lib"; use lib "$FindBin::Bin/../../lib/Grids/VM/Register/blib/arch/auto/Grids/VM/Register"; use Grids::VM; use Grids::Console; use Grids::Conf; use Grids::Node; use Getopt::Long; use Sys::Hostname; use AnyEvent; my $conffile; my $nodename = hostname; my ($help, $id, $debug); my %prog_opts = ( 'h|help' => \$help, 'n|name' => \$nodename, 'c|conf' => \$conffile, 'i|id' => \$id, 'd|debug' => \$debug, ); GetOptions(%prog_opts); usage() and exit if $help; my $conf = Grids::Conf->new(conf_file => $conffile); # main loop condition my $main = AnyEvent->condvar; my $con = Grids::Console->new( cv => $main, conf => $conf, title => "GridsNode", prompt => "GridsNode [$nodename]> ", handlers => { help => \&help, set => \&Grids::Console::set, save => \&Grids::Console::save, list => \&Grids::Console::list, }, ); run(); sub client_connected { my ($node, $connection, $peer_name) = @_; $con->print("Client $peer_name connected, encrypted transport enabled"); } sub client_disconnected { my ($node, $connection, $peer_name) = @_; $con->print("Client $peer_name disconnected, encrypted transport disabled"); } sub run { $con->print("Loaded settings from " . $conf->file_name) if $conf->loaded; # get identity my $identity = $con->interactively_load_identity; unless ($identity) { $con->print_error("No identity specified"); exit 0; } # create node my $node = Grids::Node->new( conf => $conf, log_level => $debug ? 5 : 3, id => $identity, transport_driver => 'TCP::AnyEvent', autosave_configuration => 1, autoload_configuration => 1, ); # register hooks here $node->register_hook('Connected', \&client_connected); $node->register_hook('Disconnected', \&client_disconnected); # listen for connections $node->listen; # listen for user input $con->listen_for_input; local $SIG{INT} = sub { $main->send; }; # main loop $main->recv; } sub help { my @args = @_; return q { set - set/view server variables save - save settings list - show all variables quit - quit }; } sub usage { my @args = @_; print qq { usage: $0 [-cnihd] -c[onf]: specify a configuration file. default is "gridsnode.conf" -n[ame]: specify node name -d[ebug]: enable debug output -i[d]: specify an identity to use -h[help]: print this help }; }
revmischa/grids
tools/node/gridsnode.pl
Perl
bsd-3-clause
2,784
use WebServices::Zazzle; use Digest::MD5 qw(md5_hex); use LWP::UserAgent; use URI::Escape qw(uri_escape); use XML::Simple qw(xml_in); # Test 1: object initialization my $obj = WebServices::Zazzle->new('user', 'secret'); print "ok 1\n"; # Test 2: test md5_hex my $good_sum = 'd67673f506f955d7c61821867a3a41dc'; my $test_sum = Digest::MD5::md5_hex('user', 'secret'); if ($test_sum eq $good_sum) { print "ok 2\n"; } else { print "fail 2\n"; } # Test 3: test uri_escape my $plain = 'string with symbols: !@#$%^&*()_-+='; my $coded = 'string%20with%20symbols%3A%20%21%40'; $coded .= '%23%24%25%5E%26%2A%28%29_-%2B%3D'; if (uri_escape($plain, "^A-Za-z0-9\-\._~") eq $coded) { print "ok 3\n"; } else { print "fail 3\n"; } # Test 4: test xml_in my $xml = '<xml><cat><status>Success</status></cat></xml>'; my $hr = xml_in($xml, ForceArray => ['cat']); if ($hr->{'cat'}->[0]->{'status'} eq 'Success') { print "ok 4\n"; } else { print "fail 4\n"; }
troby/zazzle
test.pl
Perl
bsd-3-clause
950
#!/usr/bin/perl # Copyright (c) 2015 Genome Research Ltd. # # Author: Robert Davies <rmd+git@sanger.ac.uk> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # 3. Neither the names Genome Research Ltd and Wellcome Trust Sanger Institute # nor the names of its contributors may be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY GENOME RESEARCH LTD AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL GENOME RESEARCH LTD OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. use strict; use warnings; use Getopt::Long; my $start = 0; my $end; my $mutex = 1; my $signal = 1; my $cond = 1; my $wait = 0; my $run = 1; my $out = ""; my $usage = "Usage: $0 -start <time> -end <time> -out <data_file> <input>\n"; GetOptions('start=s' => \$start, 'end=s' => \$end, 'stop=s' => \$end, 'mutex!' => \$mutex, 'signal!' => \$signal, 'cond!' => \$cond, 'wait!' => \$wait, 'run!' => \$run, 'out=s' => \$out) || die $usage; unless ($out) { die "Error: -out option is needed.\n$usage\n"; } my %threads; while (<>) { my ($time, $thread, $status) = split(); if (defined($end) && $time < $end) { push(@{$threads{$thread}}, [$time, hex($status)]); } } open(my $data_out, '>', $out) || die "Couldn't open $out : $!\n"; my @counts = (0) x 5; foreach my $thread (sort { $a <=> $b } keys %threads) { my $events = $threads{$thread}; my $stopped = 0; my $last_restart = 0; my $last_stop = 0; my $count = 0; foreach my $evt (@$events) { if ($evt->[0] > $end) { last; } my $status = $evt->[1] & 1; my $etype = ($evt->[1] & 0xf0) / 16; my $is_signal = $etype >= 3; next if (!$mutex && $etype == 1); next if (!$cond && $etype == 2); if (!$is_signal && $status != $stopped) { if ($status) { if ($run && $evt->[0] >= $start) { printf($data_out "%.9f %f 0\n%.9f %f 0\n\n", $last_restart > $start ? $last_restart : $start, $thread + $count / 20, $evt->[0], $thread + $count / 20); $counts[0]++; } $last_stop = $evt->[0]; } else { if ($wait && $evt->[0] >= $start) { my $offset = $etype == 1 ? 0.1 : 0.2; printf($data_out "%.9f %f %d\n%.9f %f %d\n\n", $last_stop > $start ? $last_stop : $start, $thread + $offset, $etype, $evt->[0], $thread + $offset, $etype); $counts[$etype]++; } $last_restart = $evt->[0]; } $stopped = $status; } if ($evt->[0] >= $start && $signal && $is_signal) { printf($data_out "%.9f %f %d\n%.9f %f %d\n\n", $evt->[0], $thread + 0.3, $etype, $evt->[0], $thread + 0.35, $etype); $counts[$etype]++; } } if (!$stopped && $last_restart < $end) { printf($data_out "%.9f %f 0\n%.9f %f 0\n\n", $last_restart > $start ? $last_restart : $start, $thread + $count / 20, $end, $thread + $count / 20); $counts[0]++; } } close($data_out) || die "Error writing to $out : $_\n"; my @line_types = (1, 9, 5, 3, 7); my @titles = ('Running', 'Mutex', 'Conditional', 'Signal', 'Broadcast'); my $plot_file = qq[plot "$out"]; for (my $i = 0; $i < @line_types; $i++) { next unless ($counts[$i]); printf('%s using 1:($3 == %d ? $2 : 1/0) w l lt %d lw 2 title "%s"', $plot_file, $i, $line_types[$i], $titles[$i]); $plot_file = ', ""'; } print "\n"; exit; =head1 NAME pmon_plot.pl - Convert pthread_mon data to gnuplot data files =head1 SYNOPSIS pmon_plot.pl -start <time> -stop <time> -out <data_file> <input_file> =head1 DESCRIPTION A simple script to convert the output from pthread_mon.so into something that can be drawn using gnuplot. If given too much data, gnuplot can become slow and may run into problems with loss of significant figures. This script can be used to select a small region of the data to draw. The script writes the plot data to the location given in the -out parameter. It also writes a gnuplot script to view the data to STDOUT. =head1 OPTIONS =over 4 =item -out <data_file> The location of the data file for gnuplot. This option must be present. =item -start <time> Time-point in the input file to start plotting from. =item -stop <time> Time-point where the plot should end. =item -end <time> Synonym for -stop. =item -[no]mutex If -nomutex is used, periods where threads wait for mutexes are ignored and appear as if the thread is running. Default is -mutex. =item -[no]cond If -nocond is used, periods where threads wait for condes are ignored and appear as if the thread is running. Default is -cond. =item -[no]signal Switch showing cond_signal and cond_broadcast events on or off. Default is -signal. =item -[no]wait Switch drawing lines representing times when the thread is waiting on or off. Default it -nowait. =item -[no]run Switch drawing lines representing times when the thread is not waiting on or off. Default is -run. =back =head1 AUTHOR Rob Davies. =cut
daviesrob/pthread_mon
pmon_plot.pl
Perl
bsd-3-clause
6,022
% Frame number: 0 % Frame number: 1 % Frame number: 2 % Frame number: 3 happensAt( walking( id0 ), 120 ). holdsAt( coord( id0 )=( 182, 197 ), 120 ). holdsAt( coord( id1 )=( 71, 77 ), 120 ). % Frame number: 4 % Frame number: 5 happensAt( walking( id0 ), 200 ). % Frame number: 6 % Frame number: 7 happensAt( walking( id1 ), 280 ). % Frame number: 8 % Frame number: 9 happensAt( walking( id2 ), 360 ). % Frame number: 10 % Frame number: 11 holdsAt( coord( id2 )=( 79, 65 ), 440 ). % Frame number: 12 happensAt( walking( id2 ), 480 ). % Frame number: 13 happensAt( walking( id2 ), 520 ). % Frame number: 14 % Frame number: 15 % Frame number: 16 holdsAt( coord( id0 )=( 174, 164 ), 640 ). % Frame number: 17 % Frame number: 18 happensAt( walking( id2 ), 720 ). % Frame number: 19 % Frame number: 20 holdsAt( coord( id1 )=( 71, 85 ), 800 ). happensAt( walking( id2 ), 800 ). % Frame number: 21 % Frame number: 22 happensAt( walking( id0 ), 880 ). % Frame number: 23 % Frame number: 24 happensAt( walking( id0 ), 960 ). % Frame number: 25 % Frame number: 26 % Frame number: 27 % Frame number: 28 % Frame number: 29 % Frame number: 30 % Frame number: 31 % Frame number: 32 holdsAt( coord( id1 )=( 72, 88 ), 1280 ). % Frame number: 33 happensAt( walking( id1 ), 1320 ). % Frame number: 34 % Frame number: 35 % Frame number: 36 % Frame number: 37 % Frame number: 38 % Frame number: 39 happensAt( walking( id2 ), 1560 ). holdsAt( coord( id2 )=( 81, 75 ), 1560 ). % Frame number: 40 holdsAt( coord( id2 )=( 81, 75 ), 1600 ). % Frame number: 41 % Frame number: 42 % Frame number: 43 % Frame number: 44 % Frame number: 45 % Frame number: 46 % Frame number: 47 % Frame number: 48 happensAt( walking( id0 ), 1920 ). holdsAt( coord( id0 )=( 182, 119 ), 1920 ). happensAt( walking( id1 ), 1920 ). % Frame number: 49 happensAt( walking( id2 ), 1960 ). % Frame number: 50 happensAt( walking( id2 ), 2000 ). % Frame number: 51 % Frame number: 52 holdsAt( coord( id1 )=( 73, 94 ), 2080 ). % Frame number: 53 % Frame number: 54 % Frame number: 55 holdsAt( coord( id0 )=( 182, 119 ), 2200 ). % Frame number: 56 happensAt( walking( id0 ), 2240 ). holdsAt( coord( id1 )=( 73, 99 ), 2240 ). % Frame number: 57 % Frame number: 58 holdsAt( coord( id0 )=( 181, 119 ), 2320 ). % Frame number: 59 % Frame number: 60 % Frame number: 61 % Frame number: 62 % Frame number: 63 holdsAt( coord( id0 )=( 179, 119 ), 2520 ). % Frame number: 64 holdsAt( coord( id2 )=( 83, 80 ), 2560 ). % Frame number: 65 happensAt( walking( id1 ), 2600 ). % Frame number: 66 holdsAt( coord( id2 )=( 84, 81 ), 2640 ). % Frame number: 67 % Frame number: 68 holdsAt( coord( id0 )=( 176, 118 ), 2720 ). holdsAt( coord( id2 )=( 85, 81 ), 2720 ). % Frame number: 69 happensAt( walking( id2 ), 2760 ). % Frame number: 70 % Frame number: 71 happensAt( walking( id2 ), 2840 ). % Frame number: 72 % Frame number: 73 happensAt( active( id0 ), 2920 ). holdsAt( coord( id0 )=( 173, 112 ), 2920 ). % Frame number: 74 happensAt( walking( id1 ), 2960 ). % Frame number: 75 % Frame number: 76 % Frame number: 77 % Frame number: 78 % Frame number: 79 % Frame number: 80 % Frame number: 81 holdsAt( coord( id2 )=( 88, 82 ), 3240 ). % Frame number: 82 holdsAt( coord( id2 )=( 88, 83 ), 3280 ). % Frame number: 83 % Frame number: 84 % Frame number: 85 % Frame number: 86 happensAt( active( id0 ), 3440 ). % Frame number: 87 % Frame number: 88 % Frame number: 89 happensAt( active( id0 ), 3560 ). % Frame number: 90 % Frame number: 91 happensAt( walking( id1 ), 3640 ). % Frame number: 92 % Frame number: 93 % Frame number: 94 holdsAt( coord( id1 )=( 77, 116 ), 3760 ). happensAt( walking( id2 ), 3760 ). % Frame number: 95 % Frame number: 96 % Frame number: 97 holdsAt( coord( id2 )=( 89, 88 ), 3880 ). % Frame number: 98 holdsAt( coord( id1 )=( 77, 118 ), 3920 ). % Frame number: 99 holdsAt( coord( id2 )=( 90, 88 ), 3960 ). % Frame number: 100 % Frame number: 101 % Frame number: 102 % Frame number: 103 % Frame number: 104 % Frame number: 105 holdsAt( coord( id1 )=( 77, 120 ), 4200 ). % Frame number: 106 happensAt( walking( id1 ), 4240 ). % Frame number: 107 % Frame number: 108 holdsAt( coord( id1 )=( 79, 120 ), 4320 ). % Frame number: 109 holdsAt( coord( id2 )=( 93, 90 ), 4360 ). % Frame number: 110 % Frame number: 111 % Frame number: 112 % Frame number: 113 holdsAt( coord( id1 )=( 82, 123 ), 4520 ). % Frame number: 114 % Frame number: 115 % Frame number: 116 holdsAt( coord( id1 )=( 83, 124 ), 4640 ). % Frame number: 117 holdsAt( coord( id0 )=( 180, 120 ), 4680 ). % Frame number: 118 happensAt( walking( id1 ), 4720 ). % Frame number: 119 % Frame number: 120 % Frame number: 121 % Frame number: 122 % Frame number: 123 happensAt( active( id0 ), 4920 ). holdsAt( coord( id0 )=( 180, 119 ), 4920 ). happensAt( walking( id1 ), 4920 ). % Frame number: 124 happensAt( walking( id2 ), 4960 ). % Frame number: 125 happensAt( walking( id2 ), 5000 ). % Frame number: 126 % Frame number: 127 % Frame number: 128 holdsAt( coord( id1 )=( 86, 132 ), 5120 ). happensAt( walking( id2 ), 5120 ). % Frame number: 129 happensAt( walking( id2 ), 5160 ). % Frame number: 130 % Frame number: 131 % Frame number: 132 happensAt( walking( id0 ), 5280 ). holdsAt( coord( id2 )=( 96, 99 ), 5280 ). % Frame number: 133 % Frame number: 134 % Frame number: 135 % Frame number: 136 holdsAt( coord( id2 )=( 98, 100 ), 5440 ). % Frame number: 137 % Frame number: 138 % Frame number: 139 % Frame number: 140 % Frame number: 141 % Frame number: 142 % Frame number: 143 % Frame number: 144 % Frame number: 145 happensAt( walking( id0 ), 5800 ). % Frame number: 146 % Frame number: 147 happensAt( walking( id0 ), 5880 ). happensAt( walking( id2 ), 5880 ). % Frame number: 148 % Frame number: 149 happensAt( walking( id1 ), 5960 ). % Frame number: 150 % Frame number: 151 % Frame number: 152 % Frame number: 153 holdsAt( coord( id2 )=( 103, 109 ), 6120 ). % Frame number: 154 happensAt( walking( id0 ), 6160 ). % Frame number: 155 % Frame number: 156 % Frame number: 157 % Frame number: 158 happensAt( walking( id0 ), 6320 ). % Frame number: 159 happensAt( walking( id2 ), 6360 ). % Frame number: 160 % Frame number: 161 % Frame number: 162 happensAt( walking( id0 ), 6480 ). holdsAt( coord( id0 )=( 160, 62 ), 6480 ). % Frame number: 163 % Frame number: 164 % Frame number: 165 % Frame number: 166 holdsAt( coord( id0 )=( 161, 57 ), 6640 ). holdsAt( coord( id1 )=( 101, 147 ), 6640 ). % Frame number: 167 holdsAt( coord( id0 )=( 161, 55 ), 6680 ). happensAt( walking( id2 ), 6680 ). % Frame number: 168 happensAt( walking( id1 ), 6720 ). % Frame number: 169 happensAt( walking( id1 ), 6760 ). % Frame number: 170 happensAt( walking( id2 ), 6800 ). % Frame number: 171 happensAt( walking( id1 ), 6840 ). % Frame number: 172 happensAt( walking( id0 ), 6880 ). % Frame number: 173 holdsAt( coord( id2 )=( 113, 111 ), 6920 ). % Frame number: 174 happensAt( walking( id2 ), 6960 ). % Frame number: 175 happensAt( walking( id0 ), 7000 ). % Frame number: 176 holdsAt( coord( id1 )=( 103, 149 ), 7040 ). % Frame number: 177 % Frame number: 178 % Frame number: 179 % Frame number: 180 % Frame number: 181 happensAt( walking( id2 ), 7240 ). % Frame number: 182 % Frame number: 183 happensAt( walking( id2 ), 7320 ). % Frame number: 184 holdsAt( coord( id1 )=( 111, 150 ), 7360 ). % Frame number: 185 % Frame number: 186 holdsAt( coord( id0 )=( 164, 37 ), 7440 ). % Frame number: 187 holdsAt( coord( id1 )=( 111, 150 ), 7480 ). % Frame number: 188 happensAt( walking( id2 ), 7520 ). % Frame number: 189 % Frame number: 190 happensAt( walking( id0 ), 7600 ). % Frame number: 191 % Frame number: 192 happensAt( walking( id2 ), 7680 ). % Frame number: 193 % Frame number: 194 % Frame number: 195 happensAt( walking( id1 ), 7800 ). % Frame number: 196 % Frame number: 197 holdsAt( coord( id0 )=( 167, 32 ), 7880 ). % Frame number: 198 holdsAt( coord( id1 )=( 118, 156 ), 7920 ). % Frame number: 199 happensAt( walking( id2 ), 7960 ). % Frame number: 200 % Frame number: 201 % Frame number: 202 % Frame number: 203 holdsAt( coord( id0 )=( 169, 31 ), 8120 ). % Frame number: 204 % Frame number: 205 happensAt( walking( id0 ), 8200 ). % Frame number: 206 holdsAt( coord( id1 )=( 121, 158 ), 8240 ). % Frame number: 207 % Frame number: 208 holdsAt( coord( id1 )=( 121, 158 ), 8320 ). % Frame number: 209 % Frame number: 210 happensAt( walking( id1 ), 8400 ). % Frame number: 211 happensAt( walking( id0 ), 8440 ). holdsAt( coord( id1 )=( 122, 159 ), 8440 ). % Frame number: 212 % Frame number: 213 holdsAt( coord( id1 )=( 124, 159 ), 8520 ). % Frame number: 214 % Frame number: 215 happensAt( walking( id0 ), 8600 ). happensAt( walking( id2 ), 8600 ). % Frame number: 216 holdsAt( coord( id1 )=( 129, 159 ), 8640 ). % Frame number: 217 % Frame number: 218 holdsAt( coord( id2 )=( 137, 121 ), 8720 ). % Frame number: 219 holdsAt( coord( id2 )=( 138, 121 ), 8760 ). % Frame number: 220 % Frame number: 221 % Frame number: 222 % Frame number: 223 holdsAt( coord( id0 )=( 174, 28 ), 8920 ). happensAt( walking( id1 ), 8920 ). % Frame number: 224 holdsAt( coord( id1 )=( 134, 158 ), 8960 ). % Frame number: 225 % Frame number: 226 % Frame number: 227 % Frame number: 228 % Frame number: 229 holdsAt( coord( id1 )=( 136, 158 ), 9160 ). % Frame number: 230 % Frame number: 231 % Frame number: 232 % Frame number: 233 holdsAt( coord( id1 )=( 139, 159 ), 9320 ). % Frame number: 234 happensAt( walking( id0 ), 9360 ). % Frame number: 235 % Frame number: 236 % Frame number: 237 holdsAt( coord( id2 )=( 151, 123 ), 9480 ). % Frame number: 238 % Frame number: 239 % Frame number: 240 % Frame number: 241 happensAt( walking( id1 ), 9640 ). % Frame number: 242 % Frame number: 243 % Frame number: 244 % Frame number: 245 % Frame number: 246 % Frame number: 247 % Frame number: 248 happensAt( walking( id1 ), 9920 ). % Frame number: 249 % Frame number: 250 % Frame number: 251 % Frame number: 252 % Frame number: 253 % Frame number: 254 % Frame number: 255 happensAt( active( id1 ), 10200 ). holdsAt( coord( id2 )=( 161, 131 ), 10200 ). % Frame number: 256 % Frame number: 257 happensAt( walking( id2 ), 10280 ). % Frame number: 258 % Frame number: 259 % Frame number: 260 % Frame number: 261 % Frame number: 262 % Frame number: 263 % Frame number: 264 holdsAt( coord( id2 )=( 172, 134 ), 10560 ). % Frame number: 265 % Frame number: 266 % Frame number: 267 % Frame number: 268 holdsAt( coord( id1 )=( 153, 160 ), 10720 ). % Frame number: 269 % Frame number: 270 % Frame number: 271 % Frame number: 272 % Frame number: 273 % Frame number: 274 % Frame number: 275 happensAt( walking( id2 ), 11000 ). % Frame number: 276 % Frame number: 277 % Frame number: 278 holdsAt( coord( id2 )=( 180, 144 ), 11120 ). % Frame number: 279 % Frame number: 280 holdsAt( coord( id1 )=( 154, 159 ), 11200 ). % Frame number: 281 % Frame number: 282 happensAt( walking( id2 ), 11280 ). % Frame number: 283 % Frame number: 284 % Frame number: 285 happensAt( walking( id2 ), 11400 ). % Frame number: 286 % Frame number: 287 holdsAt( coord( id1 )=( 155, 158 ), 11480 ). holdsAt( coord( id2 )=( 186, 152 ), 11480 ). % Frame number: 288 % Frame number: 289 % Frame number: 290 % Frame number: 291 holdsAt( coord( id1 )=( 156, 158 ), 11640 ). % Frame number: 292 % Frame number: 293 % Frame number: 294 % Frame number: 295 % Frame number: 296 happensAt( active( id2 ), 11840 ). % Frame number: 297 % Frame number: 298 % Frame number: 299 % Frame number: 300 % Frame number: 301 % Frame number: 302 % Frame number: 303 % Frame number: 304 holdsAt( coord( id2 )=( 194, 152 ), 12160 ). % Frame number: 305 happensAt( walking( id1 ), 12200 ). % Frame number: 306 % Frame number: 307 happensAt( active( id2 ), 12280 ). % Frame number: 308 happensAt( walking( id1 ), 12320 ). % Frame number: 309 happensAt( active( id2 ), 12360 ). % Frame number: 310 % Frame number: 311 % Frame number: 312 holdsAt( coord( id2 )=( 193, 151 ), 12480 ). % Frame number: 313 % Frame number: 314 holdsAt( coord( id2 )=( 192, 150 ), 12560 ). % Frame number: 315 % Frame number: 316 % Frame number: 317 % Frame number: 318 holdsAt( coord( id2 )=( 190, 150 ), 12720 ). % Frame number: 319 % Frame number: 320 % Frame number: 321 % Frame number: 322 % Frame number: 323 % Frame number: 324 % Frame number: 325 holdsAt( coord( id1 )=( 165, 170 ), 13000 ). % Frame number: 326 % Frame number: 327 % Frame number: 328 % Frame number: 329 % Frame number: 330 % Frame number: 331 % Frame number: 332 % Frame number: 333 % Frame number: 334 % Frame number: 335 holdsAt( coord( id1 )=( 165, 169 ), 13400 ). % Frame number: 336 % Frame number: 337 % Frame number: 338 % Frame number: 339 % Frame number: 340 % Frame number: 341 % Frame number: 342 holdsAt( coord( id1 )=( 165, 169 ), 13680 ). % Frame number: 343 % Frame number: 344 % Frame number: 345 holdsAt( coord( id2 )=( 189, 148 ), 13800 ). % Frame number: 346 holdsAt( coord( id2 )=( 189, 148 ), 13840 ). % Frame number: 347 % Frame number: 348 % Frame number: 349 % Frame number: 350 holdsAt( coord( id1 )=( 165, 169 ), 14000 ). % Frame number: 351 % Frame number: 352 % Frame number: 353 % Frame number: 354 % Frame number: 355 % Frame number: 356 holdsAt( coord( id2 )=( 189, 147 ), 14240 ). % Frame number: 357 % Frame number: 358 happensAt( active( id2 ), 14320 ). % Frame number: 359 % Frame number: 360 % Frame number: 361 % Frame number: 362 % Frame number: 363 % Frame number: 364 % Frame number: 365 % Frame number: 366 holdsAt( coord( id1 )=( 166, 170 ), 14640 ). % Frame number: 367 % Frame number: 368 % Frame number: 369 % Frame number: 370 happensAt( active( id1 ), 14800 ). holdsAt( coord( id1 )=( 166, 170 ), 14800 ). % Frame number: 371 % Frame number: 372 happensAt( active( id1 ), 14880 ). % Frame number: 373 happensAt( active( id1 ), 14920 ). % Frame number: 374 happensAt( active( id2 ), 14960 ). % Frame number: 375 % Frame number: 376 happensAt( active( id1 ), 15040 ). % Frame number: 377 % Frame number: 378 % Frame number: 379 happensAt( active( id1 ), 15160 ). % Frame number: 380 % Frame number: 381 happensAt( active( id1 ), 15240 ). % Frame number: 382 % Frame number: 383 happensAt( active( id1 ), 15320 ). % Frame number: 384 happensAt( active( id1 ), 15360 ). % Frame number: 385 % Frame number: 386 % Frame number: 387 % Frame number: 388 % Frame number: 389 holdsAt( coord( id1 )=( 166, 168 ), 15560 ). % Frame number: 390 happensAt( active( id1 ), 15600 ). % Frame number: 391 holdsAt( coord( id1 )=( 166, 170 ), 15640 ). % Frame number: 392 % Frame number: 393 happensAt( active( id2 ), 15720 ). % Frame number: 394 happensAt( active( id1 ), 15760 ). holdsAt( coord( id1 )=( 166, 171 ), 15760 ). % Frame number: 395 happensAt( active( id2 ), 15800 ). % Frame number: 396 % Frame number: 397 holdsAt( coord( id1 )=( 166, 169 ), 15880 ). % Frame number: 398 % Frame number: 399 % Frame number: 400 % Frame number: 401 % Frame number: 402 % Frame number: 403 holdsAt( coord( id1 )=( 166, 168 ), 16120 ). % Frame number: 404 % Frame number: 405 % Frame number: 406 % Frame number: 407 % Frame number: 408 holdsAt( coord( id2 )=( 189, 141 ), 16320 ). % Frame number: 409 % Frame number: 410 % Frame number: 411 % Frame number: 412 % Frame number: 413 holdsAt( coord( id1 )=( 167, 168 ), 16520 ). % Frame number: 414 % Frame number: 415 % Frame number: 416 % Frame number: 417 % Frame number: 418 happensAt( active( id2 ), 16720 ). % Frame number: 419 % Frame number: 420 % Frame number: 421 holdsAt( coord( id1 )=( 166, 176 ), 16840 ). happensAt( active( id2 ), 16840 ). % Frame number: 422 holdsAt( coord( id1 )=( 166, 177 ), 16880 ). happensAt( active( id2 ), 16880 ). % Frame number: 423 holdsAt( coord( id1 )=( 166, 178 ), 16920 ). % Frame number: 424 % Frame number: 425 happensAt( active( id2 ), 17000 ). % Frame number: 426 % Frame number: 427 happensAt( walking( id1 ), 17080 ). % Frame number: 428 % Frame number: 429 % Frame number: 430 % Frame number: 431 % Frame number: 432 % Frame number: 433 % Frame number: 434 % Frame number: 435 % Frame number: 436 % Frame number: 437 happensAt( walking( id1 ), 17480 ). % Frame number: 438 happensAt( walking( id2 ), 17520 ). % Frame number: 439 % Frame number: 440 happensAt( walking( id1 ), 17600 ). % Frame number: 441 happensAt( walking( id2 ), 17640 ). % Frame number: 442 % Frame number: 443 % Frame number: 444 % Frame number: 445 holdsAt( coord( id1 )=( 176, 199 ), 17800 ). happensAt( walking( id2 ), 17800 ). % Frame number: 446 % Frame number: 447 % Frame number: 448 % Frame number: 449 happensAt( walking( id1 ), 17960 ). % Frame number: 450 % Frame number: 451 happensAt( walking( id2 ), 18040 ). % Frame number: 452 % Frame number: 453 % Frame number: 454 happensAt( walking( id2 ), 18160 ). % Frame number: 455 % Frame number: 456 % Frame number: 457 % Frame number: 458 % Frame number: 459 happensAt( walking( id2 ), 18360 ). % Frame number: 460 % Frame number: 461 % Frame number: 462 happensAt( walking( id1 ), 18480 ). % Frame number: 463 % Frame number: 464 holdsAt( coord( id1 )=( 188, 225 ), 18560 ). % Frame number: 465 % Frame number: 466 % Frame number: 467 % Frame number: 468 happensAt( walking( id1 ), 18720 ). holdsAt( coord( id1 )=( 189, 233 ), 18720 ). happensAt( walking( id2 ), 18720 ). % Frame number: 469 happensAt( walking( id1 ), 18760 ). % Frame number: 470 % Frame number: 471 % Frame number: 472 % Frame number: 473 % Frame number: 474 % Frame number: 475 happensAt( walking( id1 ), 19000 ). % Frame number: 476 % Frame number: 477 % Frame number: 478 % Frame number: 479 % Frame number: 480 % Frame number: 481 % Frame number: 482 holdsAt( coord( id2 )=( 192, 196 ), 19280 ). % Frame number: 483 % Frame number: 484 % Frame number: 485 % Frame number: 486 % Frame number: 487 happensAt( walking( id1 ), 19480 ). % Frame number: 488 % Frame number: 489 % Frame number: 490 % Frame number: 491 holdsAt( coord( id2 )=( 198, 207 ), 19640 ). % Frame number: 492 % Frame number: 493 % Frame number: 494 % Frame number: 495 % Frame number: 496 holdsAt( coord( id1 )=( 212, 272 ), 19840 ). happensAt( walking( id2 ), 19840 ). % Frame number: 497 % Frame number: 498 happensAt( walking( id2 ), 19920 ). % Frame number: 499 happensAt( walking( id1 ), 19960 ). % Frame number: 500 % Frame number: 501 % Frame number: 502 % Frame number: 503 % Frame number: 504 % Frame number: 505 % Frame number: 506 % Frame number: 507 % Frame number: 508 happensAt( walking( id2 ), 20320 ). holdsAt( coord( id2 )=( 202, 235 ), 20320 ). % Frame number: 509 % Frame number: 510 % Frame number: 511 happensAt( walking( id1 ), 20440 ). % Frame number: 512 happensAt( walking( id2 ), 20480 ). % Frame number: 513 % Frame number: 514 % Frame number: 515 % Frame number: 516 % Frame number: 517 % Frame number: 518 % Frame number: 519 % Frame number: 520 % Frame number: 521 holdsAt( coord( id2 )=( 210, 253 ), 20840 ). % Frame number: 522 happensAt( walking( id2 ), 20880 ). % Frame number: 523 % Frame number: 524 % Frame number: 525 % Frame number: 526 % Frame number: 527 % Frame number: 528 % Frame number: 529 % Frame number: 530 % Frame number: 531 % Frame number: 532 % Frame number: 533 % Frame number: 534 % Frame number: 535 % Frame number: 536 % Frame number: 537 % Frame number: 538 % Frame number: 539 % Frame number: 540 % Frame number: 541 % Frame number: 542 % Frame number: 543 % Frame number: 544 % Frame number: 545 % Frame number: 546 % Frame number: 547 holdsAt( coord( id2 )=( 210, 274 ), 21880 ). % Frame number: 548 % Frame number: 549 % Frame number: 550 % Frame number: 551 % Frame number: 552 happensAt( walking( id2 ), 22080 ). % Frame number: 553 holdsAt( coord( id2 )=( 213, 274 ), 22120 ). % Frame number: 554 happensAt( walking( id2 ), 22160 ). holdsAt( coord( id2 )=( 214, 274 ), 22160 ). % Frame number: 555 % Frame number: 556 holdsAt( coord( id2 )=( 215, 274 ), 22240 ). % Frame number: 557 % Frame number: 558 % Frame number: 559 % Frame number: 560 % Frame number: 561 % Frame number: 562 % Frame number: 563 % Frame number: 564 % Frame number: 565 % Frame number: 566 % Frame number: 567 % Frame number: 568 % Frame number: 569 % Frame number: 570 happensAt( walking( id2 ), 22800 ). holdsAt( coord( id2 )=( 219, 279 ), 22800 ). % Frame number: 571 % Frame number: 572 % Frame number: 573 % Frame number: 574 % Frame number: 575 % Frame number: 576 % Frame number: 577 % Frame number: 578 % Frame number: 579 % Frame number: 580 % Frame number: 581 % Frame number: 582 % Frame number: 583 % Frame number: 584 % Frame number: 757 holdsAt( coord( id3 )=( 175, 30 ), 30280 ). % Frame number: 758 holdsAt( coord( id3 )=( 175, 31 ), 30320 ). % Frame number: 759 % Frame number: 760 % Frame number: 761 % Frame number: 762 % Frame number: 763 % Frame number: 764 % Frame number: 765 % Frame number: 766 % Frame number: 767 % Frame number: 768 % Frame number: 769 % Frame number: 770 % Frame number: 771 % Frame number: 772 % Frame number: 773 % Frame number: 774 % Frame number: 775 happensAt( walking( id3 ), 31000 ). % Frame number: 776 % Frame number: 777 happensAt( walking( id3 ), 31080 ). % Frame number: 778 happensAt( walking( id3 ), 31120 ). % Frame number: 779 % Frame number: 780 % Frame number: 781 % Frame number: 782 holdsAt( coord( id3 )=( 169, 34 ), 31280 ). % Frame number: 783 % Frame number: 784 % Frame number: 785 % Frame number: 786 % Frame number: 787 % Frame number: 788 % Frame number: 789 % Frame number: 790 % Frame number: 791 % Frame number: 792 % Frame number: 793 % Frame number: 794 holdsAt( coord( id3 )=( 166, 37 ), 31760 ). % Frame number: 795 % Frame number: 796 % Frame number: 797 % Frame number: 798 holdsAt( coord( id3 )=( 164, 37 ), 31920 ). % Frame number: 799 % Frame number: 800 % Frame number: 801 % Frame number: 802 % Frame number: 803 % Frame number: 804 % Frame number: 805 % Frame number: 806 % Frame number: 807 % Frame number: 808 % Frame number: 809 % Frame number: 810 % Frame number: 811 happensAt( walking( id3 ), 32440 ). % Frame number: 812 % Frame number: 813 % Frame number: 814 % Frame number: 815 % Frame number: 816 % Frame number: 817 % Frame number: 818 happensAt( walking( id3 ), 32720 ). % Frame number: 819 holdsAt( coord( id3 )=( 157, 51 ), 32760 ). % Frame number: 820 % Frame number: 821 % Frame number: 822 % Frame number: 823 % Frame number: 824 % Frame number: 825 % Frame number: 826 % Frame number: 827 % Frame number: 828 happensAt( walking( id3 ), 33120 ). % Frame number: 829 happensAt( walking( id3 ), 33160 ). % Frame number: 830 % Frame number: 831 % Frame number: 832 holdsAt( coord( id3 )=( 158, 62 ), 33280 ). % Frame number: 833 % Frame number: 834 % Frame number: 835 % Frame number: 836 % Frame number: 837 holdsAt( coord( id3 )=( 158, 68 ), 33480 ). % Frame number: 838 % Frame number: 839 % Frame number: 840 % Frame number: 841 % Frame number: 842 % Frame number: 843 % Frame number: 844 % Frame number: 845 % Frame number: 846 % Frame number: 847 happensAt( walking( id3 ), 33880 ). % Frame number: 848 % Frame number: 849 happensAt( walking( id3 ), 33960 ). % Frame number: 850 % Frame number: 851 holdsAt( coord( id3 )=( 169, 78 ), 34040 ). % Frame number: 852 % Frame number: 853 % Frame number: 854 % Frame number: 855 % Frame number: 856 % Frame number: 857 % Frame number: 858 % Frame number: 859 % Frame number: 860 % Frame number: 861 % Frame number: 862 % Frame number: 863 happensAt( walking( id3 ), 34520 ). holdsAt( coord( id3 )=( 180, 86 ), 34520 ). % Frame number: 864 % Frame number: 865 % Frame number: 866 % Frame number: 867 % Frame number: 868 % Frame number: 869 % Frame number: 870 happensAt( walking( id3 ), 34800 ). % Frame number: 871 % Frame number: 872 % Frame number: 873 % Frame number: 874 % Frame number: 875 holdsAt( coord( id3 )=( 199, 90 ), 35000 ). % Frame number: 876 % Frame number: 877 % Frame number: 878 % Frame number: 879 happensAt( walking( id3 ), 35160 ). % Frame number: 880 % Frame number: 881 % Frame number: 882 % Frame number: 883 % Frame number: 884 % Frame number: 885 % Frame number: 886 % Frame number: 887 % Frame number: 888 happensAt( walking( id3 ), 35520 ). % Frame number: 889 % Frame number: 890 % Frame number: 891 % Frame number: 892 % Frame number: 893 holdsAt( coord( id3 )=( 231, 93 ), 35720 ). % Frame number: 894 % Frame number: 895 % Frame number: 896 holdsAt( coord( id3 )=( 234, 93 ), 35840 ). % Frame number: 897 % Frame number: 898 % Frame number: 899 % Frame number: 900 % Frame number: 901 % Frame number: 902 % Frame number: 903 % Frame number: 904 % Frame number: 905 % Frame number: 906 % Frame number: 907 happensAt( walking( id3 ), 36280 ). % Frame number: 908 % Frame number: 909 % Frame number: 910 % Frame number: 911 % Frame number: 912 % Frame number: 913 % Frame number: 914 % Frame number: 915 % Frame number: 916 % Frame number: 917 % Frame number: 918 % Frame number: 919 % Frame number: 920 % Frame number: 921 % Frame number: 922 % Frame number: 923 % Frame number: 924 % Frame number: 925 happensAt( walking( id3 ), 37000 ). % Frame number: 926 % Frame number: 927 % Frame number: 928 % Frame number: 929 happensAt( walking( id3 ), 37160 ). % Frame number: 930 % Frame number: 931 % Frame number: 932 happensAt( walking( id3 ), 37280 ). % Frame number: 933 % Frame number: 934 holdsAt( coord( id3 )=( 292, 95 ), 37360 ). % Frame number: 935 holdsAt( coord( id3 )=( 292, 95 ), 37400 ). % Frame number: 936 % Frame number: 937 % Frame number: 938 % Frame number: 939 % Frame number: 940 holdsAt( coord( id3 )=( 293, 95 ), 37600 ). % Frame number: 941 % Frame number: 942 % Frame number: 943 holdsAt( coord( id3 )=( 294, 96 ), 37720 ). % Frame number: 944 % Frame number: 945 % Frame number: 946 % Frame number: 947 happensAt( walking( id3 ), 37880 ). % Frame number: 948 % Frame number: 949 % Frame number: 950 % Frame number: 951 % Frame number: 952 % Frame number: 953 % Frame number: 954 % Frame number: 955 % Frame number: 956 % Frame number: 957 % Frame number: 958 % Frame number: 959 % Frame number: 960 happensAt( inactive( id4 ), 38400 ). % Frame number: 961 % Frame number: 962 % Frame number: 963 % Frame number: 964 holdsAt( coord( id4 )=( 310, 112 ), 38560 ). % Frame number: 965 % Frame number: 966 % Frame number: 967 % Frame number: 968 holdsAt( coord( id3 )=( 277, 87 ), 38720 ). % Frame number: 969 % Frame number: 970 % Frame number: 971 % Frame number: 972 holdsAt( coord( id4 )=( 310, 112 ), 38880 ). % Frame number: 973 % Frame number: 974 % Frame number: 975 % Frame number: 976 % Frame number: 977 % Frame number: 978 % Frame number: 979 % Frame number: 980 % Frame number: 981 % Frame number: 982 % Frame number: 983 happensAt( walking( id3 ), 39320 ). % Frame number: 984 holdsAt( coord( id3 )=( 240, 86 ), 39360 ). % Frame number: 985 % Frame number: 986 % Frame number: 987 % Frame number: 988 % Frame number: 989 % Frame number: 990 % Frame number: 991 % Frame number: 992 % Frame number: 993 holdsAt( coord( id3 )=( 223, 85 ), 39720 ). % Frame number: 994 happensAt( inactive( id4 ), 39760 ). % Frame number: 995 happensAt( walking( id3 ), 39800 ). % Frame number: 996 % Frame number: 997 holdsAt( coord( id4 )=( 310, 112 ), 39880 ). % Frame number: 998 happensAt( inactive( id4 ), 39920 ). % Frame number: 999 holdsAt( coord( id4 )=( 310, 112 ), 39960 ). % Frame number: 1000 % Frame number: 1001 % Frame number: 1002 holdsAt( coord( id4 )=( 310, 112 ), 40080 ). % Frame number: 1003 holdsAt( coord( id4 )=( 310, 112 ), 40120 ). % Frame number: 1004 % Frame number: 1005 % Frame number: 1006 happensAt( walking( id3 ), 40240 ). % Frame number: 1007 holdsAt( coord( id3 )=( 195, 80 ), 40280 ). happensAt( inactive( id4 ), 40280 ). % Frame number: 1008 % Frame number: 1009 % Frame number: 1010 % Frame number: 1011 holdsAt( coord( id3 )=( 184, 79 ), 40440 ). holdsAt( coord( id4 )=( 310, 112 ), 40440 ). % Frame number: 1012 % Frame number: 1013 % Frame number: 1014 % Frame number: 1015 holdsAt( coord( id3 )=( 179, 78 ), 40600 ). % Frame number: 1016 % Frame number: 1017 % Frame number: 1018 holdsAt( coord( id3 )=( 177, 78 ), 40720 ). % Frame number: 1019 % Frame number: 1020 % Frame number: 1021 % Frame number: 1022 % Frame number: 1023 % Frame number: 1024 % Frame number: 1025 % Frame number: 1026 % Frame number: 1027 holdsAt( coord( id3 )=( 164, 69 ), 41080 ). % Frame number: 1028 % Frame number: 1029 happensAt( walking( id3 ), 41160 ). % Frame number: 1030 % Frame number: 1031 happensAt( walking( id3 ), 41240 ). % Frame number: 1032 % Frame number: 1033 holdsAt( coord( id3 )=( 162, 66 ), 41320 ). % Frame number: 1034 % Frame number: 1035 % Frame number: 1036 happensAt( inactive( id4 ), 41440 ). % Frame number: 1037 happensAt( walking( id3 ), 41480 ). % Frame number: 1038 % Frame number: 1039 % Frame number: 1040 % Frame number: 1041 % Frame number: 1042 % Frame number: 1043 % Frame number: 1044 happensAt( inactive( id4 ), 41760 ). holdsAt( coord( id4 )=( 310, 112 ), 41760 ). % Frame number: 1045 % Frame number: 1046 happensAt( inactive( id4 ), 41840 ). % Frame number: 1047 % Frame number: 1048 holdsAt( coord( id4 )=( 310, 112 ), 41920 ). % Frame number: 1049 % Frame number: 1050 % Frame number: 1051 happensAt( inactive( id4 ), 42040 ). % Frame number: 1052 % Frame number: 1053 % Frame number: 1054 % Frame number: 1055 % Frame number: 1056 holdsAt( coord( id3 )=( 156, 41 ), 42240 ). % Frame number: 1057 % Frame number: 1058 % Frame number: 1059 happensAt( walking( id3 ), 42360 ). % Frame number: 1060 holdsAt( coord( id4 )=( 310, 112 ), 42400 ). % Frame number: 1061 holdsAt( coord( id3 )=( 160, 36 ), 42440 ). % Frame number: 1062 % Frame number: 1063 % Frame number: 1064 % Frame number: 1065 % Frame number: 1066 happensAt( inactive( id4 ), 42640 ). % Frame number: 1067 happensAt( inactive( id4 ), 42680 ). % Frame number: 1068 % Frame number: 1069 % Frame number: 1070 happensAt( walking( id3 ), 42800 ). holdsAt( coord( id4 )=( 310, 112 ), 42800 ). % Frame number: 1071 % Frame number: 1072 % Frame number: 1073 happensAt( inactive( id4 ), 42920 ). % Frame number: 1074 happensAt( walking( id3 ), 42960 ). % Frame number: 1075 % Frame number: 1076 % Frame number: 1077 holdsAt( coord( id3 )=( 168, 30 ), 43080 ). % Frame number: 1078 happensAt( inactive( id4 ), 43120 ). % Frame number: 1079 % Frame number: 1080 % Frame number: 1081 % Frame number: 1082 % Frame number: 1083 % Frame number: 1084 % Frame number: 1085 % Frame number: 1086 happensAt( walking( id3 ), 43440 ). holdsAt( coord( id4 )=( 310, 112 ), 43440 ). % Frame number: 1087 % Frame number: 1088 % Frame number: 1089 % Frame number: 1090 % Frame number: 1091 % Frame number: 1092 % Frame number: 1093 % Frame number: 1094 % Frame number: 1095 % Frame number: 1096 % Frame number: 1097 holdsAt( coord( id4 )=( 310, 112 ), 43880 ). % Frame number: 1098 % Frame number: 1099 % Frame number: 1100 % Frame number: 1101 % Frame number: 1102 % Frame number: 1103 % Frame number: 1104 % Frame number: 1105 % Frame number: 1106 % Frame number: 1107 % Frame number: 1108 % Frame number: 1109 % Frame number: 1110 % Frame number: 1111 holdsAt( coord( id4 )=( 310, 112 ), 44440 ). % Frame number: 1112 % Frame number: 1113 % Frame number: 1114 holdsAt( coord( id4 )=( 310, 112 ), 44560 ). % Frame number: 1115 holdsAt( coord( id4 )=( 310, 112 ), 44600 ). % Frame number: 1116 happensAt( inactive( id4 ), 44640 ). % Frame number: 1117 % Frame number: 1118 holdsAt( coord( id4 )=( 310, 112 ), 44720 ). % Frame number: 1119 holdsAt( coord( id4 )=( 310, 112 ), 44760 ). % Frame number: 1120 % Frame number: 1121 % Frame number: 1122 % Frame number: 1123 % Frame number: 1124 happensAt( inactive( id4 ), 44960 ). % Frame number: 1125 happensAt( inactive( id4 ), 45000 ). % Frame number: 1126 % Frame number: 1127 % Frame number: 1128 % Frame number: 1129 holdsAt( coord( id4 )=( 310, 112 ), 45160 ). % Frame number: 1130 holdsAt( coord( id4 )=( 310, 112 ), 45200 ). % Frame number: 1131 % Frame number: 1132 % Frame number: 1133 holdsAt( coord( id4 )=( 310, 112 ), 45320 ). % Frame number: 1134 % Frame number: 1135 % Frame number: 1136 % Frame number: 1137 % Frame number: 1138 % Frame number: 1139 % Frame number: 1140 % Frame number: 1141 % Frame number: 1142 % Frame number: 1143 % Frame number: 1144 % Frame number: 1145 % Frame number: 1146 % Frame number: 1147 % Frame number: 1148 happensAt( inactive( id4 ), 45920 ). % Frame number: 1149 holdsAt( coord( id4 )=( 310, 112 ), 45960 ). % Frame number: 1150 % Frame number: 1151 % Frame number: 1152 % Frame number: 1153 % Frame number: 1154 holdsAt( coord( id4 )=( 310, 112 ), 46160 ). % Frame number: 1155 % Frame number: 1156 % Frame number: 1157 % Frame number: 1158 % Frame number: 1159 holdsAt( coord( id4 )=( 310, 112 ), 46360 ). % Frame number: 1160 % Frame number: 1161 holdsAt( coord( id4 )=( 310, 112 ), 46440 ). % Frame number: 1162 % Frame number: 1163 happensAt( inactive( id4 ), 46520 ). % Frame number: 1164 % Frame number: 1165 % Frame number: 1166 % Frame number: 1167 % Frame number: 1168 % Frame number: 1169 happensAt( inactive( id4 ), 46760 ). % Frame number: 1170 % Frame number: 1171 % Frame number: 1172 % Frame number: 1173 % Frame number: 1174 % Frame number: 1175 % Frame number: 1176 % Frame number: 1177 % Frame number: 1178 % Frame number: 1179 % Frame number: 1180 % Frame number: 1181 % Frame number: 1182 % Frame number: 1183 % Frame number: 1184 % Frame number: 1185 % Frame number: 1186 % Frame number: 1187 % Frame number: 1188 happensAt( inactive( id4 ), 47520 ). % Frame number: 1189 % Frame number: 1190 % Frame number: 1191 % Frame number: 1192 % Frame number: 1193 % Frame number: 1194 holdsAt( coord( id4 )=( 310, 112 ), 47760 ). % Frame number: 1195 happensAt( inactive( id4 ), 47800 ). % Frame number: 1196 % Frame number: 1197 % Frame number: 1198 % Frame number: 1199 % Frame number: 1200 % Frame number: 1201 % Frame number: 1202 % Frame number: 1203 % Frame number: 1204 % Frame number: 1205 % Frame number: 1206 % Frame number: 1207 % Frame number: 1208 % Frame number: 1209 happensAt( inactive( id4 ), 48360 ). % Frame number: 1210 % Frame number: 1211 % Frame number: 1212 % Frame number: 1213 % Frame number: 1214 % Frame number: 1215 % Frame number: 1216 happensAt( walking( id5 ), 48640 ). % Frame number: 1217 % Frame number: 1218 % Frame number: 1219 holdsAt( coord( id4 )=( 310, 112 ), 48760 ). % Frame number: 1220 holdsAt( coord( id5 )=( 175, 28 ), 48800 ). % Frame number: 1221 holdsAt( coord( id4 )=( 310, 112 ), 48840 ). % Frame number: 1222 happensAt( walking( id5 ), 48880 ). % Frame number: 1223 holdsAt( coord( id5 )=( 176, 33 ), 48920 ). % Frame number: 1224 % Frame number: 1225 % Frame number: 1226 % Frame number: 1227 happensAt( walking( id5 ), 49080 ). % Frame number: 1228 % Frame number: 1229 happensAt( inactive( id4 ), 49160 ). % Frame number: 1230 % Frame number: 1231 % Frame number: 1232 holdsAt( coord( id5 )=( 173, 37 ), 49280 ). % Frame number: 1233 happensAt( walking( id5 ), 49320 ). % Frame number: 1234 % Frame number: 1235 % Frame number: 1236 % Frame number: 1237 holdsAt( coord( id4 )=( 310, 112 ), 49480 ). happensAt( walking( id5 ), 49480 ). % Frame number: 1238 happensAt( walking( id5 ), 49520 ). % Frame number: 1239 holdsAt( coord( id5 )=( 174, 41 ), 49560 ). % Frame number: 1240 % Frame number: 1241 % Frame number: 1242 holdsAt( coord( id4 )=( 310, 112 ), 49680 ). % Frame number: 1243 holdsAt( coord( id4 )=( 310, 112 ), 49720 ). % Frame number: 1244 % Frame number: 1245 happensAt( inactive( id4 ), 49800 ). happensAt( walking( id5 ), 49800 ). % Frame number: 1246 % Frame number: 1247 holdsAt( coord( id5 )=( 175, 47 ), 49880 ). % Frame number: 1248 % Frame number: 1249 happensAt( inactive( id4 ), 49960 ). holdsAt( coord( id5 )=( 175, 49 ), 49960 ). % Frame number: 1250 % Frame number: 1251 % Frame number: 1252 % Frame number: 1253 % Frame number: 1254 % Frame number: 1255 % Frame number: 1256 % Frame number: 1257 % Frame number: 1258 happensAt( walking( id5 ), 50320 ). % Frame number: 1259 happensAt( walking( id5 ), 50360 ). % Frame number: 1260 % Frame number: 1261 % Frame number: 1262 holdsAt( coord( id5 )=( 180, 64 ), 50480 ). % Frame number: 1263 % Frame number: 1264 % Frame number: 1265 happensAt( walking( id5 ), 50600 ). % Frame number: 1266 % Frame number: 1267 holdsAt( coord( id4 )=( 310, 112 ), 50680 ). % Frame number: 1268 holdsAt( coord( id5 )=( 186, 75 ), 50720 ). % Frame number: 1269 happensAt( inactive( id4 ), 50760 ). % Frame number: 1270 % Frame number: 1271 % Frame number: 1272 % Frame number: 1273 % Frame number: 1274 % Frame number: 1275 holdsAt( coord( id4 )=( 310, 112 ), 51000 ). % Frame number: 1276 % Frame number: 1277 % Frame number: 1278 holdsAt( coord( id4 )=( 310, 112 ), 51120 ). % Frame number: 1279 % Frame number: 1280 % Frame number: 1281 % Frame number: 1282 holdsAt( coord( id5 )=( 192, 96 ), 51280 ). % Frame number: 1283 happensAt( walking( id5 ), 51320 ). % Frame number: 1284 % Frame number: 1285 % Frame number: 1286 % Frame number: 1287 holdsAt( coord( id4 )=( 310, 112 ), 51480 ). % Frame number: 1288 % Frame number: 1289 happensAt( inactive( id4 ), 51560 ). % Frame number: 1290 % Frame number: 1291 happensAt( inactive( id4 ), 51640 ). % Frame number: 1292 % Frame number: 1293 % Frame number: 1294 % Frame number: 1295 happensAt( inactive( id4 ), 51800 ). holdsAt( coord( id5 )=( 217, 99 ), 51800 ). % Frame number: 1296 % Frame number: 1297 % Frame number: 1298 % Frame number: 1299 % Frame number: 1300 % Frame number: 1301 % Frame number: 1302 % Frame number: 1303 % Frame number: 1304 % Frame number: 1305 % Frame number: 1306 holdsAt( coord( id5 )=( 248, 96 ), 52240 ). % Frame number: 1307 holdsAt( coord( id4 )=( 310, 112 ), 52280 ). % Frame number: 1308 % Frame number: 1309 happensAt( walking( id5 ), 52360 ). % Frame number: 1310 % Frame number: 1311 % Frame number: 1312 % Frame number: 1313 % Frame number: 1314 % Frame number: 1315 % Frame number: 1316 happensAt( walking( id5 ), 52640 ). holdsAt( coord( id5 )=( 272, 94 ), 52640 ). % Frame number: 1317 % Frame number: 1318 % Frame number: 1319 holdsAt( coord( id5 )=( 280, 94 ), 52760 ). % Frame number: 1320 % Frame number: 1321 % Frame number: 1322 % Frame number: 1323 % Frame number: 1324 % Frame number: 1325 % Frame number: 1326 % Frame number: 1327 happensAt( walking( id5 ), 53080 ). % Frame number: 1328 % Frame number: 1329 % Frame number: 1330 % Frame number: 1331 % Frame number: 1332 % Frame number: 1333 % Frame number: 1334 % Frame number: 1335 happensAt( inactive( id4 ), 53400 ). % Frame number: 1336 % Frame number: 1337 % Frame number: 1338 % Frame number: 1339 % Frame number: 1340 % Frame number: 1341 % Frame number: 1342 happensAt( walking( id5 ), 53680 ). % Frame number: 1343 % Frame number: 1344 % Frame number: 1345 % Frame number: 1346 % Frame number: 1347 % Frame number: 1348 holdsAt( coord( id5 )=( 291, 111 ), 53920 ). % Frame number: 1349 % Frame number: 1350 % Frame number: 1351 % Frame number: 1352 % Frame number: 1353 happensAt( walking( id5 ), 54120 ). % Frame number: 1354 happensAt( walking( id5 ), 54160 ). % Frame number: 1355 % Frame number: 1356 % Frame number: 1357 % Frame number: 1358 % Frame number: 1359 % Frame number: 1360 % Frame number: 1361 % Frame number: 1362 % Frame number: 1363 % Frame number: 1364 % Frame number: 1365 % Frame number: 1366 % Frame number: 1367 happensAt( walking( id5 ), 54680 ). % Frame number: 1368 % Frame number: 1369 % Frame number: 1370 % Frame number: 1371 happensAt( walking( id5 ), 54840 ). % Frame number: 1372 % Frame number: 1373 % Frame number: 1374 % Frame number: 1375 % Frame number: 1376 % Frame number: 1377 holdsAt( coord( id5 )=( 277, 183 ), 55080 ). % Frame number: 1378 % Frame number: 1379 happensAt( walking( id5 ), 55160 ). % Frame number: 1380 % Frame number: 1381 % Frame number: 1382 % Frame number: 1383 % Frame number: 1384 happensAt( walking( id5 ), 55360 ). % Frame number: 1385 % Frame number: 1386 % Frame number: 1387 % Frame number: 1388 % Frame number: 1389 % Frame number: 1390 % Frame number: 1391 holdsAt( coord( id5 )=( 270, 221 ), 55640 ). % Frame number: 1392 happensAt( walking( id5 ), 55680 ). holdsAt( coord( id5 )=( 270, 223 ), 55680 ). % Frame number: 1393 % Frame number: 1394 % Frame number: 1395 % Frame number: 1396 % Frame number: 1397 % Frame number: 1398 % Frame number: 1399 % Frame number: 1400 % Frame number: 1401 % Frame number: 1402 % Frame number: 1403 % Frame number: 1404 % Frame number: 1405 % Frame number: 1406 % Frame number: 1407 % Frame number: 1408 % Frame number: 1409 happensAt( walking( id5 ), 56360 ). % Frame number: 1410 % Frame number: 1411 holdsAt( coord( id5 )=( 260, 277 ), 56440 ). % Frame number: 1412 % Frame number: 1413 % Frame number: 1414 % Frame number: 1415 % Frame number: 1416 % Frame number: 1417 % Frame number: 1418 % Frame number: 1419 holdsAt( coord( id5 )=( 265, 282 ), 56760 ). % Frame number: 1420
JasonFil/Prob-EC
dataset/strong-noise/14-LeftBag/lb1gtMovementIndv_new.pl
Perl
bsd-3-clause
44,109
#!/usr/bin/perl $usage = qq{ hashLookup.pl <file1> <file2> <field1> <field2a> <field2b> <file1> table or list of IDs to look up (.tsv) <file2> lookup table with two or more fields (.tsv) <field1> field of file1 to match (eg 0) <field2a> field of file2 that matches file1 field <field2b> field of file2 that should be output Goes through each line of file1, and for each field1, finds the matching value in field2a of file2, then prints both the full line of file1 and the looked up value field2b. Files must be tab-delimited. Count fields from 0. }; die "$usage" unless @ARGV == 5; $file1 = $ARGV[0]; $file2 = $ARGV[1]; $field1 = $ARGV[2]; $field2a = $ARGV[3]; $field2b = $ARGV[4]; open (FILE, $file1) or die "Cannot open $file1!"; @data1 = <FILE>; close FILE; open (FILE, $file2) or die "Cannot open $file2!"; @data2 = <FILE>; close FILE; foreach $line (@data2) { chomp $line; @fields2 = split(/\t/, $line); $hash{$fields2[$field2a]} = $fields2[$field2b]; } foreach $line (@data1) { chomp $line; @fields1 = split(/\t/, $line); # print "$fields1[$field1]\t$hash{$fields1[$field1]}\n"; #prints only one field from file1 print "$line\t$hash{$fields1[$field1]}\n"; #prints all fields from file1 } exit;
cuttlefishh/papers
vibrio-fischeri-transcriptomics/code/perl/hashLookup_v1.pl
Perl
mit
1,320
# # Copyright 2017 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package hardware::server::supermicro::snmp::plugin; use strict; use warnings; use base qw(centreon::plugins::script_snmp); sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '1.0'; %{$self->{modes}} = ( 'hardware' => 'hardware::server::supermicro::snmp::mode::hardware', ); return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check Supermicro servers in SNMP (need SuperDoctor Agent). =cut
nichols-356/centreon-plugins
hardware/server/supermicro/snmp/plugin.pm
Perl
apache-2.0
1,326
package # hide from pause DBIx::Class::Carp; use strict; use warnings; # load Carp early to prevent tickling of the ::Internal stash being # interpreted as "Carp is already loaded" by some braindead loader use Carp (); $Carp::Internal{ (__PACKAGE__) }++; sub __find_caller { my ($skip_pattern, $class) = @_; my $skip_class_data = $class->_skip_namespace_frames if ($class and $class->can('_skip_namespace_frames')); $skip_pattern = qr/$skip_pattern|$skip_class_data/ if $skip_class_data; my $fr_num = 1; # skip us and the calling carp* my (@f, $origin); while (@f = caller($fr_num++)) { next if ( $f[3] eq '(eval)' or $f[3] =~ /::__ANON__$/ ); $origin ||= ( $f[3] =~ /^ (.+) :: ([^\:]+) $/x and ! $Carp::Internal{$1} and ############################# # Need a way to parameterize this for Carp::Skip $1 !~ /^(?: DBIx::Class::Storage::BlockRunner | Context::Preserve | Try::Tiny | Class::Accessor::Grouped | Class::C3::Componentised | Module::Runtime )$/x and $2 !~ /^(?: throw_exception | carp | carp_unique | carp_once | dbh_do | txn_do | with_deferred_fk_checks)$/x ############################# ) ? $f[3] : undef; if ( $f[0]->can('_skip_namespace_frames') and my $extra_skip = $f[0]->_skip_namespace_frames ) { $skip_pattern = qr/$skip_pattern|$extra_skip/; } last if $f[0] !~ $skip_pattern; } my $site = @f # if empty - nothing matched - full stack ? "at $f[1] line $f[2]" : Carp::longmess() ; $origin ||= '{UNKNOWN}'; return ( $site, $origin =~ /::/ ? "$origin(): " : "$origin: ", # cargo-cult from Carp::Clan ); }; my $warn = sub { my ($ln, @warn) = @_; @warn = "Warning: something's wrong" unless @warn; # back-compat with Carp::Clan - a warning ending with \n does # not include caller info warn ( @warn, $warn[-1] =~ /\n$/ ? '' : " $ln\n" ); }; sub import { my (undef, $skip_pattern) = @_; my $into = caller; $skip_pattern = $skip_pattern ? qr/ ^ $into $ | $skip_pattern /x : qr/ ^ $into $ /x ; no strict 'refs'; *{"${into}::carp"} = sub { $warn->( __find_caller($skip_pattern, $into), @_ ); }; my $fired = {}; *{"${into}::carp_once"} = sub { return if $fired->{$_[0]}; $fired->{$_[0]} = 1; $warn->( __find_caller($skip_pattern, $into), @_, ); }; my $seen; *{"${into}::carp_unique"} = sub { my ($ln, $calling) = __find_caller($skip_pattern, $into); my $msg = join ('', $calling, @_); # unique carping with a hidden caller makes no sense $msg =~ s/\n+$//; return if $seen->{$ln}{$msg}; $seen->{$ln}{$msg} = 1; $warn->( $ln, $msg, ); }; } sub unimport { die (__PACKAGE__ . " does not implement unimport yet\n"); } 1; __END__ =head1 NAME DBIx::Class::Carp - Provides advanced Carp::Clan-like warning functions for DBIx::Class internals =head1 DESCRIPTION Documentation is lacking on purpose - this an experiment not yet fit for mass consumption. If you use this do not count on any kind of stability, in fact don't even count on this module's continuing existence (it has been noindexed for a reason). In addition to the classic interface: use DBIx::Class::Carp '^DBIx::Class' this module also supports a class-data based way to specify the exclusion regex. A message is only carped from a callsite that matches neither the closed over string, nor the value of L</_skip_namespace_frames> as declared on any callframe already skipped due to the same mechanism. This is to ensure that intermediate callsites can declare their own additional skip-namespaces. =head1 CLASS ATTRIBUTES =head2 _skip_namespace_frames A classdata attribute holding the stringified regex matching callsites that should be skipped by the carp methods below. An empty string C<q{}> is treated like no setting/C<undef> (the distinction is necessary due to semantics of the class data accessors provided by L<Class::Accessor::Grouped>) =head1 EXPORTED FUNCTIONS This module export the following 3 functions. Only warning related C<carp*> is being handled here, for C<croak>-ing you must use L<DBIx::Class::Schema/throw_exception> or L<DBIx::Class::Exception>. =head2 carp Carps message with the file/line of the first callsite not matching L</_skip_namespace_frames> nor the closed-over arguments to C<use DBIx::Class::Carp>. =head2 carp_unique Like L</carp> but warns once for every distinct callsite (subject to the same ruleset as L</carp>). =head2 carp_once Like L</carp> but warns only once for the life of the perl interpreter (regardless of callsite). =head1 FURTHER QUESTIONS? Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>. =head1 COPYRIGHT AND LICENSE This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE> by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can redistribute it and/or modify it under the same terms as the L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>. =cut
ray66rus/vndrv
local/lib/perl5/DBIx/Class/Carp.pm
Perl
apache-2.0
5,096
# # Copyright 2017 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package network::hirschmann::standard::snmp::mode::cpu; use base qw(centreon::plugins::mode); use strict; use warnings; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '1.0'; $options{options}->add_options(arguments => { "warning:s" => { name => 'warning' }, "critical:s" => { name => 'critical' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); $self->{output}->option_exit(); } } sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; my $oid_hmCpuUtilization = '.1.3.6.1.4.1.248.14.2.15.2.1.0'; # in % my $result = $self->{snmp}->get_leef(oids => [$oid_hmCpuUtilization], nothing_quit => 1); my $cpu = $result->{$oid_hmCpuUtilization}; my $exit = $self->{perfdata}->threshold_check(value => $cpu, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); $self->{output}->output_add(severity => $exit, short_msg => sprintf("CPU Usage is %.2f%%", $cpu)); $self->{output}->perfdata_add(label => "cpu", unit => '%', value => sprintf("%.2f", $cpu), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), min => 0, max => 100); $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check CPU usage. hmEnableMeasurement must be activated (value = 1). =over 8 =item B<--warning> Threshold warning in %. =item B<--critical> Threshold critical in %. =back =cut
maksimatveev/centreon-plugins
network/hirschmann/standard/snmp/mode/cpu.pm
Perl
apache-2.0
3,383
#------------------------------------------------------------------------------ # File: RSRC.pm # # Description: Read Mac OS Resource information # # Revisions: 2010/03/17 - P. Harvey Created # # References: 1) http://developer.apple.com/legacy/mac/library/documentation/mac/MoreToolbox/MoreToolbox-99.html #------------------------------------------------------------------------------ package Image::ExifTool::RSRC; use strict; use vars qw($VERSION); use Image::ExifTool qw(:DataAccess :Utils); $VERSION = '1.08'; # Information decoded from Mac OS resources %Image::ExifTool::RSRC::Main = ( GROUPS => { 2 => 'Document' }, NOTES => q{ Tags extracted from Mac OS resource files and DFONT files. These tags may also be extracted from the resource fork of any file in OS X, either by adding "/..namedfork/rsrc" to the filename to process the resource fork alone, or by using the L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> (-ee) option to process the resource fork as a sub-document of the main file. When writing, ExifTool preserves the Mac OS resource fork by default, but it may deleted with C<-rsrc:all=> on the command line. }, '8BIM' => { Name => 'PhotoshopInfo', SubDirectory => { TagTable => 'Image::ExifTool::Photoshop::Main' }, }, 'sfnt' => { Name => 'Font', SubDirectory => { TagTable => 'Image::ExifTool::Font::Name' }, }, # my samples of postscript-type DFONT files have a POST resource # with ID 0x1f5 and the same format as a PostScript file 'POST_0x01f5' => { Name => 'PostscriptFont', SubDirectory => { TagTable => 'Image::ExifTool::PostScript::Main' }, }, 'usro_0x0000' => 'OpenWithApplication', 'vers_0x0001' => 'ApplicationVersion', 'STR _0xbff3' => 'ApplicationMissingMsg', 'STR _0xbff4' => 'CreatorApplication', # the following written by Photoshop # (ref http://www.adobe.ca/devnet/photoshop/psir/ps_image_resources.pdf) 'STR#_0x0080' => 'Keywords', 'TEXT_0x0080' => 'Description', # don't extract PICT's because the clip region isn't set properly # in the PICT resource for some reason. Also, a dummy 512-byte # header would have to be added to create a valid PICT file. # 'PICT' => { Name => 'PreviewPICT', Binary => 1 }, ); #------------------------------------------------------------------------------ # Read information from a Mac resource file (ref 1) # Inputs: 0) ExifTool ref, 1) dirInfo ref # Returns: 1 on success, 0 if this wasn't a valid resource file sub ProcessRSRC($$) { my ($et, $dirInfo) = @_; my $raf = $$dirInfo{RAF}; my ($hdr, $map, $buff, $i, $j); # attempt to validate the format as thoroughly as practical return 0 unless $raf->Read($hdr, 30) == 30; my ($datOff, $mapOff, $datLen, $mapLen) = unpack('N*', $hdr); return 0 unless $raf->Seek(0, 2); my $fLen = $raf->Tell(); return 0 if $datOff < 0x10 or $datOff + $datLen > $fLen; return 0 if $mapOff < 0x10 or $mapOff + $mapLen > $fLen or $mapLen < 30; return 0 if $datOff < $mapOff and $datOff + $datLen > $mapOff; return 0 if $mapOff < $datOff and $mapOff + $mapLen > $datOff; # read the resource map $raf->Seek($mapOff, 0) and $raf->Read($map, $mapLen) == $mapLen or return 0; SetByteOrder('MM'); my $typeOff = Get16u(\$map, 24); my $nameOff = Get16u(\$map, 26); my $numTypes = Get16u(\$map, 28); # validate offsets in the resource map return 0 if $typeOff < 28 or $nameOff < 30; $et->SetFileType('RSRC') unless $$et{IN_RESOURCE}; my $verbose = $et->Options('Verbose'); my $tagTablePtr = GetTagTable('Image::ExifTool::RSRC::Main'); $et->VerboseDir('RSRC', $numTypes+1); # parse resource type list for ($i=0; $i<=$numTypes; ++$i) { my $off = $typeOff + 2 + 8 * $i; # offset of entry in type list last if $off + 8 > $mapLen; my $resType = substr($map,$off,4); # resource type my $resNum = Get16u(\$map,$off+4); # number of resources - 1 my $refOff = Get16u(\$map,$off+6) + $typeOff; # offset to first resource reference # loop through all resources for ($j=0; $j<=$resNum; ++$j) { my $roff = $refOff + 12 * $j; last if $roff + 12 > $mapLen; # read only the 24-bit resource data offset my $id = Get16u(\$map,$roff); my $resOff = (Get32u(\$map,$roff+4) & 0x00ffffff) + $datOff; my $resNameOff = Get16u(\$map,$roff+2) + $nameOff + $mapOff; my ($tag, $val, $valLen); my $tagInfo = $$tagTablePtr{$resType}; if ($tagInfo) { $tag = $resType; } else { $tag = sprintf('%s_0x%.4x', $resType, $id); $tagInfo = $$tagTablePtr{$tag}; } # read the resource data if necessary if ($tagInfo or $verbose) { unless ($raf->Seek($resOff, 0) and $raf->Read($buff, 4) == 4 and ($valLen = unpack('N', $buff)) < 100000000 and # arbitrary size limit (100MB) $raf->Read($val, $valLen) == $valLen) { $et->Warn("Error reading $resType resource"); next; } } if ($verbose) { my ($resName, $nameLen); $resName = '' unless $raf->Seek($resNameOff, 0) and $raf->Read($buff, 1) and ($nameLen = ord $buff) != 0 and $raf->Read($resName, $nameLen) == $nameLen; $et->VPrint(0,sprintf("%s resource ID 0x%.4x (offset 0x%.4x, $valLen bytes, name='%s'):\n", $resType, $id, $resOff, $resName)); $et->VerboseDump(\$val); } next unless $tagInfo; if ($resType eq 'vers') { # parse the 'vers' resource to get the long version string next unless $valLen > 8; # long version string is after short version my $p = 7 + Get8u(\$val, 6); next if $p >= $valLen; my $vlen = Get8u(\$val, $p++); next if $p + $vlen > $valLen; my $tagTablePtr = GetTagTable('Image::ExifTool::RSRC::Main'); $val = $et->Decode(substr($val, $p, $vlen), 'MacRoman'); } elsif ($resType eq 'sfnt') { # parse the OTF font block $raf->Seek($resOff + 4, 0) or next; $$dirInfo{Base} = $resOff + 4; require Image::ExifTool::Font; unless (Image::ExifTool::Font::ProcessOTF($et, $dirInfo)) { $et->Warn('Unrecognized sfnt resource format'); } # assume this is a DFONT file unless processing the rsrc fork $et->OverrideFileType('DFONT') unless $$et{DOC_NUM}; next; } elsif ($resType eq '8BIM') { my $ttPtr = GetTagTable('Image::ExifTool::Photoshop::Main'); $et->HandleTag($ttPtr, $id, $val, DataPt => \$val, DataPos => $resOff + 4, Size => $valLen, Start => 0, Parent => 'RSRC', ); next; } elsif ($resType eq 'STR ' and $valLen > 1) { # extract Pascal string my $len = ord $val; next unless $valLen >= $len + 1; $val = substr($val, 1, $len); } elsif ($resType eq 'usro' and $valLen > 4) { my $len = unpack('N', $val); next unless $valLen >= $len + 4; ($val = substr($val, 4, $len)) =~ s/\0.*//g; # truncate at null } elsif ($resType eq 'STR#' and $valLen > 2) { # extract list of strings (ref http://simtech.sourceforge.net/tech/strings.html) my $num = unpack('n', $val); next if $num & 0xf000; # (ignore special-format STR# resources) my ($i, @vals); my $pos = 2; for ($i=0; $i<$num; ++$i) { last if $pos >= $valLen; my $len = ord substr($val, $pos++, 1); last if $pos + $len > $valLen; push @vals, substr($val, $pos, $len); $pos += $len; } $val = \@vals; } elsif ($resType eq 'POST') { # assume this is a DFONT file unless processing the rsrc fork $et->OverrideFileType('DFONT') unless $$et{DOC_NUM}; $val = substr $val, 2; } elsif ($resType ne 'TEXT') { next; } $et->HandleTag($tagTablePtr, $tag, $val); } } return 1; } 1; # end __END__ =head1 NAME Image::ExifTool::RSRC - Read Mac OS Resource information =head1 SYNOPSIS This module is used by Image::ExifTool =head1 DESCRIPTION This module contains routines required by Image::ExifTool to read Mac OS resource files. =head1 AUTHOR Copyright 2003-2020, Phil Harvey (philharvey66 at gmail.com) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 REFERENCES =over 4 =item L<http://developer.apple.com/legacy/mac/library/documentation/mac/MoreToolbox/MoreToolbox-99.html> =back =head1 SEE ALSO L<Image::ExifTool::TagNames/RSRC Tags>, L<Image::ExifTool(3pm)|Image::ExifTool> =cut
mkjanke/Focus-Points
focuspoints.lrdevplugin/bin/exiftool/lib/Image/ExifTool/RSRC.pm
Perl
apache-2.0
9,622
######################################################################## # Bio::KBase::ObjectAPI::KBaseGenomes::Feature_quality_measure - This is the moose object corresponding to the KBaseGenomes.Feature_quality_measure object # Authors: Christopher Henry, Scott Devoid, Paul Frybarger # Contact email: chenry@mcs.anl.gov # Development location: Mathematics and Computer Science Division, Argonne National Lab # Date of module creation: 2014-06-23T03:40:28 ######################################################################## use strict; use Bio::KBase::ObjectAPI::KBaseGenomes::DB::Feature_quality_measure; package Bio::KBase::ObjectAPI::KBaseGenomes::Feature_quality_measure; use Moose; use namespace::autoclean; extends 'Bio::KBase::ObjectAPI::KBaseGenomes::DB::Feature_quality_measure'; #*********************************************************************************************************** # ADDITIONAL ATTRIBUTES: #*********************************************************************************************************** #*********************************************************************************************************** # BUILDERS: #*********************************************************************************************************** #*********************************************************************************************************** # CONSTANTS: #*********************************************************************************************************** #*********************************************************************************************************** # FUNCTIONS: #*********************************************************************************************************** __PACKAGE__->meta->make_immutable; 1;
cshenry/fba_tools
lib/Bio/KBase/ObjectAPI/KBaseGenomes/Feature_quality_measure.pm
Perl
mit
1,777
# This file is auto-generated by the Perl DateTime Suite time zone # code generator (0.07) This code generator comes with the # DateTime::TimeZone module distribution in the tools/ directory # # Generated from /tmp/ympzZnp0Uq/europe. Olson data version 2012c # # Do not edit this file directly. # package DateTime::TimeZone::Europe::Amsterdam; { $DateTime::TimeZone::Europe::Amsterdam::VERSION = '1.46'; } use strict; use Class::Singleton 1.03; use DateTime::TimeZone; use DateTime::TimeZone::OlsonDB; @DateTime::TimeZone::Europe::Amsterdam::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' ); my $spans = [ [ DateTime::TimeZone::NEG_INFINITY, 57875470828, DateTime::TimeZone::NEG_INFINITY, 57875472000, 1172, 0, 'LMT' ], [ 57875470828, 60441982828, 57875472000, 60441984000, 1172, 0, 'AMT' ], [ 60441982828, 60455198428, 60441987600, 60455203200, 4772, 1, 'NST' ], [ 60455198428, 60472230028, 60455199600, 60472231200, 1172, 0, 'AMT' ], [ 60472230028, 60485535628, 60472234800, 60485540400, 4772, 1, 'NST' ], [ 60485535628, 60502470028, 60485536800, 60502471200, 1172, 0, 'AMT' ], [ 60502470028, 60518194828, 60502474800, 60518199600, 4772, 1, 'NST' ], [ 60518194828, 60534524428, 60518196000, 60534525600, 1172, 0, 'AMT' ], [ 60534524428, 60549644428, 60534529200, 60549649200, 4772, 1, 'NST' ], [ 60549644428, 60565974028, 60549645600, 60565975200, 1172, 0, 'AMT' ], [ 60565974028, 60581094028, 60565978800, 60581098800, 4772, 1, 'NST' ], [ 60581094028, 60597423628, 60581095200, 60597424800, 1172, 0, 'AMT' ], [ 60597423628, 60612543628, 60597428400, 60612548400, 4772, 1, 'NST' ], [ 60612543628, 60628182028, 60612544800, 60628183200, 1172, 0, 'AMT' ], [ 60628182028, 60645116428, 60628186800, 60645121200, 4772, 1, 'NST' ], [ 60645116428, 60665506828, 60645117600, 60665508000, 1172, 0, 'AMT' ], [ 60665506828, 60676566028, 60665511600, 60676570800, 4772, 1, 'NST' ], [ 60676566028, 60691686028, 60676567200, 60691687200, 1172, 0, 'AMT' ], [ 60691686028, 60708015628, 60691690800, 60708020400, 4772, 1, 'NST' ], [ 60708015628, 60729010828, 60708016800, 60729012000, 1172, 0, 'AMT' ], [ 60729010828, 60739465228, 60729015600, 60739470000, 4772, 1, 'NST' ], [ 60739465228, 60758732428, 60739466400, 60758733600, 1172, 0, 'AMT' ], [ 60758732428, 60770914828, 60758737200, 60770919600, 4772, 1, 'NST' ], [ 60770914828, 60790268428, 60770916000, 60790269600, 1172, 0, 'AMT' ], [ 60790268428, 60802364428, 60790273200, 60802369200, 4772, 1, 'NST' ], [ 60802364428, 60821890828, 60802365600, 60821892000, 1172, 0, 'AMT' ], [ 60821890828, 60834418828, 60821895600, 60834423600, 4772, 1, 'NST' ], [ 60834418828, 60853426828, 60834420000, 60853428000, 1172, 0, 'AMT' ], [ 60853426828, 60865868428, 60853431600, 60865873200, 4772, 1, 'NST' ], [ 60865868428, 60884962828, 60865869600, 60884964000, 1172, 0, 'AMT' ], [ 60884962828, 60897318028, 60884967600, 60897322800, 4772, 1, 'NST' ], [ 60897318028, 60916498828, 60897319200, 60916500000, 1172, 0, 'AMT' ], [ 60916498828, 60928767628, 60916503600, 60928772400, 4772, 1, 'NST' ], [ 60928767628, 60948726028, 60928768800, 60948727200, 1172, 0, 'AMT' ], [ 60948726028, 60960217228, 60948730800, 60960222000, 4772, 1, 'NST' ], [ 60960217228, 60979657228, 60960218400, 60979658400, 1172, 0, 'AMT' ], [ 60979657228, 60992271628, 60979662000, 60992276400, 4772, 1, 'NST' ], [ 60992271628, 61011193228, 60992272800, 61011194400, 1172, 0, 'AMT' ], [ 61011193228, 61023721228, 61011198000, 61023726000, 4772, 1, 'NST' ], [ 61023721228, 61042729228, 61023722400, 61042730400, 1172, 0, 'AMT' ], [ 61042729228, 61055170828, 61042734000, 61055175600, 4772, 1, 'NST' ], [ 61055170828, 61074351628, 61055172000, 61074352800, 1172, 0, 'AMT' ], [ 61074351628, 61086620428, 61074356400, 61086625200, 4772, 1, 'NST' ], [ 61086620428, 61106492428, 61086621600, 61106493600, 1172, 0, 'AMT' ], [ 61106492428, 61109937628, 61106497200, 61109942400, 4772, 1, 'NST' ], [ 61109937628, 61118070000, 61109942428, 61118074800, 4800, 1, 'NEST' ], [ 61118070000, 61137423600, 61118071200, 61137424800, 1200, 0, 'NET' ], [ 61137423600, 61149519600, 61137428400, 61149524400, 4800, 1, 'NEST' ], [ 61149519600, 61168959600, 61149520800, 61168960800, 1200, 0, 'NET' ], [ 61168959600, 61181574000, 61168964400, 61181578800, 4800, 1, 'NEST' ], [ 61181574000, 61200661200, 61181575200, 61200662400, 1200, 0, 'NET' ], [ 61200661200, 61278426000, 61200668400, 61278433200, 7200, 1, 'CEST' ], [ 61278426000, 61291126800, 61278429600, 61291130400, 3600, 0, 'CET' ], [ 61291126800, 61307456400, 61291134000, 61307463600, 7200, 1, 'CEST' ], [ 61307456400, 61323181200, 61307460000, 61323184800, 3600, 0, 'CET' ], [ 61323181200, 61338906000, 61323188400, 61338913200, 7200, 1, 'CEST' ], [ 61338906000, 61354630800, 61338909600, 61354634400, 3600, 0, 'CET' ], [ 61354630800, 61369059600, 61354638000, 61369066800, 7200, 1, 'CEST' ], [ 61369059600, 62356604400, 61369063200, 62356608000, 3600, 0, 'CET' ], [ 62356604400, 62364560400, 62356608000, 62364564000, 3600, 0, 'CET' ], [ 62364560400, 62379680400, 62364567600, 62379687600, 7200, 1, 'CEST' ], [ 62379680400, 62396010000, 62379684000, 62396013600, 3600, 0, 'CET' ], [ 62396010000, 62411734800, 62396017200, 62411742000, 7200, 1, 'CEST' ], [ 62411734800, 62427459600, 62411738400, 62427463200, 3600, 0, 'CET' ], [ 62427459600, 62443184400, 62427466800, 62443191600, 7200, 1, 'CEST' ], [ 62443184400, 62459514000, 62443188000, 62459517600, 3600, 0, 'CET' ], [ 62459514000, 62474634000, 62459521200, 62474641200, 7200, 1, 'CEST' ], [ 62474634000, 62490358800, 62474637600, 62490362400, 3600, 0, 'CET' ], [ 62490358800, 62506083600, 62490366000, 62506090800, 7200, 1, 'CEST' ], [ 62506083600, 62521808400, 62506087200, 62521812000, 3600, 0, 'CET' ], [ 62521808400, 62537533200, 62521815600, 62537540400, 7200, 1, 'CEST' ], [ 62537533200, 62553258000, 62537536800, 62553261600, 3600, 0, 'CET' ], [ 62553258000, 62568982800, 62553265200, 62568990000, 7200, 1, 'CEST' ], [ 62568982800, 62584707600, 62568986400, 62584711200, 3600, 0, 'CET' ], [ 62584707600, 62601037200, 62584714800, 62601044400, 7200, 1, 'CEST' ], [ 62601037200, 62616762000, 62601040800, 62616765600, 3600, 0, 'CET' ], [ 62616762000, 62632486800, 62616769200, 62632494000, 7200, 1, 'CEST' ], [ 62632486800, 62648211600, 62632490400, 62648215200, 3600, 0, 'CET' ], [ 62648211600, 62663936400, 62648218800, 62663943600, 7200, 1, 'CEST' ], [ 62663936400, 62679661200, 62663940000, 62679664800, 3600, 0, 'CET' ], [ 62679661200, 62695386000, 62679668400, 62695393200, 7200, 1, 'CEST' ], [ 62695386000, 62711110800, 62695389600, 62711114400, 3600, 0, 'CET' ], [ 62711110800, 62726835600, 62711118000, 62726842800, 7200, 1, 'CEST' ], [ 62726835600, 62742560400, 62726839200, 62742564000, 3600, 0, 'CET' ], [ 62742560400, 62758285200, 62742567600, 62758292400, 7200, 1, 'CEST' ], [ 62758285200, 62774010000, 62758288800, 62774013600, 3600, 0, 'CET' ], [ 62774010000, 62790339600, 62774017200, 62790346800, 7200, 1, 'CEST' ], [ 62790339600, 62806064400, 62790343200, 62806068000, 3600, 0, 'CET' ], [ 62806064400, 62821789200, 62806071600, 62821796400, 7200, 1, 'CEST' ], [ 62821789200, 62837514000, 62821792800, 62837517600, 3600, 0, 'CET' ], [ 62837514000, 62853238800, 62837521200, 62853246000, 7200, 1, 'CEST' ], [ 62853238800, 62868963600, 62853242400, 62868967200, 3600, 0, 'CET' ], [ 62868963600, 62884688400, 62868970800, 62884695600, 7200, 1, 'CEST' ], [ 62884688400, 62900413200, 62884692000, 62900416800, 3600, 0, 'CET' ], [ 62900413200, 62916138000, 62900420400, 62916145200, 7200, 1, 'CEST' ], [ 62916138000, 62931862800, 62916141600, 62931866400, 3600, 0, 'CET' ], [ 62931862800, 62947587600, 62931870000, 62947594800, 7200, 1, 'CEST' ], [ 62947587600, 62963917200, 62947591200, 62963920800, 3600, 0, 'CET' ], [ 62963917200, 62982061200, 62963924400, 62982068400, 7200, 1, 'CEST' ], [ 62982061200, 62995366800, 62982064800, 62995370400, 3600, 0, 'CET' ], [ 62995366800, 63013510800, 62995374000, 63013518000, 7200, 1, 'CEST' ], [ 63013510800, 63026816400, 63013514400, 63026820000, 3600, 0, 'CET' ], [ 63026816400, 63044960400, 63026823600, 63044967600, 7200, 1, 'CEST' ], [ 63044960400, 63058266000, 63044964000, 63058269600, 3600, 0, 'CET' ], [ 63058266000, 63077014800, 63058273200, 63077022000, 7200, 1, 'CEST' ], [ 63077014800, 63089715600, 63077018400, 63089719200, 3600, 0, 'CET' ], [ 63089715600, 63108464400, 63089722800, 63108471600, 7200, 1, 'CEST' ], [ 63108464400, 63121165200, 63108468000, 63121168800, 3600, 0, 'CET' ], [ 63121165200, 63139914000, 63121172400, 63139921200, 7200, 1, 'CEST' ], [ 63139914000, 63153219600, 63139917600, 63153223200, 3600, 0, 'CET' ], [ 63153219600, 63171363600, 63153226800, 63171370800, 7200, 1, 'CEST' ], [ 63171363600, 63184669200, 63171367200, 63184672800, 3600, 0, 'CET' ], [ 63184669200, 63202813200, 63184676400, 63202820400, 7200, 1, 'CEST' ], [ 63202813200, 63216118800, 63202816800, 63216122400, 3600, 0, 'CET' ], [ 63216118800, 63234867600, 63216126000, 63234874800, 7200, 1, 'CEST' ], [ 63234867600, 63247568400, 63234871200, 63247572000, 3600, 0, 'CET' ], [ 63247568400, 63266317200, 63247575600, 63266324400, 7200, 1, 'CEST' ], [ 63266317200, 63279018000, 63266320800, 63279021600, 3600, 0, 'CET' ], [ 63279018000, 63297766800, 63279025200, 63297774000, 7200, 1, 'CEST' ], [ 63297766800, 63310467600, 63297770400, 63310471200, 3600, 0, 'CET' ], [ 63310467600, 63329216400, 63310474800, 63329223600, 7200, 1, 'CEST' ], [ 63329216400, 63342522000, 63329220000, 63342525600, 3600, 0, 'CET' ], [ 63342522000, 63360666000, 63342529200, 63360673200, 7200, 1, 'CEST' ], [ 63360666000, 63373971600, 63360669600, 63373975200, 3600, 0, 'CET' ], [ 63373971600, 63392115600, 63373978800, 63392122800, 7200, 1, 'CEST' ], [ 63392115600, 63405421200, 63392119200, 63405424800, 3600, 0, 'CET' ], [ 63405421200, 63424170000, 63405428400, 63424177200, 7200, 1, 'CEST' ], [ 63424170000, 63436870800, 63424173600, 63436874400, 3600, 0, 'CET' ], [ 63436870800, 63455619600, 63436878000, 63455626800, 7200, 1, 'CEST' ], [ 63455619600, 63468320400, 63455623200, 63468324000, 3600, 0, 'CET' ], [ 63468320400, 63487069200, 63468327600, 63487076400, 7200, 1, 'CEST' ], [ 63487069200, 63500374800, 63487072800, 63500378400, 3600, 0, 'CET' ], [ 63500374800, 63518518800, 63500382000, 63518526000, 7200, 1, 'CEST' ], [ 63518518800, 63531824400, 63518522400, 63531828000, 3600, 0, 'CET' ], [ 63531824400, 63549968400, 63531831600, 63549975600, 7200, 1, 'CEST' ], [ 63549968400, 63563274000, 63549972000, 63563277600, 3600, 0, 'CET' ], [ 63563274000, 63581418000, 63563281200, 63581425200, 7200, 1, 'CEST' ], [ 63581418000, 63594723600, 63581421600, 63594727200, 3600, 0, 'CET' ], [ 63594723600, 63613472400, 63594730800, 63613479600, 7200, 1, 'CEST' ], [ 63613472400, 63626173200, 63613476000, 63626176800, 3600, 0, 'CET' ], [ 63626173200, 63644922000, 63626180400, 63644929200, 7200, 1, 'CEST' ], [ 63644922000, 63657622800, 63644925600, 63657626400, 3600, 0, 'CET' ], [ 63657622800, 63676371600, 63657630000, 63676378800, 7200, 1, 'CEST' ], [ 63676371600, 63689677200, 63676375200, 63689680800, 3600, 0, 'CET' ], [ 63689677200, 63707821200, 63689684400, 63707828400, 7200, 1, 'CEST' ], [ 63707821200, 63721126800, 63707824800, 63721130400, 3600, 0, 'CET' ], [ 63721126800, 63739270800, 63721134000, 63739278000, 7200, 1, 'CEST' ], [ 63739270800, 63752576400, 63739274400, 63752580000, 3600, 0, 'CET' ], [ 63752576400, 63771325200, 63752583600, 63771332400, 7200, 1, 'CEST' ], [ 63771325200, 63784026000, 63771328800, 63784029600, 3600, 0, 'CET' ], [ 63784026000, 63802774800, 63784033200, 63802782000, 7200, 1, 'CEST' ], [ 63802774800, 63815475600, 63802778400, 63815479200, 3600, 0, 'CET' ], [ 63815475600, 63834224400, 63815482800, 63834231600, 7200, 1, 'CEST' ], ]; sub olson_version { '2012c' } sub has_dst_changes { 76 } sub _max_year { 2022 } sub _new_instance { return shift->_init( @_, spans => $spans ); } sub _last_offset { 3600 } my $last_observance = bless( { 'format' => 'CE%sT', 'gmtoff' => '1:00', 'local_start_datetime' => bless( { 'formatter' => undef, 'local_rd_days' => 721720, 'local_rd_secs' => 0, 'offset_modifier' => 0, 'rd_nanosecs' => 0, 'tz' => bless( { 'name' => 'floating', 'offset' => 0 }, 'DateTime::TimeZone::Floating' ), 'utc_rd_days' => 721720, 'utc_rd_secs' => 0, 'utc_year' => 1978 }, 'DateTime' ), 'offset_from_std' => 0, 'offset_from_utc' => 3600, 'until' => [], 'utc_start_datetime' => bless( { 'formatter' => undef, 'local_rd_days' => 721719, 'local_rd_secs' => 82800, 'offset_modifier' => 0, 'rd_nanosecs' => 0, 'tz' => bless( { 'name' => 'floating', 'offset' => 0 }, 'DateTime::TimeZone::Floating' ), 'utc_rd_days' => 721719, 'utc_rd_secs' => 82800, 'utc_year' => 1977 }, 'DateTime' ) }, 'DateTime::TimeZone::OlsonDB::Observance' ) ; sub _last_observance { $last_observance } my $rules = [ bless( { 'at' => '1:00u', 'from' => '1996', 'in' => 'Oct', 'letter' => '', 'name' => 'EU', 'offset_from_std' => 0, 'on' => 'lastSun', 'save' => '0', 'to' => 'max', 'type' => undef }, 'DateTime::TimeZone::OlsonDB::Rule' ), bless( { 'at' => '1:00u', 'from' => '1981', 'in' => 'Mar', 'letter' => 'S', 'name' => 'EU', 'offset_from_std' => 3600, 'on' => 'lastSun', 'save' => '1:00', 'to' => 'max', 'type' => undef }, 'DateTime::TimeZone::OlsonDB::Rule' ) ] ; sub _rules { $rules } 1;
leighpauls/k2cro4
third_party/perl/perl/vendor/lib/DateTime/TimeZone/Europe/Amsterdam.pm
Perl
bsd-3-clause
14,720
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! # This file is machine-generated by mktables from the Unicode # database, Version 6.1.0. Any changes made here will be lost! # !!!!!!! INTERNAL PERL USE ONLY !!!!!!! # This file is for internal use by core Perl only. The format and even the # name or existence of this file are subject to change without notice. Don't # use it directly. return <<'END'; 0619 064F END
Dokaponteam/ITF_Project
xampp/perl/lib/unicore/lib/Ccc/CCC31.pl
Perl
mit
425
=head1 NAME XML::LibXML::Comment - XML::LibXML Comment Class =head1 SYNOPSIS use XML::LibXML; # Only methods specific to Comment nodes are listed here, # see XML::LibXML::Node manpage for other methods $node = XML::LibXML::Comment( $content ); =head1 DESCRIPTION This class provides all functions of L<<<<<< XML::LibXML Class for Text Nodes|XML::LibXML Class for Text Nodes >>>>>>, but for comment nodes. This can be done, since only the output of the node types is different, but not the data structure. :-) =head1 METHODS The class inherits from L<<<<<< Abstract Base Class of XML::LibXML Nodes|Abstract Base Class of XML::LibXML Nodes >>>>>>. The documentation for Inherited methods is not listed here. Many functions listed here are extensively documented in the L<<<<<< DOM Level 3 specification|http://www.w3.org/TR/DOM-Level-3-Core/ >>>>>>. Please refer to the specification for extensive documentation. =over 4 =item B<new> $node = XML::LibXML::Comment( $content ); The constructor is the only provided function for this package. It is required, because I<<<<<< libxml2 >>>>>> treats text nodes and comment nodes slightly differently. =back =head1 AUTHORS Matt Sergeant, Christian Glahn, Petr Pajas =head1 VERSION 1.66 =head1 COPYRIGHT 2001-2007, AxKit.com Ltd; 2002-2006 Christian Glahn; 2006-2008 Petr Pajas, All rights reserved. =cut
leighpauls/k2cro4
third_party/cygwin/lib/perl5/vendor_perl/5.10/i686-cygwin/XML/LibXML/Comment.pod
Perl
bsd-3-clause
1,386
# if regular doxycomment add a @{ # at next empty line add a //@} $ingroup = 0; $semicount =0; $endbracecount = 0; $endparencount = 0; while(<>) { chomp; $line = $_; # if the line is not an empty line if( $line =~ /\S+/ ) { if ( /\/\*\*(.*)/ ) { # I guess it was not a group, dump savebuffer if($ingroup) { print "/**" . $savebuffer . "\n"; } # if it is a class or brief then output the line but # do not start a group if ( /(\\class|\\brief)/ ) { print $line . "\n"; } # must be a group so start saving else { $savebuffer = "$1" . "\n"; $ingroup = 1; $semicount = 0; $endbracecount = 0; $endparencount = 0; } } else { # add to save buffer if in group if($ingroup) { $savebuffer = $savebuffer . $_ . "\n"; } else { # non empty line that is not the start of a doxy comment print $_ . "\n"; } } if($line =~ /;/ ) { $semicount = $semicount + 1; } if($line =~ /\}/ ) { $endbracecount = $endbracecount + 1; } if($line =~ /\)/ ) { $endparencount = $endparencount + 1; } } else { if($ingroup) { if($endparencount > 1 && ($semicount > 1 || $endbracecount > 1)) { print "/**@\{" . $savebuffer . "//@}\n\n"; } else { print "/**" . $savebuffer . "\n"; } $savebuffer = ""; $ingroup = 0; } else { print $line . "\n"; } } }
dsarrut/RTK
documentation/Doxygen/itkgroup.pl
Perl
apache-2.0
1,820
#! /usr/bin/perl -w # Copyright (C) 2007 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of # its contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # This script cleans up the headers that MIDL (Microsoft's IDL Parser/Generator) # outputs to only #include the parent interface avoiding circular dependencies # that MIDL creates. use File::Find; use strict; use warnings; my $dir = $ARGV[0]; $dir = `cygpath -u '$dir'`; chomp($dir); find(\&finder, $dir); sub finder { my $fileName = $_; return unless ($fileName =~ /IGEN_DOM(.*)\.h/); open(IN, "<", $fileName); my @contents = <IN>; close(IN); open(OUT, ">", $fileName); my $state = 0; foreach my $line (@contents) { if ($line =~ /^\/\* header files for imported files \*\//) { $state = 1; } elsif ($line =~ /^#include "oaidl\.h"/) { die "#include \"oaidl.h\" did not come second" if $state != 1; $state = 2; } elsif ($line =~ /^#include "ocidl\.h"/) { die "#include \"ocidl.h\" did not come third" if $state != 2; $state = 3; } elsif ($line =~ /^#include "IGEN_DOM/ && $state == 3) { $state = 4; } elsif ($line =~ /^#include "(IGEN_DOM.*)\.h"/ && $state == 4) { next; } print OUT $line; } close(OUT); }
mogoweb/webkit_for_android5.1
webkit/Source/WebKit/win/WebKit.vcproj/FixMIDLHeaders.pl
Perl
apache-2.0
2,752
# Copyrights 1995-2008 by Mark Overmeer <perl@overmeer.net>. # For other contributors see ChangeLog. # See the manual pages for details on the licensing terms. # Pod stripped from pm file by OODoc 1.04. use strict; package Mail::Mailer::sendmail; use vars '$VERSION'; $VERSION = '2.03'; use base 'Mail::Mailer::rfc822'; sub exec($$$$) { my($self, $exe, $args, $to, $sender) = @_; # Fork and exec the mailer (no shell involved to avoid risks) # We should always use a -t on sendmail so that Cc: and Bcc: work # Rumor: some sendmails may ignore or break with -t (AIX?) # Chopped out the @$to arguments, because -t means # they are sent in the body, and postfix complains if they # are also given on comand line. exec( $exe, '-t', @$args ); } 1;
carlgao/lenga
images/lenny64-peon/usr/share/perl5/Mail/Mailer/sendmail.pm
Perl
mit
780
#!/usr/bin/perl # # MySQL SQL generating perl module # This file is part of http://github/m5n/nutriana use strict; sub sql_comment { my ($comment) = @_; return "-- $comment"; } sub sql_how_to_run_as_admin { my ($user_name, $outfile) = @_; return "mysql --local_infile=1 -v -u root < $outfile"; } sub sql_recreate_database_and_user_to_access_it { my ($db_name, $user_name, $user_pwd, $db_server) = @_; # *Re*create, so drop old database, if any. my $result = "drop database if exists $db_name;\n"; # Create database. $result .= "create database $db_name;\n"; # Switch to it. $result .= "use $db_name;\n"; # Create user, if not already there. # The grant statement will create a user if it doesn't already exist. # Thanks, http://bugs.mysql.com/bug.php?id=19166 $result .= "grant all on $db_name.* to '$user_name'\@'$db_server' identified by '$user_pwd';"; # No need to switch to this user for schema creation or data import; this user is for accessing the data only. # TODO: limit to specific grants rather than "all"? return $result; } sub sql_create_table_start { my ($table_name) = @_; return "create table $table_name ("; } sub sql_create_table_end { return ");"; } sub sql_datatype_def { my ($type, $size, $is_unsigned) = @_; if ($type eq "Numeric") { my $result; if ($size =~ /\./) { $result = "dec(" . join(", ", split /\./, $size) . ")"; } elsif ($size <= 2) { $result = "tinyint($size)"; } elsif ($size <= 4) { $result = "smallint($size)"; } elsif ((!$is_unsigned and $size <= 6) or ($is_unsigned and $size <= 7)) { $result = "mediumint($size)"; } elsif ($size <= 9) { $result = "int($size)"; } else { $result = "bigint($size)"; } $result .= " unsigned" if $is_unsigned; return $result; } elsif ($type eq "Alphanumeric") { return "varchar($size)"; } elsif ($type =~ /^Date/) { return "date"; } else { die "Unexpected data type $type"; } } sub sql_field_def { my ($field_name, $datatype, $allows_null) = @_; return "$field_name $datatype" . ($allows_null ? "" : " not null"); } sub sql_insert { my ($table_name, %field_names_and_values) = @_; my @field_names = (); my @field_values = (); foreach my $key (keys %field_names_and_values) { push @field_names, $key; push @field_values, $field_names_and_values{$key}; } return "insert into $table_name (" . join(", ", @field_names) . ") values ('" . join("', '", @field_values) . "');"; } sub sql_convert_empty_string_to_null { my ($table_name, $field_name) = @_; return "UPDATE $table_name SET $field_name = NULL WHERE $field_name = '';"; } sub sql_convert_to_uppercase { my ($table_name, $field_name) = @_; return "UPDATE $table_name SET $field_name = UPPER($field_name);"; } sub sql_add_primary_keys { my ($table_name, @field_names) = @_; return "alter table $table_name add primary key (" . join(", ", @field_names) . ");"; } sub sql_add_foreign_key { my ($table_name, $field_name, $foreign_key) = @_; return "alter table $table_name add foreign key ($field_name) references " . join("(", split /\./, $foreign_key) . ");"; } sub sql_dateformat { my ($format) = @_; $format =~ s/mm/%m/; $format =~ s/dd/%d/; $format =~ s/yyyy/%Y/; return $format; } sub sql_load_file { my ($nutdbid, $user_name, $user_pwd, $file, $table_name, $field_separator, $text_separator, $line_separator, $ignore_header_lines, @fieldinfo) = @_; # TODO: how to make MySQL generate an error if varchar data truncation occurs? my $relative_file = join("", split /\.\/$nutdbid\/dist/, $file); my $result = "load data local infile '$relative_file'\n"; $result .= " into table $table_name\n"; $result .= " fields terminated by '$field_separator'"; $result .= " optionally enclosed by '$text_separator'" if $text_separator; $result .= "\n"; $result .= " lines terminated by '$line_separator'\n"; $result .= " ignore $ignore_header_lines lines\n" if $ignore_header_lines; $result .= " ("; # Specify field order and convert dates. my $saw_one = 0; my @date_vars = (); foreach (@fieldinfo) { $result .= ", " if $saw_one; $saw_one = 1; my %info = %{$_}; if ($info{"type"} =~ m/^Date/) { $info{"type"} =~ s/Date\(//; $info{"type"} =~ s/\)//; push @date_vars, { "name" => $info{"name"}, "format" => sql_dateformat($info{"type"}) }; $result .= "\@date" . ($#date_vars + 1); } else { $result .= $info{"name"}; } } $result .= ")\n"; # Output date assignments, if any. $result .= " set\n" if $#date_vars >= 0; my $idx = 1; my $saw_one = 0; foreach (@date_vars) { $result .= ",\n" if $saw_one; $saw_one = 1; my %info = %{$_}; $result .= " " . $info{"name"} . " = str_to_date(\@date$idx, '" . $info{"format"} . "')"; $idx += 1; } # Finish command. $result .= ";"; return $result; } sub sql_assert_record_count { my ($table_name, $record_count) = @_; # MySQL (versions <= 5.5 at least) does not support assertions, so do this via a workaround. # 1. create a temporary table with a single unique numeric field # 2. insert the value 2 # 3. insert the record count of the table to be asserted # 4. remove the record where the value is the assertion value # case a: if the record count in step 3 == assertion value, there's now just 1 row in the temporary table (just the value 2) # case b: if the record count in step 3 != assertion value, there are now 2 rows in the temporary table (the value 2 and the incorrect record count value) # 5. insert the record count of the temporary table # no error for case a, and a sql error for case b (trying to insert a non-unique value) # (note this also works if the assertion value happens to == 2) my $result = "create table tmp (c int unique key);\n"; $result .= "insert into tmp (c) values (2);\n"; $result .= "insert into tmp (select count(*) from $table_name);\n"; $result .= "delete from tmp where c = $record_count;\n"; $result .= "insert into tmp (select count(*) from tmp);\n"; $result .= "drop table tmp;"; return $result; } 1;
m5n/nutriana
src/MySQL.pm
Perl
mit
6,559
package HMMER2GO::Command::map2gaf; # ABSTRACT: Generate association file for gene and GO term mappings. use 5.010; use strict; use warnings; use HMMER2GO -command; use POSIX qw(strftime); use IPC::System::Simple qw(system); use HTTP::Tiny; use File::Basename; use Bio::DB::Taxonomy; #use Data::Dump::Color; our $VERSION = '0.18.1'; sub opt_spec { return ( [ "infile|i=s", "Tab-delimited file containing gene -> GO term mappings (GO terms should be separated by commas)." ], [ "outfile|o=s", "File name for the association file." ], [ "species|s=s", "The species name to be used in the association file." ], [ "gofile|g=s", "GO.terms_alt_ids file containing the one letter code for each term." ], ); } sub validate_args { my ($self, $opt, $args) = @_; my $command = __FILE__; if ($self->app->global_options->{man}) { system([0..5], "perldoc $command"); } else { $self->usage_error("Too few arguments.") unless $opt->{infile} && $opt->{outfile} && $opt->{species}; } } sub execute { my ($self, $opt, $args) = @_; exit(0) if $self->app->global_options->{man}; my $infile = $opt->{infile}; my $outfile = $opt->{outfile}; my $species = $opt->{species}; my $gofile = $opt->{gofile}; my $result = _generate_go_association($infile, $outfile, $species, $gofile); } sub _generate_go_association { my ($infile, $outfile, $species, $gofile) = @_; $gofile = _get_term_file() if !$gofile; unless (-s $gofile) { say STDERR "\n[ERROR]: Could not fetch GO term file. Try manually: http://purl.obolibrary.org/obo/go.obo.\n"; exit(1); } my ($goterms, $format, $version) = _parse_obo_to_terms($gofile); my $taxonid = _get_taxon_id($species); my $taxon = defined $taxonid ? "taxon:$taxonid" : 'taxon:0'; my $date = strftime "%Y%m%d", localtime; open my $in, '<', $infile or die "\nERROR: Could not open file: $infile\n"; open my $out, '>', $outfile or die "\nERROR: Could not open file: $outfile\n"; # https://geneontology.github.io/docs/go-annotation-file-gaf-format-2.1/ say $out '!gaf-version: 2.1'; say $out "! File generated by HMMER2GO (v$VERSION): https://github.com/sestaton/HMMER2GO"; say $out "! Date generated on: $date"; say $out "! Generated from GO ontology format version: $format"; say $out "! Generated from GO ontology data version: $version"; say $out '!==========================================================================='; my %namespace = ( 'biological_process' => 'P', 'cellular_component' => 'C', 'external' => 'E', 'molecular_function' => 'F' ); my $pattern = qr/ \[ # matching `[` sign \s* # ... and, if any, whitespace after them ([^]]+) # starting from the first non-whitespace symbol, capture all the non-']' symbols ] /x; while (my $line = <$in>) { chomp $line; my @go_mappings = split /\t/, $line; #my $dbstring = 'db.'.$go_mappings[0]; my @go_terms = split /\,/, $go_mappings[4]; for my $term (@go_terms) { if (exists $goterms->{$term}) { my $aspect = $namespace{ $goterms->{$term}{namespace} }; my ($dbxrefs) = ($goterms->{$term}{def} =~ /$pattern/); my $xrefs = defined $dbxrefs ? join "|", split /\,\s+/, $dbxrefs : ''; say $out join "\t", 'Pfam', $go_mappings[0], $go_mappings[0], '', $term, $xrefs, 'IEA', '', $aspect, $goterms->{$term}{name}, '|', 'gene', $taxon, $date, 'Pfam', '', ''; } } } close $in; close $out; unlink $gofile; } sub _parse_obo_to_terms { my ($gofile) = @_; open my $fh, '<', $gofile or die "\n[ERROR]: Could not open file: $gofile\n";; local $/ = ""; my ($format, $version); my %ids; while (my $line = <$fh>) { chomp $line; if ($line =~ /format-version|data-version/) { ($format) = ($line =~ /format-version: (\d+\.\d+)/); ($version) = ($line =~ /data-version: releases\/(\d+\-?\d+\-?\d+)/); #2020-12-08 } next if $line =~ /^format-version|^data-version|^subsetdef|^synonymtypedef|^default-namespace|^ontology|^property_value/; my ($header, $id, $name, $namespace, $def, $syn, @rels) = map { s/^\w+\: //; $_ } split /\n/, $line; # skip obsolete terms next if $def =~ /obsolete/i; $ids{$id}{name} = $name; $ids{$id}{def} = $def; $ids{$id}{namespace} = $namespace; $ids{$id}{synonym} = $syn; $ids{$id}{isa_a} = \@rels } close $fh; return (\%ids, $format, $version); } sub _get_term_file { my $urlbase = 'http://current.geneontology.org/ontology/go.obo'; my $response = HTTP::Tiny->new->get($urlbase); unless ($response->{success}) { die "Can't get url $urlbase -- Status: ", $response->{status}, " -- Reason: ", $response->{reason}; } my $gofile = 'go.obo'; open my $out, '>', $gofile or die "\n[ERROR]: Could not open file: $gofile\n"; say $out $response->{content}; close $out; return $gofile; } sub _fetch_terms_file_curl { my ($outfile) = @_; my $host = 'http://current.geneontology.org'; my $dir = 'ontology'; my $file = 'go.obo'; my $endpoint = join "/", $host, $dir, $file; system([0..5], 'curl', '-u', 'anonymous:anonymous@foo.com', '-sL', '-o', $outfile, $endpoint) == 0 or die "\n[ERROR]: 'wget' failed. Cannot fetch map file. Please report this error."; return $outfile; } sub _get_taxon_id { my ($species) = @_; my $db = Bio::DB::Taxonomy->new(-source => 'entrez'); my $taxonid = $db->get_taxonid($species); return $taxonid; } 1; __END__ =pod =head1 NAME hmmer2go map2gaf - Create GO Annotation Format (GAF) file for statistical analysis =head1 SYNOPSIS hmmer2go map2gaf -i genes_orfs_GOterm_mapping.tsv -s 'Helianthus annuus' -o genes_orfs_GOterm_mapping.gaf =head1 AUTHOR S. Evan Staton, C<< <evan at evanstaton.com> >> =head1 DESCRIPTION This command takes the sequence and GO term mappings generated by the 'hmmer2go mapterms' and creates an association file in GAF format. =head1 REQUIRED ARGUMENTS =over 2 =item -i, --infile The sequence ID and GO term mapping file generated by the 'hmmer2go mapterms' command. The file should be a two column tab-delimted file with the sequence ID in the first column and the GO terms separated by commas in the second column. =item -o, --outfile The file GO Annotation Format (GAF) file to be created by this command. See: https://geneontology.github.io/docs/go-annotation-file-gaf-format-2.1/ for the specifications on this format. =item -s, --species A species name must be given when creating the association. This should be the epithet in quotes. An example is provided in the synopsis section of the document. =back =head1 OPTIONS =over 2 =item -g, --gofile The GO.terms_alt_ids file obtained from the Gene Ontology website. If not provided, the latest version will be downloaed and used. =item -h, --help Print a usage statement. =item -m, --man Print the full documentation. =back =cut
sestaton/HMMER2GO
lib/HMMER2GO/Command/map2gaf.pm
Perl
mit
7,524
#!/usr/bin/perl use strict; use lib "/httpd/modules"; use TOXML; use FLOW::LIST; use TOXML::UTIL; use Data::Dumper; use ZTOOLKIT; my $USERNAME = ''; my $FORMAT = 'WRAPPER'; my @USERS = (); push @USERS, ''; # push @USERS, "sporks"; my $dbh = &DBINFO::db_zoovy_connect(); &DBINFO::db_zoovy_close(); foreach my $USERNAME (@USERS) { upgradeUser($USERNAME,'WRAPPER'); } sub upgradeUser { my ($USERNAME,$FORMAT) = @_; my $ar = TOXML::UTIL::listDocs($USERNAME,$FORMAT); foreach my $docref (@{$ar}) { next if (($USERNAME eq '') && ($docref->{'MID'}>0)); next if (($USERNAME ne '') && ($docref->{'MID'}==0)); # next if ($docref->{'DOCID'} ne 'gradefade'); print "DOC: $docref->{'FORMAT'},$docref->{'DOCID'}\n"; my ($t) = TOXML->new($docref->{'FORMAT'},$docref->{'DOCID'},USERNAME=>$USERNAME); my @DIVS = (); push @DIVS, ''; if ((defined $t->{'_DIVS'}) && (scalar(@{$t->{'_DIVS'}})>0)) { die("Document has Divs!"); } my $changed = 0; foreach my $div (@DIVS) { foreach my $iniref (@{$t->getElements($div)}) { my $TYPE = $iniref->{'TYPE'}; # print "TYPE: $TYPE\n"; if ($TYPE eq 'OUTPUT') {} elsif ($TYPE eq 'READONLY') {} elsif (&ZTOOLKIT::isin(['FOOTER', 'SEARCH','SUBCAT','CARTPRODCATS','PRODCATS'],$TYPE)) { if (defined $iniref->{'HTML'}) { my $x = $iniref->{'HTML'}; $iniref->{'HTML'} = &FLOW::LIST::upgrade1to2($iniref->{'HTML'}); if ($x ne $iniref->{'HTML'}) { print "Upgraded $TYPE $iniref->{'ID'}\n"; $changed++; } } } elsif (&ZTOOLKIT::isin(['REVIEWS', 'FINDER', 'PRODLIST'],$TYPE)) { ## FINDER - all SPEC_ foreach my $k (keys %{$iniref}) { my $x = $iniref->{$k}; $iniref->{$k} = &FLOW::LIST::upgrade1to2($iniref->{$k}); if ($x ne $iniref->{$k}) { print "Upgraded $TYPE $iniref->{'ID'}\n"; $changed++; } } print Dumper($iniref); } elsif (&ZTOOLKIT::isin(['MENU','BREADCRUMB'],$TYPE)) { if ($iniref->{'HTML'} =~ /<!-- CATEGORY -->/) {} else { $iniref->{'DIVIDER'} = &FLOW::LIST::upgrade1to2($iniref->{'DIVIDER'}); $iniref->{'BEFORE'} = &FLOW::LIST::upgrade1to2($iniref->{'BEFORE'}); $iniref->{'AFTER'} = &FLOW::LIST::upgrade1to2($iniref->{'AFTER'}); $iniref->{'HTML'} = &FLOW::LIST::upgrade1to2($iniref->{'HTML'}); $iniref->{'DIVIDER'} =~ s/"/&quot;/gs; # escape the divider for runspec $iniref->{'DIVIDER'} =~ s/>/&gt;/gs; $iniref->{'DIVIDER'} =~ s/</&lt;/gs; $iniref->{'DIVIDER'} =~ s/[\n\r]+/ /gs; my $spec = qq~$iniref->{'BEFORE'}\n<!-- CATEGORY -->\n$iniref->{'HTML'}\n~; if ($iniref->{'DIVIDER'} ne '') { $spec .= qq~\n<% load(\$TOTALCOUNT); math(op=>"subtract",var=>\$COUNT); math(op=>"subtract",var=>"1"); stop(unless=>\$_); runspec("$iniref->{'DIVIDER'}"); print(); %>\n~; } $spec .=qq~\n<!-- /CATEGORY -->\n$iniref->{'AFTER'}\n~; delete $iniref->{'DIVIDER'}; delete $iniref->{'AFTER'}; delete $iniref->{'BEFORE'}; $spec =~ s/\$NUM/\$cat_num/gs; $spec =~ s/\$MESSAGE/\$cat_pretty/gs; $spec =~ s/\$URL/\$cat_url/gs; $spec =~ s/\$LT/"&lt;"/gs; $spec =~ s/\$GT/"&gt;"/gs; $spec =~ s/\$BREAK/"\n"/gs; $spec =~ s/\$WIDTH/\$button_width/gs; $spec =~ s/\$HEIGHT/\$button_height/gs; $spec =~ s/\$SRC/\$button_imgsrc/gs; $iniref->{'HTML'} = $spec; print "Upgraded $TYPE $iniref->{'ID'}\n"; $changed++; } } else { print "IGNORED: ".$iniref->{'ID'}.' '.$TYPE." [$changed]\n"; } } } print "CHANGED: $changed\n"; if ($changed) { if ($t->{'_SYSTEM'}==1) { $t->MaSTerSaVE(); } else { $t->save(); } # die(); } # print Dumper($docref,$t); } }
CommerceRack/backend-static
upgradespec.pl
Perl
mit
3,806
#!/usr/bin/env perl #The MIT License (MIT) #Copyright (c) <year> <copyright holders> #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: #The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.j use strict; use LWP::Simple; use HTML::Tree; use IO::Socket::SSL; sub parser(){ my ($url) = @_; my $ua = "Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"; my $browser = LWP::UserAgent->new(); my $ag = $browser->agent($ua); my $re = $browser->get($url); my $page = $re->content; return $page; } sub get_title(){ my ($url) = @_; my $page = &parser($url); my $parse = HTML::Tree->new(); $parse->parse($page); my ($title) = $parse->look_down('_tag','title'); if (defined $title){ $title = $title->as_text; return $title; } } if(@ARGV > 4 || @ARGV < 4){ print "Usage: tbot [NICK] [SERVER] [CHANNEL] [PORT]\n"; exit; } my $user = $ARGV[0]; my $host = $ARGV[1]; my $channel = $ARGV[2]; my $port = $ARGV[3]; my $sock = new IO::Socket::SSL( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', SSL_verify_mode => SSL_VERIFY_PEER, SSL_ca_path => '/etc/ssl/certs' ) or die "Couldn't connect: $!"; sub reconnect{ my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', ) or die "Couldn't connect: $!"; } sub connect{ print $sock "USER $user $user $user :$user IRC\r\n"; print $sock "NICK $user\r\n"; print $sock "JOIN $channel\r\n"; } sub send{ my ($msg) = @_; print $sock "PRIVMSG $channel :\x02\x1Dtitle:\x0F\x0307\x1D $msg\r\n"; } sub error_code{ my ($url) = @_; } sub join_ch{ my ($ch) = @_; print $sock "JOIN $ch\r\n"; } &connect; sub ch_nick{ my ($ch) = @_; print $sock "NICK $ch\r\n"; } while(1){ my $line = <$sock>; print $line; if($line =~ /(PING\s\:\S+)/i){ my $pg = $1; $pg =~ s/PING/PONG/; print $sock "$1\r\n"; } if($line =~ /(PRIVMSG\s$channel\s.*)/i){ if($1 =~ /(http(s)?\S+)/){ my $url = $1; if($url =~ /\.(bin|png|jpeg|jpg|png|gif|webm|gif|pdf|mp4|mp3)/si){ my $file = "$url | $1"; #do nothing } elsif($url =~ /0x0/){ #do notthing } else{ my $title = &get_title($url); &send($title); } } } if($line =~ /(:Duff_man\S+\sPRIVMSG\s$channel.+)/i){ my $nick = $1; if($nick =~ /(.nick\s\S+)/){ $nick =~ s/:Duff_man\S+\sPRIVMSG\s$channel\s:\S+\s//; print "$nick\n"; &ch_nick($nick); } } if($line =~ /KICK\s$channel\s$user/){ sleep 3; &connect; #prn sc JI canlr\n"; } }
Irabor/tbot
tbot.pl
Perl
mit
3,481
#!/usr/bin/perl # Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies of the Software, its documentation and marketing & publicity # materials, and acknowledgment shall be given in the documentation, materials # and software packages that this Software was used. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # This script is still VERY VERY VERY early on in development # but I wanted to give you folks an idea of why the IPC was being # set up the way it was. this is just a quick hack. expect better # samples in the near future. # This app will take the parameters "on" and "off", and will basically # shade all the windows on the current desktop and area. (or unshade) # # --Mandrake # here we're going to test to see whether we are shading or unshading # the window. if($ARGV[0] eq "on") { $shade = 1; } else { $shade = 0; } # here we'll retreive the current desk we're on $_ = `eesh desk`; @stuff = split(/\s*:\s*/); @stuff = split(/\s*\/\s*/, $stuff[1]); $current_desk = $stuff[0]; # here we'll retreive the current area we're on $_ = `eesh area`; @stuff = split(/\s*\n\s*/); @stuff = split(/\s*:\s*/, $stuff[0]); $current_area = $stuff[1]; $current_area =~ s/\n//g; # get the old shadespeed so that we can set it back later # because we want this to happen fairly quickly, we'll set # the speed to something really high $_ = `eesh show misc.shading.speed`; @stuff = split(/\s*\n\s*/); @stuff = split(/\s*=\s*/, $stuff[0]); $shadespeed = $stuff[1]; open IPCPIPE,"| eesh"; print IPCPIPE "set misc.shading.speed 10000000\n"; # now we're going to walk through each of these windows and # shade them @winlist = `eesh window_list a`; foreach (@winlist) { if (/\s*(\w+)\s* : .* :: \s*(-*\d+)\s* : (.*) : (.*)$/) { $window = $1; $desk = $2; $area = $3; $name = $4; # Skip pagers, iconboxes, systrays, and epplets next if ($name =~ /^Pager-|Iconbox|Systray|E-/); # next unless (($desk == -1) and ($desk eq $current_desk)); next unless ($desk eq $current_desk); next unless ($area eq $current_area); if ($shade) { print IPCPIPE "win_op $window shade on\n"; } else { print IPCPIPE "win_op $window shade off\n"; } } } # now we're going to set the shade speed back to what it was originally print IPCPIPE "set misc.shading.speed $shadespeed\n"; close IPCPIPE; # that's it!
burzumishi/e16
sample-scripts/testroller.pl
Perl
mit
3,303
#!/usr/bin/env perl #=============================================================================== # # FILE: lsf_job_manager.pl # # USAGE: ./lsf_job_manager.pl # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: NJWALKER (), nw11@sanger.ac.uk modified RJGUNNING, rg12@sanger.ac.uk # COMPANY: # VERSION: 1.0 # CREATED: 24/02/13 12:05:44 # REVISION: --- #=============================================================================== use strict; use warnings; use strict; use warnings; use YAML::Any; use Graph::Easy; use Graph; use Graph::Convert; use Path::Class qw(dir file); use LSF RaiseError => 0, PrintError => 1, PrintOutput => 0; use LSF::Job; use Time::Stamp qw(-stamps); use autobox::Core; # This should just be given the directory as an input # Then everything else should be down to reading the config file that # gives the names of the appropriate files. my $pipeline_dir = dir($ARGV[0]); print "$pipeline_dir\n"; my $pipeline_name = $pipeline_dir->basename; print "$pipeline_name\n"; $pipeline_name =~ s/.graph.yaml//g; my $pipeline_graph_and_jobs_yaml_file = file($pipeline_dir); print "$pipeline_graph_and_jobs_yaml_file\n"; my $pipeline_graph_and_jobs_yaml = $pipeline_graph_and_jobs_yaml_file->slurp; my $graph_and_jobs = Load( $pipeline_graph_and_jobs_yaml ); print $pipeline_name, "\n"; #Get graph #my $graph_easy = Graph::Easy->new( $graph_and_jobs->[1] ); #my $graph = Graph::Convert->as_graph ( $graph_easy ); my $graph = make_graph1($graph_and_jobs); my @job_ids = $graph->vertices; print "Got these jobs: @job_ids\n"; #Get jobs my @lsf_jobs; ##################### # 1. # Assign an lsf job name to each job - so we can refer to it in the dependency # expression. This will be a combination of pipeline name, step, and a time based # run number my $timestamp = gmstamp(); foreach my $job_id (@job_ids) { $graph->set_vertex_attribute($job_id, 'lsf-job-name', $pipeline_name . "-$job_id-$timestamp" ); print "Set $job_id lsf name to $pipeline_name-$job_id-$timestamp\n" } my $job_manager = LSF::JobManager->new( -q => 'normal', -M => "500" ,-R => "span[hosts=1] select[mem>500] rusage[mem=500]" , -L => "/usr/local/bin/bash");#, -L => '/bin/bash' ); # 2. # Submit each job with it's possible dependencies. my @job_ids_topologically_sorted = $graph->topological_sort; foreach my $job_id ( @job_ids_topologically_sorted ){ print "Processing $job_id\n"; my @dependent_jobs = $graph->predecessors($job_id); my $dependency_str; if( @dependent_jobs > 0 ) { print "Found dependent jobs for job $job_id: jobs(s) @dependent_jobs\n"; my @dependencies; foreach my $dependent_job (@dependent_jobs ) { my $lsf_job_name = $graph->get_vertex_attribute( $dependent_job, 'lsf-job-name'); push( @dependencies, "done($lsf_job_name)"); } $dependency_str = join('&&', @dependencies); print "LSF dependency string: ", $dependency_str, "\n"; }else{ print "No dependent job for $job_id.\n"} #Give the job a name with -J my $lsf_job_name = $graph->get_vertex_attribute( $job_id, 'lsf-job-name' ); my ($job,$step) = split(/\./,$job_id); my $cmd = $graph_and_jobs->{ $job }->{$step}->{cmd}; my $mem = $graph_and_jobs->{ $job }->{$step}->{mem}; my $queue = $graph_and_jobs->{ $job }->{$step}->{queue}; my $cores = $graph_and_jobs->{ $job }->{$step}->{cores}; my %args; $args{-w} = $dependency_str if @dependent_jobs >0; $args{-J} = $lsf_job_name; $args{-R} = "span[hosts=1] select[mem>$mem] rusage[mem=$mem]" if defined($mem); $args{-M} = $mem if defined($mem); # in KB, but we * by 1000 not 1024, since esub requires it to be less. $args{-o} = '/nfs/users/nfs_r/rg12/lustre110/Pipeline/lsfout/out-%J'; $args{'-q'} = $queue if defined($queue); $args{'-n'} = $cores if defined($cores); print "\n---SUBMISSION---\n"; if( defined( $cmd ) ){ print "CMD:\n$cmd\n"; }else{ print "CMD IS NOT DEFINED - (groupby or once step perhaps?)\n"; $cmd = "echo nothing > stdout" } print "Submit $lsf_job_name with :\n" , join " ", %args,"\n\n"; $job_manager->submit(%args, $cmd); #if( @dependent_jobs > 0 ) { # print "Submit $lsf_job_name\n"; # $job_manager->submit( -w => $dependency_str, -J => $lsf_job_name, $cmd); #} else { # $job_manager->submit( -J => $lsf_job_name, $cmd); #} } #3. wait for my $job ($job_manager->jobs){ $job->top; } $job_manager->wait_all_children( history => 1 ); print "All children have completed!\n"; for my $job ($job_manager->jobs){ # much quicker if history is pre-cached print STDERR "$job exited non zero\n" if $job->history->exit_status != 0; } $job_manager->clear; # clear out the job manager to reuse. sub make_graph1 { my $jobs = shift; my $graph = Graph->new; foreach my $job_num (%$jobs){ my $stepsinjob = $jobs->{$job_num}; foreach my $stepinjob ( keys %$stepsinjob ) { if( $stepsinjob->{$stepinjob}->{dependents}->length > 0 ){ foreach my $dependency ($stepsinjob->{$stepinjob}->{dependents}->flatten) { $graph->add_edge( $dependency, "$job_num.$stepinjob" ); print "added $dependency - $job_num.$stepinjob to graph\n"; } }else{ $graph->add_vertex("$job_num.$stepinjob"); print "add vertex $job_num.$stepinjob\n"; } } } return $graph; } sub make_graph { my $jobs = shift; my $graph = Graph->new; my $i = 0; foreach my $jobs (@$jobs){ foreach my $stepinjob ( keys %$jobs ) { if( $jobs->{$stepinjob}->{dependents}->length > 0 ){ foreach my $dependency ($jobs->{$stepinjob}->{dependents}->flatten) { $graph->add_edge( $dependency, "$i.$stepinjob" ); print "added $dependency - $i.$stepinjob to graph\n"; } }else{ $graph->add_vertex("$i.$stepinjob"); print "add vertex $i.$stepinjob\n"; } } $i++; } return $graph; }
RGunning/customscripts
lsf_dispatcher1.pl
Perl
mit
6,075
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! # This file is machine-generated by lib/unicore/mktables from the Unicode # database, Version 12.1.0. Any changes made here will be lost! # !!!!!!! INTERNAL PERL USE ONLY !!!!!!! # This file is for internal use by core Perl only. The format and even the # name or existence of this file are subject to change without notice. Don't # use it directly. Use Unicode::UCD to access the Unicode character data # base. return <<'END'; V158 48 49 1632 1633 1776 1777 1984 1985 2406 2407 2534 2535 2662 2663 2790 2791 2918 2919 3046 3047 3174 3175 3192 3193 3302 3303 3430 3431 3558 3559 3664 3665 3792 3793 3872 3873 4160 4161 4240 4241 6112 6113 6128 6129 6160 6161 6470 6471 6608 6609 6784 6785 6800 6801 6992 6993 7088 7089 7232 7233 7248 7249 8304 8305 8320 8321 8585 8586 9450 9451 9471 9472 12295 12296 38646 38647 42528 42529 42735 42736 43216 43217 43264 43265 43472 43473 43504 43505 43600 43601 44016 44017 63922 63923 65296 65297 65930 65931 66720 66721 68912 68913 69734 69735 69872 69873 69942 69943 70096 70097 70384 70385 70736 70737 70864 70865 71248 71249 71360 71361 71472 71473 71904 71905 72784 72785 73040 73041 73120 73121 92768 92769 93008 93009 93824 93825 119520 119521 120782 120783 120792 120793 120802 120803 120812 120813 120822 120823 123200 123201 123632 123633 125264 125265 127232 127234 127243 127245 END
operepo/ope
client_tools/svc/rc/usr/share/perl5/core_perl/unicore/lib/Nv/0.pl
Perl
mit
1,386
package Anagram; use strict; use warnings; use Exporter qw<import>; our @EXPORT_OK = qw<match_anagrams>; sub match_anagrams { my ($input) = @_; return undef; } 1;
exercism/xperl5
exercises/practice/anagram/Anagram.pm
Perl
mit
169
package # Date::Manip::TZ::afnair00; # Copyright (c) 2008-2015 Sullivan Beck. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # This file was automatically generated. Any changes to this file will # be lost the next time 'tzdata' is run. # Generated on: Wed Nov 25 11:33:37 EST 2015 # Data version: tzdata2015g # Code version: tzcode2015g # This module contains data from the zoneinfo time zone database. The original # data was obtained from the URL: # ftp://ftp.iana.org/tz use strict; use warnings; require 5.010000; our (%Dates,%LastRule); END { undef %Dates; undef %LastRule; } our ($VERSION); $VERSION='6.52'; END { undef $VERSION; } %Dates = ( 1 => [ [ [1,1,2,0,0,0],[1,1,2,2,27,16],'+02:27:16',[2,27,16], 'LMT',0,[1928,6,30,21,32,43],[1928,6,30,23,59,59], '0001010200:00:00','0001010202:27:16','1928063021:32:43','1928063023:59:59' ], ], 1928 => [ [ [1928,6,30,21,32,44],[1928,7,1,0,32,44],'+03:00:00',[3,0,0], 'EAT',0,[1929,12,31,20,59,59],[1929,12,31,23,59,59], '1928063021:32:44','1928070100:32:44','1929123120:59:59','1929123123:59:59' ], ], 1929 => [ [ [1929,12,31,21,0,0],[1929,12,31,23,30,0],'+02:30:00',[2,30,0], 'BEAT',0,[1939,12,31,21,29,59],[1939,12,31,23,59,59], '1929123121:00:00','1929123123:30:00','1939123121:29:59','1939123123:59:59' ], ], 1939 => [ [ [1939,12,31,21,30,0],[1940,1,1,0,15,0],'+02:45:00',[2,45,0], 'BEAUT',0,[1959,12,31,21,14,59],[1959,12,31,23,59,59], '1939123121:30:00','1940010100:15:00','1959123121:14:59','1959123123:59:59' ], ], 1959 => [ [ [1959,12,31,21,15,0],[1960,1,1,0,15,0],'+03:00:00',[3,0,0], 'EAT',0,[9999,12,31,0,0,0],[9999,12,31,3,0,0], '1959123121:15:00','1960010100:15:00','9999123100:00:00','9999123103:00:00' ], ], ); %LastRule = ( ); 1;
jkb78/extrajnm
local/lib/perl5/Date/Manip/TZ/afnair00.pm
Perl
mit
2,035
#!/usr/bin/perl ##---------------------------------------------------------------------------## ## File: ## @(#) clusterProfillicAlignmentProfiles ## Author: ## Paul Thatcher Edlefsen pedlefse@fredhutch.org ## Description: ## Script for using Profile HMMs to cluster sequences. ## By default it writes the output to ## stdout; use -o to write to a file. Note that this calls runProfillic.pl ## to create a file of alignment profiles. This file is then broken into ## input-sequence-specfiic alignment profile files. And then this ## calls out to the R script clusterProfillicAlignmentProfiles.R. ## ###****************************************************************************** use Getopt::Std; # for getopts use Text::Wrap; # for wrap $Text::Wrap::columns = 72;# TODO: DEHACKIFY MAGIC # use strict; use vars qw( $opt_D $opt_V $opt_f ); use vars qw( $VERBOSE $DEBUG ); sub clusterProfillicAlignmentProfiles { @ARGV = @_; sub clusterProfillicAlignmentProfiles_usage { print "\tclusterProfillicAlignmentProfiles [-DVf] <input_fasta_filename> <profillic_alignment_profile_files_list_file> [<output dir>]\n"; exit; } # This means -D, -V, and -f are ok, but nothin' else. # opt_f means don't actually cluster them; instead put them all into one cluster ("cluster 0"). # opt_D means print debugging output. # opt_V means be verbose. # But first reset the opt vars. ( $opt_D, $opt_V, $opt_f ) = (); if( not getopts('DVf') ) { clusterProfillicAlignmentProfiles_usage(); } $DEBUG ||= $opt_D; $VERBOSE ||= $opt_V; my $force_one_cluster = $opt_f; my $old_autoflush; if( $VERBOSE ) { select STDOUT; $old_autoflush = $|; $| = 1; # Autoflush. } my $input_fasta_file = shift @ARGV || clusterProfillicAlignmentProfiles_usage(); my ( $input_fasta_file_path, $input_fasta_file_short ) = ( $input_fasta_file =~ /^(.*?)\/([^\/]+)$/ ); unless( $input_fasta_file_short ) { $input_fasta_file_short = $input_fasta_file; $input_fasta_file_path = "."; } my $alignment_profile_files_list_file = shift @ARGV || clusterProfillicAlignmentProfiles_usage(); my $output_dir = shift @ARGV || $input_fasta_file_path; # Remove the trailing "/" if any if( defined( $output_dir ) ) { ( $output_dir ) = ( $output_dir =~ /^(.*[^\/])\/*$/ ); } if( $VERBOSE ) { print "Output will be written in directory \"$output_dir\".."; } if( !-e $output_dir ) { `mkdir $output_dir`; } if( $VERBOSE ) { print "Calling R to cluster the alignment profiles.."; if( $force_one_cluster ) { print( "Forcing one cluster..\n" ); } else { print( "Clustering..\n" ); } } my $R_output = `export clusterProfillicAlignmentProfiles_forceOneCluster="$force_one_cluster"; export clusterProfillicAlignmentProfiles_alignmentProfileFilesListFilename="$alignment_profile_files_list_file"; export clusterProfillicAlignmentProfiles_fastaFilename="$input_fasta_file"; export clusterProfillicAlignmentProfiles_outputDir="$output_dir"; R -f clusterProfillicAlignmentProfiles.R --vanilla --slave`; # The output has the number of clusters. print( $R_output ); if( $VERBOSE ) { print "\t.done.\n"; } if( $VERBOSE ) { select STDOUT; $| = $old_autoflush; } if( $VERBOSE ) { print ".Done.\n"; } if( $VERBOSE ) { select STDOUT; $| = $old_autoflush; } return 0; } # clusterProfillicAlignmentProfiles(..) clusterProfillicAlignmentProfiles( @ARGV ); 1;
pedlefsen/hiv-founder-id
clusterProfillicAlignmentProfiles.pl
Perl
mit
3,537
# Copyright 2020, Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package Google::Ads::GoogleAds::V10::Common::LanguageInfo; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = {languageConstant => $args->{languageConstant}}; # Delete the unassigned fields in this object for a more concise JSON payload remove_unassigned_fields($self, $args); bless $self, $class; return $self; } 1;
googleads/google-ads-perl
lib/Google/Ads/GoogleAds/V10/Common/LanguageInfo.pm
Perl
apache-2.0
1,033
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut package EnsEMBL::Web::PipeConfig::Tools_conf; use strict; use warnings; use EnsEMBL::Web::SpeciesDefs; use EnsEMBL::Web::Utils::DynamicLoader qw(dynamic_require); use parent qw(Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf); sub new { ## @override ## @constructor ## Adds some extra info to the object and require the tools config packages my $self = shift->SUPER::new(@_); my $sd = $self->{'_species_defs'} = EnsEMBL::Web::SpeciesDefs->new; @{$self->{'_all_tools'}} = map dynamic_require("EnsEMBL::Web::ToolsPipeConfig::$_"), $sd->hive_tools_list; return $self; } sub species_defs { ## @return Species defs object return shift->{'_species_defs'}; } sub all_tools { ## @return Array of all tools (whether or not they are available on this site) return @{$_[0]{'_all_tools'}}; } sub default_options { ## @override my $self = shift; my $hive_db = $self->species_defs->hive_db; return { %{ $self->SUPER::default_options }, 'pipeline_name' => 'ensembl_web_tools', 'hive_use_triggers' => 0, 'pipeline_db' => { '-host' => $hive_db->{'host'}, '-port' => $hive_db->{'port'}, '-user' => $hive_db->{'username'}, '-pass' => $hive_db->{'password'}, '-dbname' => $hive_db->{'database'}, '-driver' => 'mysql', } }; } sub resource_classes { ## @override my $self = shift; return { map %{$_->resource_classes($self)}, $self->all_tools }; } sub pipeline_analyses { ## @override my $self = shift; return [ map { @{$_->pipeline_analyses($self)} } $self->all_tools ]; } 1;
muffato/public-plugins
tools_hive/modules/EnsEMBL/Web/PipeConfig/Tools_conf.pm
Perl
apache-2.0
2,410
=head1 NAME Unison -- Unison database API for perl S<$Id$> =head1 SYNOPSIS use Unison; =head1 DESCRIPTION C<use Unison;> loads the most commonly used Unison modules into the Unison:: namespace. See `perldoc Unison::common' for information about which modules are included, and see `perldoc Unison::intro' for more information about the Unison API. =cut package Unison; use CBT::debug; CBT::debug::identify_file() if ($CBT::debug::trace_uses); use strict; use warnings; use base 'Exporter'; use Unison::common; =pod =head1 SEE ALSO =over =item perldoc Unison::intro =item perldoc Unison::common =back =head1 AUTHOR Reece Hart, Ph.D. rkh@gene.com, http://www.gene.com/ Genentech, Inc. 650-225-6133 (voice), -5389 (fax) Bioinformatics and Protein Engineering 1 DNA Way, MS-93 http://harts.net/reece/ South San Francisco, CA 94080-4990 reece@harts.net, GPG: 0x25EC91A0 =cut 1;
unison/unison
perl5/Unison.pm
Perl
apache-2.0
972
# # Copyright 2015 Electric Cloud, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # =head1 NAME modifyApplicationClassLoader.pl - a perl library to modify application's ClassLoader behaviour. =head1 SYNOPSIS =head1 DESCRIPTION A perl library that modifies application's ClassLoader behaviour. =head1 LICENSE Copyright (c) 2014 Electric Cloud, Inc. All rights reserved. =head1 AUTHOR --- =head2 METHODS =cut # ------------------------------------------------------------------------- # Includes # ------------------------------------------------------------------------- use ElectricCommander; use ElectricCommander::PropMod qw(/myProject/modules); use WebSphere::WebSphere; use WebSphere::Util; use warnings; use strict; $| = 1; # ------------------------------------------------------------------------- # Variables # ------------------------------------------------------------------------- my $configName = trim(q($[configurationName])); my $wsadminAbsPath = trim(q($[wsadminAbsPath])); my $applicationName = trim(q($[applicationName])); my $loadOrder = trim(q($[loadOrder])); my $classLoaderPolicy = trim(q($[classLoaderPolicy])); # create args array my @args = (); my %props = (); #get an EC object my $ec = new ElectricCommander(); $ec->abortOnError(0); print "Will modify ClassLoader for " . $applicationName . " application. Load Order: $loadOrder, ClassLoader policy: $classLoaderPolicy\n"; my $websphere = new WebSphere::WebSphere( $ec, $configName, $wsadminAbsPath ); my $file = 'modify_application_classloader.py'; my $script = $ec->getProperty("/myProject/wsadmin_scripts/$file")->getNodeText('//value'); $file = $websphere->write_jython_script( $file, {}, augment_filename_with_random_numbers => 1 ); my $shellcmd = $websphere->_create_runfile( $file, @args ); my $escapedCmdLine = $websphere->_mask_password($shellcmd); print "WSAdmin command line: $escapedCmdLine\n"; $props{'modifyApplicationClassLoaderLine'} = $escapedCmdLine; setProperties( $ec, \%props ); #execute command print `$shellcmd 2>&1`; #evaluates if exit was successful to mark it as a success or fail the step if ( $? == SUCCESS ) { $ec->setProperty( "/myJobStep/outcome", 'success' ); } else { $ec->setProperty( "/myJobStep/outcome", 'error' ); } 1;
electric-cloud/EC-WebSphere
src/main/resources/project/server/modifyApplicationClassLoader.pl
Perl
apache-2.0
2,816
new10(A,B,C,D,E) :- A=0. new9(A,B,C,D) :- E=1, B=<100, new10(E,A,B,C,D). new9(A,B,C,D) :- E=0, B>=101, new10(E,A,B,C,D). new7(A,B,C,D) :- E=1+A, F=1+B, A-D=< -1, new7(E,F,C,D). new7(A,B,C,D) :- A-D>=0, new9(A,B,C,D). new6(A,B,C,D) :- E=0, C-D=<0, new7(C,E,C,D). new5(A,B,C,D) :- C>=0, new6(A,B,C,D). new4(A,B,C,D) :- D=<100, new5(A,B,C,D). new3(A,B,C,D) :- D>=0, new4(A,B,C,D). new2 :- new3(A,B,C,D). new1 :- new2. false :- new1.
bishoksan/RAHFT
benchmarks_scp/misc/programs-clp/DAGGER-substring1.map.c.map.pl
Perl
apache-2.0
430
# OpenXPKI::Server::Workflow::Condition::CertificateNotYetRevoked # Written by Alexander Klink for the OpenXPKI project 2007 # Copyright (c) 2007 by The OpenXPKI Project package OpenXPKI::Server::Workflow::Condition::CertificateNotYetRevoked; use strict; use warnings; use base qw( Workflow::Condition ); use Workflow::Exception qw( condition_error configuration_error ); use OpenXPKI::Server::Context qw( CTX ); use OpenXPKI::Serialization::Simple; use OpenXPKI::Debug; use English; use OpenXPKI::Exception; sub evaluate { ##! 1: 'start' my ( $self, $workflow ) = @_; my $context = $workflow->context(); my $identifier = $context->param('cert_identifier'); my $reason_code = $context->param('reason_code'); my $pki_realm = CTX('session')->data->pki_realm; OpenXPKI::Exception->throw( message => 'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_CERTIFICATE_NOT_YET_REVOKED_IDENTIFIER_MISSING', ) unless $identifier; my $cert = CTX('dbi')->select_one( from => 'certificate', columns => [ 'status' ], where => { identifier => $identifier, pki_realm => $pki_realm, } ); CTX('log')->application()->debug("Cert status is ".$cert->{status}); ##! 16: 'status: ' . $cert->{'STATUS'} condition_error 'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_CERTIFICATE_NOT_YET_REVOKED_CERT_IN_STATE_CRL_ISSUANCE_PENDING' if ('CRL_ISSUANCE_PENDING' eq $cert->{status}); condition_error 'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_CERTIFICATE_NOT_YET_REVOKED_CERT_IN_STATE_REVOKED' if ('REVOKED' eq $cert->{status}); condition_error 'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_CERTIFICATE_NOT_YET_REVOKED_CERT_ON_HOLD_AND_REASON_CODE_NOT_REMOVE_FROM_CRL' if ('HOLD' eq $cert->{status} and $reason_code ne 'removeFromCRL'); condition_error 'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_CERTIFICATE_NOT_YET_REVOKED_CERT_NOT_ON_HOLD_AND_REASON_CODE_REMOVE_FROM_CRL' if ($cert->{status} ne 'HOLD' and $reason_code eq 'removeFromCRL'); return 1; } 1; __END__ =head1 NAME OpenXPKI::Server::Workflow::Condition::CertificateNotYetRevoked =head1 SYNOPSIS <action name="do_something"> <condition name="certificate_not_yet_revoked" class="OpenXPKI::Server::Workflow::Condition::CertificateNotYetRevoked"> </condition> </action> =head1 DESCRIPTION The condition checks if the certificate from a CRR has not yet been revoked. It furthermore throws an exception when the certificate is in state 'HOLD' and the reason code is not 'removeFromCRL'.
aleibl/openxpki
core/server/OpenXPKI/Server/Workflow/Condition/CertificateNotYetRevoked.pm
Perl
apache-2.0
2,597
package Google::Ads::AdWords::v201402::ConstantDataService::ConstantDataServiceInterfacePort; use strict; use warnings; use Class::Std::Fast::Storable; use Scalar::Util qw(blessed); use base qw(SOAP::WSDL::Client::Base); # only load if it hasn't been loaded before require Google::Ads::AdWords::v201402::TypeMaps::ConstantDataService if not Google::Ads::AdWords::v201402::TypeMaps::ConstantDataService->can('get_class'); sub START { $_[0]->set_proxy('https://adwords.google.com/api/adwords/cm/v201402/ConstantDataService') if not $_[2]->{proxy}; $_[0]->set_class_resolver('Google::Ads::AdWords::v201402::TypeMaps::ConstantDataService') if not $_[2]->{class_resolver}; $_[0]->set_prefix($_[2]->{use_prefix}) if exists $_[2]->{use_prefix}; } sub getAgeRangeCriterion { my ($self, $body, $header) = @_; die "getAgeRangeCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getAgeRangeCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getAgeRangeCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getCarrierCriterion { my ($self, $body, $header) = @_; die "getCarrierCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getCarrierCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getCarrierCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getGenderCriterion { my ($self, $body, $header) = @_; die "getGenderCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getGenderCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getGenderCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getLanguageCriterion { my ($self, $body, $header) = @_; die "getLanguageCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getLanguageCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getLanguageCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getMobileDeviceCriterion { my ($self, $body, $header) = @_; die "getMobileDeviceCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getMobileDeviceCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getMobileDeviceCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getOperatingSystemVersionCriterion { my ($self, $body, $header) = @_; die "getOperatingSystemVersionCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getOperatingSystemVersionCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getOperatingSystemVersionCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getProductBiddingCategoryData { my ($self, $body, $header) = @_; die "getProductBiddingCategoryData must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getProductBiddingCategoryData', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getProductBiddingCategoryData )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getUserInterestCriterion { my ($self, $body, $header) = @_; die "getUserInterestCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getUserInterestCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getUserInterestCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } sub getVerticalCriterion { my ($self, $body, $header) = @_; die "getVerticalCriterion must be called as object method (\$self is <$self>)" if not blessed($self); return $self->SUPER::call({ operation => 'getVerticalCriterion', soap_action => '', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::getVerticalCriterion )], }, header => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/', encodingStyle => '', parts => [qw( Google::Ads::AdWords::v201402::ConstantDataService::RequestHeader )], }, headerfault => { } }, $body, $header); } 1; __END__ =pod =head1 NAME Google::Ads::AdWords::v201402::ConstantDataService::ConstantDataServiceInterfacePort - SOAP Interface for the ConstantDataService Web Service =head1 SYNOPSIS use Google::Ads::AdWords::v201402::ConstantDataService::ConstantDataServiceInterfacePort; my $interface = Google::Ads::AdWords::v201402::ConstantDataService::ConstantDataServiceInterfacePort->new(); my $response; $response = $interface->getAgeRangeCriterion(); $response = $interface->getCarrierCriterion(); $response = $interface->getGenderCriterion(); $response = $interface->getLanguageCriterion(); $response = $interface->getMobileDeviceCriterion(); $response = $interface->getOperatingSystemVersionCriterion(); $response = $interface->getProductBiddingCategoryData(); $response = $interface->getUserInterestCriterion(); $response = $interface->getVerticalCriterion(); =head1 DESCRIPTION SOAP Interface for the ConstantDataService web service located at https://adwords.google.com/api/adwords/cm/v201402/ConstantDataService. =head1 SERVICE ConstantDataService =head2 Port ConstantDataServiceInterfacePort =head1 METHODS =head2 General methods =head3 new Constructor. All arguments are forwarded to L<SOAP::WSDL::Client|SOAP::WSDL::Client>. =head2 SOAP Service methods Method synopsis is displayed with hash refs as parameters. The commented class names in the method's parameters denote that objects of the corresponding class can be passed instead of the marked hash ref. You may pass any combination of objects, hash and list refs to these methods, as long as you meet the structure. List items (i.e. multiple occurences) are not displayed in the synopsis. You may generally pass a list ref of hash refs (or objects) instead of a hash ref - this may result in invalid XML if used improperly, though. Note that SOAP::WSDL always expects list references at maximum depth position. XML attributes are not displayed in this synopsis and cannot be set using hash refs. See the respective class' documentation for additional information. =head3 getAgeRangeCriterion Returns a list of all age range criteria. @return A list of age ranges. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getAgeRangeCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getAgeRangeCriterionResponse> object. $response = $interface->getAgeRangeCriterion( { },, ); =head3 getCarrierCriterion Returns a list of all carrier criteria. @return A list of carriers. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getCarrierCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getCarrierCriterionResponse> object. $response = $interface->getCarrierCriterion( { },, ); =head3 getGenderCriterion Returns a list of all gender criteria. @return A list of genders. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getGenderCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getGenderCriterionResponse> object. $response = $interface->getGenderCriterion( { },, ); =head3 getLanguageCriterion Returns a list of all language criteria. @return A list of languages. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getLanguageCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getLanguageCriterionResponse> object. $response = $interface->getLanguageCriterion( { },, ); =head3 getMobileDeviceCriterion Returns a list of all mobile devices. @return A list of mobile devices. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getMobileDeviceCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getMobileDeviceCriterionResponse> object. $response = $interface->getMobileDeviceCriterion( { },, ); =head3 getOperatingSystemVersionCriterion Returns a list of all operating system version criteria. @return A list of operating system versions. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getOperatingSystemVersionCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getOperatingSystemVersionCriterionResponse> object. $response = $interface->getOperatingSystemVersionCriterion( { },, ); =head3 getProductBiddingCategoryData Returns a list of shopping bidding categories. A country predicate must be included in the selector. An empty parentDimensionType predicate will filter for root categories. @return A list of shopping bidding categories. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getProductBiddingCategoryDataResponse|Google::Ads::AdWords::v201402::ConstantDataService::getProductBiddingCategoryDataResponse> object. $response = $interface->getProductBiddingCategoryData( { selector => $a_reference_to, # see Google::Ads::AdWords::v201402::Selector },, ); =head3 getUserInterestCriterion Returns a list of user interests. @param userInterestTaxonomyType The type of taxonomy to use when requesting user interests. @return A list of user interests. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getUserInterestCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getUserInterestCriterionResponse> object. $response = $interface->getUserInterestCriterion( { userInterestTaxonomyType => $some_value, # ConstantDataService.UserInterestTaxonomyType },, ); =head3 getVerticalCriterion Returns a list of content verticals. @return A list of verticals. @throws ApiException when there is at least one error with the request. Returns a L<Google::Ads::AdWords::v201402::ConstantDataService::getVerticalCriterionResponse|Google::Ads::AdWords::v201402::ConstantDataService::getVerticalCriterionResponse> object. $response = $interface->getVerticalCriterion( { },, ); =head1 AUTHOR Generated by SOAP::WSDL on Thu Jun 26 19:31:19 2014 =cut
gitpan/GOOGLE-ADWORDS-PERL-CLIENT
lib/Google/Ads/AdWords/v201402/ConstantDataService/ConstantDataServiceInterfacePort.pm
Perl
apache-2.0
15,942
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =head1 NAME Bio::EnsEMBL::Compara::RunnableDB::DBMergeCheck =head1 AUTHORSHIP Ensembl Team. Individual contributions can be found in the GIT log. =head1 SYNOPSIS This Runnable needs the following parameters: - src_db_aliases: list of database aliases (the databases to merge) - curr_rel_db: alias of the target database All the above aliases must be resolvable via $self->param(...) - master_tables: list of Compara tables that are populated by populate_new_database - production_tables: list of Compara production tables (should map ensembl-compara/sql/pipeline-tables.sql) - hive_tables: list of eHive tables (should map ensembl-hive/sql/tables.sql) It works by: 1. Listing all the tables that are non-empty 2. Deciding for each table whether they have to be copied over or merged - a table is copied (replaced) if there is a single source - a table is merged if there are multiple sources (perhaps the target as well) 3. When merging, the runnable checks that the data does not overlap - first by comparing the interval of the primary key - then comparing the actual values if needed 4. If everything is fine, the jobs are all dataflown Primary keys can most of the time be guessed from the schema. However, you can define the hash primary_keys as 'table' => 'column_name' to override some of the keys / provide them if they are not part of the schema. They don't have to be the whole primary key on their own, they can simply be a representative column that can be used to check for overlap between databases. Currently, only INT anc CHAR columns are allowed. The Runnable will complain if: - no primary key is defined / can be found for a table that needs to be merged - the primary key is not INT or CHAR - the tables refered by the "only_tables" parameter should all be non-empty - the tables refered by the "exclusive_tables" parameter should all be non-empty - all the non-production and non-eHive tables of the source databases should exist in the target database - some tables that need to be merged share a value of their primary key =cut package Bio::EnsEMBL::Compara::RunnableDB::DBMergeCheck; use strict; use warnings; use Data::Dumper; use Bio::EnsEMBL::DBSQL::DBConnection; use Bio::EnsEMBL::Hive::Utils ('go_figure_dbc', 'stringify'); use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable'); sub param_defaults { return { # Static list of the main tables that must be ignored (their # content exclusively comes from the master database) 'master_tables' => [qw(meta genome_db species_set species_set_header method_link method_link_species_set ncbi_taxa_node ncbi_taxa_name dnafrag)], # Static list of production tables that must be ignored 'production_tables' => [qw(ktreedist_score recovered_member cmsearch_hit CAFE_data gene_tree_backup split_genes mcl_sparse_matrix statistics constrained_element_production dnafrag_chunk lr_index_offset dnafrag_chunk_set dna_collection anchor_sequence anchor_align homology_id_mapping)], # Do we want to be very picky and die if a table hasn't been listed # above / isn't in the target database ? 'die_if_unknown_table' => 1, # How to compare overlapping data. Primary keys are read from the schema unless overriden here 'primary_keys' => { 'gene_tree_root_tag' => [ 'root_id', 'tag' ], 'gene_tree_node_tag' => [ 'node_id', 'tag' ], 'species_tree_node_tag' => [ 'node_id', 'tag' ], 'dnafrag_region' => [ 'synteny_region_id', ], 'constrained_element' => [ 'constrained_element_id', ], }, # Maximum number of elements that we are allowed to fetch to check for a primary key conflict 'max_nb_elements_to_fetch' => 50e6 }; } sub fetch_input { my $self = shift @_; $self->dbc->disconnect_if_idle(); my $src_db_aliases = $self->param_required('src_db_aliases'); my $exclusive_tables = $self->param_required('exclusive_tables'); my $ignored_tables = $self->param_required('ignored_tables'); my $dbconnections = { map {$_ => go_figure_dbc( $self->param_required($_) ) } (@$src_db_aliases, 'curr_rel_db') }; $self->param('dbconnections', $dbconnections); # Expand the exclusive tables that have a "%" in their name foreach my $table ( keys %$exclusive_tables ) { if ($table =~ /%/) { my $sql = "SHOW TABLES LIKE '$table'"; my $db = delete $exclusive_tables->{$table}; my $list = $dbconnections->{$db}->db_handle->selectall_arrayref($sql); foreach my $expanded_arrayref (@$list) { $exclusive_tables->{$expanded_arrayref->[0]} = $db; } } } # Gets the list of non-empty tables for each db my $table_size = {}; foreach my $db (keys %$dbconnections) { # Production-only tables my @bad_tables_list = (@{$self->db->hive_pipeline->list_all_hive_tables}, @{$self->db->hive_pipeline->list_all_hive_views}, @{$self->param('production_tables')}, @{$self->param('master_tables')}); # We don't care about tables that are exclusive to another db push @bad_tables_list, (grep {$exclusive_tables->{$_} ne $db} (keys %$exclusive_tables)); # We may want to ignore some more tables push @bad_tables_list, @{$ignored_tables->{$db}} if exists $ignored_tables->{$db}; my @wildcards = grep {$_ =~ /\%/} @{$ignored_tables->{$db}}; my $extra = join("", map {" AND Name NOT LIKE '$_' "} @wildcards); my $this_db_handle = $dbconnections->{$db}->db_handle; my $bad_tables = join(',', map {"'$_'"} @bad_tables_list); my $sql_table_status = "SHOW TABLE STATUS WHERE Engine IS NOT NULL AND Name NOT IN ($bad_tables) $extra"; my $table_list = $this_db_handle->selectcol_arrayref($sql_table_status, { Columns => [1] }); my $sql_size_table = 'SELECT COUNT(*) FROM '; $table_size->{$db} = {}; foreach my $t (@$table_list) { my ($s) = $this_db_handle->selectrow_array($sql_size_table.$t); # We want all the tables on the release database in order to detect production tables # but we only need the non-empty tables of the other databases $table_size->{$db}->{$t} = $s if ($db eq 'curr_rel_db') or $s; } } print Dumper($table_size) if $self->debug; $self->param('table_size', $table_size); } sub _find_primary_key { my $self = shift @_; my $dbconnection = shift @_; my $table = shift @_; my $primary_keys = $self->param('primary_keys'); # Check on primary key my $key = $primary_keys->{$table}; unless (defined $key) { my $sth = $dbconnection->db_handle->primary_key_info(undef, undef, $table); my @pk = map {$_->[3]} sort {$a->[4] <=> $b->[4]} @{ $sth->fetchall_arrayref() }; die " -ERROR- No primary key for table '$table'" unless @pk; $primary_keys->{$table} = $key = \@pk; } # Key type my $key_type = $dbconnection->db_handle->column_info(undef, undef, $table, $key->[0])->fetch->[5]; my $is_string_type = ($key_type =~ /char/i ? 1 : 0); # We only accept char and int die "'$key_type' type is not handled" unless $is_string_type or $key_type =~ /int/i; return ($key, $is_string_type); } sub run { my $self = shift @_; $self->dbc->disconnect_if_idle(); my $table_size = $self->param('table_size'); my $exclusive_tables = $self->param('exclusive_tables'); my $only_tables = $self->param_required('only_tables'); my $src_db_aliases = $self->param_required('src_db_aliases'); my $dbconnections = $self->param('dbconnections'); # Structures the information per table my $all_tables = {}; foreach my $db (@{$src_db_aliases}) { my @ok_tables; if (exists $only_tables->{$db}) { # If we want some specific tables, they should be non-empty foreach my $table (@{$only_tables->{$db}}) { die "'$table' should be non-empty in '$db'" unless exists $table_size->{$db}->{$table}; push @ok_tables, $table; } } else { # All the non-empty tables push @ok_tables, keys %{$table_size->{$db}}; } foreach my $table (@ok_tables) { $all_tables->{$table} = [] unless exists $all_tables->{$table}; push @{$all_tables->{$table}}, $db; } } print Dumper($all_tables) if $self->debug; # The exclusive tables should all be non-empty foreach my $table (keys %$exclusive_tables) { die "'$table' should be non-empty in '", $exclusive_tables->{$table}, "'" unless exists $all_tables->{$table}; } my %copy = (); my %merge = (); # We decide whether the table needs to be copied or merged (and if the IDs don't overlap) foreach my $table (keys %$all_tables) { #Record all the errors then die after all the values were checked, reporting the list of errors: my %error_list; unless (exists $table_size->{'curr_rel_db'}->{$table} or exists $exclusive_tables->{$table}) { if ($self->param('die_if_unknown_table')) { die "The table '$table' exists in ".join("/", @{$all_tables->{$table}})." but not in the target database\n"; } else { $self->warning("The table '$table' exists in ".join("/", @{$all_tables->{$table}})." but not in the target database\n"); next; } } if (not $table_size->{'curr_rel_db'}->{$table} and scalar(@{$all_tables->{$table}}) == 1) { my $db = $all_tables->{$table}->[0]; $self->_assert_same_table_schema($dbconnections->{$db}, $dbconnections->{'curr_rel_db'}, $table); # Single source -> copy print "$table is copied over from $db\n" if $self->debug; $copy{$table} = $db; } else { my ($full_key, $is_string_type) = $self->_find_primary_key($dbconnections->{$all_tables->{$table}->[0]}, $table); my $key = $full_key->[0]; # Multiple source -> merge (possibly with the target db) my @dbs = @{$all_tables->{$table}}; push @dbs, 'curr_rel_db' if $table_size->{'curr_rel_db'}->{$table}; print "$table is merged from ", join(" and ", @dbs), "\n" if $self->debug; my $sql = "SELECT MIN($key), MAX($key), COUNT($key) FROM $table"; my $min_max = {map {$_ => $dbconnections->{$_}->db_handle->selectrow_arrayref($sql) } @dbs}; my $bad = 0; # Since the counts may not be accurate, we need to update the hash map { $table_size->{$_}->{$table} = $min_max->{$_}->[2] } @dbs; # and re-filter the list of databases @dbs = grep {$table_size->{$_}->{$table}} @dbs; foreach my $db (@dbs) { $self->_assert_same_table_schema($dbconnections->{$db}, $dbconnections->{'curr_rel_db'}, $table); } my $sql_overlap = "SELECT COUNT(*) FROM $table WHERE $key BETWEEN ? AND ?"; # min and max values must not overlap foreach my $db1 (@dbs) { foreach my $db2 (@dbs) { next if $db2 le $db1; # Do the intervals overlap ? if ($is_string_type) { $bad = [$db1,$db2] if ($min_max->{$db1}->[1] ge $min_max->{$db2}->[0]) and ($min_max->{$db2}->[1] ge $min_max->{$db1}->[0]); } else { $bad = [$db1,$db2] if ($min_max->{$db1}->[1] >= $min_max->{$db2}->[0]) and ($min_max->{$db2}->[1] >= $min_max->{$db1}->[0]); } # Is one interval in a "hole" ? if ($bad) { my ($c2_in_1) = $dbconnections->{$db1}->db_handle->selectrow_array($sql_overlap, undef, $min_max->{$db2}->[0], $min_max->{$db2}->[1]); my ($c1_in_2) = $dbconnections->{$db2}->db_handle->selectrow_array($sql_overlap, undef, $min_max->{$db1}->[0], $min_max->{$db1}->[1]); $bad = 0 if !$c2_in_1 or !$c1_in_2; } last if $bad; } last if $bad; } if ($bad) { unless (grep { $table_size->{$_}->{$table} > $self->param('max_nb_elements_to_fetch') } @dbs) { print " -INFO- comparing the actual values of the primary key\n" if $self->debug; my $keys = join(",", @$full_key); # We really make sure that no value is shared between the tables $sql = "SELECT $keys FROM $table"; my %all_values = (); foreach my $db (@dbs) { my $sth = $dbconnections->{$db}->prepare($sql, { 'mysql_use_result' => 1 }); $sth->execute; while (my $cols = $sth->fetchrow_arrayref()) { my $value = join(",", map {$_ // '<NULL>'} @$cols); push(@error_list, sprintf(" -ERROR- for the key %s(%s), the value '%s' is present in '%s' and '%s'\n", $table, $keys, $value, $db, $all_values{$value})) if exists $all_values{$value}; my @tok = split(/\,/,$value); $error_list{$tok[0]} = 1 if exists $all_values{$value}; $all_values{$value} = $db; } } } else { die " -ERROR- ranges of the key '$key' overlap, and there are too many elements to perform an extensive check\n", Dumper($min_max); } } print " -INFO- ranges of the key '$key' are fine\n" if $self->debug; $merge{$table} = [grep {$table_size->{$_}->{$table}} @{ $all_tables->{$table} }]; } if (%error_list){ die "Errors: \n" . join("\n", keys(%error_list)) . "\n"; } } $self->param('copy', \%copy); $self->param('merge', \%merge); } sub write_output { my $self = shift @_; my $table_size = $self->param('table_size'); my $primary_keys = $self->param('primary_keys'); # If in write_output, it means that there are no ID conflict. We can safely dataflow the copy / merge operations. while ( my ($table, $db) = each(%{$self->param('copy')}) ) { warn "ACTION: copy '$table' from '$db'\n" if $self->debug; $self->dataflow_output_id( {'src_db_conn' => "#$db#", 'table' => $table}, 2); } while ( my ($table, $dbs) = each(%{$self->param('merge')}) ) { my $n_total_rows = $table_size->{'curr_rel_db'}->{$table} || 0; my @inputlist = (); foreach my $db (@$dbs) { push @inputlist, [ "#$db#" ]; $n_total_rows += $table_size->{$db}->{$table}; } warn "ACTION: merge '$table' from ".join(", ", map {"'$_'"} @$dbs)."\n" if $self->debug; $self->dataflow_output_id( {'table' => $table, 'inputlist' => \@inputlist, 'n_total_rows' => $n_total_rows, 'key' => $primary_keys->{$table}->[0]}, 3); } } sub _assert_same_table_schema { my ($self, $src_dbc, $dest_dbc, $table) = @_; my $src_sth = $src_dbc->db_handle->column_info(undef, undef, $table, '%'); my $src_schema = $src_sth->fetchall_arrayref; $src_sth->finish(); my $dest_sth = $dest_dbc->db_handle->column_info(undef, undef, $table, '%'); my $dest_schema = $dest_sth->fetchall_arrayref; $dest_sth->finish(); if (! @$dest_schema){ return; } die sprintf("'%s' has a different schema in '%s' and '%s'\n", $table, $src_dbc->dbname, $dest_dbc->dbname) if stringify($src_schema) ne stringify($dest_schema); } 1;
danstaines/ensembl-compara
modules/Bio/EnsEMBL/Compara/RunnableDB/DBMergeCheck.pm
Perl
apache-2.0
16,904
#!/usr/bin/perl -W use strict; use File::Copy; use File::Path; my($MINSEQLENGTH)=30; my($HAREA)=20; my($HMIN)=3; my($CDHIT_IDENTITY)=0.97; my($CDHIT_WORD_SIZE)=5; my($BLAST_PATH)='dc_blastall'; my($BLAST_ALGO)='tera-blastp'; my($KNOWNSEQS_DB)='fusionated'; my($BLAST_EVALUE)=1e-5; my($BLAST_HITS)=500; my($PDBPREFILE)='pdbpre.fas'; my($PDBFILE)='pdb.fas'; my($ORIGPRE)='prev-'; my($FILTPRE)='filtered-'; my($SURVPRE)='survivors-'; my($LEADERSPRE)='leaders-'; my($ORIGDB)='original.fas'; my($SURVDB)='survivors.fas'; my($LEADERSDB)='leaders.fas'; my($PDBPREPREFIX)='N'; my($PDBPREFIX)='P'; my($BLASTPOST)='.blast'; my($queryParticle)='Query='; sub readFASTAHeaders($\@); sub pruneSequence($;$); sub filterFASTAFile($$$$); sub processFASTAPDBDesc($); sub copyWithPrefix($$$); sub chooseLeaders($$$$$$$); sub readFASTAHeaders($\@) { my($FH,$p_headers)=@_; my($line); my(@headers)=(); while($line=<$FH>) { # We are only getting the headers if(substr($line,0,1) eq '>') { chomp($line); push(@headers,substr($line,1)); } } # Sorting headers @{$p_headers}=sort(@headers); } # This method takes a one-line sequence, and it removes # histidine heads and/or tails. Optional second parameter # drives the behavior (undef or 0 is head, 1 is tail, 2 is both). sub pruneSequence($;$) { my($cutseq,$mode)=@_; if(defined($mode) && $mode>0) { if($mode >= 2) { return pruneSequence(pruneSequence($cutseq),1); } $cutseq=scalar(reverse($cutseq)); } else { $mode=undef; } if(length($cutseq)>=$MINSEQLENGTH && substr($cutseq,0,$HAREA) =~ /[HX]{$HMIN,}/) { # Let's get last match substr($cutseq,0,$HAREA) =~ /[HX]{$HMIN,}/g; my($lastpos)=$-[0]; # And now the length substr($cutseq,$lastpos) =~ /^[HX]+/; # So the pos is... my($headpos)=$lastpos+length($&); $cutseq=substr($cutseq,$lastpos+length($&)); } return defined($mode)?scalar(reverse($cutseq)):$cutseq; } sub filterFASTAFile($$$$) { my($origFile,$newFile,$filtFile,$analFile)=@_; my($succeed)=1; my($ORIG,$NEW,$FILT,$ANAL); if(open($ORIG,'<',$origFile)) { my(@origheaders)=(); readFASTAHeaders($ORIG,@origheaders); # We don't need it any more close($ORIG); if(open($NEW,'<',$newFile)) { my(@newheaders)=(); readFASTAHeaders($NEW,@newheaders); # Reset file pointer for further usage seek($NEW,0,0); # Now, let's find only new entries my($maxorigpos,$maxnewpos)=(scalar(@origheaders),scalar(@newheaders)); my($origpos,$newpos)=(0,0); my(%candidate)=(); while($origpos<$maxorigpos && $newpos<$maxnewpos) { if($origheaders[$origpos] eq $newheaders[$newpos]) { # Equal, next step! $origpos++; $newpos++; } elsif($origheaders[$origpos] lt $newheaders[$newpos]) { # Not skipped yet, next step on original! $origpos++; } else { # Skipped, save and next step on new! $candidate{$newheaders[$newpos]}=undef; $newpos++; } } # Now we know the candidate, let's save them if(open($FILT,'>',$filtFile) && open($ANAL,'>',$analFile)) { # Let's analyze the sequences, getting the headers my($line); my($description)=undef; my($sequence)=undef; my($survivor)=undef; while($line=<$NEW>) { chomp($line); if(substr($line,0,1) eq '>') { # We have a candidate sequence! if(defined($description) && length($sequence)>=$MINSEQLENGTH) { my($cutseq)=pruneSequence(uc($sequence),2); # Has passed the filter? if(length($cutseq)>=$MINSEQLENGTH) { # Let's save it! print $FILT $description,"\n"; print $FILT $cutseq,"\n"; if(defined($survivor)) { print $ANAL $description,"\n"; print $ANAL $cutseq,"\n"; } } } # New header is it in the "chosen one" list? $description=$line; $sequence=''; if(exists($candidate{substr($line,1)})) { $survivor=1; } else { $survivor=undef; } } elsif(defined($sequence)) { $line =~ tr/ \t//d; $sequence .= $line; } } if(defined($description) && length($sequence)>=$MINSEQLENGTH) { my($cutseq)=pruneSequence(uc($sequence),2); # Has passed the filter? if(length($cutseq)>=$MINSEQLENGTH) { # Let's save it! print $FILT $description,"\n"; print $FILT $cutseq,"\n"; if(defined($survivor)) { print $ANAL $description,"\n"; print $ANAL $cutseq,"\n"; } } } close($FILT); close($ANAL); } else { warn "ERROR: Unable to create $filtFile or $analFile\n"; $succeed=undef; } close($NEW); } else { warn "ERROR: Unable to open $newFile\n"; $succeed=undef; } } else { warn "ERROR: Unable to open $origFile\n"; $succeed=undef; } return $succeed; } sub processFASTAPDBDesc($) { my($desc)=@_; # Now, store my($id); if($desc =~ /PDB:([^ :]+)[ :]/) { $id=$1; } else { $desc =~ s/^[ \t]+//; my($fake); ($id,$fake)=split(/[ \t]+/,$desc,2); } return $id; } sub copyWithPrefix($$$) { my($fastaFile,$prefix,$FH)=@_; my($FASTA); my(@seqs)=(); if(open($FASTA,'<',$fastaFile)) { my($line); my($id)=undef; my($iddesc)=undef; my($sequence)=undef; while($line=<$FASTA>) { if(substr($line,0,1) eq '>') { push(@seqs,[$id,$iddesc,$sequence]) if(defined($id)); my($desc)=substr($line,1); print $FH '>',$prefix,':',$desc; # Now, store $id=processFASTAPDBDesc($desc); chomp($desc); $iddesc=$desc; $sequence=''; } else { print $FH $line; chomp($line); $sequence.=$line; } } close($FASTA); push(@seqs,[$id,$iddesc,$sequence]) if(defined($id)); } else { die "ERROR: Unable to open $fastaFile to prefix it with $prefix!\n"; } return \@seqs; } sub chooseLeaders($$$$$$$) { my($workdir,$origprepdb,$origpdb,$analprepdb,$analpdb,$leadersdb,$leadersReport)=@_; # First, let's generate common original database my($origdb)=$workdir.'/'.$ORIGDB; my($survdb)=$workdir.'/'.$SURVDB; my($leaderscanddb)=$leadersdb.'.candidate'; my($ORIGFH); # Second, let's concatenate all of them if(open($ORIGFH,'>',$origdb)) { eval { copy($origpdb,$ORIGFH); copy($origprepdb,$ORIGFH); }; my($err)=$@; close($ORIGFH); die "ERROR: Unable to concatenate $origpdb and $origprepdb into $origdb due $err\n" if($err); my($SURVFH); if(open($SURVFH,'>',$survdb)) { my($pdbArray)=copyWithPrefix($analpdb,$PDBPREFIX,$SURVFH) || die "ERROR: Unable to concatenate $analpdb to $survdb\n"; my($pdbPreArray)=copyWithPrefix($analprepdb,$PDBPREPREFIX,$SURVFH) || die "ERROR: Unable to concatenate $analprepdb to $survdb\n"; close($SURVFH); my(%survivor)=($PDBPREFIX=>$pdbArray,$PDBPREPREFIX=>$pdbPreArray); # Now, let's calculate needed memory for clustering my($cdmem)=int(((stat($origdb))[7]+(stat($survdb))[7])/(1024*1024)*20+0.5); # And let's launch cd-hit-2d my(@CDHIT2Dparams)=( 'cd-hit-2d', '-i',$origdb, '-i2',$survdb, '-o',$leaderscanddb, '-c',$CDHIT_IDENTITY, '-n',$CDHIT_WORD_SIZE, '-M',$cdmem ); print STDERR "NOTICE: Launching @CDHIT2Dparams\n"; system(@CDHIT2Dparams)==0 || die "system @CDHIT2Dparams failed: $?"; my(@CDHITparams)=( 'cd-hit', '-i',$leaderscanddb, '-o',$leadersdb, '-c',$CDHIT_IDENTITY, '-n',$CDHIT_WORD_SIZE, '-M',$cdmem ); print STDERR "NOTICE: Launching @CDHITparams\n"; system(@CDHITparams)==0 || die "system @CDHITparams failed: $?"; # And now, information about the survivors! my(@BLASTparams)=( $BLAST_PATH, '-p',$BLAST_ALGO, '-i',$leadersdb, '-d',$KNOWNSEQS_DB, '-e',$BLAST_EVALUE, '-v',$BLAST_HITS, '-b',$BLAST_HITS, ); # Let's parse! my($BLFH); my($LEREFH); if(open($LEREFH,'>',$leadersReport) && open($BLFH,'-|',@BLASTparams)) { my($line); my($query)=undef; my($gettingQuery)=undef; while($line=<$BLFH>) { # Saving original report print $LEREFH $line; if(index($line,$queryParticle)==0) { # First, let's save the obtained results # Second, new information chomp($line); $query=substr($line,length($queryParticle)); $gettingQuery=1; } elsif(defined($gettingQuery)) { if($line =~ /\([0-9]+ letters?\)/) { $gettingQuery=undef; } else { chomp($line); $query.=' '.substr($line,length($queryParticle)); } } elsif(index($line,'***** No hits found ******')!=-1) { print "This one is really difficult! $query\n"; # We need to save here the information to generate the XML report $query=undef; } elsif(index($line,'Sequences producing significant')==0) { print "An easy one: $query\n"; # We need to save here the information to generate the XML report $query=undef; } } close($LEREFH); close($BLFH); } else { die "ERROR: Unable to create $leadersReport or to run @BLASTparams\n"; } } else { die "ERROR: Unable to create file $survdb\n"; } } else { die "ERROR: Unable to create file $origdb\n"; } } if(scalar(@ARGV)>=5) { my($origprepdb)=shift(@ARGV); my($newprepdb)=shift(@ARGV); my($origpdb)=shift(@ARGV); my($newpdb)=shift(@ARGV); my($workdir)=shift(@ARGV); my($first)=undef; $first=shift(@ARGV) if(scalar(@ARGV)>0); # First, time to create workfing directory eval { mkpath($workdir); }; if($@) { die "FATAL ERROR: Unable to create directory $workdir due $@\n"; } # Second, let's copy the original and new files there my($Worigprepdb)=$workdir.'/'.$ORIGPRE.$PDBPREFILE; eval { copy($origprepdb,$Worigprepdb); }; if($@) { die "FATAL ERROR: Unable to copy $origprepdb to $Worigprepdb due $@\n"; } my($Worigpdb)=$workdir.'/'.$ORIGPRE.$PDBFILE; eval { copy($origpdb,$Worigpdb); }; if($@) { die "FATAL ERROR: Unable to copy $origpdb to $Worigpdb due $@\n"; } my($Wnewprepdb)=$workdir.'/'.$PDBPREFILE; eval { copy($newprepdb,$Wnewprepdb); }; if($@) { die "FATAL ERROR: Unable to copy $newprepdb to $Wnewprepdb due $@\n"; } my($Wnewpdb)=$workdir.'/'.$PDBFILE; eval { copy($newpdb,$Wnewpdb); }; if($@) { die "FATAL ERROR: Unable to copy $newpdb to $Wnewpdb due $@\n"; } # These ones are for the next week iteration my($Wnewfiltprepdb)=$workdir.'/'.$FILTPRE.$PDBPREFILE; my($Wnewfiltpdb)=$workdir.'/'.$FILTPRE.$PDBFILE; # And these ones are for now! my($analprepdb)=$workdir.'/'.$SURVPRE.$PDBPREFILE; my($analpdb)=$workdir.'/'.$SURVPRE.$PDBFILE; if(defined($first)) { # To run only the first time my($TH); # Like 'touch' command open($TH,'>',$Wnewfiltprepdb) && close($TH); open($TH,'>',$Wnewfiltpdb) && close($TH); filterFASTAFile($Wnewfiltprepdb,$Worigprepdb,$newprepdb,$analprepdb) || die "FATAL ERROR: Unable to generate $analprepdb from $Worigprepdb and $Wnewprepdb"; filterFASTAFile($Wnewfiltpdb,$Worigpdb,$newpdb,$analpdb) || die "FATAL ERROR: Unable to generate $analpdb from $Worigpdb and $Wnewpdb"; exit(0); } else { # Third, easy filtering phase (new only, 30 residues or more after # prunning histidines heads and tails) filterFASTAFile($Worigprepdb,$Wnewprepdb,$Wnewfiltprepdb,$analprepdb) || die "FATAL ERROR: Unable to generate $analprepdb from $Worigprepdb and $Wnewprepdb"; filterFASTAFile($Worigpdb,$Wnewpdb,$Wnewfiltpdb,$analpdb) || die "FATAL ERROR: Unable to generate $analpdb from $Worigpdb and $Wnewpdb"; # Fourth, heuristics and difficult filtering phase my($leadersdb)=$workdir.'/'.$LEADERSDB; my($leadersReport)=$workdir.'/'.$LEADERSDB.$BLASTPOST; chooseLeaders($workdir,$origprepdb,$origpdb,$analprepdb,$analpdb,$leadersdb,$leadersReport); # my($leadersprepdb)=$workdir.'/'.$LEADERSPRE.$PDBPREFILE; # my($leaderspdb)=$workdir.'/'.$LEADERSPRE.$PDBFILE; # Fifth, other tools????? } } else { print STDERR <<EOF ; FATAL ERROR: This program needs at least 5 params, in order: * The filtered, previous week, PDBPre database file in FASTA format. * The unfiltered, current week, PDBPre database file in FASTA format. * The filtered, previous week, PDB database file in FASTA format. * The unfiltered, current week, PDB database file in FASTA format. * The working directory where to store all the results and intermediate files. When a sixth optional param is used (the value does not matter), the meaning changes: * The unfiltered, current week, PDBPre database file in FASTA format. * The filtered, current week, PDBPre database file in FASTA format (to be generated). * The unfiltered, current week, PDB database file in FASTA format. * The filtered, current week, PDB database file in FASTA format (to be generated). * The working directory where to store all the intermediate files. EOF }
inab/GOPHER
prototype/gopher-prepare.pl
Perl
apache-2.0
12,819
package Paws::CloudDirectory::IndexAttachment; use Moose; has IndexedAttributes => (is => 'ro', isa => 'ArrayRef[Paws::CloudDirectory::AttributeKeyAndValue]'); has ObjectIdentifier => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::CloudDirectory::IndexAttachment =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::CloudDirectory::IndexAttachment object: $service_obj->Method(Att1 => { IndexedAttributes => $value, ..., ObjectIdentifier => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::CloudDirectory::IndexAttachment object: $result = $service_obj->Method(...); $result->Att1->IndexedAttributes =head1 DESCRIPTION Represents an index and an attached object. =head1 ATTRIBUTES =head2 IndexedAttributes => ArrayRef[L<Paws::CloudDirectory::AttributeKeyAndValue>] The indexed attribute values. =head2 ObjectIdentifier => Str The C<ObjectIdentifier> of the object attached to the index. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::CloudDirectory> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/CloudDirectory/IndexAttachment.pm
Perl
apache-2.0
1,609
package Paws::SimpleWorkflow::HistoryEvent; use Moose; has ActivityTaskCanceledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskCanceledEventAttributes', request_name => 'activityTaskCanceledEventAttributes', traits => ['NameInRequest']); has ActivityTaskCancelRequestedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskCancelRequestedEventAttributes', request_name => 'activityTaskCancelRequestedEventAttributes', traits => ['NameInRequest']); has ActivityTaskCompletedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskCompletedEventAttributes', request_name => 'activityTaskCompletedEventAttributes', traits => ['NameInRequest']); has ActivityTaskFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskFailedEventAttributes', request_name => 'activityTaskFailedEventAttributes', traits => ['NameInRequest']); has ActivityTaskScheduledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskScheduledEventAttributes', request_name => 'activityTaskScheduledEventAttributes', traits => ['NameInRequest']); has ActivityTaskStartedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskStartedEventAttributes', request_name => 'activityTaskStartedEventAttributes', traits => ['NameInRequest']); has ActivityTaskTimedOutEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ActivityTaskTimedOutEventAttributes', request_name => 'activityTaskTimedOutEventAttributes', traits => ['NameInRequest']); has CancelTimerFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::CancelTimerFailedEventAttributes', request_name => 'cancelTimerFailedEventAttributes', traits => ['NameInRequest']); has CancelWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::CancelWorkflowExecutionFailedEventAttributes', request_name => 'cancelWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has ChildWorkflowExecutionCanceledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ChildWorkflowExecutionCanceledEventAttributes', request_name => 'childWorkflowExecutionCanceledEventAttributes', traits => ['NameInRequest']); has ChildWorkflowExecutionCompletedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ChildWorkflowExecutionCompletedEventAttributes', request_name => 'childWorkflowExecutionCompletedEventAttributes', traits => ['NameInRequest']); has ChildWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ChildWorkflowExecutionFailedEventAttributes', request_name => 'childWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has ChildWorkflowExecutionStartedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ChildWorkflowExecutionStartedEventAttributes', request_name => 'childWorkflowExecutionStartedEventAttributes', traits => ['NameInRequest']); has ChildWorkflowExecutionTerminatedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ChildWorkflowExecutionTerminatedEventAttributes', request_name => 'childWorkflowExecutionTerminatedEventAttributes', traits => ['NameInRequest']); has ChildWorkflowExecutionTimedOutEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ChildWorkflowExecutionTimedOutEventAttributes', request_name => 'childWorkflowExecutionTimedOutEventAttributes', traits => ['NameInRequest']); has CompleteWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::CompleteWorkflowExecutionFailedEventAttributes', request_name => 'completeWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has ContinueAsNewWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ContinueAsNewWorkflowExecutionFailedEventAttributes', request_name => 'continueAsNewWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has DecisionTaskCompletedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::DecisionTaskCompletedEventAttributes', request_name => 'decisionTaskCompletedEventAttributes', traits => ['NameInRequest']); has DecisionTaskScheduledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::DecisionTaskScheduledEventAttributes', request_name => 'decisionTaskScheduledEventAttributes', traits => ['NameInRequest']); has DecisionTaskStartedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::DecisionTaskStartedEventAttributes', request_name => 'decisionTaskStartedEventAttributes', traits => ['NameInRequest']); has DecisionTaskTimedOutEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::DecisionTaskTimedOutEventAttributes', request_name => 'decisionTaskTimedOutEventAttributes', traits => ['NameInRequest']); has EventId => (is => 'ro', isa => 'Int', request_name => 'eventId', traits => ['NameInRequest'], required => 1); has EventTimestamp => (is => 'ro', isa => 'Str', request_name => 'eventTimestamp', traits => ['NameInRequest'], required => 1); has EventType => (is => 'ro', isa => 'Str', request_name => 'eventType', traits => ['NameInRequest'], required => 1); has ExternalWorkflowExecutionCancelRequestedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ExternalWorkflowExecutionCancelRequestedEventAttributes', request_name => 'externalWorkflowExecutionCancelRequestedEventAttributes', traits => ['NameInRequest']); has ExternalWorkflowExecutionSignaledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ExternalWorkflowExecutionSignaledEventAttributes', request_name => 'externalWorkflowExecutionSignaledEventAttributes', traits => ['NameInRequest']); has FailWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::FailWorkflowExecutionFailedEventAttributes', request_name => 'failWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has LambdaFunctionCompletedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::LambdaFunctionCompletedEventAttributes', request_name => 'lambdaFunctionCompletedEventAttributes', traits => ['NameInRequest']); has LambdaFunctionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::LambdaFunctionFailedEventAttributes', request_name => 'lambdaFunctionFailedEventAttributes', traits => ['NameInRequest']); has LambdaFunctionScheduledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::LambdaFunctionScheduledEventAttributes', request_name => 'lambdaFunctionScheduledEventAttributes', traits => ['NameInRequest']); has LambdaFunctionStartedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::LambdaFunctionStartedEventAttributes', request_name => 'lambdaFunctionStartedEventAttributes', traits => ['NameInRequest']); has LambdaFunctionTimedOutEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::LambdaFunctionTimedOutEventAttributes', request_name => 'lambdaFunctionTimedOutEventAttributes', traits => ['NameInRequest']); has MarkerRecordedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::MarkerRecordedEventAttributes', request_name => 'markerRecordedEventAttributes', traits => ['NameInRequest']); has RecordMarkerFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::RecordMarkerFailedEventAttributes', request_name => 'recordMarkerFailedEventAttributes', traits => ['NameInRequest']); has RequestCancelActivityTaskFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::RequestCancelActivityTaskFailedEventAttributes', request_name => 'requestCancelActivityTaskFailedEventAttributes', traits => ['NameInRequest']); has RequestCancelExternalWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::RequestCancelExternalWorkflowExecutionFailedEventAttributes', request_name => 'requestCancelExternalWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has RequestCancelExternalWorkflowExecutionInitiatedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::RequestCancelExternalWorkflowExecutionInitiatedEventAttributes', request_name => 'requestCancelExternalWorkflowExecutionInitiatedEventAttributes', traits => ['NameInRequest']); has ScheduleActivityTaskFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ScheduleActivityTaskFailedEventAttributes', request_name => 'scheduleActivityTaskFailedEventAttributes', traits => ['NameInRequest']); has ScheduleLambdaFunctionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::ScheduleLambdaFunctionFailedEventAttributes', request_name => 'scheduleLambdaFunctionFailedEventAttributes', traits => ['NameInRequest']); has SignalExternalWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::SignalExternalWorkflowExecutionFailedEventAttributes', request_name => 'signalExternalWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has SignalExternalWorkflowExecutionInitiatedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::SignalExternalWorkflowExecutionInitiatedEventAttributes', request_name => 'signalExternalWorkflowExecutionInitiatedEventAttributes', traits => ['NameInRequest']); has StartChildWorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::StartChildWorkflowExecutionFailedEventAttributes', request_name => 'startChildWorkflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has StartChildWorkflowExecutionInitiatedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::StartChildWorkflowExecutionInitiatedEventAttributes', request_name => 'startChildWorkflowExecutionInitiatedEventAttributes', traits => ['NameInRequest']); has StartLambdaFunctionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::StartLambdaFunctionFailedEventAttributes', request_name => 'startLambdaFunctionFailedEventAttributes', traits => ['NameInRequest']); has StartTimerFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::StartTimerFailedEventAttributes', request_name => 'startTimerFailedEventAttributes', traits => ['NameInRequest']); has TimerCanceledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::TimerCanceledEventAttributes', request_name => 'timerCanceledEventAttributes', traits => ['NameInRequest']); has TimerFiredEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::TimerFiredEventAttributes', request_name => 'timerFiredEventAttributes', traits => ['NameInRequest']); has TimerStartedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::TimerStartedEventAttributes', request_name => 'timerStartedEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionCanceledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionCanceledEventAttributes', request_name => 'workflowExecutionCanceledEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionCancelRequestedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionCancelRequestedEventAttributes', request_name => 'workflowExecutionCancelRequestedEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionCompletedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionCompletedEventAttributes', request_name => 'workflowExecutionCompletedEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionContinuedAsNewEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionContinuedAsNewEventAttributes', request_name => 'workflowExecutionContinuedAsNewEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionFailedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionFailedEventAttributes', request_name => 'workflowExecutionFailedEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionSignaledEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionSignaledEventAttributes', request_name => 'workflowExecutionSignaledEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionStartedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionStartedEventAttributes', request_name => 'workflowExecutionStartedEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionTerminatedEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionTerminatedEventAttributes', request_name => 'workflowExecutionTerminatedEventAttributes', traits => ['NameInRequest']); has WorkflowExecutionTimedOutEventAttributes => (is => 'ro', isa => 'Paws::SimpleWorkflow::WorkflowExecutionTimedOutEventAttributes', request_name => 'workflowExecutionTimedOutEventAttributes', traits => ['NameInRequest']); 1; ### main pod documentation begin ### =head1 NAME Paws::SimpleWorkflow::HistoryEvent =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::SimpleWorkflow::HistoryEvent object: $service_obj->Method(Att1 => { ActivityTaskCanceledEventAttributes => $value, ..., WorkflowExecutionTimedOutEventAttributes => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::SimpleWorkflow::HistoryEvent object: $result = $service_obj->Method(...); $result->Att1->ActivityTaskCanceledEventAttributes =head1 DESCRIPTION Event within a workflow execution. A history event can be one of these types: =over =item * C<ActivityTaskCancelRequested> E<ndash> A C<RequestCancelActivityTask> decision was received by the system. =item * C<ActivityTaskCanceled> E<ndash> The activity task was successfully canceled. =item * C<ActivityTaskCompleted> E<ndash> An activity worker successfully completed an activity task by calling RespondActivityTaskCompleted. =item * C<ActivityTaskFailed> E<ndash> An activity worker failed an activity task by calling RespondActivityTaskFailed. =item * C<ActivityTaskScheduled> E<ndash> An activity task was scheduled for execution. =item * C<ActivityTaskStarted> E<ndash> The scheduled activity task was dispatched to a worker. =item * C<ActivityTaskTimedOut> E<ndash> The activity task timed out. =item * C<CancelTimerFailed> E<ndash> Failed to process CancelTimer decision. This happens when the decision isn't configured properly, for example no timer exists with the specified timer Id. =item * C<CancelWorkflowExecutionFailed> E<ndash> A request to cancel a workflow execution failed. =item * C<ChildWorkflowExecutionCanceled> E<ndash> A child workflow execution, started by this workflow execution, was canceled and closed. =item * C<ChildWorkflowExecutionCompleted> E<ndash> A child workflow execution, started by this workflow execution, completed successfully and was closed. =item * C<ChildWorkflowExecutionFailed> E<ndash> A child workflow execution, started by this workflow execution, failed to complete successfully and was closed. =item * C<ChildWorkflowExecutionStarted> E<ndash> A child workflow execution was successfully started. =item * C<ChildWorkflowExecutionTerminated> E<ndash> A child workflow execution, started by this workflow execution, was terminated. =item * C<ChildWorkflowExecutionTimedOut> E<ndash> A child workflow execution, started by this workflow execution, timed out and was closed. =item * C<CompleteWorkflowExecutionFailed> E<ndash> The workflow execution failed to complete. =item * C<ContinueAsNewWorkflowExecutionFailed> E<ndash> The workflow execution failed to complete after being continued as a new workflow execution. =item * C<DecisionTaskCompleted> E<ndash> The decider successfully completed a decision task by calling RespondDecisionTaskCompleted. =item * C<DecisionTaskScheduled> E<ndash> A decision task was scheduled for the workflow execution. =item * C<DecisionTaskStarted> E<ndash> The decision task was dispatched to a decider. =item * C<DecisionTaskTimedOut> E<ndash> The decision task timed out. =item * C<ExternalWorkflowExecutionCancelRequested> E<ndash> Request to cancel an external workflow execution was successfully delivered to the target execution. =item * C<ExternalWorkflowExecutionSignaled> E<ndash> A signal, requested by this workflow execution, was successfully delivered to the target external workflow execution. =item * C<FailWorkflowExecutionFailed> E<ndash> A request to mark a workflow execution as failed, itself failed. =item * C<MarkerRecorded> E<ndash> A marker was recorded in the workflow history as the result of a C<RecordMarker> decision. =item * C<RecordMarkerFailed> E<ndash> A C<RecordMarker> decision was returned as failed. =item * C<RequestCancelActivityTaskFailed> E<ndash> Failed to process RequestCancelActivityTask decision. This happens when the decision isn't configured properly. =item * C<RequestCancelExternalWorkflowExecutionFailed> E<ndash> Request to cancel an external workflow execution failed. =item * C<RequestCancelExternalWorkflowExecutionInitiated> E<ndash> A request was made to request the cancellation of an external workflow execution. =item * C<ScheduleActivityTaskFailed> E<ndash> Failed to process ScheduleActivityTask decision. This happens when the decision isn't configured properly, for example the activity type specified isn't registered. =item * C<SignalExternalWorkflowExecutionFailed> E<ndash> The request to signal an external workflow execution failed. =item * C<SignalExternalWorkflowExecutionInitiated> E<ndash> A request to signal an external workflow was made. =item * C<StartActivityTaskFailed> E<ndash> A scheduled activity task failed to start. =item * C<StartChildWorkflowExecutionFailed> E<ndash> Failed to process StartChildWorkflowExecution decision. This happens when the decision isn't configured properly, for example the workflow type specified isn't registered. =item * C<StartChildWorkflowExecutionInitiated> E<ndash> A request was made to start a child workflow execution. =item * C<StartTimerFailed> E<ndash> Failed to process StartTimer decision. This happens when the decision isn't configured properly, for example a timer already exists with the specified timer Id. =item * C<TimerCanceled> E<ndash> A timer, previously started for this workflow execution, was successfully canceled. =item * C<TimerFired> E<ndash> A timer, previously started for this workflow execution, fired. =item * C<TimerStarted> E<ndash> A timer was started for the workflow execution due to a C<StartTimer> decision. =item * C<WorkflowExecutionCancelRequested> E<ndash> A request to cancel this workflow execution was made. =item * C<WorkflowExecutionCanceled> E<ndash> The workflow execution was successfully canceled and closed. =item * C<WorkflowExecutionCompleted> E<ndash> The workflow execution was closed due to successful completion. =item * C<WorkflowExecutionContinuedAsNew> E<ndash> The workflow execution was closed and a new execution of the same type was created with the same workflowId. =item * C<WorkflowExecutionFailed> E<ndash> The workflow execution closed due to a failure. =item * C<WorkflowExecutionSignaled> E<ndash> An external signal was received for the workflow execution. =item * C<WorkflowExecutionStarted> E<ndash> The workflow execution was started. =item * C<WorkflowExecutionTerminated> E<ndash> The workflow execution was terminated. =item * C<WorkflowExecutionTimedOut> E<ndash> The workflow execution was closed because a time out was exceeded. =back =head1 ATTRIBUTES =head2 ActivityTaskCanceledEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskCanceledEventAttributes> If the event is of type C<ActivityTaskCanceled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ActivityTaskCancelRequestedEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskCancelRequestedEventAttributes> If the event is of type C<ActivityTaskcancelRequested> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ActivityTaskCompletedEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskCompletedEventAttributes> If the event is of type C<ActivityTaskCompleted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ActivityTaskFailedEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskFailedEventAttributes> If the event is of type C<ActivityTaskFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ActivityTaskScheduledEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskScheduledEventAttributes> If the event is of type C<ActivityTaskScheduled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ActivityTaskStartedEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskStartedEventAttributes> If the event is of type C<ActivityTaskStarted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ActivityTaskTimedOutEventAttributes => L<Paws::SimpleWorkflow::ActivityTaskTimedOutEventAttributes> If the event is of type C<ActivityTaskTimedOut> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 CancelTimerFailedEventAttributes => L<Paws::SimpleWorkflow::CancelTimerFailedEventAttributes> If the event is of type C<CancelTimerFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 CancelWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::CancelWorkflowExecutionFailedEventAttributes> If the event is of type C<CancelWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ChildWorkflowExecutionCanceledEventAttributes => L<Paws::SimpleWorkflow::ChildWorkflowExecutionCanceledEventAttributes> If the event is of type C<ChildWorkflowExecutionCanceled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ChildWorkflowExecutionCompletedEventAttributes => L<Paws::SimpleWorkflow::ChildWorkflowExecutionCompletedEventAttributes> If the event is of type C<ChildWorkflowExecutionCompleted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ChildWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::ChildWorkflowExecutionFailedEventAttributes> If the event is of type C<ChildWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ChildWorkflowExecutionStartedEventAttributes => L<Paws::SimpleWorkflow::ChildWorkflowExecutionStartedEventAttributes> If the event is of type C<ChildWorkflowExecutionStarted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ChildWorkflowExecutionTerminatedEventAttributes => L<Paws::SimpleWorkflow::ChildWorkflowExecutionTerminatedEventAttributes> If the event is of type C<ChildWorkflowExecutionTerminated> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ChildWorkflowExecutionTimedOutEventAttributes => L<Paws::SimpleWorkflow::ChildWorkflowExecutionTimedOutEventAttributes> If the event is of type C<ChildWorkflowExecutionTimedOut> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 CompleteWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::CompleteWorkflowExecutionFailedEventAttributes> If the event is of type C<CompleteWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ContinueAsNewWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::ContinueAsNewWorkflowExecutionFailedEventAttributes> If the event is of type C<ContinueAsNewWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 DecisionTaskCompletedEventAttributes => L<Paws::SimpleWorkflow::DecisionTaskCompletedEventAttributes> If the event is of type C<DecisionTaskCompleted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 DecisionTaskScheduledEventAttributes => L<Paws::SimpleWorkflow::DecisionTaskScheduledEventAttributes> If the event is of type C<DecisionTaskScheduled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 DecisionTaskStartedEventAttributes => L<Paws::SimpleWorkflow::DecisionTaskStartedEventAttributes> If the event is of type C<DecisionTaskStarted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 DecisionTaskTimedOutEventAttributes => L<Paws::SimpleWorkflow::DecisionTaskTimedOutEventAttributes> If the event is of type C<DecisionTaskTimedOut> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 B<REQUIRED> EventId => Int The system generated ID of the event. This ID uniquely identifies the event with in the workflow execution history. =head2 B<REQUIRED> EventTimestamp => Str The date and time when the event occurred. =head2 B<REQUIRED> EventType => Str The type of the history event. =head2 ExternalWorkflowExecutionCancelRequestedEventAttributes => L<Paws::SimpleWorkflow::ExternalWorkflowExecutionCancelRequestedEventAttributes> If the event is of type C<ExternalWorkflowExecutionCancelRequested> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ExternalWorkflowExecutionSignaledEventAttributes => L<Paws::SimpleWorkflow::ExternalWorkflowExecutionSignaledEventAttributes> If the event is of type C<ExternalWorkflowExecutionSignaled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 FailWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::FailWorkflowExecutionFailedEventAttributes> If the event is of type C<FailWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 LambdaFunctionCompletedEventAttributes => L<Paws::SimpleWorkflow::LambdaFunctionCompletedEventAttributes> Provides the details of the C<LambdaFunctionCompleted> event. It isn't set for other event types. =head2 LambdaFunctionFailedEventAttributes => L<Paws::SimpleWorkflow::LambdaFunctionFailedEventAttributes> Provides the details of the C<LambdaFunctionFailed> event. It isn't set for other event types. =head2 LambdaFunctionScheduledEventAttributes => L<Paws::SimpleWorkflow::LambdaFunctionScheduledEventAttributes> Provides the details of the C<LambdaFunctionScheduled> event. It isn't set for other event types. =head2 LambdaFunctionStartedEventAttributes => L<Paws::SimpleWorkflow::LambdaFunctionStartedEventAttributes> Provides the details of the C<LambdaFunctionStarted> event. It isn't set for other event types. =head2 LambdaFunctionTimedOutEventAttributes => L<Paws::SimpleWorkflow::LambdaFunctionTimedOutEventAttributes> Provides the details of the C<LambdaFunctionTimedOut> event. It isn't set for other event types. =head2 MarkerRecordedEventAttributes => L<Paws::SimpleWorkflow::MarkerRecordedEventAttributes> If the event is of type C<MarkerRecorded> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 RecordMarkerFailedEventAttributes => L<Paws::SimpleWorkflow::RecordMarkerFailedEventAttributes> If the event is of type C<DecisionTaskFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 RequestCancelActivityTaskFailedEventAttributes => L<Paws::SimpleWorkflow::RequestCancelActivityTaskFailedEventAttributes> If the event is of type C<RequestCancelActivityTaskFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 RequestCancelExternalWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::RequestCancelExternalWorkflowExecutionFailedEventAttributes> If the event is of type C<RequestCancelExternalWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 RequestCancelExternalWorkflowExecutionInitiatedEventAttributes => L<Paws::SimpleWorkflow::RequestCancelExternalWorkflowExecutionInitiatedEventAttributes> If the event is of type C<RequestCancelExternalWorkflowExecutionInitiated> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ScheduleActivityTaskFailedEventAttributes => L<Paws::SimpleWorkflow::ScheduleActivityTaskFailedEventAttributes> If the event is of type C<ScheduleActivityTaskFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 ScheduleLambdaFunctionFailedEventAttributes => L<Paws::SimpleWorkflow::ScheduleLambdaFunctionFailedEventAttributes> Provides the details of the C<ScheduleLambdaFunctionFailed> event. It isn't set for other event types. =head2 SignalExternalWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::SignalExternalWorkflowExecutionFailedEventAttributes> If the event is of type C<SignalExternalWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 SignalExternalWorkflowExecutionInitiatedEventAttributes => L<Paws::SimpleWorkflow::SignalExternalWorkflowExecutionInitiatedEventAttributes> If the event is of type C<SignalExternalWorkflowExecutionInitiated> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 StartChildWorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::StartChildWorkflowExecutionFailedEventAttributes> If the event is of type C<StartChildWorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 StartChildWorkflowExecutionInitiatedEventAttributes => L<Paws::SimpleWorkflow::StartChildWorkflowExecutionInitiatedEventAttributes> If the event is of type C<StartChildWorkflowExecutionInitiated> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 StartLambdaFunctionFailedEventAttributes => L<Paws::SimpleWorkflow::StartLambdaFunctionFailedEventAttributes> Provides the details of the C<StartLambdaFunctionFailed> event. It isn't set for other event types. =head2 StartTimerFailedEventAttributes => L<Paws::SimpleWorkflow::StartTimerFailedEventAttributes> If the event is of type C<StartTimerFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 TimerCanceledEventAttributes => L<Paws::SimpleWorkflow::TimerCanceledEventAttributes> If the event is of type C<TimerCanceled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 TimerFiredEventAttributes => L<Paws::SimpleWorkflow::TimerFiredEventAttributes> If the event is of type C<TimerFired> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 TimerStartedEventAttributes => L<Paws::SimpleWorkflow::TimerStartedEventAttributes> If the event is of type C<TimerStarted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionCanceledEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionCanceledEventAttributes> If the event is of type C<WorkflowExecutionCanceled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionCancelRequestedEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionCancelRequestedEventAttributes> If the event is of type C<WorkflowExecutionCancelRequested> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionCompletedEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionCompletedEventAttributes> If the event is of type C<WorkflowExecutionCompleted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionContinuedAsNewEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionContinuedAsNewEventAttributes> If the event is of type C<WorkflowExecutionContinuedAsNew> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionFailedEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionFailedEventAttributes> If the event is of type C<WorkflowExecutionFailed> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionSignaledEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionSignaledEventAttributes> If the event is of type C<WorkflowExecutionSignaled> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionStartedEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionStartedEventAttributes> If the event is of type C<WorkflowExecutionStarted> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionTerminatedEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionTerminatedEventAttributes> If the event is of type C<WorkflowExecutionTerminated> then this member is set and provides detailed information about the event. It isn't set for other event types. =head2 WorkflowExecutionTimedOutEventAttributes => L<Paws::SimpleWorkflow::WorkflowExecutionTimedOutEventAttributes> If the event is of type C<WorkflowExecutionTimedOut> then this member is set and provides detailed information about the event. It isn't set for other event types. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::SimpleWorkflow> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/SimpleWorkflow/HistoryEvent.pm
Perl
apache-2.0
35,528
#!/usr/bin/perl package Format::Bam2Fastq; use strict; use warnings; use File::Basename; use CQS::PBS; use CQS::ConfigUtils; use CQS::SystemUtils; use CQS::FileUtils; use CQS::Task; use CQS::StringUtils; our @ISA = qw(CQS::Task); sub new { my ($class) = @_; my $self = $class->SUPER::new(); $self->{_name} = "Format::Bam2Fastq"; $self->{_suffix} = "_b2q"; bless $self, $class; return $self; } sub perform { my ( $self, $config, $section ) = @_; my ( $task_name, $path_file, $pbsDesc, $target_dir, $logDir, $pbsDir, $resultDir, $option, $sh_direct, $cluster ) = get_parameter( $config, $section ); my $ispaired = get_option( $config, $section, "ispaired", 0 ); my $unzipped = get_option( $config, $section, "unzipped", 0 ); my %rawFiles = %{ get_raw_files( $config, $section ) }; my $shfile = $self->taskfile( $pbsDir, $task_name ); open( SH, ">$shfile" ) or die "Cannot create $shfile"; print SH get_run_command($sh_direct) . "\n"; for my $sampleName ( sort keys %rawFiles ) { my @sampleFiles = @{ $rawFiles{$sampleName} }; my $bamfile = $sampleFiles[0]; my $pbsFile = $self->pbsfile( $pbsDir, $sampleName ); my $pbsName = basename($pbsFile); my $log = $self->logfile( $logDir, $sampleName ); print SH "\$MYCMD ./$pbsName \n"; my $finalFile = $ispaired ? $sampleName . "_1.fastq" : $sampleName . ".fastq"; if ( !$unzipped ) { $finalFile = $finalFile . ".gz"; } my $log_desc = $cluster->get_log_desc($log); open( OUT, ">$pbsFile" ) or die $!; print OUT "$pbsDesc $log_desc $path_file cd $resultDir echo started=`date` if [ ! -s $finalFile ]; then bam2fastq -o ${sampleName}#.fastq $bamfile "; if ( !$unzipped ) { if ($ispaired) { print OUT " gzip ${sampleName}_1.fastq gzip ${sampleName}_2.fastq "; } else { print OUT " gzip ${sampleName}.fastq"; } } print OUT " fi echo finished=`date` exit 0 "; close OUT; print "$pbsFile created \n"; } close(SH); if ( is_linux() ) { chmod 0755, $shfile; } print "!!!shell file $shfile created, you can run this shell file to submit all Bam2Fastq tasks.\n"; #`qsub $pbsFile`; } sub result { my ( $self, $config, $section, $pattern ) = @_; my ( $task_name, $path_file, $pbsDesc, $target_dir, $logDir, $pbsDir, $resultDir, $option, $sh_direct ) = get_parameter( $config, $section ); my $ispaired = get_option( $config, $section, "ispaired", 0 ); my $unzipped = get_option( $config, $section, "unzipped", 0 ); my %rawFiles = %{ get_raw_files( $config, $section ) }; my $result = {}; for my $sampleName ( keys %rawFiles ) { my @resultFiles = (); if ($ispaired) { if ($unzipped) { push( @resultFiles, $resultDir . "/" . $sampleName . "_1.fastq" ); push( @resultFiles, $resultDir . "/" . $sampleName . "_2.fastq" ); } else { push( @resultFiles, $resultDir . "/" . $sampleName . "_1.fastq.gz" ); push( @resultFiles, $resultDir . "/" . $sampleName . "_2.fastq.gz" ); } } else { if ($unzipped) { push( @resultFiles, $resultDir . "/" . $sampleName . ".fastq" ); } else { push( @resultFiles, $resultDir . "/" . $sampleName . ".fastq.gz" ); } } $result->{$sampleName} = filter_array( \@resultFiles, $pattern ); } return $result; } 1;
realizor/ngsperl
lib/Format/Bam2Fastq.pm
Perl
apache-2.0
3,542
package Paws::Lightsail::CreateDomain; use Moose; has DomainName => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'domainName' , required => 1); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'CreateDomain'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::Lightsail::CreateDomainResult'); class_has _result_key => (isa => 'Str', is => 'ro'); 1; ### main pod documentation begin ### =head1 NAME Paws::Lightsail::CreateDomain - Arguments for method CreateDomain on Paws::Lightsail =head1 DESCRIPTION This class represents the parameters used for calling the method CreateDomain on the Amazon Lightsail service. Use the attributes of this class as arguments to method CreateDomain. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to CreateDomain. As an example: $service_obj->CreateDomain(Att1 => $value1, Att2 => $value2, ...); Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. =head1 ATTRIBUTES =head2 B<REQUIRED> DomainName => Str The domain name to manage (e.g., C<example.com>). You cannot register a new domain name using Lightsail. You must register a domain name using Amazon Route 53 or another domain name registrar. If you have already registered your domain, you can enter its name in this parameter to manage the DNS records for that domain. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method CreateDomain in L<Paws::Lightsail> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/Lightsail/CreateDomain.pm
Perl
apache-2.0
1,930
:- module(load_simple_ciaopp, [load_file/1,my_clause/3], [assertions, isomodes, doccomments, dynamic]). %! \title Simple program loader % % \module % Load clauses in `my_clause/3` (keeps a unique identifer for each % clause). Drops any `:- _` declaration. :- use_module(ciaopp(ciaopp)). :- use_module(ciaopp(p_unit),[program/2,replace_program/2]). :- dynamic my_clause/3. :- use_module(library(streams)). :- use_module(library(lists)). :- use_module(library(read)). :- use_module(chclibs(common), [conj2List/2]). :- use_module(library(write)). :- use_module(library(streams)). load_file(F) :- retractall(my_clause(_,_,_)), module(F), program(Cs,_Ds), assert_all(Cs,1), showProg. assert_all([],_). assert_all([C|Cs],K) :- assert_my_clause(C,K), !, K1 is K+1, assert_all(Cs,K1). assert_all([_|Cs],K) :- assert_all(Cs,K). assert_my_clause(clause(Head,Body):_ClauseID, K) :- !, tidyHead(Head,H), tidyBody(Body,B), conj2List(B,BL), makeClauseId(K,CK), assertz(my_clause(H,BL,CK)). makeClauseId(K,CK) :- name(K,NK), append("c",NK,CNK), name(CK,CNK). tidyHead(H,H). tidyBody((B,Bs),(B1,Bs1)) :- !, tidyAtom(B,B1), tidyBody(Bs,Bs1). tidyBody(B,B1) :- !, tidyAtom(B,B1). tidyAtom(A:_Pos,A1) :- A =.. [P|Args], tidyPred(P,P1), A1 =.. [P1|Args]. tidyPred(P,P1) :- atom_concat('arithmetic:',P1,P), !. tidyPred(P,P1) :- atom_concat('term_basic:',P1,P), !. tidyPred(P,P). showProg :- my_clause(H,B,C), write(my_clause(H,B,C)), nl, fail. showProg.
bishoksan/chclibs
src/ciaopp/load_simple_ciaopp.pl
Perl
apache-2.0
1,535
package Tapper::Reports::Receiver::Util; # ABSTRACT: Receive test reports use 5.010; use strict; use warnings; use Data::Dumper; use DateTime::Format::Natural; use File::MimeInfo::Magic; use IO::Scalar; use Moose; use YAML::Syck; use Devel::Backtrace; use Try::Tiny; use Sys::Syslog; # core module since 1994 use Tapper::Config; use Tapper::Model 'model'; use Tapper::TAP::Harness; extends 'Tapper::Base'; has report => (is => 'rw'); has tap => (is => 'rw'); =head2 cfg Provide Tapper config. =cut sub cfg { my ($self) = @_; return Tapper::Config->subconfig(); } =head2 start_new_report Create database entries to store the new report. @param string - remote host name @param int - remote port @return success - report id =cut sub start_new_report { my ($self, $host, $port) = @_; $self->report( model('ReportsDB')->resultset('Report')->new({ peerport => $port, peerhost => $host, })); $self->report->insert; my $tap = model('ReportsDB')->resultset('Tap')->new({ tap => '', report_id => $self->report->id, }); $tap->insert; return $self->report->id; } =head2 tap_mimetype Return mimetype of received TAP (Text vs. TAP::Archive). =cut sub tap_mimetype { my ($self) = shift; my $TAPH = IO::Scalar->new(\($self->tap)); return mimetype($TAPH); } =head2 tap_is_archive Return true when TAP is TAP::Archive. =cut sub tap_is_archive { my ($self) = shift; return $self->tap_mimetype =~ m,application/(x-)?(octet-stream|compressed|gzip), ? 1 : 0; } =head2 write_tap_to_db Put tap string into database. @return success - undef @return error - die =cut sub write_tap_to_db { my ($self) = shift; $self->report->tap->tap_is_archive(1) if $self->tap_is_archive; $self->report->tap->tap( $self->tap ); $self->report->tap->update; return; } =head2 get_suite Get suite name from TAP. =cut sub get_suite { my ($self, $suite_name, $suite_type) = @_; $suite_name ||= 'unknown'; $suite_type ||= 'software'; my $suite = model("ReportsDB")->resultset('Suite')->search({name => $suite_name }, {rows => 1})->first; if (not $suite) { $suite = model("ReportsDB")->resultset('Suite')->new({ name => $suite_name, type => $suite_type, description => "$suite_name test suite", }); $suite->insert; } return $suite; } =head2 create_report_sections Divide TAP into sections (a Tapper specific extension). =cut sub create_report_sections { my ($self, $parsed_report) = @_; # meta keys my $section_nr = 0; foreach my $section ( @{$parsed_report->{tap_sections}} ) { $section_nr++; my $report_section = model('ReportsDB')->resultset('ReportSection')->new ({ report_id => $self->report->id, succession => $section_nr, name => $section->{section_name}, }); foreach (keys %{$section->{db_section_meta}}) { my $value = $section->{db_section_meta}{$_}; $report_section->$_ ($value) if defined $value; } $report_section->insert; } } =head2 update_reportgroup_testrun_stats Update testrun stats where this report belongs to. =cut sub update_reportgroup_testrun_stats { my ($self, $testrun_id) = @_; my $reportgroupstats = model('ReportsDB')->resultset('ReportgroupTestrunStats')->find($testrun_id); unless ($reportgroupstats and $reportgroupstats->testrun_id) { $reportgroupstats = model('ReportsDB')->resultset('ReportgroupTestrunStats')->new({ testrun_id => $testrun_id }); $reportgroupstats->insert; } $reportgroupstats->update_failed_passed; $reportgroupstats->update; } =head2 create_report_groups Create reportgroup from testrun details or arbitrary IDs. =cut sub create_report_groups { my ($self, $parsed_report) = @_; my ($reportgroup_arbitrary, $reportgroup_testrun, $reportgroup_primary, $owner ) = ( $parsed_report->{db_report_reportgroup_meta}{reportgroup_arbitrary}, $parsed_report->{db_report_reportgroup_meta}{reportgroup_testrun}, $parsed_report->{db_report_reportgroup_meta}{reportgroup_primary}, $parsed_report->{db_report_reportgroup_meta}{owner}, ); if ($reportgroup_arbitrary and $reportgroup_arbitrary ne 'None') { my $reportgroup = model('ReportsDB')->resultset('ReportgroupArbitrary')->new ({ report_id => $self->report->id, arbitrary_id => $reportgroup_arbitrary, primaryreport => $reportgroup_primary, owner => $owner, }); $reportgroup->insert; } if ($reportgroup_testrun and $reportgroup_testrun ne 'None') { if (not $owner) { # don't check existance of each element in the search chain eval { $owner = model('TestrunDB')->resultset('Testrun')->find($reportgroup_testrun)->owner->login; }; } my $reportgroup = model('ReportsDB')->resultset('ReportgroupTestrun')->new ({ report_id => $self->report->id, testrun_id => $reportgroup_testrun, primaryreport => $reportgroup_primary, owner => $owner, }); $reportgroup->insert; $self->update_reportgroup_testrun_stats($reportgroup_testrun); } } =head2 create_report_comment Reports can be attached with a comment. Create this. =cut sub create_report_comment { my ($self, $parsed_report) = @_; my ($comment) = ( $parsed_report->{db_report_reportcomment_meta}{reportcomment} ); if ($comment) { my $reportcomment = model('ReportsDB')->resultset('ReportComment')->new ({ report_id => $self->report->id, comment => $comment, succession => 1, }); $reportcomment->insert; } } =head2 update_parsed_report_in_db Carve out details from report and update those values in DB. =cut sub update_parsed_report_in_db { my ($self, $parsed_report) = @_; no strict 'refs'; ## no critic (ProhibitNoStrict) # lookup missing values in db $parsed_report->{db_report_meta}{suite_id} = $self->get_suite($parsed_report->{report_meta}{'suite-name'}, $parsed_report->{report_meta}{'suite-type'}, )->id; # report information foreach (keys %{$parsed_report->{db_report_meta}}) { my $value = $parsed_report->{db_report_meta}{$_}; $self->report->$_( $value ) if defined $value; } # report information - date fields foreach (keys %{$parsed_report->{db_report_date_meta}}) { my $value = $parsed_report->{db_report_date_meta}{$_}; $self->report->$_( DateTime::Format::Natural->new->parse_datetime($value ) ) if defined $value; } # success statistics foreach (keys %{$parsed_report->{stats}}) { my $value = $parsed_report->{stats}{$_}; $self->report->$_( $value ) if defined $value; } $self->report->update; $self->create_report_sections($parsed_report); $self->create_report_groups($parsed_report); $self->create_report_comment($parsed_report); } =head2 forward_to_level2_receivers Load configured I<Level 2 receiver> plugins and call them with this report. =cut sub forward_to_level2_receivers { my ($self) = @_; my @level2_receivers = (keys %{$self->cfg->{receiver}{level2} || {}}); foreach my $l2receiver (@level2_receivers) { $self->log->debug( "L2 receiver: $l2receiver" ); my $options = $self->cfg->{receiver}{level2}{$l2receiver}; next if $options->{disabled}; my $l2r_class = "Tapper::Reports::Receiver::Level2::$l2receiver"; eval "use $l2r_class"; ## no critic if ($@) { return "Could not load $l2r_class"; } else { no strict 'refs'; ## no critic $self->log->debug( "Call ${l2r_class}::submit()" ); my ($error, $retval) = &{"${l2r_class}::submit"}($self, $self->report, $options); if ($error) { $self->log->error( "Error calling ${l2r_class}::submit: " . $retval ); return $retval; } return 0; } } } =head2 process_request Process the tap and put it into the database. @param string - tap =cut sub process_request { my ($self, $tap) = @_; $SIG{CHLD} = 'IGNORE'; my $pid = fork(); if ($pid == 0) { try { $0 = "tapper-reports-receiver-".$self->report->id; $self->log->debug("Processing ".$self->report->id); $SIG{USR1} = sub { local $SIG{USR1} = 'ignore'; # make handler reentrant, don't handle signal twice my $backtrace = Devel::Backtrace->new(-start=>2, -format => '%I. %s'); open my $fh, ">>", '/tmp/tapper-receiver-util-'.$self->report->id; print $fh $backtrace; close $fh; }; $self->tap($tap); $self->write_tap_to_db(); my $harness = Tapper::TAP::Harness->new( tap => $self->tap, tap_is_archive => $self->report->tap->tap_is_archive ); $harness->evaluate_report(); $self->update_parsed_report_in_db( $harness->parsed_report ); $self->forward_to_level2_receivers(); } catch { # We can not use log4perl, because that might throw another # exception e.g. when logfile is not writable openlog('Tapper-Reports-Receiver', 'nofatal, ndelay', 'local0'); syslog('ALERT', "Error in processing report and can not safely log with Log4perl: $_"); closelog(); }; exit 0; } else { # noop in parent, return immediately } } 1;
tapper/Tapper-Reports-Receiver
lib/Tapper/Reports/Receiver/Util.pm
Perl
bsd-2-clause
12,053
# vim:ts=4 # # Copyright (c) 2005 Hypertriton, Inc. <http://hypertriton.com/> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. sub Test { MkCompileC('_MK_HAVE_SYS_TYPES_H', '', '', << 'EOF'); #include <sys/types.h> int main(int argc, char *argv[]) { size_t len = 1; len++; return (0); } EOF MkIfTrue('${_MK_HAVE_SYS_TYPES_H}'); MkPrintN('checking for 64-bit types...'); MkCompileC('HAVE_64BIT', '', '', << 'EOF'); #include <sys/types.h> int main(int argc, char *argv[]) { int64_t i64 = 0; u_int64_t u64 = 0; return (i64 != 0 || u64 != 0); } EOF MkElse; MkSaveUndef('HAVE_64BIT'); MkEndif; return (0); } sub Emul { my ($os, $osrel, $machine) = @_; if ($os =~ /^windows/) { MkEmulWindowsSYS('_MK_HAVE_SYS_TYPES_H'); if ($os =~ /64/) { MkEmulWindowsSYS('64BIT'); } else { MkEmulUnavailSYS('64BIT'); } } else { MkEmulUnavailSYS('_MK_HAVE_SYS_TYPES_H'); MkEmulUnavailSYS('64BIT'); } return (1); } BEGIN { $DESCR{'sys_types'} = '<sys/types.h>'; $TESTS{'sys_types'} = \&Test; $EMUL{'sys_types'} = \&Emul; $DEPS{'sys_types'} = 'cc'; } ;1
stqism/ToxBuild
ToxBuild/sys_types.pm
Perl
bsd-2-clause
2,325
#!%PERL% # Copyright (c) vhffs project and its contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. #2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. #3. Neither the name of vhffs nor the names of its contributors # may be used to endorse or promote products derived from this # software without specific prior written permission. # #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # Mirroring script for exim on mx1. # Set master & slave DB params and put it in a cron. # Slave database must have # - vhffs_object # - vhffs_mx # - vhffs_mx_localpart # - vhffs_mx_redirect # - vhffs_mx_box # - vhffs_mx_catchall # - vhffs_mx_ml # - vhffs_mx_ml_subscribers # tables from mx1-mirror.sql use DBI; use strict; use utf8; # Master DB params my $MASTER_DB_DATASOURCE = 'database=vhffs;host=localhost;port=5432'; my $MASTER_DB_USER = 'vhffs'; my $MASTER_DB_PASS = 'vhffs'; # Slave DB params my $SLAVE_DB_DATASOURCE = 'database=mailmirror;host=localhost;port=5432'; my $SLAVE_DB_USER = 'mailmirror'; my $SLAVE_DB_PASS = 'mirror'; # We've to connect to the master DB, fetch # object, mx, boxes, redirects, ml & ml_subscribers # tables and reinject them in slave DB my $master_dbh = DBI->connect('DBI:Pg:'.$MASTER_DB_DATASOURCE, $MASTER_DB_USER, $MASTER_DB_PASS) or die('Unable to open master connection'."\n"); my $slave_dbh = DBI->connect('DBI:Pg:'.$SLAVE_DB_DATASOURCE, $SLAVE_DB_USER, $SLAVE_DB_PASS) or die('Unable to open slave connection'."\n"); # Create temporary tables $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx(LIKE vhffs_mx)') or die('Unable to create temporary MX domain table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx_catchall(LIKE vhffs_mx_catchall)') or die('Unable to create temporary catchall table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx_localpart(LIKE vhffs_mx_localpart)') or die('Unable to create temporary localparts table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx_box(LIKE vhffs_mx_box)') or die('Unable to create temporary boxes table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx_redirect(LIKE vhffs_mx_redirect)') or die('Unable to create temporary redirect table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx_ml(LIKE vhffs_mx_ml)') or die('Unable to create temporary ml table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_mx_ml_subscribers(LIKE vhffs_mx_ml_subscribers)') or die('Unable to create temporary ml_subscribers table'."\n"); $slave_dbh->do('CREATE TEMPORARY TABLE tmp_object(LIKE vhffs_object)') or die('Unable to create temporary object table'."\n"); $master_dbh->{AutoCommit} = 0; $slave_dbh->{AutoCommit} = 0; # We need to set transaction isolation level to serializable to avoid # foreign key issues $master_dbh->do('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE') or die('Unable to set transaction level on master DB'."\n"); # Replicate vhffs_object table # Type 60 is mail objects and 61 is ml objects. my $msth = $master_dbh->prepare(q{SELECT o.object_id, o.owner_uid, o.owner_gid, o.date_creation, o.type FROM vhffs_object o WHERE o.state = 6 AND (o.type = 60 OR o.type = 61) }) or die('Unable to prepare SELECT query for vhffs_object'."\n"); my $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_object(object_id, owner_uid, owner_gid, date_creation, type) VALUES(?, ?, ?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_object'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_object'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{object_id}, $row->{owner_uid}, $row->{owner_gid}, $row->{date_creation}, $row->{type}) or die('Unable to insert object #'.$row->{object_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx table my $msth = $master_dbh->prepare(q{SELECT d.mx_id, d.domain, d.object_id FROM vhffs_mx d INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE o.state = 6}) or die('Unable to prepare SELECT query for vhffs_mx'."\n"); my $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx(mx_id, domain, object_id) VALUES(?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_mx'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{mx_id}, $row->{domain}, $row->{object_id}) or die('Unable to insert mail domain #'.$row->{mx_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx_localpart table $msth = $master_dbh->prepare(q{SELECT lp.localpart_id, lp.mx_id, lp.localpart, lp.password, lp.nospam, lp.novirus FROM vhffs_mx_localpart lp INNER JOIN vhffs_mx d ON lp.mx_id = d.mx_id INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE o.state = 6}) or die('Unable to prepare SELECT query for vhffs_mx_localpart'."\n"); $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx_localpart(localpart_id, mx_id, localpart, password, nospam, novirus) VALUES(?, ?, ?, ?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_mx_localpart'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx_localpart'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{localpart_id}, $row->{mx_id}, $row->{localpart}, $row->{password}, $row->{nospam}, $row->{novirus}) or die('Unable to insert localpart #'.$row->{localpart_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx_redirect table $msth = $master_dbh->prepare(q{SELECT r.redirect_id, r.localpart_id, r.redirect FROM vhffs_mx_redirect r INNER JOIN vhffs_mx_localpart lp ON lp.localpart_id = r.localpart_id INNER JOIN vhffs_mx d ON d.mx_id = lp.mx_id INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE o.state = 6}) or die('Unable to prepare SELECT query for vhffs_mx_redirect'."\n"); $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx_redirect(redirect_id, localpart_id, redirect) VALUES(?, ?, ?)}) or die('Unable to prepare INSERT query for vhffs_mx_redirect'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx_redirect'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{redirect_id}, $row->{localpart_id}, $row->{redirect}) or die('Unable to insert redirect #'.$row->{redirect_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx_box table $msth = $master_dbh->prepare(q{SELECT b.box_id, b.localpart_id, b.allowpop, b.allowimap FROM vhffs_mx_box b INNER JOIN vhffs_mx_localpart lp ON lp.localpart_id = b.localpart_id INNER JOIN vhffs_mx d ON d.mx_id = lp.mx_id INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE o.state = 6 AND b.state = 6}) or die('Unable to prepare SELECT query for vhffs_mx_box'."\n"); $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx_box(box_id, localpart_id, allowpop, allowimap) VALUES(?, ?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_mx_box'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx_box'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{box_id}, $row->{localpart_id}, $row->{allowpop}, $row->{allowimap}) or die('Unable to insert box #'.$row->{box_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx_catchall table $msth = $master_dbh->prepare(q{SELECT c.catchall_id, c.mx_id, c.box_id FROM vhffs_mx_catchall c INNER JOIN vhffs_mx d ON d.mx_id = c.mx_id INNER JOIN vhffs_object o ON o.object_id = d.object_id INNER JOIN vhffs_mx_box b ON b.box_id = c.box_id INNER JOIN vhffs_mx_localpart lpb ON lpb.localpart_id = b.localpart_id INNER JOIN vhffs_mx mxb ON mxb.mx_id = lpb.mx_id INNER JOIN vhffs_object ob ON ob.object_id = mxb.object_id WHERE o.state = 6 AND b.state = 6 AND ob.state = 6}) or die('Unable to prepare SELECT query for vhffs_mx_box'."\n"); $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx_catchall(catchall_id, mx_id, box_id) VALUES(?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_mx_catchall'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx_catchall'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{catchall_id}, $row->{mx_id}, $row->{box_id}) or die('Unable to insert catchall #'.$row->{catchall_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx_ml table $msth = $master_dbh->prepare(q{SELECT ml.ml_id, ml.localpart_id, ml.prefix, ml.object_id, ml.sub_ctrl, ml.post_ctrl, ml.reply_to, ml.open_archive, ml.signature FROM vhffs_mx_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id INNER JOIN vhffs_mx_localpart lp ON lp.localpart_id = ml.localpart_id INNER JOIN vhffs_mx d ON d.mx_id = lp.mx_id INNER JOIN vhffs_object mxo ON mxo.object_id = d.object_id WHERE o.state = 6 AND mxo.state = 6}) or die('Unable to prepare SELECT query for vhffs_mx_ml'."\n"); $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx_ml(ml_id, localpart_id, prefix, object_id, sub_ctrl, post_ctrl, reply_to, open_archive, signature) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_mx_ml'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx_ml'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{ml_id}, $row->{localpart_id}, $row->{prefix}, $row->{object_id}, $row->{sub_ctrl}, $row->{post_ctrl}, $row->{reply_to}, $row->{open_archive}, $row->{signature}) or die('Unable to insert ml #'.$row->{mx_id}."\n"); } $ssth->finish(); $msth->finish(); # Replicate vhffs_mx_ml_subscribers table $msth = $master_dbh->prepare(q{SELECT ms.sub_id, ms.member, ms.perm, ms.hash, ms.ml_id, ms.language FROM vhffs_mx_ml_subscribers ms INNER JOIN vhffs_mx_ml ml ON ms.ml_id = ml.ml_id INNER JOIN vhffs_object o ON o.object_id = ml.object_id INNER JOIN vhffs_mx_localpart lp ON lp.localpart_id = ml.localpart_id INNER JOIN vhffs_mx d ON d.mx_id = lp.mx_id INNER JOIN vhffs_object mxo ON mxo.object_id = d.object_id WHERE o.state = 6 AND mxo.state = 6}) or die("Unable to prepare SELECT query for vhffs_mx_ml_subscribers\n"); $ssth = $slave_dbh->prepare(q{INSERT INTO tmp_mx_ml_subscribers(sub_id, member, perm, hash, ml_id, language) VALUES(?, ?, ?, ?, ?, ?)}) or die('Unable to prepare INSERT query for tmp_mx_ml_subscribers'."\n"); $msth->execute() or die('Unable to execute SELECT query for vhffs_mx_ml_subscribers'."\n"); while(my $row = $msth->fetchrow_hashref()) { $ssth->execute($row->{sub_id}, $row->{member}, $row->{perm}, $row->{hash}, $row->{ml_id}, $row->{language}) or die('Unable to insert ml_subscriber #'.$row->{sub_id}); } $ssth->finish(); $msth->finish(); # We're done fetching data $master_dbh->disconnect(); my $count; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_ml_subscribers WHERE sub_id NOT IN (SELECT sub_id FROM tmp_mx_ml_subscribers)})) or die('Unable to delete no more existing ml users'."\n"); print int($count).' subscribers deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_ml WHERE ml_id NOT IN (SELECT ml_id FROM tmp_mx_ml)})) or die('Unable to delete no more existing ml'."\n"); print int($count).' mailing lists deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_redirect WHERE redirect_id NOT IN (SELECT redirect_id FROM tmp_mx_redirect)})) or die('Unable to delete no more existing redirects'."\n"); print int($count).' redirects deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_catchall WHERE catchall_id NOT IN (SELECT catchall_id FROM tmp_mx_catchall)})) or die('Unable to delete no more existing catchall'."\n"); print int($count).' catchalls deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_box WHERE box_id NOT IN (SELECT box_id FROM tmp_mx_box)})) or die('Unable to delete no more existing boxes'."\n"); print int($count).' boxes deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_box WHERE box_id NOT IN (SELECT box_id FROM tmp_mx_box)})) or die('Unable to delete no more existing boxes'."\n"); print int($count).' boxes deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_mx_localpart WHERE localpart_id NOT IN (SELECT localpart_id FROM tmp_mx_localpart)})) or die('Unable to delete no more existing localparts'."\n"); print int($count).' localparts deleted'."\n"; ($count = $slave_dbh->do(q{DELETE FROM vhffs_object WHERE object_id NOT IN(SELECT object_id FROM vhffs_object)})) or die('Unable to delete no more existing objects'."\n"); print int($count).' objects deleted'."\n"; # Update boxes/redirects/ml/domains # The only potential change in object is owner_uid, owner_gid # Type are always set to 60 or 61 for us ($count = $slave_dbh->do(q{UPDATE vhffs_object SET owner_uid = tmp.owner_uid, owner_gid = tmp.owner_gid, date_creation = tmp.date_creation FROM tmp_object tmp WHERE tmp.object_id = vhffs_object.object_id})) or die('Unable to update object table'."\n"); # nothing to update for vhffs_mx # nothing to update for vhffs_mx_catchall $slave_dbh->do(q{UPDATE vhffs_mx_localpart SET password = tmp.password, nospam = tmp.nospam, novirus = tmp.novirus FROM tmp_mx_localpart tmp WHERE tmp.localpart_id = vhffs_mx_localpart.localpart_id}) or die('Unable to update boxes data'."\n"); $slave_dbh->do(q{UPDATE vhffs_mx_box SET allowpop = tmp.allowpop, allowimap = tmp.allowimap FROM tmp_mx_box tmp WHERE tmp.box_id = vhffs_mx_box.box_id}) or die('Unable to update boxes data'."\n"); $slave_dbh->do(q{UPDATE vhffs_mx_redirect SET redirect = tmp.redirect FROM tmp_mx_redirect tmp WHERE tmp.redirect_id = vhffs_mx_redirect.redirect_id}) or die('Unable to update redirecs data'."\n"); $slave_dbh->do(q{UPDATE vhffs_mx_ml SET prefix = tmp.prefix, sub_ctrl = tmp.sub_ctrl, post_ctrl = tmp.post_ctrl, reply_to = tmp.reply_to, open_archive = tmp.open_archive, signature = tmp.signature FROM tmp_mx_ml tmp WHERE tmp.ml_id = vhffs_mx_ml.ml_id}) or die('Unable to update mailing lists data'."\n"); $slave_dbh->do(q{UPDATE vhffs_mx_ml_subscribers SET perm = tmp.perm, hash = tmp.hash, language = tmp.language FROM tmp_mx_ml_subscribers tmp WHERE tmp.sub_id = vhffs_mx_ml_subscribers.sub_id}) or die('Unable to update subscribers data'."\n"); # Insert new boxes/redirects/ml/domains ($count = $slave_dbh->do(q{INSERT INTO vhffs_object(object_id, owner_uid, owner_gid, date_creation, type) SELECT object_id, owner_uid, owner_gid, date_creation, type FROM tmp_object tmp WHERE tmp.object_id NOT IN(SELECT object_id FROM vhffs_object)})) or die('Unable to insert new objects'."\n"); print int($count).' objects inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx(mx_id, domain, object_id) SELECT mx_id, domain, object_id FROM tmp_mx WHERE mx_id NOT IN(SELECT mx_id FROM vhffs_mx)})) or die('Unable to insert new mail domains'."\n"); print int($count).' domains inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx_localpart(localpart_id, mx_id, localpart, password, nospam, novirus) SELECT localpart_id, mx_id, localpart, password, nospam, novirus FROM tmp_mx_localpart WHERE localpart_id NOT IN(SELECT localpart_id FROM vhffs_mx_localpart)})) or die('Unable to insert new localparts'."\n"); print int($count).' localparts inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx_redirect(redirect_id, localpart_id, redirect) SELECT redirect_id, localpart_id, redirect FROM tmp_mx_redirect tmp WHERE tmp.redirect_id NOT IN (SELECT redirect_id FROM vhffs_mx_redirect)})) or die('Unable to insert new redirects'."\n"); print int($count).' redirects inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx_box(box_id, localpart_id, allowpop, allowimap) SELECT box_id, localpart_id, allowpop, allowimap FROM tmp_mx_box tmp WHERE tmp.box_id NOT IN(SELECT box_id FROM vhffs_mx_box)})) or die('Unable to insert new boxes'."\n"); print int($count).' boxes inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx_catchall(catchall_id, mx_id, box_id) SELECT catchall_id, mx_id, box_id FROM tmp_mx_catchall tmp WHERE tmp.catchall_id NOT IN(SELECT catchall_id FROM vhffs_mx_catchall)})) or die('Unable to insert new catchalls'."\n"); print int($count).' catchalls inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx_ml(ml_id, localpart_id, prefix, object_id, sub_ctrl, post_ctrl, reply_to, open_archive, signature) SELECT ml_id, localpart_id, prefix, object_id, sub_ctrl, post_ctrl, reply_to, open_archive, signature FROM tmp_mx_ml tmp WHERE tmp.ml_id NOT IN (SELECT ml_id FROM vhffs_mx_ml)})) or die('Unable to insert new ml'."\n"); print int($count).' mailing lists inserted'."\n"; ($count = $slave_dbh->do(q{INSERT INTO vhffs_mx_ml_subscribers(sub_id, member, perm, hash, ml_id, language) SELECT sub_id, member, perm, hash, ml_id, language FROM tmp_mx_ml_subscribers ms WHERE ms.sub_id NOT IN(SELECT sub_id FROM vhffs_mx_ml_subscribers)})) or die('Unable to insert new subscribers'."\n"); print int($count).' subscribers inserted'."\n"; $slave_dbh->commit(); $slave_dbh->disconnect();
najamelan/vhffs-4.5
vhffs-backend/src/mirror/mx1-mirror.pl
Perl
bsd-3-clause
18,100
#!/usr/bin/perl # vim: ts=4 sts=4 sw=4 # # Markdown -- A text-to-HTML conversion tool for web writers # # Copyright (c) 2013 Matthew Kerwin # <https://github.com/phluid61/mmdc/> # # Copyright (c) 2004 John Gruber # <http://daringfireball.net/projects/markdown/> # package Markdown; require 5.006_000; use strict; use warnings; use Digest::MD5 qw(md5_hex); use vars qw($VERSION); $VERSION = '1.1.1'; # Mon 21 Oct 2013 ## Disabled; causes problems under Perl 5.6.1: # use utf8; # binmode( STDOUT, ":utf8" ); # c.f.: http://acis.openlib.org/dev/perl-unicode-struggle.html # # Global default settings: # my $g_empty_element_suffix = " />"; # Change to ">" for HTML output my $g_tab_width = 4; # # Globals: # # Regex to match balanced [brackets]. See Friedl's # "Mastering Regular Expressions", 2nd Ed., pp. 328-331. my $g_nested_brackets; $g_nested_brackets = qr{ (?> # Atomic matching [^\[\]]+ # Anything other than brackets | \[ (??{ $g_nested_brackets }) # Recursive set of nested brackets \] )* }x; # Table of hash values for escaped characters: my %g_escape_table; foreach my $char (split //, '\\`*_{}[]()>#+-.!~') { $g_escape_table{$char} = md5_hex($char); } # Global hashes, used by various utility routines my %g_urls; my %g_titles; my %g_html_blocks; # Used to track when we're inside an ordered or unordered list # (see _ProcessListItems() for details): my $g_list_level = 0; #### Blosxom plug-in interface ########################################## # Set $g_blosxom_use_meta to 1 to use Blosxom's meta plug-in to determine # which posts Markdown should process, using a "meta-markup: markdown" # header. If it's set to 0 (the default), Markdown will process all # entries. my $g_blosxom_use_meta = 0; sub start { 1; } sub story { my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_; if ( (! $g_blosxom_use_meta) or (defined($meta::markup) and ($meta::markup =~ /^\s*markdown\s*$/i)) ){ $$body_ref = Markdown($$body_ref); } 1; } #### Movable Type plug-in interface ##################################### eval {require MT}; # Test to see if we're running in MT. unless ($@) { require MT; import MT; require MT::Template::Context; import MT::Template::Context; eval {require MT::Plugin}; # Test to see if we're running >= MT 3.0. unless ($@) { require MT::Plugin; import MT::Plugin; my $plugin = new MT::Plugin({ name => "Markdown", description => "A plain-text-to-HTML formatting plugin. (Version: $VERSION)", doc_link => 'http://daringfireball.net/projects/markdown/' }); MT->add_plugin( $plugin ); } MT::Template::Context->add_container_tag(MarkdownOptions => sub { my $ctx = shift; my $args = shift; my $builder = $ctx->stash('builder'); my $tokens = $ctx->stash('tokens'); if (defined ($args->{'output'}) ) { $ctx->stash('markdown_output', lc $args->{'output'}); } defined (my $str = $builder->build($ctx, $tokens) ) or return $ctx->error($builder->errstr); $str; # return value }); MT->add_text_filter('markdown' => { label => 'Markdown', docs => 'http://daringfireball.net/projects/markdown/', on_format => sub { my $text = shift; my $ctx = shift; my $raw = 0; if (defined $ctx) { my $output = $ctx->stash('markdown_output'); if (defined $output && $output =~ m/^html/i) { $g_empty_element_suffix = ">"; $ctx->stash('markdown_output', ''); } elsif (defined $output && $output eq 'raw') { $raw = 1; $ctx->stash('markdown_output', ''); } else { $raw = 0; $g_empty_element_suffix = " />"; } } $text = $raw ? $text : Markdown($text); $text; }, }); # If SmartyPants is loaded, add a combo Markdown/SmartyPants text filter: my $smartypants; { no warnings "once"; $smartypants = $MT::Template::Context::Global_filters{'smarty_pants'}; } if ($smartypants) { MT->add_text_filter('markdown_with_smartypants' => { label => 'Markdown With SmartyPants', docs => 'http://daringfireball.net/projects/markdown/', on_format => sub { my $text = shift; my $ctx = shift; if (defined $ctx) { my $output = $ctx->stash('markdown_output'); if (defined $output && $output eq 'html') { $g_empty_element_suffix = ">"; } else { $g_empty_element_suffix = " />"; } } $text = Markdown($text); $text = $smartypants->($text, '1'); }, }); } } else { #### BBEdit/command-line text filter interface ########################## # Needs to be hidden from MT (and Blosxom when running in static mode). # We're only using $blosxom::version once; tell Perl not to warn us: no warnings 'once'; unless ( defined($blosxom::version) ) { use warnings; #### Check for command-line switches: ################# my %cli_opts; use Getopt::Long; Getopt::Long::Configure('pass_through'); GetOptions(\%cli_opts, 'version', 'shortversion', 'html4tags', ); if ($cli_opts{'version'}) { # Version info print "\nThis is Markdown, version $VERSION.\n"; print "Copyright 2004 John Gruber\n"; print "http://daringfireball.net/projects/markdown/\n\n"; exit 0; } if ($cli_opts{'shortversion'}) { # Just the version number string. print $VERSION; exit 0; } if ($cli_opts{'html4tags'}) { # Use HTML tag style instead of XHTML $g_empty_element_suffix = ">"; } #### Process incoming text: ########################### my $text; { local $/; # Slurp the whole file $text = <>; } print Markdown($text); } } sub Markdown { # # Main function. The order in which other subs are called here is # essential. Link and image substitutions need to happen before # _EscapeSpecialChars(), so that any *'s or _'s in the <a> # and <img> tags get encoded. # my $text = shift; # Clear the global hashes. If we don't clear these, you get conflicts # from other articles when generating a page which contains more than # one article (e.g. an index page that shows the N most recent # articles): %g_urls = (); %g_titles = (); %g_html_blocks = (); # Standardize line endings: $text =~ s{\r\n}{\n}g; # DOS to Unix $text =~ s{\r}{\n}g; # Mac to Unix # Make sure $text ends with a couple of newlines: $text .= "\n\n"; # Convert all tabs to spaces. $text = _Detab($text); # Strip any lines consisting only of spaces and tabs. # This makes subsequent regexen easier to write, because we can # match consecutive blank lines with /\n+/ instead of something # contorted like /[ \t]*\n+/ . $text =~ s/^[ \t]+$//mg; # Turn block-level HTML blocks into hash entries $text = _HashHTMLBlocks($text); # Strip link definitions, store in hashes. $text = _StripLinkDefinitions($text); $text = _RunBlockGamut($text); $text = _UnescapeSpecialChars($text); return $text . "\n"; } sub _StripLinkDefinitions { # # Strips link definitions from text, stores the URLs and titles in # hash references. # my $text = shift; my $less_than_tab = $g_tab_width - 1; # Link defs are in the form: ^[id]: url "optional title" while ($text =~ s{ ^[ ]{0,$less_than_tab}\[(.+)\]: # id = $1 [ \t]* \n? # maybe *one* newline [ \t]* <?(\S+?)>? # url = $2 [ \t]* \n? # maybe one newline [ \t]* (?: (?<=\s) # lookbehind for whitespace ["(] (.+?) # title = $3 [")] [ \t]* )? # title is optional (?:\n+|\Z) } {}mx) { $g_urls{lc $1} = _EncodeAmpsAndAngles( $2 ); # Link IDs are case-insensitive if ($3) { $g_titles{lc $1} = $3; $g_titles{lc $1} =~ s/"/&quot;/g; } } return $text; } sub _HashHTMLBlocks { my $text = shift; my $less_than_tab = $g_tab_width - 1; # Hashify HTML blocks: # We only want to do this for block-level HTML tags, such as headers, # lists, and tables. That's because we still want to wrap <p>s around # "paragraphs" that are wrapped in non-block-level tags, such as anchors, # phrase emphasis, and spans. The list of tags we're looking for is # hard-coded: my $block_tags_a = qr/p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del/; my $block_tags_b = qr/p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math/; # First, look for nested blocks, e.g.: # <div> # <div> # tags for inner block must be indented. # </div> # </div> # # The outermost tags must start at the left margin for this to match, and # the inner nested divs must be indented. # We need to do this before the next, more liberal match, because the next # match will start at the first `<div>` and stop at the first `</div>`. $text =~ s{ ( # save in $1 ^ # start of line (with /m) <($block_tags_a) # start tag = $2 \b # word break (.*\n)*? # any number of lines, minimally matching </\2> # the matching end tag [ \t]* # trailing spaces/tabs (?=\n+|\Z) # followed by a newline or end of document ) }{ my $key = md5_hex($1); $g_html_blocks{$key} = $1; "\n\n" . $key . "\n\n"; }egmx; # # Now match more liberally, simply from `\n<tag>` to `</tag>\n` # $text =~ s{ ( # save in $1 ^ # start of line (with /m) <($block_tags_b) # start tag = $2 \b # word break (.*\n)*? # any number of lines, minimally matching .*</\2> # the matching end tag [ \t]* # trailing spaces/tabs (?=\n+|\Z) # followed by a newline or end of document ) }{ my $key = md5_hex($1); $g_html_blocks{$key} = $1; "\n\n" . $key . "\n\n"; }egmx; # Special case just for <hr />. It was easier to make a special case than # to make the other regex more complicated. $text =~ s{ (?: (?<=\n\n) # Starting after a blank line | # or \A\n? # the beginning of the doc ) ( # save in $1 [ ]{0,$less_than_tab} <(hr) # start tag = $2 \b # word break ([^<>])*? # /?> # the matching end tag [ \t]* (?=\n{2,}|\Z) # followed by a blank line or end of document ) }{ my $key = md5_hex($1); $g_html_blocks{$key} = $1; "\n\n" . $key . "\n\n"; }egx; # Special case for standalone HTML comments: $text =~ s{ (?: (?<=\n\n) # Starting after a blank line | # or \A\n? # the beginning of the doc ) ( # save in $1 [ ]{0,$less_than_tab} (?s: <! (--.*?--\s*)+ > ) [ \t]* (?=\n{2,}|\Z) # followed by a blank line or end of document ) }{ my $key = md5_hex($1); $g_html_blocks{$key} = $1; "\n\n" . $key . "\n\n"; }egx; return $text; } sub _RunBlockGamut { # # These are all the transformations that form block-level # tags like paragraphs, headers, and list items. # my $text = shift; $text = _DoHeaders($text); # Do Horizontal Rules: $text =~ s{^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$}{\n<hr$g_empty_element_suffix\n}gmx; $text =~ s{^[ ]{0,2}([ ]? -[ ]?){3,}[ \t]*$}{\n<hr$g_empty_element_suffix\n}gmx; $text =~ s{^[ ]{0,2}([ ]? _[ ]?){3,}[ \t]*$}{\n<hr$g_empty_element_suffix\n}gmx; $text = _DoLists($text); $text = _DoCodeBlocks($text); $text = _DoBlockQuotes($text); # We already ran _HashHTMLBlocks() before, in Markdown(), but that # was to escape raw HTML in the original Markdown source. This time, # we're escaping the markup we've just created, so that we don't wrap # <p> tags around block-level tags. $text = _HashHTMLBlocks($text); $text = _FormParagraphs($text); return $text; } sub _RunSpanGamut { # # These are all the transformations that occur *within* block-level # tags like paragraphs, headers, and list items. # my $text = shift; $text = _DoCodeSpans($text); $text = _EscapeSpecialChars($text); # Process anchor and image tags. Images must come first, # because ![foo][f] looks like an anchor. $text = _DoImages($text); $text = _DoAnchors($text); # Make links out of things like `<http://example.com/>` # Must come after _DoAnchors(), because you can use < and > # delimiters in inline links like [this](<url>). $text = _DoAutoLinks($text); $text = _EncodeAmpsAndAngles($text); $text = _DoItalicsAndBold($text); # Do hard breaks: $text =~ s/ {2,}\n/ <br$g_empty_element_suffix\n/g; return $text; } sub _EscapeSpecialChars { my $text = shift; my $tokens ||= _TokenizeHTML($text); $text = ''; # rebuild $text from the tokens # my $in_pre = 0; # Keep track of when we're inside <pre> or <code> tags. # my $tags_to_skip = qr!<(/?)(?:pre|code|kbd|script|math)[\s>]!; foreach my $cur_token (@$tokens) { if ($cur_token->[0] eq "tag") { # Within tags, encode * and _ so they don't conflict # with their use in Markdown for italics and strong. # We're replacing each such character with its # corresponding MD5 checksum value; this is likely # overkill, but it should prevent us from colliding # with the escape values by accident. $cur_token->[1] =~ s! \* !$g_escape_table{'*'}!gx; $cur_token->[1] =~ s! _ !$g_escape_table{'_'}!gx; $cur_token->[1] =~ s! ~ !$g_escape_table{'~'}!gx; $text .= $cur_token->[1]; } else { my $t = $cur_token->[1]; $t = _EncodeBackslashEscapes($t); $text .= $t; } } return $text; } sub _DoAnchors { # # Turn Markdown link shortcuts into XHTML <a> tags. # my $text = shift; # # First, handle reference-style links: [link text] [id] # $text =~ s{ ( # wrap whole match in $1 \[ ($g_nested_brackets) # link text = $2 \] [ ]? # one optional space (?:\n[ ]*)? # one optional newline followed by spaces \[ (.*?) # id = $3 \] ) }{ my $result; my $whole_match = $1; my $link_text = $2; my $link_id = lc $3; if ($link_id eq "") { $link_id = lc $link_text; # for shortcut links like [this][]. } if (defined $g_urls{$link_id}) { my $url = $g_urls{$link_id}; $url =~ s! \* !$g_escape_table{'*'}!gx; # We've got to encode these to avoid $url =~ s! _ !$g_escape_table{'_'}!gx; # conflicting with italics/bold. $url =~ s! ~ !$g_escape_table{'~'}!gx; $result = "<a href=\"$url\""; if ( defined $g_titles{$link_id} ) { my $title = $g_titles{$link_id}; $title =~ s! \* !$g_escape_table{'*'}!gx; $title =~ s! _ !$g_escape_table{'_'}!gx; $title =~ s! ~ !$g_escape_table{'~'}!gx; $result .= " title=\"$title\""; } $result .= ">$link_text</a>"; } else { $result = $whole_match; } $result; }xsge; # # Next, inline-style links: [link text](url "optional title") # $text =~ s{ ( # wrap whole match in $1 \[ ($g_nested_brackets) # link text = $2 \] \( # literal paren [ \t]* <?(.*?)>? # href = $3 [ \t]* ( # $4 (['"]) # quote char = $5 (.*?) # Title = $6 \5 # matching quote )? # title is optional \) ) }{ my $result; my $whole_match = $1; my $link_text = $2; my $url = $3; my $title = $6; $url =~ s! \* !$g_escape_table{'*'}!gx; # We've got to encode these to avoid $url =~ s! _ !$g_escape_table{'_'}!gx; # conflicting with italics/bold. $url =~ s! ~ !$g_escape_table{'~'}!gx; $result = "<a href=\"$url\""; if (defined $title) { $title =~ s/"/&quot;/g; $title =~ s! \* !$g_escape_table{'*'}!gx; $title =~ s! _ !$g_escape_table{'_'}!gx; $title =~ s! ~ !$g_escape_table{'~'}!gx; $result .= " title=\"$title\""; } $result .= ">$link_text</a>"; $result; }xsge; return $text; } sub _DoImages { # # Turn Markdown image shortcuts into <img> tags. # my $text = shift; # # First, handle reference-style labeled images: ![alt text][id] # $text =~ s{ ( # wrap whole match in $1 !\[ (.*?) # alt text = $2 \] [ ]? # one optional space (?:\n[ ]*)? # one optional newline followed by spaces \[ (.*?) # id = $3 \] ) }{ my $result; my $whole_match = $1; my $alt_text = $2; my $link_id = lc $3; if ($link_id eq "") { $link_id = lc $alt_text; # for shortcut links like ![this][]. } $alt_text =~ s/"/&quot;/g; if (defined $g_urls{$link_id}) { my $url = $g_urls{$link_id}; $url =~ s! \* !$g_escape_table{'*'}!gx; # We've got to encode these to avoid $url =~ s! _ !$g_escape_table{'_'}!gx; # conflicting with italics/bold. $url =~ s! ~ !$g_escape_table{'~'}!gx; $result = "<img src=\"$url\" alt=\"$alt_text\""; if (defined $g_titles{$link_id}) { my $title = $g_titles{$link_id}; $title =~ s! \* !$g_escape_table{'*'}!gx; $title =~ s! _ !$g_escape_table{'_'}!gx; $title =~ s! ~ !$g_escape_table{'~'}!gx; $result .= " title=\"$title\""; } $result .= $g_empty_element_suffix; } else { # If there's no such link ID, leave intact: $result = $whole_match; } $result; }xsge; # # Next, handle inline images: ![alt text](url "optional title") # Don't forget: encode * and _ $text =~ s{ ( # wrap whole match in $1 !\[ (.*?) # alt text = $2 \] \( # literal paren [ \t]* <?(\S+?)>? # src url = $3 [ \t]* ( # $4 (['"]) # quote char = $5 (.*?) # title = $6 \5 # matching quote [ \t]* )? # title is optional \) ) }{ my $result; my $whole_match = $1; my $alt_text = $2; my $url = $3; my $title = ''; if (defined($6)) { $title = $6; } $alt_text =~ s/"/&quot;/g; $title =~ s/"/&quot;/g; $url =~ s! \* !$g_escape_table{'*'}!gx; # We've got to encode these to avoid $url =~ s! _ !$g_escape_table{'_'}!gx; # conflicting with italics/bold. $url =~ s! ~ !$g_escape_table{'~'}!gx; $result = "<img src=\"$url\" alt=\"$alt_text\""; if (defined $title) { $title =~ s! \* !$g_escape_table{'*'}!gx; $title =~ s! _ !$g_escape_table{'_'}!gx; $title =~ s! ~ !$g_escape_table{'~'}!gx; $result .= " title=\"$title\""; } $result .= $g_empty_element_suffix; $result; }xsge; return $text; } sub _DoHeaders { my $text = shift; # Setext-style headers: # Header 1 # ======== # # Header 2 # -------- # $text =~ s{ ^(.+)[ \t]*\n=+[ \t]*\n+ }{ "<h1>" . _RunSpanGamut($1) . "</h1>\n\n"; }egmx; $text =~ s{ ^(.+)[ \t]*\n-+[ \t]*\n+ }{ "<h2>" . _RunSpanGamut($1) . "</h2>\n\n"; }egmx; # atx-style headers: # # Header 1 # ## Header 2 # ## Header 2 with closing hashes ## # ... # ###### Header 6 # $text =~ s{ ^(\#{1,6}) # $1 = string of #'s [ \t]* (.+?) # $2 = Header text [ \t]* \#* # optional closing #'s (not counted) \n+ }{ my $h_level = length($1); "<h$h_level>" . _RunSpanGamut($2) . "</h$h_level>\n\n"; }egmx; return $text; } sub _DoLists { # # Form HTML ordered (numbered) and unordered (bulleted) lists. # my $text = shift; my $less_than_tab = $g_tab_width - 1; # Re-usable patterns to match list item bullets and number markers: my $marker_ul = qr/[*+-]/; my $marker_ol = qr/\d+[.]/; my $marker_any = qr/(?:$marker_ul|$marker_ol)/; # Re-usable pattern to match any entirel ul or ol list: my $whole_list = qr{ ( # $1 = whole list ( # $2 [ ]{0,$less_than_tab} (${marker_any}) # $3 = first list item marker [ \t]+ ) (?s:.+?) ( # $4 \z | \n{2,} (?=\S) (?! # Negative lookahead for another list item marker [ \t]* ${marker_any}[ \t]+ ) ) ) }mx; # We use a different prefix before nested lists than top-level lists. # See extended comment in _ProcessListItems(). # # Note: There's a bit of duplication here. My original implementation # created a scalar regex pattern as the conditional result of the test on # $g_list_level, and then only ran the $text =~ s{...}{...}egmx # substitution once, using the scalar as the pattern. This worked, # everywhere except when running under MT on my hosting account at Pair # Networks. There, this caused all rebuilds to be killed by the reaper (or # perhaps they crashed, but that seems incredibly unlikely given that the # same script on the same server ran fine *except* under MT. I've spent # more time trying to figure out why this is happening than I'd like to # admit. My only guess, backed up by the fact that this workaround works, # is that Perl optimizes the substition when it can figure out that the # pattern will never change, and when this optimization isn't on, we run # afoul of the reaper. Thus, the slightly redundant code to that uses two # static s/// patterns rather than one conditional pattern. if ($g_list_level) { $text =~ s{ ^ $whole_list }{ my $list = $1; my $list_type = ($3 =~ m/$marker_ul/) ? "ul" : "ol"; # Turn double returns into triple returns, so that we can make a # paragraph for the last item in a list, if necessary: $list =~ s/\n{2,}/\n\n\n/g; my $result = _ProcessListItems($list, $marker_any); $result = "<$list_type>\n" . $result . "</$list_type>\n"; $result; }egmx; } else { $text =~ s{ (?:(?<=\n\n)|\A\n?) $whole_list }{ my $list = $1; my $list_type = ($3 =~ m/$marker_ul/) ? "ul" : "ol"; # Turn double returns into triple returns, so that we can make a # paragraph for the last item in a list, if necessary: $list =~ s/\n{2,}/\n\n\n/g; my $result = _ProcessListItems($list, $marker_any); $result = "<$list_type>\n" . $result . "</$list_type>\n"; $result; }egmx; } return $text; } sub _ProcessListItems { # # Process the contents of a single ordered or unordered list, splitting it # into individual list items. # my $list_str = shift; my $marker_any = shift; # The $g_list_level global keeps track of when we're inside a list. # Each time we enter a list, we increment it; when we leave a list, # we decrement. If it's zero, we're not in a list anymore. # # We do this because when we're not inside a list, we want to treat # something like this: # # I recommend upgrading to version # 8. Oops, now this line is treated # as a sub-list. # # As a single paragraph, despite the fact that the second line starts # with a digit-period-space sequence. # # Whereas when we're inside a list (or sub-list), that line will be # treated as the start of a sub-list. What a kludge, huh? This is # an aspect of Markdown's syntax that's hard to parse perfectly # without resorting to mind-reading. Perhaps the solution is to # change the syntax rules such that sub-lists must start with a # starting cardinal number; e.g. "1." or "a.". $g_list_level++; # trim trailing blank lines: $list_str =~ s/\n{2,}\z/\n/; $list_str =~ s{ (\n)? # leading line = $1 (^[ \t]*) # leading whitespace = $2 ($marker_any) [ \t]+ # list marker = $3 ((?s:.+?) # list item text = $4 (\n{1,2})) (?= \n* (\z | \2 ($marker_any) [ \t]+)) }{ my $item = $4; my $leading_line = $1; my $leading_space = $2; if ($leading_line or ($item =~ m/\n{2,}/)) { $item = _RunBlockGamut(_Outdent($item)); } else { # Recursion for sub-lists: $item = _DoLists(_Outdent($item)); chomp $item; $item = _RunSpanGamut($item); } "<li>" . $item . "</li>\n"; }egmx; $g_list_level--; return $list_str; } sub _DoCodeBlocks { # # Process Markdown `<pre><code>` blocks. # my $text = shift; $text =~ s{ (?:\n\n|\A) ( # $1 = the code block -- one or more lines, starting with a space/tab (?: (?:[ ]{$g_tab_width} | \t) # Lines must start with a tab or a tab-width of spaces .*\n+ )+ ) ((?=^[ ]{0,$g_tab_width}\S)|\Z) # Lookahead for non-space at line-start, or end of doc }{ my $codeblock = $1; my $result; # return value $codeblock = _EncodeCode(_Outdent($codeblock)); $codeblock = _Detab($codeblock); $codeblock =~ s/\A\n+//; # trim leading newlines $codeblock =~ s/\s+\z//; # trim trailing whitespace $result = "\n\n<pre><code>" . $codeblock . "\n</code></pre>\n\n"; $result; }egmx; return $text; } sub _DoCodeSpans { # # * Backtick quotes are used for <code></code> spans. # # * You can use multiple backticks as the delimiters if you want to # include literal backticks in the code span. So, this input: # # Just type ``foo `bar` baz`` at the prompt. # # Will translate to: # # <p>Just type <code>foo `bar` baz</code> at the prompt.</p> # # There's no arbitrary limit to the number of backticks you # can use as delimters. If you need three consecutive backticks # in your code, use four for delimiters, etc. # # * You can use spaces to get literal backticks at the edges: # # ... type `` `bar` `` ... # # Turns to: # # ... type <code>`bar`</code> ... # my $text = shift; $text =~ s@ (`+) # $1 = Opening run of ` (.+?) # $2 = The code block (?<!`) \1 # Matching closer (?!`) @ my $c = "$2"; $c =~ s/^[ \t]*//g; # leading whitespace $c =~ s/[ \t]*$//g; # trailing whitespace $c = _EncodeCode($c); "<code>$c</code>"; @egsx; return $text; } sub _EncodeCode { # # Encode/escape certain characters inside Markdown code runs. # The point is that in code, these characters are literals, # and lose their special Markdown meanings. # local $_ = shift; # Encode all ampersands; HTML entities are not # entities within a Markdown code span. s/&/&amp;/g; # Encode $'s, but only if we're running under Blosxom. # (Blosxom interpolates Perl variables in article bodies.) { no warnings 'once'; if (defined($blosxom::version)) { s/\$/&#036;/g; } } # Do the angle bracket song and dance: s! < !&lt;!gx; s! > !&gt;!gx; # Now, escape characters that are magic in Markdown: s! \* !$g_escape_table{'*'}!gx; s! _ !$g_escape_table{'_'}!gx; s! ~ !$g_escape_table{'~'}!gx; s! { !$g_escape_table{'{'}!gx; s! } !$g_escape_table{'}'}!gx; s! \[ !$g_escape_table{'['}!gx; s! \] !$g_escape_table{']'}!gx; s! \\ !$g_escape_table{'\\'}!gx; return $_; } sub _DoItalicsAndBold { my $text = shift; # <strong> must go before <em> and <u>: $text =~ s{ (\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1 } {<strong>$2</strong>}gsx; $text =~ s{ (\*) (?=\S) (.+?) (?<=\S) \1 } {<em>$2</em>}gsx; $text =~ s{ (?<!\w) (_) (?=\S) (.+?) (?<=\S) \1 (?!\w) } {<u>$2</u>}gsx; $text =~ s{ (~~) (?=\S) (.+?) (?<=\S) \1 } {<s>$2</s>}gsx; return $text; } sub _DoBlockQuotes { my $text = shift; $text =~ s{ ( # Wrap whole match in $1 ( ^[ \t]*>[ \t]? # '>' at the start of a line .+\n # rest of the first line (.+\n)* # subsequent consecutive lines \n* # blanks )+ ) }{ my $bq = $1; $bq =~ s/^[ \t]*>[ \t]?//gm; # trim one level of quoting $bq =~ s/^[ \t]+$//mg; # trim whitespace-only lines $bq = _RunBlockGamut($bq); # recurse $bq =~ s/^/ /g; # These leading spaces screw with <pre> content, so we need to fix that: $bq =~ s{ (\s*<pre>.+?</pre>) }{ my $pre = $1; $pre =~ s/^ //mg; $pre; }egsx; "<blockquote>\n$bq\n</blockquote>\n\n"; }egmx; return $text; } sub _FormParagraphs { # # Params: # $text - string to process with html <p> tags # my $text = shift; # Strip leading and trailing lines: $text =~ s/\A\n+//; $text =~ s/\n+\z//; my @grafs = split(/\n{2,}/, $text); # # Wrap <p> tags. # foreach (@grafs) { unless (defined( $g_html_blocks{$_} )) { $_ = _RunSpanGamut($_); s/^([ \t]*)/<p>/; $_ .= "</p>"; } } # # Unhashify HTML blocks # foreach (@grafs) { if (defined( $g_html_blocks{$_} )) { $_ = $g_html_blocks{$_}; } } return join "\n\n", @grafs; } sub _EncodeAmpsAndAngles { # Smart processing for ampersands and angle brackets that need to be encoded. my $text = shift; # Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: # http://bumppo.net/projects/amputator/ $text =~ s/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/&amp;/g; # Encode naked <'s $text =~ s{<(?![a-z/?\$!])}{&lt;}gi; return $text; } sub _EncodeBackslashEscapes { # # Parameter: String. # Returns: The string, with after processing the following backslash # escape sequences. # local $_ = shift; s! \\\\ !$g_escape_table{'\\'}!gx; # Must process escaped backslashes first. s! \\` !$g_escape_table{'`'}!gx; s! \\\* !$g_escape_table{'*'}!gx; s! \\_ !$g_escape_table{'_'}!gx; s! \\~ !$g_escape_table{'~'}!gx; s! \\\{ !$g_escape_table{'{'}!gx; s! \\\} !$g_escape_table{'}'}!gx; s! \\\[ !$g_escape_table{'['}!gx; s! \\\] !$g_escape_table{']'}!gx; s! \\\( !$g_escape_table{'('}!gx; s! \\\) !$g_escape_table{')'}!gx; s! \\> !$g_escape_table{'>'}!gx; s! \\\# !$g_escape_table{'#'}!gx; s! \\\+ !$g_escape_table{'+'}!gx; s! \\\- !$g_escape_table{'-'}!gx; s! \\\. !$g_escape_table{'.'}!gx; s{ \\! }{$g_escape_table{'!'}}gx; return $_; } sub _DoAutoLinks { my $text = shift; $text =~ s{<((https?|ftp):[^'">\s]+)>}{<a href="$1">$1</a>}gi; # Email addresses: <address@domain.foo> $text =~ s{ < (?:mailto:)? ( [-.\w]+ \@ [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ ) > }{ _EncodeEmailAddress( _UnescapeSpecialChars($1) ); }egix; return $text; } sub _EncodeEmailAddress { # # Input: an email address, e.g. "foo@example.com" # # Output: the email address as a mailto link, with each character # of the address encoded as either a decimal or hex entity, in # the hopes of foiling most address harvesting spam bots. E.g.: # # <a href="&#x6D;&#97;&#105;&#108;&#x74;&#111;:&#102;&#111;&#111;&#64;&#101; # x&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;&#111;&#109;">&#102;&#111;&#111; # &#64;&#101;x&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;&#111;&#109;</a> # # Based on a filter by Matthew Wickline, posted to the BBEdit-Talk # mailing list: <http://tinyurl.com/yu7ue> # my $addr = shift; srand; my @encode = ( sub { '&#' . ord(shift) . ';' }, sub { '&#x' . sprintf( "%X", ord(shift) ) . ';' }, sub { shift }, ); $addr = "mailto:" . $addr; $addr =~ s{(.)}{ my $char = $1; if ( $char eq '@' ) { # this *must* be encoded. I insist. $char = $encode[int rand 1]->($char); } elsif ( $char ne ':' ) { # leave ':' alone (to spot mailto: later) my $r = rand; # roughly 10% raw, 45% hex, 45% dec $char = ( $r > .9 ? $encode[2]->($char) : $r < .45 ? $encode[1]->($char) : $encode[0]->($char) ); } $char; }gex; $addr = qq{<a href="$addr">$addr</a>}; $addr =~ s{">.+?:}{">}; # strip the mailto: from the visible part return $addr; } sub _UnescapeSpecialChars { # # Swap back in all the special characters we've hidden. # my $text = shift; while( my($char, $hash) = each(%g_escape_table) ) { $text =~ s/$hash/$char/g; } return $text; } sub _TokenizeHTML { # # Parameter: String containing HTML markup. # Returns: Reference to an array of the tokens comprising the input # string. Each token is either a tag (possibly with nested, # tags contained therein, such as <a href="<MTFoo>">, or a # run of text between tags. Each element of the array is a # two-element array; the first is either 'tag' or 'text'; # the second is the actual value. # # # Derived from the _tokenize() subroutine from Brad Choate's MTRegex plugin. # <http://www.bradchoate.com/past/mtregex.php> # my $str = shift; my $pos = 0; my $len = length $str; my @tokens; my $depth = 6; my $nested_tags = join('|', ('(?:<[a-z/!$](?:[^<>]') x $depth) . (')*>)' x $depth); my $match = qr/(?s: <! ( -- .*? -- \s* )+ > ) | # comment (?s: <\? .*? \?> ) | # processing instruction $nested_tags/ix; # nested tags while ($str =~ m/($match)/g) { my $whole_tag = $1; my $sec_start = pos $str; my $tag_start = $sec_start - length $whole_tag; if ($pos < $tag_start) { push @tokens, ['text', substr($str, $pos, $tag_start - $pos)]; } push @tokens, ['tag', $whole_tag]; $pos = pos $str; } push @tokens, ['text', substr($str, $pos, $len - $pos)] if $pos < $len; \@tokens; } sub _Outdent { # # Remove one level of line-leading tabs or spaces # my $text = shift; $text =~ s/^(\t|[ ]{1,$g_tab_width})//gm; return $text; } sub _Detab { # # Cribbed from a post by Bart Lateur: # <http://www.nntp.perl.org/group/perl.macperl.anyperl/154> # my $text = shift; $text =~ s{(.*?)\t}{$1.(' ' x ($g_tab_width - length($1) % $g_tab_width))}ge; return $text; } 1; __END__ =pod =head1 NAME B<Markdown> =head1 SYNOPSIS B<Markdown.pl> [ B<--html4tags> ] [ B<--version> ] [ B<-shortversion> ] [ I<file> ... ] =head1 DESCRIPTION Markdown is a text-to-HTML filter; it translates an easy-to-read / easy-to-write structured text format into HTML. Markdown's text format is most similar to that of plain text email, and supports features such as headers, *emphasis*, code blocks, blockquotes, and links. Markdown's syntax is designed not as a generic markup language, but specifically to serve as a front-end to (X)HTML. You can use span-level HTML tags anywhere in a Markdown document, and you can use block level HTML tags (like <div> and <table> as well). For more information about Markdown's syntax, see: http://daringfireball.net/projects/markdown/ and: https://github.com/vmg/redcarpet =head1 OPTIONS Use "--" to end switch parsing. For example, to open a file named "-z", use: Markdown.pl -- -z =over 4 =item B<--html4tags> Use HTML 4 style for empty element tags, e.g.: <br> instead of Markdown's default XHTML style tags, e.g.: <br /> =item B<-v>, B<--version> Display Markdown's version number and copyright information. =item B<-s>, B<--shortversion> Display the short-form version number. =back =head1 BUGS To file bug reports or feature requests (other than topics listed in the Caveats section above) please use the issue tracker at: https://github.com/phluid61/mmdc/issues Please include with your report: (1) the example input; (2) the output you expected; (3) the output Markdown actually produced. =head1 VERSION HISTORY See the readme file for detailed release notes for this version. 1.1.1 - 21 Oct 2013 1.1 - 24 Sep 2013 1.0.1 - 14 Dec 2004 1.0 - 28 Aug 2004 =head1 AUTHOR Matthew Kerwin http://matthew.kerwin.net.au/ John Gruber http://daringfireball.net PHP port and other contributions by Michel Fortin http://michelf.com =head1 COPYRIGHT AND LICENSE Copyright (c) 2013 Matthew Kerwin <http://matthew.kerwin.net.au/> All rights reserved. Copyright (c) 2003-2004 John Gruber <http://daringfireball.net/> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name "Markdown" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. =cut
phluid61/mmdc
Markdown.pl
Perl
bsd-3-clause
36,645
#! /usr/bin/env perl # Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy # in the file LICENSE in the source distribution or at # https://www.openssl.org/source/license.html # # ==================================================================== # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL # project. The module is, however, dual licensed under OpenSSL and # CRYPTOGAMS licenses depending on where you obtain it. For further # details see http://www.openssl.org/~appro/cryptogams/. # ==================================================================== # # GHASH for ARMv8 Crypto Extension, 64-bit polynomial multiplication. # # June 2014 # Initial version was developed in tight cooperation with Ard Biesheuvel # of Linaro from bits-n-pieces from other assembly modules. Just like # aesv8-armx.pl this module supports both AArch32 and AArch64 execution modes. # # July 2014 # Implement 2x aggregated reduction [see ghash-x86.pl for background # information]. # # Current performance in cycles per processed byte: # # PMULL[2] 32-bit NEON(*) # Apple A7 0.92 5.62 # Cortex-A53 1.01 8.39 # Cortex-A57 1.17 7.61 # Denver 0.71 6.02 # Mongoose 1.10 8.06 # Kryo 1.16 8.00 # # (*) presented for reference/comparison purposes; $flavour = shift; $output = shift; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}../../../perlasm/arm-xlate.pl" and -f $xlate) or die "can't locate arm-xlate.pl"; open OUT,"| \"$^X\" $xlate $flavour $output"; *STDOUT=*OUT; $Xi="x0"; # argument block $Htbl="x1"; $inp="x2"; $len="x3"; $inc="x12"; { my ($Xl,$Xm,$Xh,$IN)=map("q$_",(0..3)); my ($t0,$t1,$t2,$xC2,$H,$Hhl,$H2)=map("q$_",(8..14)); $code=<<___; #include <openssl/arm_arch.h> .text ___ $code.=".arch armv8-a+crypto\n" if ($flavour =~ /64/); $code.=<<___ if ($flavour !~ /64/); .fpu neon .code 32 #undef __thumb2__ ___ ################################################################################ # void gcm_init_v8(u128 Htable[16],const u64 H[2]); # # input: 128-bit H - secret parameter E(K,0^128) # output: precomputed table filled with degrees of twisted H; # H is twisted to handle reverse bitness of GHASH; # only few of 16 slots of Htable[16] are used; # data is opaque to outside world (which allows to # optimize the code independently); # $code.=<<___; .global gcm_init_v8 .type gcm_init_v8,%function .align 4 gcm_init_v8: vld1.64 {$t1},[x1] @ load input H vmov.i8 $xC2,#0xe1 vshl.i64 $xC2,$xC2,#57 @ 0xc2.0 vext.8 $IN,$t1,$t1,#8 vshr.u64 $t2,$xC2,#63 vdup.32 $t1,${t1}[1] vext.8 $t0,$t2,$xC2,#8 @ t0=0xc2....01 vshr.u64 $t2,$IN,#63 vshr.s32 $t1,$t1,#31 @ broadcast carry bit vand $t2,$t2,$t0 vshl.i64 $IN,$IN,#1 vext.8 $t2,$t2,$t2,#8 vand $t0,$t0,$t1 vorr $IN,$IN,$t2 @ H<<<=1 veor $H,$IN,$t0 @ twisted H vst1.64 {$H},[x0],#16 @ store Htable[0] @ calculate H^2 vext.8 $t0,$H,$H,#8 @ Karatsuba pre-processing vpmull.p64 $Xl,$H,$H veor $t0,$t0,$H vpmull2.p64 $Xh,$H,$H vpmull.p64 $Xm,$t0,$t0 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing veor $t2,$Xl,$Xh veor $Xm,$Xm,$t1 veor $Xm,$Xm,$t2 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl veor $Xl,$Xm,$t2 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase vpmull.p64 $Xl,$Xl,$xC2 veor $t2,$t2,$Xh veor $H2,$Xl,$t2 vext.8 $t1,$H2,$H2,#8 @ Karatsuba pre-processing veor $t1,$t1,$H2 vext.8 $Hhl,$t0,$t1,#8 @ pack Karatsuba pre-processed vst1.64 {$Hhl-$H2},[x0] @ store Htable[1..2] ret .size gcm_init_v8,.-gcm_init_v8 ___ ################################################################################ # void gcm_gmult_v8(u64 Xi[2],const u128 Htable[16]); # # input: Xi - current hash value; # Htable - table precomputed in gcm_init_v8; # output: Xi - next hash value Xi; # $code.=<<___; .global gcm_gmult_v8 .type gcm_gmult_v8,%function .align 4 gcm_gmult_v8: vld1.64 {$t1},[$Xi] @ load Xi vmov.i8 $xC2,#0xe1 vld1.64 {$H-$Hhl},[$Htbl] @ load twisted H, ... vshl.u64 $xC2,$xC2,#57 #ifndef __ARMEB__ vrev64.8 $t1,$t1 #endif vext.8 $IN,$t1,$t1,#8 vpmull.p64 $Xl,$H,$IN @ H.lo·Xi.lo veor $t1,$t1,$IN @ Karatsuba pre-processing vpmull2.p64 $Xh,$H,$IN @ H.hi·Xi.hi vpmull.p64 $Xm,$Hhl,$t1 @ (H.lo+H.hi)·(Xi.lo+Xi.hi) vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing veor $t2,$Xl,$Xh veor $Xm,$Xm,$t1 veor $Xm,$Xm,$t2 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl veor $Xl,$Xm,$t2 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction vpmull.p64 $Xl,$Xl,$xC2 veor $t2,$t2,$Xh veor $Xl,$Xl,$t2 #ifndef __ARMEB__ vrev64.8 $Xl,$Xl #endif vext.8 $Xl,$Xl,$Xl,#8 vst1.64 {$Xl},[$Xi] @ write out Xi ret .size gcm_gmult_v8,.-gcm_gmult_v8 ___ ################################################################################ # void gcm_ghash_v8(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len); # # input: table precomputed in gcm_init_v8; # current hash value Xi; # pointer to input data; # length of input data in bytes, but divisible by block size; # output: next hash value Xi; # $code.=<<___; .global gcm_ghash_v8 .type gcm_ghash_v8,%function .align 4 gcm_ghash_v8: ___ $code.=<<___ if ($flavour !~ /64/); vstmdb sp!,{d8-d15} @ 32-bit ABI says so ___ $code.=<<___; vld1.64 {$Xl},[$Xi] @ load [rotated] Xi @ "[rotated]" means that @ loaded value would have @ to be rotated in order to @ make it appear as in @ algorithm specification subs $len,$len,#32 @ see if $len is 32 or larger mov $inc,#16 @ $inc is used as post- @ increment for input pointer; @ as loop is modulo-scheduled @ $inc is zeroed just in time @ to preclude overstepping @ inp[len], which means that @ last block[s] are actually @ loaded twice, but last @ copy is not processed vld1.64 {$H-$Hhl},[$Htbl],#32 @ load twisted H, ..., H^2 vmov.i8 $xC2,#0xe1 vld1.64 {$H2},[$Htbl] cclr $inc,eq @ is it time to zero $inc? vext.8 $Xl,$Xl,$Xl,#8 @ rotate Xi vld1.64 {$t0},[$inp],#16 @ load [rotated] I[0] vshl.u64 $xC2,$xC2,#57 @ compose 0xc2.0 constant #ifndef __ARMEB__ vrev64.8 $t0,$t0 vrev64.8 $Xl,$Xl #endif vext.8 $IN,$t0,$t0,#8 @ rotate I[0] b.lo .Lodd_tail_v8 @ $len was less than 32 ___ { my ($Xln,$Xmn,$Xhn,$In) = map("q$_",(4..7)); ####### # Xi+2 =[H*(Ii+1 + Xi+1)] mod P = # [(H*Ii+1) + (H*Xi+1)] mod P = # [(H*Ii+1) + H^2*(Ii+Xi)] mod P # $code.=<<___; vld1.64 {$t1},[$inp],$inc @ load [rotated] I[1] #ifndef __ARMEB__ vrev64.8 $t1,$t1 #endif vext.8 $In,$t1,$t1,#8 veor $IN,$IN,$Xl @ I[i]^=Xi vpmull.p64 $Xln,$H,$In @ H·Ii+1 veor $t1,$t1,$In @ Karatsuba pre-processing vpmull2.p64 $Xhn,$H,$In b .Loop_mod2x_v8 .align 4 .Loop_mod2x_v8: vext.8 $t2,$IN,$IN,#8 subs $len,$len,#32 @ is there more data? vpmull.p64 $Xl,$H2,$IN @ H^2.lo·Xi.lo cclr $inc,lo @ is it time to zero $inc? vpmull.p64 $Xmn,$Hhl,$t1 veor $t2,$t2,$IN @ Karatsuba pre-processing vpmull2.p64 $Xh,$H2,$IN @ H^2.hi·Xi.hi veor $Xl,$Xl,$Xln @ accumulate vpmull2.p64 $Xm,$Hhl,$t2 @ (H^2.lo+H^2.hi)·(Xi.lo+Xi.hi) vld1.64 {$t0},[$inp],$inc @ load [rotated] I[i+2] veor $Xh,$Xh,$Xhn cclr $inc,eq @ is it time to zero $inc? veor $Xm,$Xm,$Xmn vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing veor $t2,$Xl,$Xh veor $Xm,$Xm,$t1 vld1.64 {$t1},[$inp],$inc @ load [rotated] I[i+3] #ifndef __ARMEB__ vrev64.8 $t0,$t0 #endif veor $Xm,$Xm,$t2 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction #ifndef __ARMEB__ vrev64.8 $t1,$t1 #endif vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl vext.8 $In,$t1,$t1,#8 vext.8 $IN,$t0,$t0,#8 veor $Xl,$Xm,$t2 vpmull.p64 $Xln,$H,$In @ H·Ii+1 veor $IN,$IN,$Xh @ accumulate $IN early vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction vpmull.p64 $Xl,$Xl,$xC2 veor $IN,$IN,$t2 veor $t1,$t1,$In @ Karatsuba pre-processing veor $IN,$IN,$Xl vpmull2.p64 $Xhn,$H,$In b.hs .Loop_mod2x_v8 @ there was at least 32 more bytes veor $Xh,$Xh,$t2 vext.8 $IN,$t0,$t0,#8 @ re-construct $IN adds $len,$len,#32 @ re-construct $len veor $Xl,$Xl,$Xh @ re-construct $Xl b.eq .Ldone_v8 @ is $len zero? ___ } $code.=<<___; .Lodd_tail_v8: vext.8 $t2,$Xl,$Xl,#8 veor $IN,$IN,$Xl @ inp^=Xi veor $t1,$t0,$t2 @ $t1 is rotated inp^Xi vpmull.p64 $Xl,$H,$IN @ H.lo·Xi.lo veor $t1,$t1,$IN @ Karatsuba pre-processing vpmull2.p64 $Xh,$H,$IN @ H.hi·Xi.hi vpmull.p64 $Xm,$Hhl,$t1 @ (H.lo+H.hi)·(Xi.lo+Xi.hi) vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing veor $t2,$Xl,$Xh veor $Xm,$Xm,$t1 veor $Xm,$Xm,$t2 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl veor $Xl,$Xm,$t2 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction vpmull.p64 $Xl,$Xl,$xC2 veor $t2,$t2,$Xh veor $Xl,$Xl,$t2 .Ldone_v8: #ifndef __ARMEB__ vrev64.8 $Xl,$Xl #endif vext.8 $Xl,$Xl,$Xl,#8 vst1.64 {$Xl},[$Xi] @ write out Xi ___ $code.=<<___ if ($flavour !~ /64/); vldmia sp!,{d8-d15} @ 32-bit ABI says so ___ $code.=<<___; ret .size gcm_ghash_v8,.-gcm_ghash_v8 ___ } $code.=<<___; .asciz "GHASH for ARMv8, CRYPTOGAMS by <appro\@openssl.org>" .align 2 ___ if ($flavour =~ /64/) { ######## 64-bit code sub unvmov { my $arg=shift; $arg =~ m/q([0-9]+)#(lo|hi),\s*q([0-9]+)#(lo|hi)/o && sprintf "ins v%d.d[%d],v%d.d[%d]",$1,($2 eq "lo")?0:1,$3,($4 eq "lo")?0:1; } foreach(split("\n",$code)) { s/cclr\s+([wx])([^,]+),\s*([a-z]+)/csel $1$2,$1zr,$1$2,$3/o or s/vmov\.i8/movi/o or # fix up legacy mnemonics s/vmov\s+(.*)/unvmov($1)/geo or s/vext\.8/ext/o or s/vshr\.s/sshr\.s/o or s/vshr/ushr/o or s/^(\s+)v/$1/o or # strip off v prefix s/\bbx\s+lr\b/ret/o; s/\bq([0-9]+)\b/"v".($1<8?$1:$1+8).".16b"/geo; # old->new registers s/@\s/\/\//o; # old->new style commentary # fix up remaining legacy suffixes s/\.[ui]?8(\s)/$1/o; s/\.[uis]?32//o and s/\.16b/\.4s/go; m/\.p64/o and s/\.16b/\.1q/o; # 1st pmull argument m/l\.p64/o and s/\.16b/\.1d/go; # 2nd and 3rd pmull arguments s/\.[uisp]?64//o and s/\.16b/\.2d/go; s/\.[42]([sd])\[([0-3])\]/\.$1\[$2\]/o; print $_,"\n"; } } else { ######## 32-bit code sub unvdup32 { my $arg=shift; $arg =~ m/q([0-9]+),\s*q([0-9]+)\[([0-3])\]/o && sprintf "vdup.32 q%d,d%d[%d]",$1,2*$2+($3>>1),$3&1; } sub unvpmullp64 { my ($mnemonic,$arg)=@_; if ($arg =~ m/q([0-9]+),\s*q([0-9]+),\s*q([0-9]+)/o) { my $word = 0xf2a00e00|(($1&7)<<13)|(($1&8)<<19) |(($2&7)<<17)|(($2&8)<<4) |(($3&7)<<1) |(($3&8)<<2); $word |= 0x00010001 if ($mnemonic =~ "2"); # since ARMv7 instructions are always encoded little-endian. # correct solution is to use .inst directive, but older # assemblers don't implement it:-( sprintf ".byte\t0x%02x,0x%02x,0x%02x,0x%02x\t@ %s %s", $word&0xff,($word>>8)&0xff, ($word>>16)&0xff,($word>>24)&0xff, $mnemonic,$arg; } } foreach(split("\n",$code)) { s/\b[wx]([0-9]+)\b/r$1/go; # new->old registers s/\bv([0-9])\.[12468]+[bsd]\b/q$1/go; # new->old registers s/\/\/\s?/@ /o; # new->old style commentary # fix up remaining new-style suffixes s/\],#[0-9]+/]!/o; s/cclr\s+([^,]+),\s*([a-z]+)/mov$2 $1,#0/o or s/vdup\.32\s+(.*)/unvdup32($1)/geo or s/v?(pmull2?)\.p64\s+(.*)/unvpmullp64($1,$2)/geo or s/\bq([0-9]+)#(lo|hi)/sprintf "d%d",2*$1+($2 eq "hi")/geo or s/^(\s+)b\./$1b/o or s/^(\s+)ret/$1bx\tlr/o; print $_,"\n"; } } close STDOUT; # enforce flush
youtube/cobalt
third_party/boringssl/src/crypto/fipsmodule/modes/asm/ghashv8-armx.pl
Perl
bsd-3-clause
11,861
#!/usr/bin/perl # # Copyright © 2013 University of Wisconsin-La Crosse. # All rights reserved. # # See COPYING in top-level directory. # # $HEADER$ # use strict; use warnings; use Getopt::Long; use JSON; use lib "@bindir@"; use Perl_IB_support; main(@ARGV); ######################################################################## #### Public Functions #### ######################################################################## sub main { my $infile_arg; my $subnet_id_arg; my $outfile_arg; &Getopt::Long::Configure("bundling"); my $ok = Getopt::Long::GetOptions( "infile|i=s" => \$infile_arg, "subnet|s=s" => \$subnet_id_arg, "outfile|o=s" => \$outfile_arg ); if( !$ok ) { print "Error: Must Specify --infile|-i, --subnet|-s, and --outfile|-o\n"; exit(1); } elsif( !defined($infile_arg) || length($infile_arg) <= 0 ) { print "Error: Must specify an input file (ibnetdiscover data)\n"; exit(1); } elsif( !defined($subnet_id_arg) || length($subnet_id_arg) <= 0 ) { print "Error: Must specify a subnet string\n"; exit(1); } elsif( !defined($outfile_arg) || length($outfile_arg) <= 0 ) { print "Error: Must specify an output filename\n"; exit(1); } _parse_network_topology($infile_arg, $subnet_id_arg, $outfile_arg); } ######################################################################## #### Private Functions #### ######################################################################## sub _parse_network_topology { my $file_name = shift(@_); my $subnet_id = shift(@_); my $outfile = shift(@_); my (%nodes); #print "Reading file $file_name, subnet ID $subnet_id\n"; # # Open the file # die "Error: Can't read $file_name" unless(-r $file_name); open(my $input_fh, "<", $file_name) or die "Error: Failed to open $file_name\n"; # # Process the file # while(<$input_fh>) { # # Don't need lines beginning with "DR" or artificially inserted # comments # if(/^DR / || /^\#/) { next; } # # Split out the columns. One form of line has both source and # destination information. The other form only has source # information (because it's not hooked up to anything -- # usually a switch port that doesn't have anything plugged in). # chomp; my $line = $_; my ($have_peer, $src_type, $src_lid, $src_port_id, $src_guid, $width, $speed, $dest_type, $dest_lid, $dest_port_id, $dest_guid, $edge_desc, $src_desc, $dest_desc); # # Search for lines that look like: # SW 32 2 0x0005ad00070423f6 4x SDR - CA 63 2 0x0005adffff0856b6 ( 'Desc. of src' - 'Desc. of dest.' ) # if ($line !~ m/ (CA|SW) \s+ # Source type (\d+) \s+ # Source lid (\d+) \s+ # Source port id (0x[0-9a-f]{16}) \s+ # Source guid (\d+x) \s (.{3}) \s+ # Connection width, speed - \s+ # Dash seperator (CA|SW) \s+ # Dest type (\d+) \s+ # Dest lid (\d+) \s+ # Dest port id (0x[0-9a-f]{16}) \s+ # Dest guid ([\w|\W]+) # Rest of the line is the description /x) { # # This is a port that is not connected to anything (no peer information) # # JJH: We do not need this data, so ignore it for now. # next; $have_peer = 0; $line =~ m/(CA|SW)\s+(\d+)\s+(\d+)\s+(0x[0-9a-f]{16})\s+(\d+x)\s(.{3})/; ($src_type, $src_lid, $src_port_id, $src_guid, $width, $speed) = ($1, $2, $3, $4, $5, $6); } # # Parse the lines that have both a src and dest (active ports) # else { $have_peer = 1; ($src_type, $src_lid, $src_port_id, $src_guid, $width, $speed, $dest_type, $dest_lid, $dest_port_id, $dest_guid) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10); # Break up the description $edge_desc = $11; $edge_desc =~ s/^\s*\(\s*//; $edge_desc =~ s/\s*\)\s*$//; my @desc_vs = split(" - ", $edge_desc); if( scalar(@desc_vs) == 2 ) { $src_desc = $desc_vs[0]; $dest_desc = $desc_vs[1]; } else { $src_desc = ""; $dest_desc = ""; } } # # Get the source node # my $src_node; $src_node = _enter_node(\%nodes, $src_type, $src_lid, $src_guid, $subnet_id, $src_desc); # # If we have a destination node, get it and link the source to # the destination # if($have_peer) { # # Get destination node # my $dest_node; $dest_node = _enter_node(\%nodes, $dest_type, $dest_lid, $dest_guid, $subnet_id, $dest_desc); # # Add this connection to the list of edges # push(@{$src_node->connections->{phy_id_normalizer($dest_guid)}}, new Edge( port_from => $src_node->phy_id, port_id_from => $src_port_id, port_type_from => $src_type, width => $width, speed => $speed, port_to => $dest_node->phy_id, port_id_to => $dest_port_id, port_type_to => $dest_type, description => $edge_desc ) ); } } # # Write data to the file # open(my $fh_s, ">", $outfile) or die "Error: Failed to open $outfile\n"; print $fh_s to_json( \%nodes, {allow_blessed=>1,convert_blessed=>1} ); close($fh_s); } ######################################################################## # # Access a node, or add it if has not been seen before # sub _enter_node { my $nodes_hash_ref = shift(@_); my $type = shift(@_); my $log_id = shift(@_); my $phy_id = shift(@_); my $subnet_id = shift(@_); my $desc = shift(@_); my $node; # If the port didn't already exist, create and add it unless(exists($nodes_hash_ref->{phy_id_normalizer($phy_id)})) { $node = new Node; $node->type($type); $node->log_id($log_id); $node->phy_id(phy_id_normalizer($phy_id)); $node->subnet_id($subnet_id); $node->network_type("IB"); $node->description($desc); $nodes_hash_ref->{phy_id_normalizer($phy_id)} = $node; } # Otherwise, fetch it else { $node = $nodes_hash_ref->{phy_id_normalizer($phy_id)}; } return $node; } ########################################################################
shekkbuilder/hwloc
utils/netloc_reader_ib/netloc_reader_ib_backend_general.pl
Perl
bsd-3-clause
7,477
#ExStart:1 use lib 'lib'; use strict; use warnings; use utf8; use File::Slurp; # From CPAN use JSON; use AsposeStorageCloud::StorageApi; use AsposeStorageCloud::ApiClient; use AsposeStorageCloud::Configuration; use AsposePdfCloud::PdfApi; use AsposePdfCloud::ApiClient; use AsposePdfCloud::Configuration; my $configFile = '../config/config.json'; my $configPropsText = read_file($configFile); my $configProps = decode_json($configPropsText); my $data_path = '../../../Data/'; my $out_path = $configProps->{'out_folder'}; $AsposePdfCloud::Configuration::app_sid = $configProps->{'app_sid'}; $AsposePdfCloud::Configuration::api_key = $configProps->{'api_key'}; $AsposePdfCloud::Configuration::debug = 1; $AsposeStorageCloud::Configuration::app_sid = $configProps->{'app_sid'}; $AsposeStorageCloud::Configuration::api_key = $configProps->{'api_key'}; # Instantiate Aspose.Storage and Aspose.Pdf API SDK my $storageApi = AsposeStorageCloud::StorageApi->new(); my $pdfApi = AsposePdfCloud::PdfApi->new(); # Set input file name my $name = 'SampleAttachment.pdf'; my $attachmentIndex = 1; # Upload file to aspose cloud storage my $response = $storageApi->PutCreate(Path => $name, file => $data_path.$name); # Invoke Aspose.Pdf Cloud SDK API to get a specific attachment from a PDF $response = $pdfApi->GetDocumentAttachmentByIndex(name=>$name, attachmentIndex=>$attachmentIndex); if($response->{'Status'} eq 'OK'){ my $attach = $response->{'Attachment'}; print("\n Name :: " . $attach->{'Name'}); print("\n MimeType :: " . $attach->{'MimeType'}); } #ExEnd:1
asposepdf/Aspose_Pdf_Cloud
Examples/Perl/Attachments/GetSpecificAttachment.pl
Perl
mit
1,590
/* Part of XPCE --- The SWI-Prolog GUI toolkit Author: Jan Wielemaker and Anjo Anjewierden E-mail: jan@swi.psy.uva.nl WWW: http://www.swi.psy.uva.nl/projects/xpce/ Copyright (c) 2000-2011, University of Amsterdam All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ :- module(doc_table, []). :- use_module(library(pce)). :- use_module(doc(util)). /******************************* * TABLE * *******************************/ :- pce_begin_class(doc_table, figure, "Format a table/tabular environment"). variable(line_width, int*, get, "Table computed for this width"). variable(adjusted_for_width, int*, get, "Table is adjusted for this width"). variable(natural_width, int*, get, "Width I would like to have"). variable(def_alignment, {left,center,right} := left, both, "Default cell alignment"). initialise(T, Options:prolog) :-> send_super(T, initialise), send(T, layout_manager, new(Table, doc_table_manager)), send(Table, border, 0), send(Table, frame, void), send(Table, rules, none), apply_options(Options, table_option, T). make_cell(T, Options:prolog, PB:parbox) :<- "Add a new cell":: get(T, layout_manager, Table), ( get(Table, current, point(X, _Y)), get(Table, column, X, Col), get(Col, attribute, fixed_width, Width), option(colspan(Span), Options, 1), Span == 1 -> debug(table, 'Fixed width (~w) cell. Span: ~q~n', [Width, Span]), new(PB, pbox(Width, left)) ; new(PB, pbox(1000, left)), send(PB, auto_crop, @on) ), new(Cell, table_cell(PB)), send(Cell, halign, stretch), ( select(align=Align, Options, Options1) -> ( Align == char -> print_message(warning, doc(ignored_attribute(td, align=char))) ; send(PB, alignment, Align) ) ; get(T, def_alignment, Align), send(PB, alignment, Align), Options1 = Options ), send(Table, append, Cell), apply_options(Options1, cell_option, Cell). next_row(T, Options:prolog) :-> "Move to the next row":: get(T, layout_manager, Table), ( get(Table, current, point(1, _)) -> true % is at start of row ; send(T?layout_manager, next_row) ), ( Options == [] -> true ; get(Table, current, point(_, Y)), get(Table, row, Y, @on, Row), apply_options(Options, row_option, Row) ). compute_cell_rubber(_T, PB:parbox) :-> "Compute ->hrubber or table_cell":: get(PB, layout_interface, Cell), cell_padding(Cell, CP), get(PB, width, NW0), % TBD: <-natural_width? get(PB, minimum_width, MW0), NW is NW0+2*CP, MW is MW0+2*CP, Shrink is (NW-MW)**2, Stretch is NW, new(R, rubber(1, Stretch, Shrink)), send(R, natural, NW), send(R, minimum, MW), send(Cell, hrubber, R), debug(table, print_rubber(Cell, hrubber)). :- pce_group(attributes). frame(T, Frame:name) :-> send(T?layout_manager, frame, Frame). rules(T, Rules:name) :-> send(T?layout_manager, rules, Rules). border(T, Border:'0..') :-> get(T, layout_manager, Table), send(Table, border, Border), ( Border > 0 -> send(Table, rules, all), get(Table, cell_padding, size(W, H)), PW is max(W, Border//2+5), PH is max(H, Border//2+2), send(Table, cell_padding, size(PW, PH)) ; true ). specify_table_width(T, Width:name) :-> % from HTML spec table_width(Width, CW), ( CW = percent(Rel) -> send(T, attribute, relative_width, Rel) ; send(T, attribute, fixed_width, CW) ). col_spec(T, Options:prolog) :-> "Set attributes for the next column(s)":: get(T, layout_manager, Table), get(Table?columns, high_index, HI), Start is HI+1, option(span(Span), Options, 1), End is Start+Span-1, ( between(Start, End, ColN), get(Table, column, ColN, @on, Col), set_col_options(Col, Options), fail ; true ). set_col_options(Col, Options) :- ( option(width(Width), Options), column_width(Width, CW) -> ( CW = *(Rel) -> send(Col, attribute, relative_width, Rel) ; ( get(Col, attribute, fixed_width, CW0) -> CW1 is max(CW0, CW) ; CW1 = CW ), send(Col, attribute, fixed_width, CW1) ) ). set_col_options(Col, Options) :- ( option(align(Align), Options) -> send(Col, halign, Align) ). set_col_options(Col, Options) :- ( option(bgcolor(Colour), Options) -> catch(new(C, colour(Colour)), _, fail), send(Col, background, C) ). row_group(T, _Options:prolog) :-> "Start a new row group using options":: get(T, layout_manager, Table), get(Table, current, point(_, Y)), ( get(Table, row, Y, Row) -> send(Row, end_group, @on) ; true ). table_option(width(W), T) :- send(T, specify_table_width, W). table_option(align(_), _). table_option(bgcolor(Colour), O) :- catch(new(C, colour(Colour)), _, fail), send(O, background, C). table_option(cellpadding(X), T) :- send(T?layout_manager, cell_padding, X). table_option(cellspacing(X), T) :- send(T?layout_manager, cell_spacing, X). cell_option(colspan(X), Cell) :- send(Cell, col_span, X). cell_option(rowspan(X), Cell) :- send(Cell, row_span, X). cell_option(cellpadding(X), Cell) :- send(Cell, cell_padding, X). cell_option(valign(HTML), Cell) :- valign(HTML, L), send(Cell, valign, L). cell_option(align(X), Cell) :- send(Cell, halign, X). cell_option(bgcolor(C), Cell) :- send(Cell, background, colour(C)). cell_option(background(_), Cell) :- debug(table, 'Ignoring background for ~p~n', [Cell]). cell_option(width(W), Cell) :- get(Cell, column, ColN), get(Cell, table, Table), get(Table, column, ColN, @on, Col), set_col_options(Col, [width(W)]). valign(middle, center) :- !. valign(baseline, bottom) :- !. % for now valign(X, X). % row_option/2 % % Incomplete handling of options on table-rows row_option(bgcolor(Colour), O) :- catch(new(C, colour(Colour)), _, fail), send(O, background, C). /******************************* * GEOMETRY HANDLING * *******************************/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Table geometry handling is all about managing the width of the table. There are three types of columns: * Unspecified width * Pixel-size specified width * Relative width Resolving the column width distribution, we will: * Walk along the columns, setting the parbox at that cell to + The correct with on relative-width columns + Infinite (autocropping) on unspecified columns * Compute the columns * See how much should be changed * Distribute the pain, increasingly on the wider columns - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ :- pce_group(geometry). container_size_changed(T, W:[int], _H:[int]) :-> ( get(T, natural_width, NW), integer(NW), % we have had ->compute_dimensions W \== @default, \+ get(T, line_width, W) -> send(T, slot, line_width, W), get(T, layout_manager, Table), ( get(T, attribute, fixed_width, FW) -> NewW is min(W, FW), send(Table, width, NewW) ; get(T, attribute, relative_width, RW) -> NewW is (W*RW)//100, send(Table, width, NewW) ; ( NW > W -> send(Table, width, W) ; send(Table, width, @default) ) ) ; true ). compute_dimensions(T) :-> "(re)compute the column-width specification":: get(T, width, NW), send(T, slot, natural_width, NW), get(T, layout_manager, Table), get(Table, column_range, tuple(L, H)), get(Table, row_range, tuple(RL, RH)), compute_columns(L, H, RL, RH, Table). compute_columns(N, H, RL, RH, Table) :- N =< H, !, NN is N + 1, get(Table, column, N, C), compute_column(C, RL, RH), compute_columns(NN, H, RL, RH, Table). compute_columns(_, _, _, _, _). compute_column(C, _, _) :- get(C, attribute, fixed_width, W), !, get(C, index, ColN), debug(table, 'Col ~w: fixed width = ~w~n', [ColN, W]), new(R, rubber(1, 10, 10)), send(R, natural, W), send(C, rubber, R). compute_column(C, _, _) :- get(C, attribute, relative_width, W), !, get(C, index, ColN), debug(table, 'Col ~w: Relative width = *~w~n', [ColN, W]), Stretch is 100*W, % ??? new(R, rubber(1, Stretch, 0)), send(R, shrink, 0), send(R, stretch, Stretch), send(R, natural, 0), send(C, rubber, R). compute_column(C, _L, _H) :- send(C, rubber, @default), % make column compute rubber debug(table, print_rubber(C, rubber)). :- pce_end_class. /******************************* * LAYOUT MANAGER * *******************************/ :- pce_begin_class(doc_table_manager, table, "Table for the document rendering system"). stretched_column(T, Col:table_column, W:int) :-> "Column has been stretched to specified width":: get(Col, index, I), debug(table, 'Stretching column ~w to width = ~w~n', [I, W]), send(Col, for_all, message(T, stretched_cell, @arg1, W)), send_super(T, stretched_column, Col, W). stretched_cell(T, Cell:table_cell, W:int) :-> ( get(Cell, col_span, 1) -> image_width(Cell, W, IW), get(Cell, image, Image), get(Cell, row, R), get(Cell, column, C), debug(table, '~p: Cell ~w,~w to width = ~w~n', [T, C, R, IW]), send(Image, auto_crop, @off), send(Image, line_width, IW) ; true ). image_width(Cell, W, IW) :- cell_padding(Cell, CP), IW is max(0, W - 2*CP). cell_padding(Cell, CP) :- ( get(Cell, cell_padding, Size), Size \== @default -> true ; get(Cell?table, cell_padding, Size) ), get(Size, width, CP). :- pce_end_class. /******************************* * DEBUG * *******************************/ print_rubber(Cell, Sel) :- send(Cell, instance_of, table_cell), !, get(Cell, column, Col), get(Cell, row, Row), get(Cell, Sel, Rubber), format('Cell at ~w,~w: ', [Col, Row]), print_rubber(Rubber). print_rubber(Col, Sel) :- send(Col, instance_of, table_column), !, get(Col, index, ColN), get(Col, Sel, Rubber), format('Col ~w: ', [ColN]), print_rubber(Rubber). print_rubber(R) :- get(R, natural, N), get(R, minimum, Min), get(R, maximum, Max), get(R, stretch, Stretch), get(R, shrink, Shrink), format('~w<~w<~w <~w >~w~n', [Min, N, Max, Shrink, Stretch]).
TeamSPoon/logicmoo_workspace
docker/rootfs/usr/local/lib/swipl/xpce/prolog/lib/doc/table.pl
Perl
mit
12,529
## ## French tables, contributed by Emmanuel Bataille (bem@residents.frmug.org) ## package Date::Language::French; use Date::Language (); use vars qw(@ISA @DoW @DoWs @MoY @MoYs @AMPM @Dsuf %MoY %DoW $VERSION); @ISA = qw(Date::Language); $VERSION = "1.04"; @DoW = qw(dimanche lundi mardi mercredi jeudi vendredi samedi); @MoY = qw(janvier février mars avril mai juin juillet août septembre octobre novembre décembre); @DoWs = map { substr($_,0,3) } @DoW; @MoYs = map { substr($_,0,3) } @MoY; $MoYs[6] = 'jul'; @AMPM = qw(AM PM); @Dsuf = ((qw(er e e e e e e e e e)) x 3, 'er'); @MoY{@MoY} = (0 .. scalar(@MoY)); @MoY{@MoYs} = (0 .. scalar(@MoYs)); @DoW{@DoW} = (0 .. scalar(@DoW)); @DoW{@DoWs} = (0 .. scalar(@DoWs)); # Formatting routines sub format_a { $DoWs[$_[0]->[6]] } sub format_A { $DoW[$_[0]->[6]] } sub format_b { $MoYs[$_[0]->[4]] } sub format_B { $MoY[$_[0]->[4]] } sub format_h { $MoYs[$_[0]->[4]] } sub format_p { $_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0] } sub format_o { $_[0]->[3] } 1;
operepo/ope
client_tools/svc/rc/usr/share/perl5/vendor_perl/Date/Language/French.pm
Perl
mit
1,020
#----------------------------------------------------------- # usb # Similar to usbstor plugin, but prints output in .csv format; # also checks MountedDevices keys # # # copyright 2008 H. Carvey, keydet89@yahoo.com #----------------------------------------------------------- package autopsyusb; use strict; my %config = (hive => "System", osmask => 22, hasShortDescr => 1, hasDescr => 0, hasRefs => 0, version => 20080825); sub getConfig{return %config} sub getShortDescr { return "Get USB subkeys info; csv output"; } sub getDescr{} sub getRefs {} sub getHive {return $config{hive};} sub getVersion {return $config{version};} my $VERSION = getVersion(); my $reg; sub pluginmain { my $class = shift; my $hive = shift; $reg = Parse::Win32Registry->new($hive); my $root_key = $reg->get_root_key; # Code for System file, getting CurrentControlSet my $current; my $ccs; my $key_path = 'Select'; my $key; if ($key = $root_key->get_subkey($key_path)) { $current = $key->get_value("Current")->get_data(); $ccs = "ControlSet00".$current; } else { #::rptMsg($key_path." not found."); return; } my $name_path = $ccs."\\Control\\ComputerName\\ComputerName"; my $comp_name; eval { $comp_name = $root_key->get_subkey($name_path)->get_value("ComputerName")->get_data(); }; $comp_name = "Test" if ($@); my $key_path = $ccs."\\Enum\\USB"; my $key; if ($key = $root_key->get_subkey($key_path)) { ::rptMsg("<usb><time>N/A</time><artifacts>"); my @subkeys = $key->get_list_of_subkeys(); if (scalar(@subkeys) > 0) { foreach my $s (@subkeys) { my $dev_class = $s->get_name(); my @sk = $s->get_list_of_subkeys(); if (scalar(@sk) > 0) { foreach my $k (@sk) { my $serial = $k->get_name(); my $sn_lw = $k->get_timestamp(); my $str = $comp_name.",".$dev_class.",".$serial.",".$sn_lw; my $loc; eval { $loc = $k->get_value("LocationInformation")->get_data(); $str .= ",".$loc; }; $str .= ", " if ($@); my $friendly; eval { $friendly = $k->get_value("FriendlyName")->get_data(); $str .= ",".$friendly; }; $str .= ", " if ($@); my $parent; eval { $parent = $k->get_value("ParentIdPrefix")->get_data(); $str .= ",".$parent; }; ::rptMsg("<device name=\"" . $sn_lw. "\" dev=\"" . $dev_class . "\" >" . $serial . "</device>"); } } } } else { ::rptMsg($key_path." has no subkeys."); #::logMsg($key_path." has no subkeys."); } ::rptMsg("</artifacts></usb>"); } else { ::rptMsg($key_path." not found."); #::logMsg($key_path." not found."); } } 1;
kefir-/autopsy
RecentActivity/release/rr/plugins/autopsyusb.pl
Perl
apache-2.0
2,774
package CoGe::Algos::Pairwise; use strict; use base 'Class::Accessor'; use Data::Dumper; use IO::Socket; use CoGe::Accessory::Web; BEGIN { use Exporter (); use vars qw($P $VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $NWALIGN $MATRIX_FILE); $VERSION = '0.1'; @ISA = (@ISA, qw(Exporter)); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw(); @EXPORT_OK = qw(); %EXPORT_TAGS = (); __PACKAGE__->mk_accessors(qw(seqA seqB matrix gap gap_ext dpm alignA alignB nwalign nwalign_server_port)); # $P = CoGe::Accessory::Web::get_defaults(); # $NWALIGN = $P->{NWALIGN}; # $MATRIX_FILE = $P->{BLASTMATRIX}."aa/BLOSUM62"; } #################### main pod documentation begin ################### ## Below is the stub of documentation for your module. ## You better edit it! =head1 NAME CoGe::Algos::Pairwise - Pairwise =head1 SYNOPSIS use CoGe::Algos::Pairwise; my $seq1 = "PELICAN"; my $seq2 = "CELLAICAN"; my $pairwise = new CoGe::Algos::Pairwise $pairwise->seqA($seq1); $pairwise->seqB($seq2); #align the sequence my ($align1, $align2) = $pairwise->global_align(); #pretty print the dynamic programming matrix $pairwise->print_dpm(); =head1 DESCRIPTION Stub documentation for this module was created by ExtUtils::ModuleMaker. It looks like the author of the extension was negligent enough to leave the stub unedited. Blah blah blah. =head1 USAGE =head1 BUGS =head1 SUPPORT =head1 AUTHOR Eric Lyons CPAN ID: MODAUTHOR UC Berkeley elyons(@t)nature.berkeley.edu =head1 COPYRIGHT This program is free software licensed under the... The Artistic License The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO perl(1). =cut #################### main pod documentation end ################### #################### subroutine header begin #################### =head2 seqA Usage : $pairwise->seqA($seq) Purpose : get/set one of the sequences Returns : string Argument : string Throws : none Comment : this is how you set one of the two sequences to be aligned : See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 seqB Usage : $pairwise->seqB($seq) Purpose : get/set one of the sequences Returns : string Argument : string Throws : none Comment : this is how you set one of the two sequences to be aligned : See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 matrix Usage : $pairwise->matrix($matrix) Purpose : get/set the scoring matrix for the alignment Returns : a ref to a hash of hash refs Argument : a ref to a hash of hash refs Throws : none Comment : example matrix: $matrix = {{A}=>{A=>1, T=>-1, C=>-1}, G=>-1}, : {T}=>{A=>-1, T=>1, C=>-1}, G=>-1}, : {C}=>{A=>-1, T=>-1, C=>1}, G=>-1}, : {G}=>{A=>-1, T=>-1, C=>-1}, G=>1},}; : if no matrix is supplied, this will use the BLOSUM62 by default =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 gap Usage : $pairwise->gap(-10) Purpose : get/set the gap opening cost Returns : string/int Argument : string/int Throws : 0 Comment : If no gap is specified, -10 is used by default : See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 gap_ext Usage : $pairwise->gap_ext(-2) Purpose : get/set the gap extension cost Returns : string/int Argument : string/int Throws : none Comment : If no gap extension is specified, -2 is used by default : See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 dpm Usage : my $dpm = $pairwise->dpm(); Purpose : storage place for the dynamic programming matrix used for the last alignment Returns : a reference to a 2D matrix of hash refs Argument : this is set by the global_align subroutine Throws : none Comment : If you want to get a hold the the DPM used to generate the alignment, this : is the puppy. However, if you want to see it printed pretty, see the : print_dpm sub. See Also : sub print_dpm =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 alignA Usage : $aligna = $pairwise->alignA(); Purpose : storage place for one of the aligned sequence post alignment Returns : a string (or nothing if not set) Argument : this is set by the alignment subroutine Throws : none Comment : Allows you to retrieve the alignment for one of the sequence : after the alignment has been run. See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 alignB Usage : $alignb = $pairwise->alignB(); Purpose : storage place for one of the aligned sequence post alignment Returns : a string (or nothing if not set) Argument : this is set by the alignment subroutine Throws : none Comment : Allows you to retrieve the alignment for one of the sequence : after the alignment has been run. See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 Usage : Purpose : Returns : Argument : Throws : Comment : : See Also : =cut #################### subroutine header end #################### #################### subroutine header begin #################### =head2 global_align Usage : $pairwise->global_align() Purpose : aligns two sequences stored in the pairwise object. The sequences must have been previously set with $pairwise->seqA($seq) and $pairwise->seqB($seq2) Returns : an array of two strings where each string is the global sequence alignment Argument : None Throws : returns 0 if either sequence is not defined Comment : This does a global sequence alignment between two sequences using gap and gap extension : penalties. See Also : =cut #################### subroutine header end #################### sub global_align { my $self = shift; my %opts = @_; my $seq1 = $opts{seqA}; $seq1 = $self->seqA unless defined $seq1; my $seq2 = $opts{seqB}; $seq2 = $self->seqB unless defined $seq2; return 0 unless ( $seq1 && $seq2 ); my $gap = $opts{gap}; $gap = $self->gap unless defined $gap; my $gap_ext = $opts{gap_ext}; $gap_ext = $self->gap_ext unless defined $gap_ext; $gap = -10 unless defined $gap; $gap_ext = -2 unless $gap_ext; my $matrix = $opts{matrix}; #path to blast formated alignment matrix; $P = CoGe::Accessory::Web::get_defaults($opts{config}); $NWALIGN = get_command_path('NWALIGN'); $MATRIX_FILE = $P->{BLASTMATRIX}."aa/BLOSUM62"; $matrix = $MATRIX_FILE unless $matrix && -r $matrix; my ($align1, $align2); if ($self->nwalign_server_port) { my $sock = IO::Socket::INET->new( PeerAddr => 'localhost:'.$self->nwalign_server_port, ) or die "Can't bind: $@\n"; my $cmd = " --matrix $matrix --gap_extend $gap_ext --gap_open $gap $seq1 $seq2"; print $sock $cmd; my $res; $sock->recv($res, 128000); ($align1, $align2) = split/\s+/, $res, 2; } else { my $prog = $self->nwalign; $prog = $NWALIGN unless $prog; my $cmd = "$prog --matrix=$matrix --gap_extend=$gap_ext --gap_open=$gap $seq1 $seq2"; open (RUN, "$cmd |"); ($align1, $align2) = <RUN>; close RUN; } $align1 =~ s/\n//; $align2 =~ s/\n//; return ( $align1, $align2 ); } sub global_align_perl { ######################## # initialization stage # ######################## ## set up an empty matrix, fill is with our starting values ## make horizontals point "left", and verticals point up ## row or column value is the gap penalty multiplied by the position in ## the matrix my ($self) = (@_); my $seq1 = $self->seqA; my $seq2 = $self->seqB; return 0 unless ( $seq1 && $seq2 ); $self->gap(-10) unless $self->gap; $self->gap_ext(-2) unless $self->gap_ext; my $GAP = $self->gap; my $GAP_EXT = $self->gap_ext; $self->_initialize_default_scoring_matrix unless $self->matrix; my $sm = $self->matrix; my @matrix; $matrix[0][0]{score} = 0; $matrix[0][0]{pointer} = "none"; $matrix[0][0]{gap} = 0; for ( my $j = 1 ; $j <= length($seq1) ; $j++ ) { my $cost = $matrix[0][ $j - 1 ]{gap} ? $GAP_EXT : $GAP; $matrix[0][$j]{score} = $matrix[0][ $j - 1 ]{score} + $cost; $matrix[0][$j]{pointer} = "lt"; $matrix[0][$j]{gap} = 1; } for ( my $i = 1 ; $i <= length($seq2) ; $i++ ) { my $cost = $matrix[ $i - 1 ][0]{gap} ? $GAP_EXT : $GAP; $matrix[$i][0]{score} = $matrix[ $i - 1 ][0]{score} + $cost; $matrix[$i][0]{pointer} = "up"; $matrix[$i][0]{gap} = 1; } ######################## # fill stage # ######################## ## run through every element and calculate whether or not there is a ## match, score accordingly ## for ( my $i = 1 ; $i <= length($seq2) ; $i++ ) { for ( my $j = 1 ; $j <= length($seq1) ; $j++ ) { my ( $diagonal_score, $left_score, $up_score ); # calculate match score my $letter1 = substr( $seq1, $j - 1, 1 ); my $letter2 = substr( $seq2, $i - 1, 1 ); my $match_score = $sm->{$letter1}{$letter2}; $match_score = 0 unless defined $match_score ; #some odd character? Let's not make it hurt or add $diagonal_score = $matrix[ $i - 1 ][ $j - 1 ]{score} + $match_score; # calculate gap scores my $cost = $matrix[ $i - 1 ][$j]{gap} ? $GAP_EXT : $GAP; $up_score = $matrix[ $i - 1 ][$j]{score} + $cost; $cost = $matrix[$i][ $j - 1 ]{gap} ? $GAP_EXT : $GAP; $left_score = $matrix[$i][ $j - 1 ]{score} + $cost; # choose best score if ( $diagonal_score >= $up_score ) { if ( $diagonal_score >= $left_score ) { $matrix[$i][$j]{score} = $diagonal_score; $matrix[$i][$j]{pointer} = "dg"; $matrix[$i][$j]{gap} = 0; } else { $matrix[$i][$j]{score} = $left_score; $matrix[$i][$j]{pointer} = "lt"; $matrix[$i][$j]{gap} = 1; } } else { if ( $up_score >= $left_score ) { $matrix[$i][$j]{score} = $up_score; $matrix[$i][$j]{pointer} = "up"; $matrix[$i][$j]{gap} = 1; } else { $matrix[$i][$j]{score} = $left_score; $matrix[$i][$j]{pointer} = "lt"; $matrix[$i][$j]{gap} = 1; } } } } ###################### # trace-back # ###################### my $align1 = ""; # reserve some global variables here my $align2 = ""; # start at last cell of matrix, (i,j) my $j = length($seq1); my $i = length($seq2); ## while loop condition is always true while (1) { last if $matrix[$i][$j]{pointer} eq "none"; # exits while loop # at first cell of matrix if ($matrix[$i][$j]{pointer} eq "dg") { $align1 .= substr($seq1, $j-1, 1); $align2 .= substr($seq2, $i-1, 1); $i--; #decrement operator $j--; #decrement operator } elsif ($matrix[$i][$j]{pointer} eq "lt") { $align1 .= substr($seq1, $j-1, 1); $align2 .= "-"; $j--; #decrement operator } elsif ($matrix[$i][$j]{pointer} eq "up") { $align1 .= "-"; $align2 .= substr($seq2, $i-1, 1); $i--; #decrement operator } } $self->dpm( \@matrix ); $align1 = reverse($align1); $align2 = reverse($align2); $self->alignA($align1); $self->alignB($align2); return ( $align1, $align2 ); } #################### subroutine header begin #################### =head2 print_dpm Usage : $self->print_dpm Purpose : pretty prints the dynamic programming matrix Returns : none Argument : none Throws : 0 Comment : output is: score:gap_flag:trace_direction : e.g. -10:1:up -3:0:dg -13:1:lt : lt = trace is from left cell : up = trace is from above cell : gd = trace is from above diagonal cell See Also : =cut #################### subroutine header end #################### sub print_dpm { my $self = shift; my $matrix = shift || $self->dpm(); return 0 unless $matrix; foreach my $i (@$matrix) { foreach my $j (@$i) { print join( ":", sprintf( "%4d", $j->{score} ), $j->{gap}, $j->{pointer} ); print "\t"; } print "\n"; } } #################### subroutine header begin #################### =head2 print_align Usage : $pw->print_align(); Purpose : prints a pretty alignment Returns : none Argument : string (int) for the number of characters before wrapping the : alignment to the next string Throws : none Comment : a simple way to get a pretty and easy to read alignment : See Also : =cut #################### subroutine header end #################### sub print_align { my $self = shift; my %opts = @_; my $wrap = $opts{wrap} || 60; my $seqA = $opts{seqA} || $opts{seq1} || $self->alignA; my $seqB = $opts{seqB} || $opts{seq2} || $self->alignB; my @seqA = split //, $seqA; my @seqB = split //, $seqB; my ( $s1, $s2, $s3 ); my $count = 1; my $index = 0; foreach my $c1 (@seqA) { my $c2 = $seqB[$index]; $s1 .= $c1; $s2 .= $c2; if ( $c1 eq $c2 ) { $s3 .= ":"; } elsif ($self->matrix->{$c1} && defined $self->matrix->{$c1}{$c2} && $self->matrix->{$c1}{$c2} >= 0 ) { $s3 .= "."; } else { $s3 .= " "; } $count++; $index++; if ( $count == $wrap ) { print join( "\n", $s1, $s2, $s3, "\n" ); $count = 1; $s1 = undef; $s2 = undef; $s3 = undef; } } print join( "\n", $s1, $s2, $s3, "\n" ); } #################### subroutine header begin #################### =head2 _initialize_default_scoring_matrix Usage : $pairwise->_initialize_default_scoring_matrix Purpose : set the scoring matrix to BLOSOM62 Returns : $self->matrix() Argument : none Throws : none Comment : if no scoring matrix has been specified, this matrix is used : See Also : =cut #################### subroutine header end #################### sub _initialize_default_scoring_matrix { #BLOSUM62 my $self = shift; $self->matrix( { 'S' => { 'S' => '4', 'F' => '-2', 'T' => '1', 'N' => '1', 'K' => '0', '*' => '-4', 'Y' => '-2', 'E' => '0', 'V' => '-2', 'Z' => '0', 'Q' => '0', 'M' => '-1', 'C' => '-1', 'L' => '-2', 'A' => '1', 'W' => '-3', 'X' => '0', 'P' => '-1', 'B' => '0', 'H' => '-1', 'D' => '0', 'R' => '-1', 'I' => '-2', 'G' => '0' }, 'F' => { 'S' => '-2', 'F' => '6', 'T' => '-2', 'N' => '-3', 'K' => '-3', '*' => '-4', 'Y' => '3', 'E' => '-3', 'V' => '-1', 'Z' => '-3', 'Q' => '-3', 'M' => '0', 'C' => '-2', 'L' => '0', 'A' => '-2', 'W' => '1', 'X' => '-1', 'P' => '-4', 'B' => '-3', 'H' => '-1', 'D' => '-3', 'R' => '-3', 'I' => '0', 'G' => '-3' }, 'T' => { 'S' => '1', 'F' => '-2', 'T' => '5', 'N' => '0', 'K' => '-1', '*' => '-4', 'Y' => '-2', 'E' => '-1', 'V' => '0', 'Z' => '-1', 'Q' => '-1', 'M' => '-1', 'C' => '-1', 'L' => '-1', 'A' => '0', 'W' => '-2', 'X' => '0', 'P' => '-1', 'B' => '-1', 'H' => '-2', 'D' => '-1', 'R' => '-1', 'I' => '-1', 'G' => '-2' }, 'N' => { 'S' => '1', 'F' => '-3', 'T' => '0', 'N' => '6', 'K' => '0', '*' => '-4', 'Y' => '-2', 'E' => '0', 'V' => '-3', 'Z' => '0', 'Q' => '0', 'M' => '-2', 'C' => '-3', 'L' => '-3', 'A' => '-2', 'W' => '-4', 'X' => '-1', 'P' => '-2', 'B' => '3', 'H' => '1', 'D' => '1', 'R' => '0', 'I' => '-3', 'G' => '0' }, 'K' => { 'S' => '0', 'F' => '-3', 'T' => '-1', 'N' => '0', 'K' => '5', '*' => '-4', 'Y' => '-2', 'E' => '1', 'V' => '-2', 'Z' => '1', 'Q' => '1', 'M' => '-1', 'C' => '-3', 'L' => '-2', 'A' => '-1', 'W' => '-3', 'X' => '-1', 'P' => '-1', 'B' => '0', 'H' => '-1', 'D' => '-1', 'R' => '2', 'I' => '-3', 'G' => '-2' }, '*' => { 'S' => '-4', 'F' => '-4', 'T' => '-4', 'N' => '-4', 'K' => '-4', '*' => '1', 'Y' => '-4', 'E' => '-4', 'V' => '-4', 'Z' => '-4', 'Q' => '-4', 'M' => '-4', 'C' => '-4', 'L' => '-4', 'A' => '-4', 'W' => '-4', 'X' => '-4', 'P' => '-4', 'B' => '-4', 'H' => '-4', 'D' => '-4', 'R' => '-4', 'I' => '-4', 'G' => '-4' }, 'Y' => { 'S' => '-2', 'F' => '3', 'T' => '-2', 'N' => '-2', 'K' => '-2', '*' => '-4', 'Y' => '7', 'E' => '-2', 'V' => '-1', 'Z' => '-2', 'Q' => '-1', 'M' => '-1', 'C' => '-2', 'L' => '-1', 'A' => '-2', 'W' => '2', 'X' => '-1', 'P' => '-3', 'B' => '-3', 'H' => '2', 'D' => '-3', 'R' => '-2', 'I' => '-1', 'G' => '-3' }, 'E' => { 'S' => '0', 'F' => '-3', 'T' => '-1', 'N' => '0', 'K' => '1', '*' => '-4', 'Y' => '-2', 'E' => '5', 'V' => '-2', 'Z' => '4', 'Q' => '2', 'M' => '-2', 'C' => '-4', 'L' => '-3', 'A' => '-1', 'W' => '-3', 'X' => '-1', 'P' => '-1', 'B' => '1', 'H' => '0', 'D' => '2', 'R' => '0', 'I' => '-3', 'G' => '-2' }, 'V' => { 'S' => '-2', 'F' => '-1', 'T' => '0', 'N' => '-3', 'K' => '-2', '*' => '-4', 'Y' => '-1', 'E' => '-2', 'V' => '4', 'Z' => '-2', 'Q' => '-2', 'M' => '1', 'C' => '-1', 'L' => '1', 'A' => '0', 'W' => '-3', 'X' => '-1', 'P' => '-2', 'B' => '-3', 'H' => '-3', 'D' => '-3', 'R' => '-3', 'I' => '3', 'G' => '-3' }, 'Z' => { 'S' => '0', 'F' => '-3', 'T' => '-1', 'N' => '0', 'K' => '1', '*' => '-4', 'Y' => '-2', 'E' => '4', 'V' => '-2', 'Z' => '4', 'Q' => '3', 'M' => '-1', 'C' => '-3', 'L' => '-3', 'A' => '-1', 'W' => '-3', 'X' => '-1', 'P' => '-1', 'B' => '1', 'H' => '0', 'D' => '1', 'R' => '0', 'I' => '-3', 'G' => '-2' }, 'Q' => { 'S' => '0', 'F' => '-3', 'T' => '-1', 'N' => '0', 'K' => '1', '*' => '-4', 'Y' => '-1', 'E' => '2', 'V' => '-2', 'Z' => '3', 'Q' => '5', 'M' => '0', 'C' => '-3', 'L' => '-2', 'A' => '-1', 'W' => '-2', 'X' => '-1', 'P' => '-1', 'B' => '0', 'H' => '0', 'D' => '0', 'R' => '1', 'I' => '-3', 'G' => '-2' }, 'M' => { 'S' => '-1', 'F' => '0', 'T' => '-1', 'N' => '-2', 'K' => '-1', '*' => '-4', 'Y' => '-1', 'E' => '-2', 'V' => '1', 'Z' => '-1', 'Q' => '0', 'M' => '5', 'C' => '-1', 'L' => '2', 'A' => '-1', 'W' => '-1', 'X' => '-1', 'P' => '-2', 'B' => '-3', 'H' => '-2', 'D' => '-3', 'R' => '-1', 'I' => '1', 'G' => '-3' }, 'C' => { 'S' => '-1', 'F' => '-2', 'T' => '-1', 'N' => '-3', 'K' => '-3', '*' => '-4', 'Y' => '-2', 'E' => '-4', 'V' => '-1', 'Z' => '-3', 'Q' => '-3', 'M' => '-1', 'C' => '9', 'L' => '-1', 'A' => '0', 'W' => '-2', 'X' => '-2', 'P' => '-3', 'B' => '-3', 'H' => '-3', 'D' => '-3', 'R' => '-3', 'I' => '-1', 'G' => '-3' }, 'L' => { 'S' => '-2', 'F' => '0', 'T' => '-1', 'N' => '-3', 'K' => '-2', '*' => '-4', 'Y' => '-1', 'E' => '-3', 'V' => '1', 'Z' => '-3', 'Q' => '-2', 'M' => '2', 'C' => '-1', 'L' => '4', 'A' => '-1', 'W' => '-2', 'X' => '-1', 'P' => '-3', 'B' => '-4', 'H' => '-3', 'D' => '-4', 'R' => '-2', 'I' => '2', 'G' => '-4' }, 'A' => { 'S' => '1', 'F' => '-2', 'T' => '0', 'N' => '-2', 'K' => '-1', '*' => '-4', 'Y' => '-2', 'E' => '-1', 'V' => '0', 'Z' => '-1', 'Q' => '-1', 'M' => '-1', 'C' => '0', 'L' => '-1', 'A' => '4', 'W' => '-3', 'X' => '0', 'P' => '-1', 'B' => '-2', 'H' => '-2', 'D' => '-2', 'R' => '-1', 'I' => '-1', 'G' => '0' }, 'W' => { 'S' => '-3', 'F' => '1', 'T' => '-2', 'N' => '-4', 'K' => '-3', '*' => '-4', 'Y' => '2', 'E' => '-3', 'V' => '-3', 'Z' => '-3', 'Q' => '-2', 'M' => '-1', 'C' => '-2', 'L' => '-2', 'A' => '-3', 'W' => '11', 'X' => '-2', 'P' => '-4', 'B' => '-4', 'H' => '-2', 'D' => '-4', 'R' => '-3', 'I' => '-3', 'G' => '-2' }, 'X' => { 'S' => '0', 'F' => '-1', 'T' => '0', 'N' => '-1', 'K' => '-1', '*' => '-4', 'Y' => '-1', 'E' => '-1', 'V' => '-1', 'Z' => '-1', 'Q' => '-1', 'M' => '-1', 'C' => '-2', 'L' => '-1', 'A' => '0', 'W' => '-2', 'X' => '-1', 'P' => '-2', 'B' => '-1', 'H' => '-1', 'D' => '-1', 'R' => '-1', 'I' => '-1', 'G' => '-1' }, 'P' => { 'S' => '-1', 'F' => '-4', 'T' => '-1', 'N' => '-2', 'K' => '-1', '*' => '-4', 'Y' => '-3', 'E' => '-1', 'V' => '-2', 'Z' => '-1', 'Q' => '-1', 'M' => '-2', 'C' => '-3', 'L' => '-3', 'A' => '-1', 'W' => '-4', 'X' => '-2', 'P' => '7', 'B' => '-2', 'H' => '-2', 'D' => '-1', 'R' => '-2', 'I' => '-3', 'G' => '-2' }, 'B' => { 'S' => '0', 'F' => '-3', 'T' => '-1', 'N' => '3', 'K' => '0', '*' => '-4', 'Y' => '-3', 'E' => '1', 'V' => '-3', 'Z' => '1', 'Q' => '0', 'M' => '-3', 'C' => '-3', 'L' => '-4', 'A' => '-2', 'W' => '-4', 'X' => '-1', 'P' => '-2', 'B' => '4', 'H' => '0', 'D' => '4', 'R' => '-1', 'I' => '-3', 'G' => '-1' }, 'H' => { 'S' => '-1', 'F' => '-1', 'T' => '-2', 'N' => '1', 'K' => '-1', '*' => '-4', 'Y' => '2', 'E' => '0', 'V' => '-3', 'Z' => '0', 'Q' => '0', 'M' => '-2', 'C' => '-3', 'L' => '-3', 'A' => '-2', 'W' => '-2', 'X' => '-1', 'P' => '-2', 'B' => '0', 'H' => '8', 'D' => '-1', 'R' => '0', 'I' => '-3', 'G' => '-2' }, 'D' => { 'S' => '0', 'F' => '-3', 'T' => '-1', 'N' => '1', 'K' => '-1', '*' => '-4', 'Y' => '-3', 'E' => '2', 'V' => '-3', 'Z' => '1', 'Q' => '0', 'M' => '-3', 'C' => '-3', 'L' => '-4', 'A' => '-2', 'W' => '-4', 'X' => '-1', 'P' => '-1', 'B' => '4', 'H' => '-1', 'D' => '6', 'R' => '-2', 'I' => '-3', 'G' => '-1' }, 'R' => { 'S' => '-1', 'F' => '-3', 'T' => '-1', 'N' => '0', 'K' => '2', '*' => '-4', 'Y' => '-2', 'E' => '0', 'V' => '-3', 'Z' => '0', 'Q' => '1', 'M' => '-1', 'C' => '-3', 'L' => '-2', 'A' => '-1', 'W' => '-3', 'X' => '-1', 'P' => '-2', 'B' => '-1', 'H' => '0', 'D' => '-2', 'R' => '5', 'I' => '-3', 'G' => '-2' }, 'I' => { 'S' => '-2', 'F' => '0', 'T' => '-1', 'N' => '-3', 'K' => '-3', '*' => '-4', 'Y' => '-1', 'E' => '-3', 'V' => '3', 'Z' => '-3', 'Q' => '-3', 'M' => '1', 'C' => '-1', 'L' => '2', 'A' => '-1', 'W' => '-3', 'X' => '-1', 'P' => '-3', 'B' => '-3', 'H' => '-3', 'D' => '-3', 'R' => '-3', 'I' => '4', 'G' => '-4' }, 'G' => { 'S' => '0', 'F' => '-3', 'T' => '-2', 'N' => '0', 'K' => '-2', '*' => '-4', 'Y' => '-3', 'E' => '-2', 'V' => '-3', 'Z' => '-2', 'Q' => '-2', 'M' => '-3', 'C' => '-3', 'L' => '-4', 'A' => '0', 'W' => '-2', 'X' => '-1', 'P' => '-2', 'B' => '-1', 'H' => '-2', 'D' => '-1', 'R' => '-2', 'I' => '-4', 'G' => '6' } } ); return $self->matrix; } 1; # The preceding line will help the module return a true value
asherkhb/coge
modules/Algos/Pairwise/lib/CoGe/Algos/Pairwise.pm
Perl
bsd-2-clause
33,357
:-table reach/2. go:- cputime(Start), top, cputime(End), T is End-Start, write('TIME:'),write(T),nl. main:-top. top:- reach(X,Y), % write(r(X,Y)),nl, fail. top. reach(X,Y):-edge(X,Y). reach(X,Y):-edge(X,Z),reach(Z,Y). :-['edge.pl'].
TeamSPoon/pfc
t/tabling-tests/Bench/tabling/tcr.pl
Perl
bsd-2-clause
269
=pod =head1 NAME BIO_get_ex_new_index, BIO_set_ex_data, BIO_get_ex_data, BIO_set_app_data, BIO_get_app_data, DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data, DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data, EC_KEY_get_ex_new_index, EC_KEY_set_ex_data, EC_KEY_get_ex_data, ENGINE_get_ex_new_index, ENGINE_set_ex_data, ENGINE_get_ex_data, EVP_PKEY_get_ex_new_index, EVP_PKEY_set_ex_data, EVP_PKEY_get_ex_data, RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data, RSA_set_app_data, RSA_get_app_data, SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data, SSL_set_app_data, SSL_get_app_data, SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data, SSL_CTX_set_app_data, SSL_CTX_get_app_data, SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data, SSL_SESSION_set_app_data, SSL_SESSION_get_app_data, UI_get_ex_new_index, UI_set_ex_data, UI_get_ex_data, UI_set_app_data, UI_get_app_data, X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ex_data, X509_STORE_CTX_set_app_data, X509_STORE_CTX_get_app_data, X509_STORE_get_ex_new_index, X509_STORE_set_ex_data, X509_STORE_get_ex_data, X509_get_ex_new_index, X509_set_ex_data, X509_get_ex_data - application-specific data =head1 SYNOPSIS =for openssl generic #include <openssl/x509.h> int TYPE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int TYPE_set_ex_data(TYPE *d, int idx, void *arg); void *TYPE_get_ex_data(const TYPE *d, int idx); #define TYPE_set_app_data(TYPE *d, void *arg) #define TYPE_get_app_data(TYPE *d) Deprecated since OpenSSL 3.0, can be hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, see L<openssl_user_macros(7)>: int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int DH_set_ex_data(DH *type, int idx, void *arg); void *DH_get_ex_data(DH *type, int idx); int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int DSA_set_ex_data(DSA *type, int idx, void *arg); void *DSA_get_ex_data(DSA *type, int idx); int EC_KEY_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int EC_KEY_set_ex_data(EC_KEY *type, int idx, void *arg); void *EC_KEY_get_ex_data(EC_KEY *type, int idx); int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int RSA_set_ex_data(RSA *type, int idx, void *arg); void *RSA_get_ex_data(RSA *type, int idx); int RSA_set_app_data(RSA *type, void *arg); void *RSA_get_app_data(RSA *type); int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int ENGINE_set_ex_data(ENGINE *type, int idx, void *arg); void *ENGINE_get_ex_data(ENGINE *type, int idx); =head1 DESCRIPTION In the description here, I<TYPE> is used a placeholder for any of the OpenSSL datatypes listed in L<CRYPTO_get_ex_new_index(3)>. All functions with a I<TYPE> of B<DH>, B<DSA>, B<RSA> and B<EC_KEY> are deprecated. Applications should instead use EVP_PKEY_set_ex_data(), EVP_PKEY_get_ex_data() and EVP_PKEY_get_ex_new_index(). All functions with a I<TYPE> of B<ENGINE> are deprecated. Applications using engines should be replaced by providers. These functions handle application-specific data for OpenSSL data structures. TYPE_get_ex_new_index() is a macro that calls CRYPTO_get_ex_new_index() with the correct B<index> value. TYPE_set_ex_data() is a function that calls CRYPTO_set_ex_data() with an offset into the opaque exdata part of the TYPE object. TYPE_get_ex_data() is a function that calls CRYPTO_get_ex_data() with an offset into the opaque exdata part of the TYPE object. For compatibility with previous releases, the exdata index of zero is reserved for "application data." There are two convenience functions for this. TYPE_set_app_data() is a macro that invokes TYPE_set_ex_data() with B<idx> set to zero. TYPE_get_app_data() is a macro that invokes TYPE_get_ex_data() with B<idx> set to zero. =head1 RETURN VALUES TYPE_get_ex_new_index() returns a new index on success or -1 on error. TYPE_set_ex_data() returns 1 on success or 0 on error. TYPE_get_ex_data() returns the application data or NULL if an error occurred. =head1 SEE ALSO L<CRYPTO_get_ex_new_index(3)>. =head1 HISTORY The functions DH_get_ex_new_index(), DH_set_ex_data(), DH_get_ex_data(), DSA_get_ex_new_index(), DSA_set_ex_data(), DSA_get_ex_data(), EC_KEY_get_ex_new_index(), EC_KEY_set_ex_data(), EC_KEY_get_ex_data(), ENGINE_get_ex_new_index(), ENGINE_set_ex_data(), ENGINE_get_ex_data(), RSA_get_ex_new_index(), RSA_set_ex_data(), RSA_get_ex_data(), RSA_set_app_data() and RSA_get_app_data() were deprecated in OpenSSL 3.0. =head1 COPYRIGHT Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
jens-maus/amissl
openssl/doc/man3/BIO_get_ex_new_index.pod
Perl
bsd-3-clause
5,506
package AsposeEmailCloud::Object::LineNumberRestartMode; require 5.6.0; use strict; use warnings; use utf8; use JSON qw(decode_json); use Data::Dumper; use Module::Runtime qw(use_module); use Log::Any qw($log); use Date::Parse; use DateTime; use base "AsposeEmailCloud::Object::BaseObject"; # # # #NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. # my $swagger_types = { }; my $attribute_map = { }; # new object sub new { my ($class, %args) = @_; my $self = { }; return bless $self, $class; } # get swagger type of the attribute sub get_swagger_types { return $swagger_types; } # get attribute mappping sub get_attribute_map { return $attribute_map; } 1;
asposeemail/Aspose_Email_Cloud
SDKs/Aspose.Email-Cloud-SDK-for-Perl/lib/AsposeEmailCloud/Object/LineNumberRestartMode.pm
Perl
mit
772