Skip to content

Commit

Permalink
Merge pull request #2 from refgenie/dev
Browse files Browse the repository at this point in the history
Release 0.1.0
  • Loading branch information
nsheff authored Jun 17, 2021
2 parents f90ecf9 + ce9ee6b commit 3a362e8
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 121 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pip install refget
```python
import refget

rgc = RefGetClient("https://refget.herokuapp.com/sequence/")
rgc = refget.RefGetClient("https://refget.herokuapp.com/sequence/")
rgc.refget("6681ac2f62509cfc220d78751b8dc524", start=0, end=10)

```
Expand Down
8 changes: 6 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.0.1] - Unreleased
## [0.1.0] - 2021-06-17

First public version
First public version, backed by henge version 0.1.1.

## [0.0.1] - 2020-06-25

Beta version for testing
157 changes: 58 additions & 99 deletions docs_jupyter/tutorial.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion refget/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.1"
__version__ = "0.1.0"
26 changes: 10 additions & 16 deletions refget/refget.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@

sequence_schema = """description: "Schema for a single raw sequence"
henge_class: sequence
type: object
properties:
sequence:
type: string
description: "Actual sequence content"
required:
- sequence
type: string
description: "Actual sequence content"
"""



class RefGetClient(henge.Henge):
def __init__(self, api_url_base=None, database={}, schemas=None, henges=None, checksum_function=henge.md5, suppress_connect=True):
def __init__(self, api_url_base=None, database={}, schemas=[], schemas_str=[], henges=None, checksum_function=henge.md5, suppress_connect=True):
"""
A user interface to insert and retrieve decomposable recursive unique
identifiers (DRUIDs).
Expand All @@ -49,10 +44,9 @@ def __init__(self, api_url_base=None, database={}, schemas=None, henges=None, ch


# These are the item types that this henge can understand.
if not schemas:
schemas = [sequence_schema]
print(schemas)
super(RefGetClient, self).__init__(database, schemas, henges=henges,
if len(schemas) ==0 and len(schemas_str) == 0:
schemas_str = [sequence_schema]
super(RefGetClient, self).__init__(database, schemas, schemas_str, henges=henges,
checksum_function=checksum_function)

def refget_remote(self, digest, start=None, end=None):
Expand Down Expand Up @@ -82,18 +76,18 @@ def refget_remote(self, digest, start=None, end=None):
def refget(self, digest, start=None, end=None):
full_data = None
try:
full_data = self.retrieve(digest)
full_data = super(RefGetClient, self).retrieve(digest)
if start is not None and end is not None:
result = full_data['sequence'][start:end]
result = full_data[start:end]
else:
result = full_data['sequence']
result = full_data

return result
except henge.NotFoundException:
return self.refget_remote(digest, start, end)

def load_seq(self, seq):
checksum = self.insert({'sequence': seq}, "sequence")
checksum = self.insert(seq, "sequence")
_LOGGER.debug("Loaded {}".format(checksum))
return checksum

Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
henge
henge==0.1.1
pyfaidx
requests
yacman>=0.6.7
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"Programming Language :: Python :: 3.6",
],
keywords="genome, assembly, bioinformatics, reference, sequence",
url="https://github.com/databio/refget",
url="https://github.com/refgenie/refget",
author=u"Nathan Sheffield, Michal Stolarczyk",
author_email=u"nathan@code.databio.org",
license="BSD2",
Expand Down

0 comments on commit 3a362e8

Please sign in to comment.