Skip to content

Commit

Permalink
Try numpy-style docstring format
Browse files Browse the repository at this point in the history
  • Loading branch information
bsweger committed Oct 10, 2024
1 parent 4832d02 commit 655aa09
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"sphinx.ext.intersphinx",
"myst_parser", # markdown (NOTE: this is NOT mystmd)
"sphinxext.opengraph",
"sphinx.ext.napoleon",
]

intersphinx_mapping = {
Expand Down
36 changes: 27 additions & 9 deletions src/cladetime/cladetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,34 @@
class CladeTime:
"""Wrapper around Nextstrain Sars-CoV-2 genome sequences, metadata, and clade assignments.
:param sequence_as_of Use the NextStrain sequences and sequence metadata
that were available as of this date and time (UTC)
:type sequence_as_of: datetime
:param tree_as_of Use the NextStrain reference tree that was available as
of this date and time (UTC).
:type tree_as_of: datetime
The CladeTime class is instantiated with two optional arguments that
specify the point in time at which to access Nextstrain sequence
data and the reference tree used to assign sequences to clades.
Parameters
----------
sequence_as_of : datetime
Use the NextStrain sequences and sequence metadata that were available
as of this date and time (UTC)
tree_as_of : datetime
Use the NextStrain reference tree that was available as of this date
and time (UTC)
Attributes
----------
ncov_metadata : dict
Metadata for the Nextstrain ncov pipeline that generated the sequence
and sequence metadata that correspond to the sequence_as_of date
url_sequence : str
S3 URL to the Nextstrain Sars-CoV-2 sequence file (zst-compressed
.fasta) that was available at the sequence_as_of
url_sequence_metadata : str
S3 URL to the Nextstrain Sars-CoV-2 sequence metadata file
(zst-compressed tsv) that was available at the sequence_as_of
"""

def __init__(self, sequence_as_of=None, tree_as_of=None):
"""Constructor"""
"""CladeTime constructor."""
self._config = self._get_config()
self.sequence_as_of = self._validate_as_of_date(sequence_as_of)
self.tree_as_of = self._validate_as_of_date(tree_as_of)
Expand Down Expand Up @@ -53,7 +71,7 @@ def ncov_metadata(self):

@ncov_metadata.getter
def ncov_metadata(self) -> dict:
"""Set the ncov_metadata attribute."""
"""str: S3 URL to the Nextstrain ncov metadata file (.json)"""
if self.url_ncov_metadata:
metadata = _get_ncov_metadata(self.url_ncov_metadata)
return metadata
Expand All @@ -67,7 +85,7 @@ def sequence_metadata(self):

@sequence_metadata.getter
def sequence_metadata(self) -> pl.LazyFrame:
"""Set the sequence_metadata attribute."""
"""polars.LazyFrame: a reference to url_sequence_metadata."""
if self.url_sequence_metadata:
sequence_metadata = get_covid_genome_metadata(metadata_url=self.url_sequence_metadata)
return sequence_metadata
Expand Down

0 comments on commit 655aa09

Please sign in to comment.