IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Modules Perl Discussion :

perl.exe et Bankfraud.E trojan


Sujet :

Modules Perl

  1. #1
    Membre émérite
    Avatar de Jasmine80
    Femme Profil pro
    Bioinformaticienne
    Inscrit en
    Octobre 2006
    Messages
    3 157
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 44
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Bioinformaticienne
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2006
    Messages : 3 157
    Points : 2 673
    Points
    2 673
    Par défaut perl.exe et Bankfraud.E trojan
    File :
    C: Document~Temp\ppm-H1Y7Q0\bioperl-1.5.2_...\CodonTable.html
    Threat :
    HTML/Bankfraud.E trojan
    Comment :
    Event occurred on a new file created by the application: C:\Perl\bin\perl.exe. The file was moved to quarantine. You may close this window.
    ... il y a vraiment des virus partout, vive Windows! Et merci mon anti-virus.
    Comment fonctionne Perl? Quels contrôles y a-t'il quand on soumet un module?
    -- Jasmine --

  2. #2
    Expert éminent
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Points : 8 586
    Points
    8 586
    Par défaut
    Et bien je dois dire que c'est un peu surprenant, es-tu sûr que ce n'est pas une fausse alerte ?

    Globalement ce que dit le message c'est que PPM a essayé d'installer Bioperl à partir d'un repository (à toi de voir lequel) et que l'un des fichiers téléchargé légitimement lors de cette tâche contient du html infecté par un trojan (du javascript on suppose), ma première suggestion serait de voir s'il n'y a pas erreur, regarde le source du html, cela ne présente aucun danger et certains antivirus sont un peu trop sensible.
    Ensuite si effectivement il y a un trojan, c'est que le repository a été infecté et il serait avisé d'en informer le propriétaire. Une autre possibilité serait que la source Bioperl elle-même ait été infectée mais cela parait peu probable.

    Comment fonctionne Perl? Quels contrôles y a-t'il quand on soumet un module?
    A peu près aucun, sauf ceux appliqués par la communauté, n'oublions pas que tous les codes sources sont disponibles. Les modules sont également signés cryptographiquement par leur auteur, et les auteurs ont leur réputation.

    D'un autre côté il faut bien voir que cela n'est pas différent de tous les autres langages de programmation (en fait c'est même un peu plus sécurisé puisque les modules sont centralisés sur le CPAN, les sources sont disponibles et un virus découvert entrainerait des conséquences immédiates pour les modules de l'auteur présumé), ou même de n'importe quel logiciel que tu dois installer. Perlscript a le même genre de restriction que Javascript (exécuté dans une sandbox) mais personne n'utilise Perlscript.

    Par ailleurs Perl le langage a pas mal d'outils pour la sécurité, le mode taint en lui-même élimine un tas d'erreurs de débutants pour les CGI, erreurs souvent faites dans des langages comme PHP. DBI et ses drivers permet également aisément une utilisation sûre des SGBD contrairement à PHP qui pendant longtemps ne permettait que la concaténation pour former des requête SQL dans sa bibliothèque standard.
    Enfin il existe des modules qui permettent d'exécuter du code, des modules dans une sandbox, comme Safe ou le pragma ops.

    --
    Jedaï

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Août 2008
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Août 2008
    Messages : 505
    Points : 712
    Points
    712
    Par défaut

  4. #4
    Expert éminent
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Points : 8 586
    Points
    8 586
    Par défaut
    Citation Envoyé par thierry.chich Voir le message
    Voilà un message qui laisse à désirer... Que voulais-tu exprimer ?

    --
    Jedaï

  5. #5
    Membre émérite
    Avatar de Jasmine80
    Femme Profil pro
    Bioinformaticienne
    Inscrit en
    Octobre 2006
    Messages
    3 157
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 44
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Bioinformaticienne
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2006
    Messages : 3 157
    Points : 2 673
    Points
    2 673
    Par défaut
    Jedai, merci pour cette réponse bien détaillée.
    Et bien je dois dire que c'est un peu surprenant, es-tu sûr que ce n'est pas une fausse alerte ?
    Oui, c'est peut-être une fausse alerte. La seule explication que j'ai trouvée de ce virus, si du moins elle est correcte, est étrange
    Html.Bankfraud.E is not an infected file. But it is a malicious email, which asks you to enter your bank account data into a webpage which imitates the look of the origional page. (Phishing)
    Je ne sais pas mais il y a bien un cheval de Troie en quarantaine. Pourquoi y a-t'il TEMP dans le nom du chemin vers le fichier en quarantaine?


    ma première suggestion serait de voir s'il n'y a pas erreur, regarde le source du html,
    Le fichier est dans C:\Perl\site\lib\Bio\Tools\CodonTable.html comment voir la source du html?

    Ensuite si effectivement il y a un trojan, c'est que le repository a été infecté et il serait avisé d'en informer le propriétaire. Une autre possibilité serait que la source Bioperl elle-même ait été infectée mais cela parait peu probable.
    Cela vient de
    bioperl
    Bioinformatics Toolkit
    Version: 1.5.2_100
    Released: 2006-12-6
    Author: Bioperl Team <bioperl-l@bioperl.org>
    CPAN: http://search.cpan.org/dist/bioperl-1.5.2_100/

    Pour les repositories, en plus d'activestate, j'ai ajouté :

    trouchelle
    http://trouchelle.com/ppm/

    theoryx
    http://theoryx5.uwinnipeg.ca/ppms/

    bribes
    http://www.bribes.org/perl/ppm

    bioperl1
    http://bioperl.org/DIST/package.xml

    bioperl2
    http://bioperl.org/DIST/RC/

    ... je suppose que si il y a vraiment un problème, il provient d'un des 2 derniers.

    Ce que je sais est que j'ai installé exactement ce module au boulot il y a 6 mois et que je n'ai pas eu ce problème. Je devrais vérifier si ce fichier CodonTable.html était déjà dans bioperl-1.5.2_100 à ce moment là.




    Et merci à thierry.chich de compatir à mon malheur
    -- Jasmine --

  6. #6
    Expert éminent
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Points : 8 586
    Points
    8 586
    Par défaut
    Citation Envoyé par Jasmine80 Voir le message
    Je ne sais pas mais il y a bien un cheval de Troie en quarantaine. Pourquoi y a-t'il TEMP dans le nom du chemin vers le fichier en quarantaine?
    Parce que ppm commence par télécharger et décompresser le module dans le dossier Temp(oraire) avant de l'installer.

    Citation Envoyé par Jasmine80 Voir le message
    Le fichier est dans C:\Perl\site\lib\Bio\Tools\CodonTable.html comment voir la source du html?
    Tu ouvres le fichier avec un éditeur de texte (type SciTE).


    Néanmoins ça ressemble vraiment à une fausse alerte, ou en tout cas, complètement inoffensif...

    --
    Jedaï

  7. #7
    Membre éclairé
    Profil pro
    Inscrit en
    Août 2008
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Août 2008
    Messages : 505
    Points : 712
    Points
    712
    Par défaut
    Citation Envoyé par Jedai Voir le message
    Voilà un message qui laisse à désirer... Que voulais-tu exprimer ?

    --
    Jedaï
    En fait je voulais faire un commentaire extrèmement pertinent. il se trouve en relisant ce que tu avais écrit, que mon commentaire était une redite moins détaillée. J'ai donc voulu supprimer mon message. Mais je ne pouvais pas.
    J'ai donc laissé l'émoticon exprimant tout à la fois ma compassion pour Jasmine et mon désarroi de ne pas pouvoir supprimer ce message.

    Et je pense qu'il s'agit en effet d'une fausse alerte.

  8. #8
    Membre émérite
    Avatar de Jasmine80
    Femme Profil pro
    Bioinformaticienne
    Inscrit en
    Octobre 2006
    Messages
    3 157
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 44
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Bioinformaticienne
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2006
    Messages : 3 157
    Points : 2 673
    Points
    2 673
    Par défaut
    Citation Envoyé par Jedai
    Tu ouvres le fichier avec un éditeur de texte (type SciTE).
    Ca paraît normal comme fichier
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    # $Id: CodonTable.pm,v 1.37.2.1 2006/10/02 23:10:31 sendu Exp $
    #
    # bioperl module for Bio::Tools::CodonTable
    #
    # Cared for by Heikki Lehvaslaiho <heikki-at-bioperl-dot-org>
    #
    # Copyright Heikki Lehvaslaiho
    #
    # You may distribute this module under the same terms as perl itself
     
    # POD documentation - main docs before the code
     
    =head1 NAME
     
    Bio::Tools::CodonTable - Bioperl codon table object
     
    =head1 SYNOPSIS
     
      # This is a read-only class for all known codon tables.  The IDs are
      # the ones used by nucleotide sequence databases.  All common IUPAC
      # ambiguity codes for DNA, RNA and animo acids are recognized.
     
      # to use
      use Bio::Tools::CodonTable;
     
      # defaults to ID 1 "Standard"
      $myCodonTable   = Bio::Tools::CodonTable->new();
      $myCodonTable2  = Bio::Tools::CodonTable->new( -id => 3 );
     
      # change codon table
      $myCodonTable->id(5);
     
      # examine codon table
      print  join (' ', "The name of the codon table no.", $myCodonTable->id(4),
    	       "is:", $myCodonTable->name(), "\n");
     
      # print possible codon tables
      $tables = Bio::Tools::CodonTable->tables;
      while ( ($id,$name) = each %{$tables} ) {
        print "$id = $name\n";
      }
     
      # translate a codon
      $aa = $myCodonTable->translate('ACU');
      $aa = $myCodonTable->translate('act');
      $aa = $myCodonTable->translate('ytr');
     
      # reverse translate an amino acid
      @codons = $myCodonTable->revtranslate('A');
      @codons = $myCodonTable->revtranslate('Ser');
      @codons = $myCodonTable->revtranslate('Glx');
      @codons = $myCodonTable->revtranslate('cYS', 'rna');
     
      # reverse translate an entire amino acid sequence into a IUPAC
      # nucleotide string
     
      my $seqobj    = Bio::PrimarySeq->new(-seq => 'FHGERHEL');
      my $iupac_str = $myCodonTable->reverse_translate_all($seqobj);
     
      #boolean tests
      print "Is a start\n"       if $myCodonTable->is_start_codon('ATG');
      print "Is a termianator\n" if $myCodonTable->is_ter_codon('tar');
      print "Is a unknown\n"     if $myCodonTable->is_unknown_codon('JTG');
     
    =head1 DESCRIPTION
     
    Codon tables are also called translation tables or genetic codes
    since that is what they represent. A bit more complete picture
    of the full complexity of codon usage in various taxonomic groups
    is presented at the NCBI Genetic Codes Home page.
     
    CodonTable is a BioPerl class that knows all current translation
    tables that are used by primary nucleotide sequence databases
    (GenBank, EMBL and DDBJ). It provides methods to output information
    about tables and relationships between codons and amino acids.
     
    This class and its methods recognized all common IUPAC ambiguity codes
    for DNA, RNA and animo acids. The translation method follows the
    conventions in EMBL and TREMBL databases.
     
    It is a nuisance to separate RNA and cDNA representations of nucleic
    acid transcripts. The CodonTable object accepts codons of both type as
    input and allows the user to set the mode for output when reverse
    translating. Its default for output is DNA.
     
    Note: 
     
    This class deals primarily with individual codons and amino
    acids. However in the interest of speed you can L<translate>
    longer sequence, too. The full complexity of protein translation
    is tackled by L<Bio::PrimarySeqI::translate>.
     
     
    The amino acid codes are IUPAC recommendations for common amino acids:
     
              A           Ala            Alanine
              R           Arg            Arginine
              N           Asn            Asparagine
              D           Asp            Aspartic acid
              C           Cys            Cysteine
              Q           Gln            Glutamine
              E           Glu            Glutamic acid
              G           Gly            Glycine
              H           His            Histidine
              I           Ile            Isoleucine
              L           Leu            Leucine
              K           Lys            Lysine
              M           Met            Methionine
              F           Phe            Phenylalanine
              P           Pro            Proline
    		  O           Pyl            Pyrrolysine (22nd amino acid)
    		  U           Sec            Selenocysteine (21st amino acid)
              S           Ser            Serine
              T           Thr            Threonine
              W           Trp            Tryptophan
              Y           Tyr            Tyrosine
              V           Val            Valine
              B           Asx            Aspartic acid or Asparagine
              Z           Glx            Glutamine or Glutamic acid
    		  J           Xle            Isoleucine or Valine (mass spec ambiguity)
              X           Xaa            Any or unknown amino acid
     
     
    It is worth noting that, "Bacterial" codon table no. 11 produces an
    polypeptide that is, confusingly, identical to the standard one. The
    only differences are in available initiator codons.
     
     
    NCBI Genetic Codes home page:
         http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c
     
    EBI Translation Table Viewer:
         http://www.ebi.ac.uk/cgi-bin/mutations/trtables.cgi
     
    Amended ASN.1 version with ids 16 and 21 is at:
         ftp://ftp.ebi.ac.uk/pub/databases/geneticcode/
     
    Thanks to Matteo diTomasso for the original Perl implementation
    of these tables.
     
    =head1 FEEDBACK
     
    =head2 Mailing Lists
     
    User feedback is an integral part of the evolution of this and other
    Bioperl modules. Send your comments and suggestions preferably to the
    Bioperl mailing lists  Your participation is much appreciated.
     
      bioperl-l@bioperl.org                  - General discussion
      http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
     
    =head2 Reporting Bugs
     
    Report bugs to the Bioperl bug tracking system to help us keep track
    the bugs and their resolution.  Bug reports can be submitted via the
    web:
     
      http://bugzilla.open-bio.org/
     
    =head1 AUTHOR - Heikki Lehvaslaiho
     
    Email:  heikki-at-bioperl-dot-org
     
    =head1 APPENDIX
     
    The rest of the documentation details each of the object
    methods. Internal methods are usually preceded with a _
     
    =cut
     
     
    # Let the code begin...
     
    package Bio::Tools::CodonTable;
    use vars qw(@NAMES @TABLES @STARTS $TRCOL $CODONS %IUPAC_DNA 	    $CODONGAP $GAP
    	    %IUPAC_AA %THREELETTERSYMBOLS $VALID_PROTEIN $TERMINATOR);
    use strict;
     
    # Object preamble - inherits from Bio::Root::Root
    use Bio::Tools::IUPAC;
    use Bio::SeqUtils;
     
    use base qw(Bio::Root::Root);
     
     
    # first set internal values for all translation tables
     
    BEGIN { 
        use constant CODONSIZE => 3;
        $GAP = '-';
        $CODONGAP = $GAP x CODONSIZE;
     
        @NAMES =			#id
    	(
    	 'Standard',		#1
    	 'Vertebrate Mitochondrial',#2
    	 'Yeast Mitochondrial',# 3
    	 'Mold, Protozoan, and CoelenterateMitochondrial and Mycoplasma/Spiroplasma',#4
    	 'Invertebrate Mitochondrial',#5
    	 'Ciliate, Dasycladacean and Hexamita Nuclear',# 6
    	 '', '',
    	 'Echinoderm Mitochondrial',#9
    	 'Euplotid Nuclear',#10
    	 '"Bacterial"',# 11
    	 'Alternative Yeast Nuclear',# 12
    	 'Ascidian Mitochondrial',# 13
    	 'Flatworm Mitochondrial',# 14
    	 'Blepharisma Nuclear',# 15
    	 'Chlorophycean Mitochondrial',# 16
    	 '', '',  '', '',
    	 'Trematode Mitochondrial',# 21
    	 'Scenedesmus obliquus Mitochondrial', #22
    	 'Thraustochytrium Mitochondrial' #23
    	 );
     
        @TABLES =
    	qw(
    	   FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSS**VVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CCWWTTTTPPPPHHQQRRRRIIMMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSSSVVVVAAAADDEEGGGG
    	   FFLLSSSSYYQQCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   '' ''
    	   FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CCCWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CC*WLLLSPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSGGVVVVAAAADDEEGGGG
    	   FFLLSSSSYYY*CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG
    	   FFLLSSSSYY*QCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FFLLSSSSYY*LCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   '' '' '' ''
    	   FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNNKSSSSVVVVAAAADDEEGGGG   
    	   FFLLSS*SYY*LCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   FF*LSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG
    	   );
     
     
        @STARTS =
    	qw(
    	   ---M---------------M---------------M----------------------------
    	   --------------------------------MMMM---------------M------------
    	   ----------------------------------MM----------------------------
    	   --MM---------------M------------MMMM---------------M------------
    	   ---M----------------------------MMMM---------------M------------
    	   -----------------------------------M----------------------------
    	   '' ''
    	   -----------------------------------M----------------------------
    	   -----------------------------------M----------------------------
    	   ---M---------------M------------MMMM---------------M------------
    	   -------------------M---------------M----------------------------
    	   -----------------------------------M----------------------------
    	   -----------------------------------M----------------------------
    	   -----------------------------------M----------------------------
    	   -----------------------------------M----------------------------
    	   '' ''  '' ''
    	   -----------------------------------M---------------M------------  
    	   -----------------------------------M----------------------------
    	   --------------------------------M--M---------------M------------
    	   );
     
        my @nucs = qw(t c a g);
        my $x = 0;
        ($CODONS, $TRCOL) = ({}, {});
        for my $i (@nucs) {
    	for my $j (@nucs) {
    	    for my $k (@nucs) {
    		my $codon = "$i$j$k";
    		$CODONS->{$codon} = $x;
    		$TRCOL->{$x} = $codon;
    		$x++;
    	    }
    	}
        }
        %IUPAC_DNA = Bio::Tools::IUPAC->iupac_iub();    
        %IUPAC_AA = Bio::Tools::IUPAC->iupac_iup();
        %THREELETTERSYMBOLS = Bio::SeqUtils->valid_aa(2);
        $VALID_PROTEIN = '['.join('',Bio::SeqUtils->valid_aa(0)).']';
        $TERMINATOR = '*';
    }
     
    sub new {
        my($class,@args) = @_;
        my $self = $class->SUPER::new(@args);
     
        my($id) =
    	$self->_rearrange([qw(ID
    			     )],
    			 @args);
     
        $id = 1 if ( ! $id );
        $id  && $self->id($id);
        return $self; # success - we hope!
    }
     
    =head2 id
     
     Title   : id
     Usage   : $obj->id(3); $id_integer = $obj->id();
     Function:
     
               Sets or returns the id of the translation table.  IDs are
               integers from 1 to 15, excluding 7 and 8 which have been
               removed as redundant. If an invalid ID is given the method
               returns 0, false.
     
     
     Example :
     Returns : value of id, a scalar, 0 if not a valid
     Args    : newvalue (optional)
     
    =cut
     
    sub id{
       my ($self,$value) = @_;
       if( defined $value) {
           if (  !(defined $TABLES[$value-1]) or $TABLES[$value-1] eq '') {
    	   $self->warn("Not a valid codon table ID [$value] ");
    	   $value = 0;
           }
           $self->{'id'} = $value;
       }
       return $self->{'id'};
    }
     
    =head2 name
     
     Title   : name
     Usage   : $obj->name()
     Function: returns the descriptive name of the translation table
     Example :
     Returns : A string
     Args    : None
     
     
    =cut
     
    sub name{
       my ($self) = @_;
     
       my ($id) = $self->{'id'};
       return $NAMES[$id-1];
    }
     
    =head2 tables
     
     Title   : tables
     Usage   : $obj->tables()  or  Bio::Tools::CodonTable->tables()
     Function: returns a hash reference where each key is a valid codon
               table id() number, and each value is the corresponding
               codon table name() string
     Example :
     Returns : A hashref
     Args    : None
     
     
    =cut
     
    sub tables{
      my %tables;
      for my $id (1 .. @NAMES) {
        my $name = $NAMES[$id-1];
        $tables{$id} = $name if $name;
      }
      return \%tables;
    }
     
    =head2 translate
     
     Title   : translate
     Usage   : $obj->translate('YTR')
     Function: Returns a string of one letter amino acid codes from 
               nucleotide sequence input. The imput can be of any length.
     
               Returns 'X' for unknown codons and codons that code for
               more than one amino acid. Returns an empty string if input
               is not three characters long. Exceptions for these are:
     
                 - IUPAC amino acid code B for Aspartic Acid and
                   Asparagine, is used.
                 - IUPAC amino acid code Z for Glutamic Acid, Glutamine is
                   used.
                 - if the codon is two nucleotides long and if by adding
                   an a third character 'N', it codes for a single amino
                   acid (with exceptions above), return that, otherwise
                   return empty string.
     
               Returns empty string for other input strings that are not
               three characters long.
     
     Example :
     Returns : a string of one letter ambiguous IUPAC amino acid codes
     Args    : ambiguous IUPAC nucleotide string
     
     
    =cut
     
    sub translate {
        my ($self, $seq) = @_;
        $self->throw("Calling translate without a seq argument!") unless defined $seq;
        return '' unless $seq;
     
        my $id = $self->id;
        my ($partial) = 0;
        $partial = 2 if length($seq) % CODONSIZE == 2;
     
        $seq = lc $seq;
        $seq =~ tr/u/t/;
        my $protein = "";
        if ($seq =~ /[^actg]/ ) { #ambiguous chars
            for (my $i = 0; $i < (length($seq) - (CODONSIZE-1)); $i+= CODONSIZE) {
                my $triplet = substr($seq, $i, CODONSIZE);
    	    if( $triplet eq $CODONGAP ) {
    		$protein .= $GAP;
    	    } elsif (exists $CODONS->{$triplet}) {
    		$protein .= substr($TABLES[$id-1], 
    				   $CODONS->{$triplet},1);
    	    } else {
    		$protein .= $self->_translate_ambiguous_codon($triplet);
    	    }
    	}
        } else { # simple, strict translation
    	for (my $i = 0; $i < (length($seq) - (CODONSIZE -1)); $i+=CODONSIZE) {
                my $triplet = substr($seq, $i, CODONSIZE); 
                if( $triplet eq $CODONGAP ) {
    		$protein .= $GAP;
    	    } if (exists $CODONS->{$triplet}) {
                    $protein .= substr($TABLES[$id-1], $CODONS->{$triplet}, 1);
    	    } else {
                    $protein .= 'X';
                }
            }
        }
        if ($partial == 2) { # 2 overhanging nucleotides
    	my $triplet = substr($seq, ($partial -4)). "n";
    	if( $triplet eq $CODONGAP ) {
    	    $protein .= $GAP;
    	} elsif (exists $CODONS->{$triplet}) {
    	    my $aa = substr($TABLES[$id-1], $CODONS->{$triplet},1);       
    	    $protein .= $aa;
    	} else {
    	    $protein .= $self->_translate_ambiguous_codon($triplet, $partial);
    	}
        }
        return $protein;
    }
     
    sub _translate_ambiguous_codon {
        my ($self, $triplet, $partial) = @_;
        $partial ||= 0;
        my $id = $self->id;
        my $aa;
        my @codons = _unambiquous_codons($triplet);
        my %aas =();
        foreach my $codon (@codons) {
    	$aas{substr($TABLES[$id-1],$CODONS->{$codon},1)} = 1;
        }
        my $count = scalar keys %aas;
        if ( $count == 1 ) {
    	$aa = (keys %aas)[0];
        }
        elsif ( $count == 2 ) {
    	if ($aas{'D'} and $aas{'N'}) {
    	    $aa = 'B';
    	}
    	elsif ($aas{'E'} and $aas{'Q'}) {
    	    $aa = 'Z';
    	} else {
    	    $partial ? ($aa = '') : ($aa = 'X');
    	}
        } else {
    	$partial ? ($aa = '') :  ($aa = 'X');
        }
        return $aa;
    }
     
    =head2 translate_strict
     
     Title   : translate_strict
     Usage   : $obj->translate_strict('ACT')
     Function: returns one letter amino acid code for a codon input
     
               Fast and simple translation. User is responsible to resolve
               ambiguous nucleotide codes before calling this
               method. Returns 'X' for unknown codons and an empty string
               for input strings that are not three characters long.
     
               It is not recommended to use this method in a production
               environment. Use method translate, instead.
     
     Example :
     Returns : A string
     Args    : a codon = a three nucleotide character string
     
     
    =cut
     
    sub translate_strict{
       my ($self, $value) = @_;
       my ($id) = $self->{'id'};
     
       $value  = lc $value;
       $value  =~ tr/u/t/;
     
       if (length $value != 3 ) {
           return '';
       }
       elsif (!(defined $CODONS->{$value}))  {
           return 'X';
       }
       else {
           return substr($TABLES[$id-1],$CODONS->{$value},1);
       }
    }
     
    =head2 revtranslate
     
     Title   : revtranslate
     Usage   : $obj->revtranslate('G')
     Function: returns codons for an amino acid
     
               Returns an empty string for unknown amino acid
               codes. Ambiquous IUPAC codes Asx,B, (Asp,D; Asn,N) and
               Glx,Z (Glu,E; Gln,Q) are resolved. Both single and three
               letter amino acid codes are accepted. '*' and 'Ter' are
               used for terminator.
     
               By default, the output codons are shown in DNA.  If the
               output is needed in RNA (tr/t/u/), add a second argument
               'RNA'.
     
     Example : $obj->revtranslate('Gly', 'RNA')
     Returns : An array of three lower case letter strings i.e. codons
     Args    : amino acid, 'RNA'
     
    =cut
     
    sub revtranslate {
        my ($self, $value, $coding) = @_;
        my ($id) = $self->{'id'};
        my (@aas,  $p);
        my (@codons) = ();
     
        if (length($value) == 3 ) {
    	$value = lc $value;
    	$value = ucfirst $value;
    	$value = $THREELETTERSYMBOLS{$value};
        }
        if ( defined $value and $value =~ /$VALID_PROTEIN/ 
    	 and length($value) == 1 ) {
    	$value = uc $value;
    	@aas = @{$IUPAC_AA{$value}};	
    	foreach my $aa (@aas) {
    	    #print $aa, " -2\n";
    	    $aa = '\*' if $aa eq '*';
    	    while ($TABLES[$id-1] =~ m/$aa/g) {
    		$p = pos $TABLES[$id-1];
    		push (@codons, $TRCOL->{--$p});
    	    }
    	}
        }
     
        if ($coding and uc ($coding) eq 'RNA') {
    	for my $i (0..$#codons)  {
    	    $codons[$i] =~ tr/t/u/;
    	}
        }
     
        return @codons;
    }
    =head2 reverse_translate_all
     
     Title   : reverse_translate_all
     Usage   : my $iup_str = $cttable->reverse_translate_all($seq_object)
               my $iup_str = $cttable->reverse_translate_all($seq_object,
                                                             $cutable,
                                                             15);
     Function: reverse translates a protein sequence into IUPAC nucleotide
               sequence. An 'X' in the protein sequence is converted to 'NNN'
               in the nucleotide sequence.
     Returns : a string
     Args    : a Bio::PrimarySeqI compatible object (mandatory)
               a Bio::CodonUsage::Table object and a threshold if only
                 codons with a relative frequency above the threshold are
                 to be considered. 
     
     
    =cut
     
    sub reverse_translate_all {
     
    	my ($self, $obj, $cut, $threshold) = @_;
     
        ## check args are OK
     
    	if (!$obj || !$obj->isa('Bio::PrimarySeqI')){
    		$self->throw(" I need a Bio::PrimarySeqI object, not a [".
    						ref($obj) . "]");
    		}
    	if($obj->alphabet ne 'protein')	{
    		$self->throw("Cannot reverse translate, need an amino acid sequence .".
                         "This sequence is of type [" . $obj->alphabet ."]");
    		}
    	my @data;
    	my @seq = split '', $obj->seq;
     
    	## if we're not supplying a codon usage table...
    	if( !$cut && !$threshold) {
    		## get lists of possible codons for each aa. 
    		for my $aa (@seq) {
    			if ($aa =~ /x/i) {
    				push @data, (['NNN']);
    			}else {
    				my @cods = $self->revtranslate($aa);
    				push @data, \@cods;
    			}
    		}
    	}else{
    	#else we are supplying a codon usage table, we just want common codons
    	#check args first. 
    		if(!$cut->isa('Bio::CodonUsage::Table'))	{
    			$self->throw("I need a Bio::CodonUsage::Table object, not a [".
                         ref($cut). "].");
    			}
    		my $cod_ref = $cut->probable_codons($threshold);
    		for my $aa (@seq) {
    			if ($aa =~ /x/i) {
    				push @data, (['NNN']);
    				next;
    				}
    			push @data, $cod_ref->{$aa};
    		}
    	}
     
    	return $self->_make_iupac_string(\@data);
     
    }
     
    =head2 is_start_codon
     
     Title   : is_start_codon
     Usage   : $obj->is_start_codon('ATG')
     Function: returns true (1) for all codons that can be used as a
               translation start, false (0) for others.
     Example : $myCodonTable->is_start_codon('ATG')
     Returns : boolean
     Args    : codon
     
     
    =cut
     
    sub is_start_codon{
       my ($self, $value) = @_;
       my ($id) = $self->{'id'};
     
       $value  = lc $value;
       $value  =~ tr/u/t/;
     
       if (length $value != 3  )  {
           return 0;
       }
       else {
           my $result = 1;
           my @ms = map { substr($STARTS[$id-1],$CODONS->{$_},1) } _unambiquous_codons($value);
           foreach my $c (@ms) {
    	   $result = 0 if $c ne 'M';
           }
           return $result;
       }
    }
     
     
     
    =head2 is_ter_codon
     
     Title   : is_ter_codon
     Usage   : $obj->is_ter_codon('GAA')
     Function: returns true (1) for all codons that can be used as a
               translation tarminator, false (0) for others.
     Example : $myCodonTable->is_ter_codon('ATG')
     Returns : boolean
     Args    : codon
     
     
    =cut
     
    sub is_ter_codon{
       my ($self, $value) = @_;
       my ($id) = $self->{'id'};
     
       $value  = lc $value;
       $value  =~ tr/u/t/;
     
       if (length $value != 3  )  {
           return 0;
       }
       else {
           my $result = 1;
           my @ms = map { substr($TABLES[$id-1],$CODONS->{$_},1) } _unambiquous_codons($value);
           foreach my $c (@ms) {
    	   $result = 0 if $c ne $TERMINATOR;
           }
           return $result;
       }
    }
     
    =head2 is_unknown_codon
     
     Title   : is_unknown_codon
     Usage   : $obj->is_unknown_codon('GAJ')
     Function: returns false (0) for all codons that are valid,
    	    true (1) for others.
     Example : $myCodonTable->is_unknown_codon('NTG')
     Returns : boolean
     Args    : codon
     
     
    =cut
     
    sub is_unknown_codon{
       my ($self, $value) = @_;
       my ($id) = $self->{'id'};
     
       $value  = lc $value;
       $value  =~ tr/u/t/;
     
       if (length $value != 3  )  {
           return 1;
       }
       else {
           my $result = 0;
           my @cs = map { substr($TABLES[$id-1],$CODONS->{$_},1) } _unambiquous_codons($value);
           $result = 1 if scalar @cs == 0;
           return $result;
       }
    }
     
    =head2 _unambiquous_codons
     
     Title   : _unambiquous_codons
     Usage   : @codons = _unambiquous_codons('ACN')
     Function:
     Example :
     Returns : array of strings (one letter unambiguous amino acid codes)
     Args    : a codon = a three IUPAC nucleotide character string
     
    =cut
     
    sub _unambiquous_codons{
        my ($value) = @_;
        my @nts = ();
        my @codons = ();
        my ($i, $j, $k);
        @nts = map { $IUPAC_DNA{uc $_} }  split(//, $value);
        for my $i (@{$nts[0]}) {
    	for my $j (@{$nts[1]}) {
    	    for my $k (@{$nts[2]}) {
    		push @codons, lc "$i$j$k";
    	    }
    	}
        }
        return @codons;
    }
     
    =head2 add_table
     
     Title   : add_table
     Usage   : $newid = $ct->add_table($name, $table, $starts)
     Function: Add a custom Codon Table into the object.
               Know what you are doing, only the length of
               the argument strings is checked!
     Returns : the id of the new codon table
     Args    : name, a string, optional (can be empty)
               table, a string of 64 characters
               startcodons, a string of 64 characters, defaults to standard
     
    =cut
     
    sub add_table {
        my ($self, $name, $table, $starts) = @_;
     
        $name ||= 'Custom'. scalar @NAMES + 1;
        $starts ||= $STARTS[0]; 
        $self->throw('Suspect input!')
            unless length($table) == 64 and length($starts) == 64;
     
        push @NAMES, $name;
        push @TABLES, $table;
        push @STARTS, $starts;
     
        return scalar @NAMES;
     
    }
     
    sub _make_iupac_string {
     
    	my ($self, $cod_ref) = @_;
    	if(ref($cod_ref) ne 'ARRAY') {
    		$self->throw(" I need a reference to a list of references to codons, ".
    					 " not a [". ref($cod_ref) . "].");
    		}
        my %iupac_hash   = Bio::Tools::IUPAC->iupac_rev_iub();
    	my $iupac_string = ''; ## the string to be returned
    	for my $aa (@$cod_ref) {
     
    		## scan through codon positions, record the differing values,	
    		# then look up in the iub hash
    		for my $index(0..2) {
    			my %h;
    			map { my $k = substr($_,$index,1);
    		 		$h{$k}  = undef;} @$aa;
    			my $lookup_key = join '', sort{$a cmp $b}keys %h;
     
                ## extend string 
    			$iupac_string .= $iupac_hash{uc$lookup_key};
    		}
    	}
        return $iupac_string;
     
    }
     
     
    1;
    Je vais clore le sujet, merci pour ton aide.
    -- Jasmine --

  9. #9
    Membre émérite
    Avatar de Jasmine80
    Femme Profil pro
    Bioinformaticienne
    Inscrit en
    Octobre 2006
    Messages
    3 157
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 44
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Bioinformaticienne
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2006
    Messages : 3 157
    Points : 2 673
    Points
    2 673
    Par défaut
    J'arrive pas à dormir et j'ai du code qui me trotte en tête ... est-ce grave docteur?

    J'ai une nouvelle question qui m'est venue. Les antivirus utilisent des signatures afin de reconnaitre les virus. Comment se fait-il que cela soit confondu avec un script perl?
    -- Jasmine --

  10. #10
    Expert éminent
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Points : 8 586
    Points
    8 586
    Par défaut
    Citation Envoyé par Jasmine80 Voir le message
    J'ai une nouvelle question qui m'est venue. Les antivirus utilisent des signatures afin de reconnaitre les virus. Comment se fait-il que cela soit confondu avec un script perl?
    Les antivirus utilisent une panoplie de méthodes dont les signatures, mais pas seulement.
    Je suppose qu'une heuristique mal réglée a confondu un bout de texte du code Perl avec une tentative de Phising quoique j'ai du mal à voir comment... C'est presque à coup sûr une fausse alerte (c'est relativement commun, regarde le nombre d'installateurs qui précise maintenant de désactiver l'antivirus durant l'installation ou que tel et tel antivirus donne une fausse alerte durant l'installation, etc...).

    --
    Jedaï

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. winloghon.exe infecté par un trojan
    Par sam01 dans le forum Sécurité
    Réponses: 24
    Dernier message: 28/11/2010, 14h27
  2. Réponses: 13
    Dernier message: 24/08/2010, 10h23
  3. Changer le nom du processus (Perl.exe par monscirpt.pl)
    Par Julon dans le forum Programmation et administration système
    Réponses: 8
    Dernier message: 08/06/2009, 21h51
  4. Problème Processus "perl.exe" Oracle 10g
    Par mugla dans le forum Installation
    Réponses: 2
    Dernier message: 11/12/2007, 10h19
  5. Perl.exe crash à chaque appel
    Par Fabien Celaia dans le forum Langage
    Réponses: 4
    Dernier message: 07/06/2006, 08h56

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo