Skip to content

Commit

Permalink
Merge branch 'master' into pgrt-looking_for_integer
Browse files Browse the repository at this point in the history
  • Loading branch information
smirarab committed Nov 4, 2020
2 parents fad567e + 15a627b commit 1132e5b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 14 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ os:
- osx
env:
- PYVERSION="3.5"
- PYVERSION="3.8"
before_install:
- echo "$TRAVIS_OS_NAME"
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
* Version 4.3.15:
* some py3.8 changes and some java changes from pgrt
* Version 4.3.14:
* Added option `-R "Nmin Nmax"` to specify the range of full length sequences to UPP
* Version 4.3.13:
* Added backtranslation functionality to UPP for amino acid sequences.
* Added backtranslation functionality to UPP for amino acid sequences.
* Version 4.3.12:
* Added `-rt` to remove temp files
* Version 4.3.11:
Expand Down
2 changes: 1 addition & 1 deletion sepp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

__all__ = ["alignment", "shortreadalignment", "taxonneighbourfinder",
"tools", "problem"]
version = "4.3.12"
version = "4.3.15"
_DEBUG = ("SEPP_DEBUG" in os.environ) and \
(os.environ["SEPP_DEBUG"].lower() == "true")

Expand Down
24 changes: 17 additions & 7 deletions sepp/exhaustive_upp.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def generate_backbone(self):
sequences.read_file_object(self.options.sequence_file)
sequences.degap()
fragments = MutableAlignment()
if (options().median_full_length is not None):
if (options().median_full_length is not None or options().full_length_range is not None):
if (options().median_full_length == -1):
seq_lengths = sorted(
[len(seq) for seq in list(sequences.values())])
Expand All @@ -77,12 +77,17 @@ def generate_backbone(self):
seq_lengths[l2] + seq_lengths[l2 + 1]) / 2.0
else:
options().median_full_length = seq_lengths[l2]

(min_length, max_length) = (
int(options().median_full_length * (
1 - options().backbone_threshold)),
int(options().median_full_length*(
1 + options().backbone_threshold)))
if options().full_length_range is not None:
L = sorted(int(x) for x in options().full_length_range.split())
min_length = L[0]
max_length = L[1]
else:
(min_length, max_length) = (
int(options().median_full_length * (
1 - options().backbone_threshold)),
int(options().median_full_length*(
1 + options().backbone_threshold)))
_LOG.info("Full length sequences are set to be from %d to %d character long" % (min_length,max_length))
frag_names = [
name for name in sequences
if len(sequences[name]) > max_length or
Expand Down Expand Up @@ -383,6 +388,11 @@ def augment_parser():
default=10,
help="max alignment subset size of N "
"[default: 10]")
decompGroup.add_argument(
"-R", "--full_length_range",type=str,
dest="full_length_range", metavar="\"Nmin Nmax\"",
default=None,
help="Only consider sequences with lengths within Nmin and Nmax")
decompGroup.add_argument(
"-M", "--median_full_length", type=int,
dest="median_full_length", metavar="N",
Expand Down
2 changes: 1 addition & 1 deletion sepp/metagenomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def distribution(classification_files, output_dir):
assert frag_info['phylum']['unclassified'] != 1
for clade, cladeval in frag_info.items():
for clade_name, cnc in cladeval.items():
if cnc not in distribution[clade]:
if clade_name not in distribution[clade]:
distribution[clade][clade_name] = 0
distribution[clade][clade_name] += cnc
frag_info = {"species": {'unclassified': 1},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from distutils.spawn import find_executable

use_setuptools(version="0.6.24")
version = "4.3.13"
version = "4.3.15"


def get_tools_dir(where):
Expand Down
8 changes: 6 additions & 2 deletions tools/merge/src/phylolab/taxonamic/JSONMerger.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ public int compare(JSONArray o1, JSONArray o2) {
return (int) o;
}
});
sortedPlacements.addAll(placements);
for (Iterator<JSONArray> it=placements.iterator() ; it.hasNext() ;) {
sortedPlacements.add(it.next());
}
double total = 0;
ArrayList < JSONArray > list = new ArrayList < JSONArray > ();
for (Iterator < JSONArray > itp = sortedPlacements.iterator(); threshold > total && itp.hasNext();) {
Expand Down Expand Up @@ -565,7 +567,9 @@ public int compare(JSONObject o1, JSONObject o2) {
return name1.compareTo(name2);
}
});
sortedPlacements.addAll(resultsPlacements);
for (int i=0 ; i<resultsPlacements.size() ; i++) {
sortedPlacements.add(resultsPlacements.getJSONObject(i));
}
resultsPlacements = new JSONArray();
resultsPlacements.addAll(sortedPlacements);
}
Expand Down
4 changes: 3 additions & 1 deletion tools/merge/src/phylolab/taxonamic/PPlacerJSONMerger.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ public int compare(JSONObject o1, JSONObject o2) {
return name1.compareTo(name2);
}
});
sortedPlacements.addAll(resultsPlacements);
for (int i=0 ; i<resultsPlacements.size() ; i++) {
sortedPlacements.add(resultsPlacements.getJSONObject(i));
}
resultsPlacements = new JSONArray();
resultsPlacements.addAll(sortedPlacements);
}
Expand Down

0 comments on commit 1132e5b

Please sign in to comment.