Bonjour,
Pour la prochaine fois, le forum "langage" est mieux adapté à ce type de question que "Programmation et administration système". Essaie par ailleurs d'utiliser les balises (en particulier la balise CODE).
Sauf erreur de ma part il manque la ligne
AGmSSNQSISsPVLDAVPr_S11(Phospho);M3(Oxidation)_M3(Oxidation);S11(Phospho);R19(Label:13C(6)15N(4))
dans ta partie "Exemple:".
de plus la ligne
AHLsENELEALEk_S4(Phospho)_S4(Phospho);K13(Label:13C(6)15N(2))
est en double... Est-ce normal ?
Moyennant cette correction, i.e. en prenant comme fichier d'entrée celiac.dat contenant
AGTLSITEFADmLSGNAGGFrsr_S22(Phospho);M12(Oxidation)_M12(Oxidation);R21(Label:13C(6)15N(4));S22(Phospho);R23(Label:13C(6)15N(4))
AGmSSNQSISsPVLDAVPR_S11(Phospho);M3(Oxidation)_M3(Oxidation);S11(Phospho)
AHLsENELEALEk_S4(Phospho)_S4(Phospho);K13(Label:13C(6)15N(2))
AGAGmITQHSSNAsPINR_S14(Phospho);M5(Oxidation)_M5(Oxidation);S14(Phospho)
AHLsENELEALEK_S4(Phospho)_S4(Phospho)
AGTLSITEFADMLSGNAGGFRsR_S22(Phospho)_S22(Phospho)
AHLsENELEALEk_S4(Phospho)_S4(Phospho);K13(Label:13C(6)15N(2))
AHLTVGQAAAGGsGNLLTER_S13(Phospho)_S13(Phospho)
AHLTVGQAAAGGsGNLLTEr_S13(Phospho)_S13(Phospho);R20(Label:13C(6)15N(4))
AGAGmITQHSSNAsPINr_S14(Phospho);M5(Oxidation)_M5(Oxidation);S14(Phospho);R18(Label:13C(6)15N(4))
AGmSSNQSISsPVLDAVPr_S11(Phospho);M3(Oxidation)_M3(Oxidation);S11(Phospho);R19(Label:13C(6)15N(4))
et avec le script celiac.pl suivant
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
| use strict;
use warnings;
my %unlabeled;
my %labeled;
# lecture du (ou des) fichier(s) contenant les séquences (marquées et non marquées).
while (defined(my $line = <>)) {
$line =~ s/[\r\n]*$//;
next if $line =~ /^\s*$/;
my ($cased_seq, $cased_mod1, $cased_mod2) = split /_/, $line;
my ($lower_seq, $lower_mod1, $lower_mod2) = map { lc } ($cased_seq, $cased_mod1, $cased_mod2);
# pour être indépendant de la casse on prend comme clé la version "en minuscules" de ${seq}_${mod1}
my $key = $lower_seq . "_" . $lower_mod1;
if ($lower_mod2 =~ /label/) {
# la séquence est marquée
warn "une sequence marquee existe deja pour la cle '$key'\n",
"existante : $labeled{$key}\n",
"courante : $line\n"
if exists $labeled{$key};
$labeled{$key} = $line;
} else {
# la séquence n'est pas marquée
warn "une sequence non marquee existe deja pour la cle '$key'\n",
"existante : $unlabeled{$key}\n",
"courante : $line\n"
if exists $unlabeled{$key};
$unlabeled{$key} = $line;
}
}
print "--> Sequences appariees:\n";
for my $key (keys %unlabeled) {
if (exists $labeled{$key}) {
print "$unlabeled{$key}\n";
print "$labeled{$key}\n";
delete $unlabeled{$key};
delete $labeled{$key};
}
}
print "--> Sequences non appariees:\n";
print "$_\n" for values(%unlabeled);
print "$_\n" for values(%labeled); |
j'obtiens le résultat suivant :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Taisha:~/perl/forum $ perl celiac.pl celiac.dat
une sequence marquee existe deja pour la cle 'ahlsenelealek_s4(phospho)'
existante : AHLsENELEALEk_S4(Phospho)_S4(Phospho);K13(Label:13C(6)15N(2))
courante : AHLsENELEALEk_S4(Phospho)_S4(Phospho);K13(Label:13C(6)15N(2))
--> Sequences appariees:
AHLTVGQAAAGGsGNLLTER_S13(Phospho)_S13(Phospho)
AHLTVGQAAAGGsGNLLTEr_S13(Phospho)_S13(Phospho);R20(Label:13C(6)15N(4))
AHLsENELEALEK_S4(Phospho)_S4(Phospho)
AHLsENELEALEk_S4(Phospho)_S4(Phospho);K13(Label:13C(6)15N(2))
AGmSSNQSISsPVLDAVPR_S11(Phospho);M3(Oxidation)_M3(Oxidation);S11(Phospho)
AGmSSNQSISsPVLDAVPr_S11(Phospho);M3(Oxidation)_M3(Oxidation);S11(Phospho);R19(Label:13C(6)15N(4))
AGAGmITQHSSNAsPINR_S14(Phospho);M5(Oxidation)_M5(Oxidation);S14(Phospho)
AGAGmITQHSSNAsPINr_S14(Phospho);M5(Oxidation)_M5(Oxidation);S14(Phospho);R18(Label:13C(6)15N(4))
--> Sequences non appariees:
AGTLSITEFADMLSGNAGGFRsR_S22(Phospho)_S22(Phospho)
AGTLSITEFADmLSGNAGGFrsr_S22(Phospho);M12(Oxidation)_M12(Oxidation);R21(Label:13C(6)15N(4));S22(Phospho);R23(Label:13C(6)15N(4))
Taisha:~/perl/forum $ |
qui semble faire ce que tu veux (au warning près...). Mais je ne suis pas certain de comprendre quel est ton problème avec Oxidation.
Partager