0

作为后续(查找这个和那个核苷酸序列的多个匹配项

我现在想将每个 ORF(如 ATG...TAG 或 ATG...TAA)添加到每个序列的哈希中,以便对于任何序列,我都将 ORF 作为值附加。我到目前为止 -

#!/usr/bin/perl
use warnings;
use strict;

my @file = qw(ATGCCCCCCCCCCCCCTAGATGAAAAAAAAAATAAATGAAAAATAGATGCCCCCCCCCCCCCCC ATGCGCGCTATATATGCGCGGGCTAATATAT ATATGAGGTCGTAGCTAGCAAACACAAATAAA );

my %hash;
foreach (@file){
my @match = ($_ =~ /(ATG\w+?TA[AG])/g);

# then make %hash with sequence as key and ORFs as values)...

}

谁能帮我?

4

1 回答 1

0

以您的代码为基础:(我更改了核苷酸序列,以便更容易查看终止和起始密码子,但对您的序列的工作方式完全相同......)我还将您匹配的序列存储在一个数组哈希中的数组,如下所示:

#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

my @file = qw(ATGcgcgcgcgcgcgTAAATGatatatatataTAG ATGcccccccccTAAgggggggggATGtttttttttttTAG atATGaggggaTAGaaaatttttttctttct);

my (@match, %hash, @sequence, $line);
my $line_number = 0;
foreach  (@file){
    push @match, /(ATG\w+?TA[AG])/g;    
    push @sequence, @file for 0 .. $#match; 
}

push @ { $hash{$sequence[$_]}}, [$match[$_] ] for 0 .. $#match; # Hasho of arrays

for my $key (sort keys %hash){
        for my $orf (@ { $hash{$key}}){
            my ($match) = @$orf;
            print "Sequence:$key contains ORFs: $match\n";
    }
}

输出:

Sequence:ATGcccccccccTAAgggggggggATGtttttttttttTAG contains ORFs: ATGatatatatataTAG
Sequence:ATGcccccccccTAAgggggggggATGtttttttttttTAG contains ORFs: ATGaggggaTAG
Sequence:ATGcgcgcgcgcgcgTAAATGatatatatataTAG contains ORFs: ATGcgcgcgcgcgcgTAA
Sequence:ATGcgcgcgcgcgcgTAAATGatatatatataTAG contains ORFs: ATGtttttttttttTAG
Sequence:atATGaggggaTAGaaaatttttttctttct contains ORFs: ATGcccccccccTAA
于 2013-09-03T16:48:29.677 回答