2013-05-01 60 views
0

我有一個perl腳本,它從輸入文本文件中獲取一些字段並將其轉換爲生成更有用的(對於我)文本文件。Perl腳本在我的計算機上正常工作,而不是在遠程服務器上

當我在我的Mac上運行它(有一個非常小的文件由真實文件中的幾行構成)時,它會生成正確的輸出。它會產生一些警告,粘貼在下面,但輸出是可以的。

當我在我的機構的服務器上運行這個完全相同的腳本時,它會返回很多「使用未初始化值」的警告,雖然它創建一個輸出文件,但它的內容完全一致,作爲輸入文件。我也用我在我的電腦上測試過的小文件來嘗試它。

我有一種感覺,這與perl的版本有關?我不是管理員,那我該如何解決這個問題?

警告返回服務器上:

Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 1. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 1. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 1. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 1. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 1. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 1. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 1. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 1. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 1. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 1. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 1. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 2. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 2. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 2. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 2. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 2. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 2. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 2. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 2. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 2. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 2. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 2. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 3. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 3. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 3. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 3. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 3. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 3. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 3. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 3. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 3. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 3. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 3. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 4. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 4. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 4. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 4. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 4. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 4. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 4. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 4. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 4. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 4. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 4. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 5. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 5. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 5. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 5. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 5. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 5. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 5. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 5. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 5. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 5. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 5. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 6. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 6. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 6. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 6. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 6. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 6. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 6. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 6. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 6. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 6. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 6. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 7. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 7. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 7. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 7. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 7. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 7. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 7. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 7. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 7. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 7. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 7. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 8. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 8. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 8. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 8. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 8. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 8. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 8. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 8. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 8. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 8. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 8. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 48, <R2_FILE> line 9. 
Use of uninitialized value $Clipped in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 9. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 53, <R2_FILE> line 9. 
Use of uninitialized value $Read_Cigar in pattern match (m//) at ../perl/R2_Warrior.pl line 59, <R2_FILE> line 9. 
Use of uninitialized value $Matched in negation (-) at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 9. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 64, <R2_FILE> line 9. 
Use of uninitialized value $Read_Info in pattern match (m//) at ../perl/R2_Warrior.pl line 73, <R2_FILE> line 9. 
Use of uninitialized value $X2 in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 9. 
Use of uninitialized value $Read_Seq in substr at ../perl/R2_Warrior.pl line 91, <R2_FILE> line 9. 
Use of uninitialized value $X2 in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 9. 
Use of uninitialized value $Matched in addition (+) at ../perl/R2_Warrior.pl line 97, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 
Use of uninitialized value in concatenation (.) or string at ../perl/R2_Warrior.pl line 104, <R2_FILE> line 9. 

腳本:

use strict; 
use warnings; 


my ($Line) = ""; 
my (@Split_Line) =(); 
my (%All_read_and_info_HASH) =(); 


open(R2_FILE,"R2_Sample.txt") || die "Sorry I couldn't open the INPUT file: $!\n"; 
open(OUTPUT, ">R2_Output.txt") || die "Sorry I couldnt create the OUTPUT file: $!\n"; 

while(<R2_FILE>){ 

    ### Elimina los \n 
    ### Parte cada linea por tabuladores 
    chomp; 
    $Line = $_; 
    @Split_Line = split(/\t+/, $Line); 


    ### Guarda los campos de donde se obtiene el resto de la informacion 
    my $Read_Name = $Split_Line[0]; 
    my $Read_ID = $Split_Line[3]; 
    my $Read_Cigar = $Split_Line[5]; 
    my $Read_Seq = $Split_Line[9]; 
    my $Read_Info = $Split_Line[14]; 


    #print "$Read_Name\t$Read_Cigar\t$Read_Seq\t$Read_Info\n"; 
    #<STDIN>; 


    ########################################################## 
    ### Llena el hash de hashes       ### 
    ### Key = $Read_Name         ### 
    ### La segunda llave, i.e. 'Sequence' son cada uno de ### 
    ### los campos del 0 al 8 del PDF      ### 
    ########################################################## 

    my($Clipped, $Matched, $X1, $X2, $Temporal_Seq); 

    ### [0]: Guarda la secuencia del read 
    $All_read_and_info_HASH{$Read_Name}{'Sequence'} = $Read_Seq; 


    ### [1]: Guarda el numero de nt 'clipeados' 
    if ($Read_Cigar =~ /(\d+)S\d+M/){ $Clipped = $1; } 
    $All_read_and_info_HASH{$Read_Name}{'Clipped_Nt'} = $Clipped; 


    ### [2]: Guarda los primeros N nt de la secuencia completa del read 
    $Temporal_Seq = substr($Read_Seq, 0, $Clipped); 
    $All_read_and_info_HASH{$Read_Name}{'Non_R2_Sequence'} = $Temporal_Seq; 
    $Temporal_Seq = ""; 


    ### [3]: Guarda el numero de nt matcheados a R2 
    if ($Read_Cigar =~ /\d+S(\d+)M/){ $Matched = $1; } 
    $All_read_and_info_HASH{$Read_Name}{'R2_Matched_Nt'} = $Matched; 


    ### [4]: Guarda los ultimos N nt de la secuencia completa del read (Las bases matcheadas a R2) 
    $Temporal_Seq = substr($Read_Seq, -$Matched); 
    $All_read_and_info_HASH{$Read_Name}{'R2_Matched_Sequence'} = $Temporal_Seq; 
    $Temporal_Seq = ""; 


    ### [5]: Guarda el CIGAR string 
    $All_read_and_info_HASH{$Read_Name}{'CIGAR'} = $Read_Cigar; 


    if ($Read_Info =~ /\+(\d+),(\d+)M/){ 
    $X1 = $1; 
    $X2 = $2; 

    #print "$X1\t$X2\n"; 
    #<STDIN>; 
    } 


    ### [6]: Guarda el numero X1 
    $All_read_and_info_HASH{$Read_Name}{'28s_Start'} = $X1; 


    ### [7]: Guarda el numero X2 
    $All_read_and_info_HASH{$Read_Name}{'28s_Matched_NT'} = $X2; 


    ### [8]: Guarda los primeros X2 nt de la secuencia completa del read 
    $Temporal_Seq = substr($Read_Seq, 0, $X2); 
    $All_read_and_info_HASH{$Read_Name}{'28s_Matched_Sequence'} = $Temporal_Seq; 
    $Temporal_Seq = ""; 


    ### [9]: Calcula 144-([3] + [7]) 
    $All_read_and_info_HASH{$Read_Name}{'Result'} = (144 - ($Matched + $X2)); 


    ### [10]: Guarda el sitio de R2 Truncation 
    $All_read_and_info_HASH{$Read_Name}{'R2_Truncation'} = $Read_ID; 


    print OUTPUT $Read_Name."\t".$All_read_and_info_HASH{$Read_Name}{'Sequence'}."\t".$All_read_and_info_HASH{$Read_Name}{'Clipped_Nt'}."\t".$All_read_and_info_HASH{$Read_Name}{'Non_R2_Sequence'}."\t".$All_read_and_info_HASH{$Read_Name}{'R2_Matched_Nt'}."\t".$All_read_and_info_HASH{$Read_Name}{'R2_Matched_Sequence'}."\t".$All_read_and_info_HASH{$Read_Name}{'CIGAR'}."\t".$All_read_and_info_HASH{$Read_Name}{'28s_Start'}."\t".$All_read_and_info_HASH{$Read_Name}{'28s_Matched_NT'}."\t".$All_read_and_info_HASH{$Read_Name}{'28s_Matched_Sequence'}."\t".$All_read_and_info_HASH{$Read_Name}{'Result'}."\t".$All_read_and_info_HASH{$Read_Name}{'R2_Truncation'}."\n"; 


    #print $Read_Name."\n".$All_read_and_info_HASH{$Read_Name}{'Sequence'}."\n".$All_read_and_info_HASH{$Read_Name}{'First_N'}."\n".$All_read_and_info_HASH{$Read_Name}{'Sequence'}."\n".$All_read_and_info_HASH{$Read_Name}{'Last_N'}."\n"; 

    #<STDIN>; 
} 
close(R2_FILE); 
close(OUTPUT); 
+0

你有沒有比較的Perl的版本?腳本在服務器上的較小文件上使用時是否提供正確的輸出?警告你的意思是'@Split_Line = split(/ \ t + /,$ Line);'沒有按預期工作,並且沒有變量被初始化。 – 2013-05-01 19:23:16

+0

這個問題是關閉的話題在這裏(不要擔心,它可能會自動遷移)。你的問題幾乎可以肯定的是,服務器上存在與你本地嘗試的文件不同的文件,所以你的'split'失敗了@AlexeyIvanov的建議。另外,當問這種問題時,包含一個示例輸入文件是一個好主意。 – terdon 2013-05-01 19:38:23

+1

一個經常被忽視的陷阱是,你有錯誤的行尾(特別是郵寄腳本時)。根據我的經驗,可能會產生最多的錯誤。那麼,您是如何將腳本傳輸到您的服務器以及您的計算機和機構的服務器上運行哪個操作系統的? – mpy 2013-05-01 20:03:36

回答

2

嘗試使用

​​

,因爲你是在循環的塊外設置它。

您還可以設置您的變量是這樣的...

my($Read_Name, $Read_ID ,$Read_Cigar , $Read_Seq , $Read_Info) = 
     split(/\t+/, $Line); 
+0

是的,'@ Split_Line'聲明可能是原因。您可能需要在'while'結尾處清除數組。但是,我不確定。 – 2013-05-02 13:42:44

+0

如果仔細觀察上面的腳本,會看到有些索引被跳過,所以表達式my($ Read_Name,...)不起作用。要跳過某個值,請使用'undef':'my($ Read_Name,undef,undef,$ Read_ID,...)= split(/ \ t + /,$ Line);'。 – 2013-05-02 13:46:44

相關問題