Skip to content
Permalink
Browse files

Merge pull request #9 from evogytis/add-packaging-files

Add packaging files
  • Loading branch information
evogytis committed Dec 20, 2019
2 parents bc61591 + ae0e0b1 commit dda6d955066c178a1e9ab0c8b8eb3ae42576f72d
@@ -0,0 +1,85 @@
# Contributor Covenant Code of Conduct
To ensure a welcoming experience for our entire community, this project adheres to the [Contributor Covenant code of conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). By participating, you are expected to uphold this code. Please report unacceptable behavior to evogytis@gmail.com.

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the project community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
No changes.
@@ -61,31 +61,31 @@ for k in myTree.Objects:

## samogitia

<img src="figures/coa_samogitia.jpg" width=200px>
<img src="docs/figures/coa_samogitia.jpg" width=200px>

[`samogitia.py`](samogitia.py) is the heavy-lifting, tree file-wrangling script in the collection. It’s main role is to parse BEAST tree files, use baltic to create tree data structures, which samogitia then manipulates to create BEAST-like log files that can usually be imported into [Tracer](http://tree.bio.ed.ac.uk/software/tracer/) or used in another program.

--------------------

## austechia

<img src="figures/coa_austechia.png" width=200px>
<img src="docs/figures/coa_austechia.png" width=200px>

[`austechia.ipynb`](austechia.ipynb) is the fancy Jupyter notebook that takes tree files, usually MCC trees from BEAST, and plots them. It is meant to be part teaching tool to get people to think about how trees are plotted, to allow for highly customisable representations of trees (e.g. Fig 6 in my [MERS-CoV paper](http://dx.doi.org/10.1093/ve/vev023)) and to improve the aesthetics situation in phylogenetics.

--------------------

## galindia

<img src="figures/coa_galindia.jpg" width=200px>
<img src="docs/figures/coa_galindia.jpg" width=200px>

[`galindia.ipynb`](galindia.ipynb) is a notebook that uses baltic to plot JSONs from [nextstrain.org](nextstrain.org) in order to allow customisable, static, publication-ready figures for phylogenies coming from nextstrain's augur pipeline.

--------------------

## curonia

<img src="figures/coa_curonia.jpg" width=200px>
<img src="docs/figures/coa_curonia.jpg" width=200px>

[`curonia.ipynb`](curonia.ipynb) generalises the [notebook](https://github.com/ebov/space-time/blob/master/Scripts/notebooks/EBOV_phylogeography_animation.ipynb) used to animate the [spread of Ebola virus in West Africa](https://www.youtube.com/watch?v=j4Ut4krp8GQ). This notebook should require minimal manual editing to produce similarly styled animation of other study systems.

@@ -0,0 +1 @@
from .baltic import *
@@ -2,6 +2,10 @@
import datetime as dt
from functools import reduce

__all__ = ['decimalDate', 'convertDate', 'reticulation', # make from baltic import * safe
'clade', 'node', 'tree',
'make_tree', 'make_treeJSON', 'loadJSON', 'loadNexus', 'loadNewick']

sys.setrecursionlimit(9001)

def decimalDate(date,fmt="%Y-%m-%d",variable=False):
@@ -43,7 +43,7 @@ def overlap(a,b):
upper=int(upper)

try:
for line in open('banner_samogitia.txt','r'):
for line in open('../docs/banner_samogitia.txt','r'):
sys.stderr.write('%s'%(line))
except:
pass
@@ -118,7 +118,7 @@ def overlap(a,b):
elif k.name in Conakry_tips:
tmrcas['B'].append(k.numName)
tmrcas['C'].append(k.numName)

outfile.write('\t%s'%('\t'.join(sorted(tmrcas.keys()))))
###########################################
if 'transitions' in analyses:
@@ -198,7 +198,7 @@ def overlap(a,b):
if len(targetLeft)==0 and len(queryLeft)<=score[required]: ## all of query tips must be descended from common ancestor, every extra descendant of common ancestor not in query contributes to a score
nodes[required]=k ## if score improved - assign new common ancestor
score[required]=len(queryLeft) ## score is extra descendants not in the list of known tips

outTMRCA=['%.6f'%(nodes[n].absoluteTime) for n in sorted(nodes.keys())] ## fetch absoluteTime of each identified common ancestor
outfile.write('\t%s'%('\t'.join(outTMRCA)))
###################################################
@@ -216,7 +216,7 @@ def overlap(a,b):
t=min(map(bt.decimalDate,[dateCerberus.search(x).group(1) for x in all_leaves]))-k.absoluteTime+halfBranch
else:
t=halfBranch

outSharp.append('(%d,%d,%.4f)'%(N,S,t))
outfile.write('\t%s'%('\t'.join(outSharp)))
###################################################
@@ -247,18 +247,18 @@ def overlap(a,b):
if [ch.traits[traitName] for ch in k.children].count(kloc)>0:
proceed=True
#print k.index,k.parent.index,k.traits,k.parent.traits,k.traits[traitName]

if proceed==True: ## if at least one valid tip and no hanging nodes
subtree=copy.deepcopy(ll.traverseWithinTrait(k,traitName))
subtree_leaves=[x.name for x in subtree if isinstance(x,bt.leaf)]

if len(subtree_leaves)>0:
mostRecentTip=max([bt.decimalDate(x.strip("'").split('|')[-1]) for x in subtree_leaves])
while sum([len(nd.children)-sum([1 if ch in subtree else 0 for ch in nd.children]) for nd in subtree if isinstance(nd,bt.node) and nd.index!='Root'])>0: ## keep removing nodes as long as there are nodes with children that are not entirely within subtree
for nd in sorted([q for q in subtree if isinstance(q,bt.node)],key=lambda x:(sum([1 if ch in subtree else 0 for ch in x.children]),x.height)): ## iterate over nodes in subtree, starting with ones that have fewest valid children and are more recent

child_status=[1 if ch in subtree else 0 for ch in nd.children] ## check how many children of current node are under the right trait value

if sum(child_status)<2 and nd.index!='Root': ## if less than 2 children in subtree (i.e. not all children are under the same trait state)
#print 'removing: %d, children in: %s'%(nd.index,[location_to_country[ch.traits[traitName]] for ch in nd.children])
grand_parent=nd.parent ## fetch grandparent of node to be removed
@@ -298,14 +298,14 @@ def overlap(a,b):
###################################################
outfile.write('\n') ## newline for post-burnin tree
treecount+=1 ## increment tree counter
################################################################################
################################################################################
if treecount==threshold: ## tree passed progress bar threshold
timeTakenSoFar=dt.datetime.now()-begin ## time elapsed
timeElapsed=float(divmod(timeTakenSoFar.total_seconds(),60)[0]+(divmod(timeTakenSoFar.total_seconds(),60)[1])/float(60))
timeRate=float(divmod(timeTakenSoFar.total_seconds(),60)[0]*60+divmod(timeTakenSoFar.total_seconds(),60)[1])/float(treecount+1) ## rate at which trees have been processed
processingRate.append(timeRate) ## remember rate
ETA=(sum(processingRate)/float(len(processingRate))*(Ntrees-treecount))/float(60)/float(60) ## estimate how long it'll take, given mean processing rate

excessiveTrees=treecount
if treecount>=10000:
excessiveTrees=10000
@@ -315,7 +315,7 @@ def overlap(a,b):
else:
reportElapsed=timeElapsed ## keep minutes
reportUnit='m'

sys.stderr.write('\r') ## output progress bar
sys.stderr.write("[%-30s] %4d%% trees: %5d elapsed: %5.2f%1s ETA: %5.2fh (%6.1e s/tree)" % ('='*(excessiveTrees/progress_update),treecount/float(Ntrees)*100.0,treecount,reportElapsed,reportUnit,ETA,processingRate[-1]))
sys.stderr.flush()
@@ -325,4 +325,4 @@ def overlap(a,b):
if 'End;' in line:
pass
outfile.close()
sys.stderr.write('\nDone!\n') ## done!
sys.stderr.write('\nDone!\n') ## done!
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
numpy>=1.17
@@ -0,0 +1,25 @@
from setuptools import setup, find_packages

with open("README.md", "rb") as fh:
long_description = fh.read().decode()

with open("requirements.txt") as fh:
requirements = fh.read().splitlines()

setup(
name="baltic",
version="0.1.0",
packages=find_packages(),
url="https://github.com/evogytis/baltic",
# license="",
author="Gytis Dudas",
author_email="gytisdudas@gmail.com",
description="Lightweight package for analyzing, manipulating and visualizing annotated phylogenetic trees",
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=requirements,
# python_requires=">=3.6.*",
include_package_data=False,
zip_safe=False,
# classifiers=[],
)

0 comments on commit dda6d95

Please sign in to comment.
You can’t perform that action at this time.