-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathKit_basic_stats.pl
More file actions
executable file
·74 lines (60 loc) · 1.28 KB
/
Kit_basic_stats.pl
File metadata and controls
executable file
·74 lines (60 loc) · 1.28 KB
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
#!usr/bin/perl -w
use strict;
die "Usage: perl $0 [fq.infor] [primers.fas] [out.table]\n" unless (@ARGV == 3);
open FQ, "$ARGV[0]" or die "$ARGV[0] $!\n";
open PRI, "$ARGV[1]" or die "$ARGV[1] $!\n";
open OT, ">$ARGV[2]" or die "$ARGV[2] $!\n";
my (%raw_data);
#my $header = <FQ>;
while(<FQ>){
chomp;
my @line = split;
my @id = split/\./, $line[0];
$raw_data{$id[0]} = $line[1];
}
my %primers;
while(<PRI>){
chomp;
if(/^>/){
my $line = $_;
$line =~ s/\>//;
my @line = split/\_/;
$primers{$line[0]} = 1;
}
}
my %demul;
foreach my $k (sort keys %raw_data){
print OT "$k\t$raw_data{$k}\t";
open DE, "$k\.demultiplex.infor" or die "$k\.demultiplex.infor $!\n";
my $header = <DE>;
while(<DE>){
my @line = split;
my $gene = shift @line;
my $numbers = join "\t", @line;
$demul{$k}{$gene} = $numbers;
print OT "$gene\t$numbers\t";
open MG, "$k\_$gene\.merged.fastq" or die "$k\_$gene\.merged.fastq $!\n";
my $fq = 0;
while(<MG>){
$fq ++;
}
close MG;
$fq = $fq / 4;
print OT "$fq\t";
my $fa = 0;
open MG, "$k\_$gene\.merged.fasta" or die "$k\_$gene\.merged.fasta $!\n";
while(<MG>){
if(/^>/){
$fa ++;
}
}
close MG;
print OT "$fa\t";
$demul{$k}{$gene} .= $fq."\t".$fa;
}
print OT "\n";
}
close FQ;
close PRI;
close OT;
print "DONE!";