Skip to content

Commit

Permalink
ENH/DEP: add temporary action pending framework fix (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcaporaso authored Jul 29, 2020
1 parent 66e6913 commit 6fe92ee
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
7 changes: 7 additions & 0 deletions genome_sampler/label_seqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ def label_seqs(seqs: pd.Series, delimiter: str,
seqs.index = seqs.index.map(rename)

return seqs


def label_unaligned_seqs(seqs: pd.Series, delimiter: str,
metadata: qiime2.Metadata = None, columns: str = None,
missing_value: str = 'missing') \
-> pd.Series:
return label_seqs(seqs, delimiter, metadata, columns, missing_value)
38 changes: 36 additions & 2 deletions genome_sampler/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from genome_sampler.filter import filter_seqs
from genome_sampler.combine import combine_selections
from genome_sampler.summarize import summarize_selections
from genome_sampler.label_seqs import label_seqs
from genome_sampler.label_seqs import label_seqs, label_unaligned_seqs
from genome_sampler.mask import mask

citations = Citations.load('citations.bib', package='genome_sampler')
Expand Down Expand Up @@ -416,7 +416,7 @@ def _5(fmt: VCFLikeMaskFormat) -> pd.DataFrame:
output_descriptions={
'labeled_seqs': 'The re-labeled sequences.'
},
name='Re-label sequences',
name='Re-label aligned sequences',
description='Modifies sequence identifiers either by adding or removing'
' metadata. If metadata and one or more columns are provided,'
' the specified metadata columns will be added to the sequence'
Expand All @@ -426,6 +426,40 @@ def _5(fmt: VCFLikeMaskFormat) -> pd.DataFrame:
' that will be removed from all sequence ids.'
)

plugin.methods.register_function(
function=label_unaligned_seqs,
inputs={'seqs': FeatureData[Sequence]},
parameters={
'delimiter': Str % Choices('|', ',', '+', ':', ';'),
'metadata': Metadata,
'columns': List[Str],
'missing_value': Str,
},
outputs=[('labeled_seqs', FeatureData[Sequence])],
input_descriptions={'seqs': 'The sequences to be re-labeled.'},
parameter_descriptions={
'delimiter': 'The delimiter between the sequence id and each metadata'
' entry.',
'metadata': 'The metadata to embed in the header.',
'columns': 'The columns in the metadata to be used.',
'missing_value': 'Value to use to indicate missing metadata column '
'values for sequences.'
},
output_descriptions={
'labeled_seqs': 'The re-labeled sequences.'
},
name='Re-label unaligned sequences (deprecated)',
description='Modifies sequence identifiers either by adding or removing'
' metadata. If metadata and one or more columns are provided,'
' the specified metadata columns will be added to the sequence'
' id following the original sequence id and separated by'
' `delimiter`. If metadata and columns are not provided, the'
' first occurrence of delimiter and any characters following'
' that will be removed from all sequence ids. DEPRECATED: this'
' will be accessible through `label_seqs`.'

)


plugin.visualizers.register_function(
function=summarize_selections,
Expand Down

0 comments on commit 6fe92ee

Please sign in to comment.