Skip to content

Commit

Permalink
Update to record all sequences for which no classifications were output
Browse files Browse the repository at this point in the history
  • Loading branch information
skoren committed Oct 24, 2012
1 parent 55d602e commit b152d7e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
30 changes: 29 additions & 1 deletion Utilities/perl/ImportFCP.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
my $combine;
my $local;
my $url;
my $fastaClassified;

GetOptions(
'o=s' => \$outFile,
'i' => \$include,
'c' => \$combine,
'p' => \$includeConfidence,
'l' => \$local,
'u=s' => \$url
'u=s' => \$url,
'f=s' => \$fastaClassified
);

if
Expand Down Expand Up @@ -93,6 +95,22 @@
print "Loading taxonomy...\n";
loadTaxonomy();

# load set of what we could have classified
my %classified;
if (defined($fastaClassified)) {
my @files = split /:/, $fastaClassified;
foreach my $file (@files) {
open F, "<$file" or die $!;
while (my $line = <F>) {
chomp $line;
if ($line =~ /^>(\S*)/) {
$classified{$1} = 1;
}
}
close(F)
}
}

print "Loading name to taxonomy index...\n";
# FCP outputs common names not GI numbers so we have to load the taxonomy and find the gi
open INFO, "<$libPath/../taxonomy/taxonomy.tab" or die
Expand Down Expand Up @@ -255,10 +273,12 @@
}
}
addByTaxID(\%tree, $set, $bestTaxa, $contigID, $magnitude, $conf2);
$classified{$contigID} = 0;
}
else
{
addByTaxID(\%tree, $set, 1, $contigID, $magnitude, 0);
$classified{$contigID} = 0;
}
$totalMagnitude += $magnitude;
}
Expand All @@ -269,6 +289,14 @@
close CONF;
}

foreach my $id (keys %classified) {
if ($classified{$id} == 1) {
my $magnitude = (defined($magnitudes{$id}) ? $magnitudes{$id} : 1);
addByTaxID(\%tree, $set, 0, $id, $magnitude, 0);
$totalMagnitude+=$magnitude;
}
}

if ( $include && $totalMagnitude )
{
$tree{'magnitude'}[$set] = $totalMagnitude;
Expand Down
27 changes: 27 additions & 0 deletions Utilities/perl/ImportPhyloSift.pl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
my $local;
my $verbose;
my $url;
my $fastaClassified;

GetOptions(
'o=s' => \$outFile,
Expand All @@ -56,6 +57,7 @@
'c' => \$combine,
'l' => \$local,
'v' => \$verbose,
'f=s' => \$fastaClassified,
'u=s' => \$url
);

Expand Down Expand Up @@ -130,6 +132,22 @@
print "Loading taxonomy...\n";
loadTaxonomy();

# load set of what we could have classified
my %classified;
if (defined($fastaClassified)) {
my @files = split /:/, $fastaClassified;
foreach my $file (@files) {
open F, "<$file" or die $!;
while (my $line = <F>) {
chomp $line;
if ($line =~ /^>(\S*)/) {
$classified{$1} = 1;
}
}
close(F)
}
}

# parse BLAST results

my $set = 0;
Expand Down Expand Up @@ -237,6 +255,7 @@
}
}
}
$classified{$currCtg} = 0;
addByTaxID(\%tree, $set, $bestTaxon, $currCtg, $magnitude, $bestScores{$bestName});

$totalMagnitude += $magnitude;
Expand All @@ -257,6 +276,14 @@
$currCtg = $contigID;
}
}

foreach my $id (keys %classified) {
if ($classified{$id} == 1) {
my $magnitude = (defined($magnitudes{$id}) ? $magnitudes{$id} : 1);
addByTaxID(\%tree, $set, 0, $id, $magnitude, 0);
$totalMagnitude+=$magnitude;
}
}

if ( $include && $totalMagnitude )
{
Expand Down

0 comments on commit b152d7e

Please sign in to comment.