Skip to content

Commit

Permalink
add cite subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
maxibor committed Mar 25, 2021
1 parent ed191e3 commit 0a2dfac
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pydamage_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ jobs:
- name: Check pydamage on test data
shell: bash -l {0}
run: |
pydamage analyze --verbose tests/data/aligned.bam
pydamage analyze --verbose tests/data/aligned.bam
pydamage filter pydamage_results/pydamage_results.csv
pydamage cite
15 changes: 15 additions & 0 deletions pydamage/citation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def get_citation():
BIB = """
@article{Borry2021_pydamage,
author = {Borry, Maxime and Huebner, Alexander and Rohrlach, Adam B and Warinner, Christina G},
doi = {10.1101/2021.03.24.436838},
elocation-id = {2021.03.24.436838},
eprint = {https://www.biorxiv.org/content/early/2021/03/24/2021.03.24.436838.full.pdf},
journal = {bioRxiv},
publisher = {Cold Spring Harbor Laboratory},
title = {PyDamage: automated ancient damage identification and estimation for contigs in ancient DNA de novo assembly},
url = {https://www.biorxiv.org/content/early/2021/03/24/2021.03.24.436838},
year = {2021}
}
"""
print(BIB)
22 changes: 21 additions & 1 deletion pydamage/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@

import click
from pydamage.main import pydamage_analyze
from pydamage.citation import get_citation
from pydamage.kneedle import apply_filter
from pydamage import __version__
from collections import OrderedDict

class NaturalOrderGroup(click.Group):

@click.group()
def __init__(self, name=None, commands=None, **attrs):
super(NaturalOrderGroup, self).__init__(
name=name, commands=None, **attrs)
if commands is None:
commands = OrderedDict()
elif not isinstance(commands, OrderedDict):
commands = OrderedDict(commands)
self.commands = commands

def list_commands(self, ctx):
return self.commands.keys()

@click.group(cls=NaturalOrderGroup)
@click.version_option(__version__)
@click.pass_context
@click.option(
Expand Down Expand Up @@ -88,6 +103,11 @@ def filter(ctx, no_args_is_help=True, **kwargs):

apply_filter(**kwargs, **ctx.obj)

@cli.command()
def cite():
"""Get pydamage citation in bibtex format
"""
get_citation()

if __name__ == "__main__":
cli()

0 comments on commit 0a2dfac

Please sign in to comment.