[med-svn] [Git][med-team/radiant][upstream] New upstream version 2.8+dfsg
Nilesh Patra (@nilesh)
gitlab at salsa.debian.org
Wed Jun 2 21:23:04 BST 2021
Nilesh Patra pushed to branch upstream at Debian Med / radiant
Commits:
a7f91b98 by Nilesh Patra at 2021-06-03T01:26:24+05:30
New upstream version 2.8+dfsg
- - - - -
7 changed files:
- KronaTools/lib/KronaTools.pm
- KronaTools/scripts/ClassifyBLAST.pl
- KronaTools/scripts/GetTaxIDFromAcc.pl
- KronaTools/scripts/GetTaxInfo.pl
- KronaTools/scripts/ImportBLAST.pl
- KronaTools/scripts/accession2taxid.make
- KronaTools/src/krona-2.0.js
Changes:
=====================================
KronaTools/lib/KronaTools.pm
=====================================
@@ -114,6 +114,8 @@ my %optionFormats =
'e=i',
'factor' =>
'e=f',
+ 'includeUnk' =>
+ 'f',
'include' =>
'i',
'cellular' =>
@@ -189,6 +191,7 @@ my %optionDescriptions =
'hueGood' => 'Hue (0-360) for "good" scores.',
'percentIdentity' => 'Use percent identity for average scores instead of log[10] e-value.',
'include' => 'Include a wedge for queries with no hits.',
+ 'includeUnk' => 'If any best hits have unknown accessions, force classification to root instead of ignoring them.',
'local' => 'Use resources from the local KronaTools installation instead of bundling them with charts (charts will be smaller but will only work on this computer).',
'magCol' => 'Column of input files to use as magnitude. If magnitude files are specified, their magnitudes will override those in this column.',
'minConfidence' => 'Minimum confidence. Each query sequence will only be added to taxa that were predicted with a confidence score of at least this value.',
@@ -915,7 +918,7 @@ sub classifyBlast
# taxonomically classifies BLAST results based on LCA (or random selection)
# of 'best' hits.
#
- # Options used: bitScore, factor, include, percentIdentity, random, score
+ # Options used: bitScore, factor, include, percentIdentity, random, score, includeUnk
my # parameters
(
@@ -1008,21 +1011,32 @@ sub classifyBlast
last; # EOF
}
- my $acc = getAccFromSeqID($hitID);
-
- if ( ! defined $acc )
- {
- $lastQueryID = $queryID;
- next;
- }
-
if # this is a 'best' hit if...
(
- $queryID ne $lastQueryID || # new query ID (including null at EOF)
+ $ties == 0 || # first hit
$bitScore >= $topScore - $options{'threshold'} || # within score threshold
$options{'factor'} && $eVal <= $options{'factor'} * $topEVal # within e-val factor
)
{
+ my $acc = getAccFromSeqID($hitID);
+ my $newTaxID = getTaxIDFromAcc($acc);
+
+ if
+ (
+ ! defined $acc ||
+ ! $options{'includeUnk'} && (! $newTaxID || ! taxIDExists($newTaxID))
+ )
+ {
+ $lastQueryID = $queryID;
+ next;
+ }
+
+ if ( $ties == 0 )
+ {
+ $topScore = $bitScore;
+ $topEVal = $eVal;
+ }
+
# add score for average
#
if ( $options{'percentIdentity'} )
@@ -1055,8 +1069,6 @@ sub classifyBlast
int(rand($ties)) == 0 # randomly chosen to replace other hit
)
{
- my $newTaxID = getTaxIDFromAcc($acc);
-
if ( ! $newTaxID || ! taxIDExists($newTaxID) )
{
$newTaxID = 1;
@@ -1073,12 +1085,6 @@ sub classifyBlast
}
}
- if ( $queryID ne $lastQueryID )
- {
- $topScore = $bitScore;
- $topEVal = $eVal;
- }
-
$lastQueryID = $queryID;
}
@@ -1218,6 +1224,11 @@ sub getTaxInfo
$tax = int($tax);
+ if ( $tax == 0 )
+ {
+ return ('', '', '', '', '');
+ }
+
if ( defined $taxInfoByID{$tax} )
{
return @{$taxInfoByID{$tax}};
@@ -1822,6 +1833,11 @@ sub taxLowestCommonAncestor
#
foreach my $node ( @nodes )
{
+ if ( $node == 1)
+ {
+ return 1; # early out if any nodes are root
+ }
+
while ( getTaxDepth($node) > $minDepth )
{
$node = getTaxParent($node);
=====================================
KronaTools/scripts/ClassifyBLAST.pl
=====================================
@@ -21,6 +21,7 @@ my @options =
qw(
out
threshold
+ includeUnk
random
percentIdentity
bitScore
=====================================
KronaTools/scripts/GetTaxIDFromAcc.pl
=====================================
@@ -23,6 +23,7 @@ my $help;
my $prepend;
my $append;
my $tax;
+my $field = 1;
GetOptions
(
@@ -30,7 +31,8 @@ GetOptions
'help' => \$help,
'p' => \$prepend,
'a' => \$append,
- 'tax=s' => \$tax
+ 'tax=s' => \$tax,
+ 'f=i' => \$field
);
if ( defined $tax )
@@ -59,13 +61,17 @@ Usage:
Fasta tag example:
- grep ">" sequence
+ grep ">" sequence | ktGetTaxIDFromAcc > sequence.tax
Options:
- -p Prepend tax IDs to the original lines (separated by tabs).
+ [-p] Prepend tax IDs to the original lines (separated by tabs).
- -a Append tax IDs to the original lines (separated by tabs).
+ [-a] Append tax IDs to the original lines (separated by tabs).
+
+ [-f] <integer> Field of accessions. [Default: \'1\']
+
+ [-tax <string> Path to directory containing a taxonomy database to use.
';
exit;
@@ -83,6 +89,11 @@ if ( @ARGV == 0 )
{
$stdin = 1;
}
+elsif ( $field != 1 )
+{
+ print STDERR "ERROR: -f requires stdin, not command line input.\n";
+ exit 1;
+}
while ( my $in = $stdin ? <STDIN> : shift @ARGV )
{
@@ -99,7 +110,8 @@ while ( my $in = $stdin ? <STDIN> : shift @ARGV )
print "$in\t";
}
- print getTaxIDFromAcc(getAccFromSeqID($in));
+ my $acc = (split /\t/, $in)[$field - 1];
+ print getTaxIDFromAcc(getAccFromSeqID($acc));
if ( $prepend )
{
=====================================
KronaTools/scripts/GetTaxInfo.pl
=====================================
@@ -17,12 +17,16 @@ my $totalMag;
my $prepend;
my $append;
my $tax;
+my $field = 1;
GetOptions
(
'h' => \$help,
'help' => \$help,
- 'tax=s' => \$tax
+ 'p' => \$prepend,
+ 'a' => \$append,
+ 'tax=s' => \$tax,
+ 'f=i' => \$field
);
if ( defined $tax )
@@ -43,6 +47,9 @@ Description:
[>,@]). If taxonomy information was not found for a given input line, the
output line will be only the taxonomy ID, which will be 0 if it was
looked up from an accession but not found.
+
+ Output fields are:
+ taxID depth parent rank name
Usage:
@@ -56,11 +63,24 @@ Usage:
grep ">" sequence.fasta | ktGetTaxInfo
+Options:
+
+ [-p] Prepend tax info to the original lines (separated by tabs).
+
+ [-a] Append tax info to the original lines (separated by tabs).
+
+ [-f] <integer> Field of accessions. [Default: \'1\']
+
+ [-tax <string> Path to directory containing a taxonomy database to use.
+
';
exit;
}
-print "#taxID\tdepth\tparent\trank\tname\n";
+if ( ! $prepend && ! $append )
+{
+ print "#taxID\tdepth\tparent\trank\tname\n";
+}
my $stdin;
@@ -79,7 +99,19 @@ while ( my $in = $stdin ? <STDIN> : shift @ARGV )
next;
}
- print join "\t", getTaxInfo(getTaxIDFromAcc(getAccFromSeqID($in)));
+ if ( $append )
+ {
+ print "$in\t";
+ }
+
+ my $acc = (split /\t/, $in)[$field - 1];
+ print join "\t", getTaxInfo(getTaxIDFromAcc(getAccFromSeqID($acc)));
+
+ if ( $prepend )
+ {
+ print "\t$in";
+ }
+
print "\n";
}
=====================================
KronaTools/scripts/ImportBLAST.pl
=====================================
@@ -28,6 +28,7 @@ qw(
name
threshold
include
+ includeUnk
random
percentIdentity
bitScore
=====================================
KronaTools/scripts/accession2taxid.make
=====================================
@@ -6,25 +6,34 @@ ACC2TAXID=\
nucl_wgs.accession2taxid \
prot.accession2taxid
-ACC2TAXID_SORTED=$(ACC2TAXID:.accession2taxid=.accession2taxid.sorted)
+ACC2TAXID_FMT=$(ACC2TAXID:.accession2taxid=.accession2taxid.fmt)
-../all.accession2taxid.sorted : $(ACC2TAXID_SORTED)
- @echo "Merging sorted..."
- @LC_ALL=C sort -m $(ACC2TAXID_SORTED) > $@
- @rm $(ACC2TAXID_SORTED)
+../all.accession2taxid.sorted : $(ACC2TAXID_FMT)
+ @echo "Merging..."
+ @LC_ALL=C TMPDIR=. sort -m $(ACC2TAXID_FMT) > $@
+ @rm $(ACC2TAXID_FMT)
-SORT := grep -v accession | sed 's/\.[[:digit:]]*//' | LC_ALL=C sort
+FORMAT4 := grep -v accession | cut -f 1,3
+FORMAT2 := grep -v accession | sed 's/\.[[:digit:]]*//;s/ / /'
-%.accession2taxid.sorted : %.accession2taxid
- @echo "Sorting $<..."
- @cut -f 2,3 $< | ${SORT} > $@
+%.accession2taxid.fmt : %.accession2taxid
+ @echo "Formatting $<..."
+ @if [ `awk '{print NF; exit}' $<` = "2" ]; then \
+ cat $< | ${FORMAT2} > $@; \
+ else \
+ cat $< | ${FORMAT4} > $@; \
+ fi
ifneq ("${PRESERVE}", "1")
@rm $<
endif
-%.accession2taxid.sorted : %.accession2taxid.gz
- @echo "Sorting $<..."
- @gunzip -c $< | cut -f 2,3 | ${SORT} > $@
+%.accession2taxid.fmt : %.accession2taxid.gz
+ @echo "Formatting $<..."
+ @if [ `gunzip -c $< | awk '{print NF; exit}'` = "2" ]; then \
+ gunzip -c $< | ${FORMAT2} > $@; \
+ else \
+ gunzip -c $< | ${FORMAT4} > $@; \
+ fi
ifneq ("${PRESERVE}", "1")
@rm $<
endif
=====================================
KronaTools/src/krona-2.0.js
=====================================
@@ -5760,10 +5760,18 @@ function setCallBacks()
}
image = document.getElementById('hiddenImage');
- image.onload = function()
+
+ if ( image.complete )
{
hiddenPattern = context.createPattern(image, 'repeat');
}
+ else
+ {
+ image.onload = function()
+ {
+ hiddenPattern = context.createPattern(image, 'repeat');
+ }
+ }
var loadingImageElement = document.getElementById('loadingImage');
View it on GitLab: https://salsa.debian.org/med-team/radiant/-/commit/a7f91b989a54eb6878e89f26f3b772664e8f1537
--
View it on GitLab: https://salsa.debian.org/med-team/radiant/-/commit/a7f91b989a54eb6878e89f26f3b772664e8f1537
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210602/13ad45e4/attachment-0001.htm>
More information about the debian-med-commit
mailing list