Skip to content

Commit

Permalink
Merge pull request #32 from stevenweaver/develop
Browse files Browse the repository at this point in the history
Quiet mode
  • Loading branch information
stevenweaver authored Mar 20, 2020
2 parents 65225d7 + 2e14756 commit 2c7e665
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
HIVClustering
-------------

A Python 3 library that makes infers molecular transmission networks from sequence data. A part of [HIV-TRACE](https://academic.oup.com/mbe/article/35/7/1812/4833215), available at http://hivtrace.hyphy.org
A Python 3 library that makes infers molecular transmission networks from sequence data. A part of [HIV-TRACE](https://academic.oup.com/mbe/article/35/7/1812/4833215), available at http://hivtrace.org

Related projects

Expand Down
1 change: 1 addition & 0 deletions hivclustering/networkbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ def build_a_network(extra_arguments = None):
arguments.add_argument('--before', help='[assumes DATES are available] If provided (as YYYYMMDD) then only allow EDGES that connect nodes with dates at or BEFORE this date', required=False, type = str)
arguments.add_argument('--import-attributes', dest = 'import_attr', help='Import node attributes from this JSON', required=False, type=argparse.FileType('r'))
arguments.add_argument('--subcluster-annotation', dest = 'subcluster_annotation', help='As "dist" "field"". Use subcluster annotation for distance "dist" from node attribute "field" ', required=False, nargs = 2)
arguments.add_argument('-q', '--quiet', help='Enable quiet mode', action='store_true', default=False)


if extra_arguments:
Expand Down
16 changes: 10 additions & 6 deletions scripts/hivnetworkcsv
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,19 @@ def make_hiv_network():
for c_id, mapped_id in cluster_map.items():
if c_id is None: # singletons
if len (mapped_id) > 1 or None not in mapped_id:
report_warning ("Incostistent singletons, nodes previously clustered became unclustered (%s)" % str (mapped_id))
report_warning ("Inconsistent singletons, nodes previously clustered became unclustered (%s)" % str (mapped_id))
for old_id in mapped_id:
ensure_key (discrepant_old_clusters, old_id)['disconnected'] = True

else:
if len (mapped_id) == 1:
if None in mapped_id: # new cluster
print ("Cluster %d is a new cluster" % c_id, file = sys.stderr)
if None in mapped_id :
if not settings().quiet: # new cluster
print ("Cluster %d is a new cluster" % c_id, file = sys.stderr)
else:
cluster_remap[c_id] = list(mapped_id)[0]
print ("Cluster %d [%d nodes] matches previous cluster %d [%d nodes]" % (c_id, new_cluster_sizes [c_id], cluster_remap[c_id], old_cluster_sizes[cluster_remap[c_id]]), file = sys.stderr)
if not settings().quiet:
print ("Cluster %d [%d nodes] matches previous cluster %d [%d nodes]" % (c_id, new_cluster_sizes [c_id], cluster_remap[c_id], old_cluster_sizes[cluster_remap[c_id]]), file = sys.stderr)
cluster_summary_info [cluster_remap[c_id]] = {'type' : 'existing'}
if cluster_remap[c_id] in used_existing_clusters:
record_multiple_mapping (cluster_remap[c_id], c_id)
Expand All @@ -259,7 +261,8 @@ def make_hiv_network():
mapped_id.remove (None)
update_id = list(mapped_id)[0]
cluster_remap[c_id] = update_id
print ("Cluster %d [%d nodes] extends previous cluster %d [%d nodes]" % (c_id, new_cluster_sizes [c_id], update_id, old_cluster_sizes[update_id]), file = sys.stderr)
if not settings().quiet:
print ("Cluster %d [%d nodes] extends previous cluster %d [%d nodes]" % (c_id, new_cluster_sizes [c_id], update_id, old_cluster_sizes[update_id]), file = sys.stderr)
cluster_summary_info [update_id] = {'type' : 'extended', 'size' : new_cluster_sizes [c_id], 'old_size' : old_cluster_sizes[update_id]}
if cluster_remap[c_id] in used_existing_clusters:
report_warning("Cluster %d from the existing network is mapped to multiple new clusters (nodes %s)" % (update_id, dump_cluster_members (c_id)))
Expand All @@ -270,7 +273,8 @@ def make_hiv_network():
mapped_to_existing_clusters.add (c_id)

else:
print ("Cluster %d MERGES %s" % (c_id, ", ".join ([str(k) for k in list(mapped_id)])), file = sys.stderr)
if not settings().quiet:
print ("Cluster %d MERGES %s" % (c_id, ", ".join ([str(k) for k in list(mapped_id)])), file = sys.stderr)
if None in mapped_id:
mapped_id.remove (None)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sys.path.insert(0, join(split(abspath(__file__))[0], 'lib'))

setup(name='hivclustering',
version="1.6.0",
version="1.6.1",
description='HIV molecular clustering tools',
author='Sergei Kosakovsky Pond',
author_email='[email protected]',
Expand Down

0 comments on commit 2c7e665

Please sign in to comment.