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
| use strict;
my ($lineB,$contig,$oligo,$lineA,$query_name,$query_accession,$query_description,$query_length,$hit_name,$hit_accession,$hit_description,$hit_length,$score,$evalue,$hsp_number,$hsp_query_start,$hsp_query_end,$hsp_hit_start,$hsp_hit_end,$hsp_percent_identity,$direction);
my (@elmtsA,@elmtsB);
my %contig2oligo;
open OUT, "> oligo_contig_perfect.txt" or
die "Unable to open oligo_contig_perfect file : $!\n";
open OLIGO, "< oligo_otherV6.txt" or
die "Unable to open input file #2 : $!\n";
while ($lineB=<OLIGO>) {
chomp $lineB;
if ($lineB =~ /^#/) {#Header
next;
}
@elmtsB=split "\t", $lineB;
$contig=$elmtsB[0];
$oligo=$elmtsB[4];
if (defined $contig2oligo{$contig}) {
$contig2oligo{$contig}=$contig2oligo{$contig}."\t$oligo";
#$agilent2Oligos{$agilent}.="\t$oligo";
} else {
$contig2oligo{$contig}=$oligo;
}
open CONTIG, "< blastn-oligo_restrict_otherV6-contig_restrict_otherV6-1e-3-1e-3-1,1.csv" or
die "Unable to open input file #1 : $!\n";
my $noLine=0;
while ($lineA=<CONTIG>) {
$noLine++;
chomp $lineA;
if ($lineA =~/^#/ || $noLine==1) {#Header
##print OUT "query_name\tquery_accession\tquery_description\tquery_length\thit_name\thit_accession\thit_description\thit_length\tscore\tevalue\thsp_number\thsp_query_start\thsp_query_end\thsp_hit_start\thsp_hit_end\thsp_percent_identity\tdirection\tmatch\n";
next;
}
@elmtsA=split ";", $lineA;
$query_name=$elmtsA[0];
$query_accession=$elmtsA[1];
$query_description=$elmtsA[2];
$query_length=$elmtsA[3];
$hit_name=$elmtsA[4];
$hit_accession=$elmtsA[5];
$hit_description=$elmtsA[6];
$hit_length=$elmtsA[7];
$score=$elmtsA[8];
$evalue=$elmtsA[9];
$hsp_number=$elmtsA[10];
$hsp_query_start=$elmtsA[11];
$hsp_query_end=$elmtsA[12];
$hsp_hit_start=$elmtsA[13];
$hsp_hit_end=$elmtsA[14];
$hsp_percent_identity=$elmtsA[15];
$direction=$elmtsA[16];
if (defined $contig2oligo{$hit_name}) {
$contig2oligo{$hit_name}=$contig2oligo{$hit_name}."\t$query_name";
} else {
$contig2oligo{$hit_name}=$query_name;
}
if ($contig2oligo{$contig} eq $contig2oligo{$hit_name}){
print OUT "$query_name\t$hit_name\tOK\n";
} else {
print OUT "$query_name\t$hit_name\tNA\n";
}
}
}
close(OLIGO);
close(CONTIG);
close(OUT); |
Partager