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 54d3bdd commit 4b1d403
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 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
58 changes: 37 additions & 21 deletions src/cladetime/cladetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,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):
"""
Parameters
----------
sequence_as_of : datetime | str | None, default = now()
Use the NextStrain sequences and sequence metadata that were available
as of this date. Can be a datetime object, a string in the format
"YYYY-MM-DD", or None (which defaults to the current date and time).
CladeTime treats all dates and times as UTC.
tree_as_of : datetime | str | None, default = now()
Use the NextStrain reference tree that was available as of this date.
Can be a datetime object, a string in the format
"YYYY-MM-DD", or None (which defaults to the sequence_as_of date).
CladeTime treats all dates and times as UTC.
"""

"""CladeTime constructor."""
self._config = self._get_config()
self.sequence_as_of = sequence_as_of
self.tree_as_of = tree_as_of
Expand Down Expand Up @@ -107,7 +111,13 @@ def ncov_metadata(self):

@ncov_metadata.getter
def ncov_metadata(self) -> dict:
<<<<<<< HEAD
"""Get the ncov_metadata attribute."""
||||||| parent of 655aa09 (Try numpy-style docstring format)
"""Set the ncov_metadata attribute."""
=======
"""str: S3 URL to the Nextstrain ncov metadata file (.json)"""
>>>>>>> 655aa09 (Try numpy-style docstring format)
if self.url_ncov_metadata:
metadata = _get_ncov_metadata(self.url_ncov_metadata)
return metadata
Expand All @@ -121,7 +131,13 @@ def sequence_metadata(self):
@sequence_metadata.getter
def sequence_metadata(self) -> pl.LazyFrame:
<<<<<<< HEAD
"""Get the sequence_metadata attribute."""
||||||| parent of 655aa09 (Try numpy-style docstring format)
"""Set the sequence_metadata attribute."""
=======
"""polars.LazyFrame: a reference to url_sequence_metadata."""
>>>>>>> 655aa09 (Try numpy-style docstring format)
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 4b1d403

Please sign in to comment.