根据每个fq 文件比对到基因集的统计其丰度(相对丰度)
再根据丰度(相对丰度) 从基因集里提取序列
getDataFromList.pl
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my $usage = <<_USAGE_;
usage :
version 1.0
getDataFromList.pl -i inputList -l log -td TMP_DONE -d target -p perl dir -q query column -t target column -o output dir -m mark
_USAGE_
my ($inputList, $totalRunLog, $TMP_DONE, $target, $queryColumn, $targetColumn, $perl_dir, $outputDir, $mark);
GetOptions(
"i=s" => \$inputList,
"d=s" => \$target,
"l=s" => \$totalRunLog,
"td=s" => \$TMP_DONE,
"q=s" => \$queryColumn,
"t=s" => \$targetColumn,
"o=s" => \$outputDir,
"p=s" => \$perl_dir,
"m=s" => \$mark
);
die $usage if (!$inputList || !$totalRunLog || !$TMP_DONE || !$target || !$queryColumn || !$targetColumn || !$outputDir|| !$perl_dir);
$queryColumn--;
$targetColumn--;
#my @targets = split/\s+/, $targetLine;
#foreach my $target (@targets){
# $target =~ /.+\/(.+)\./;
# my $mark = $1;
my %target;
open (my $t, "$target") || die "$!:$target\n";
while (<$t>){
chomp;next if ($_ eq '');s/\r//g;
my @entries = split/\t/;
if ($target{$entries[$targetColumn]}){
push (@{$target{$entries[$targetColumn]}}, $_);
}else{
$target{$entries[$targetColumn]}->[0] = $_;
}
}
close $t;
$inputList =~ /.+\/(.+?)\./;
my $sample = $1;
open (my $in, "$inputList" ) || die "$!:$inputList\n";
open (my $out, ">$outputDir/$sample.$mark.output") || die "$!:$outputDir/$sample.$mark.output\n";
while (<$in>){
chomp;next if ($_ eq '');s/\r//g;
my @entries = split/\t/;
my $key = $entries[$queryColumn];
if ($target{$key}){
foreach my $annot ( @{$target{$key}}){
print $out "$annot\n";
}
}
}
close $in;
close $out;
#}