Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to artifact class registration #283

Merged
merged 5 commits into from
Oct 28, 2022
Merged

updates to artifact class registration #283

merged 5 commits into from
Oct 28, 2022

Conversation

gregcaporaso
Copy link
Member

This pull request depends on qiime2/qiime2#655.

This makes changes to tests to:

  • handle new behavior associated with that PR (semantic types rather than type expressions are registered to formats for artifact classes),
  • to update to new parameter names (directory_format instead of artifact_format, though artifact_format is still supported when calling Plugin.register_semantic_type_to_format)
  • add a few artifact class descriptions and usage examples for initial testing purposes.

In a development environment with the above qiime2 branch installed, this can be tested as follows:

Access descriptions of artifact classes

from qiime2.sdk import PluginManager
pm = PluginManager()

pm.get_semantic_types()
pm.get_semantic_types()['Phylogeny[Rooted]']
pm.get_semantic_types()['Phylogeny[Rooted]'].description
'A phylogenetic tree containing a defined root.'

for e in pm.get_semantic_types().values():
    desc = e.description or "No description provided."
    print('%s : %s' % (e.type_expression, desc))

FeatureTable[PresenceAbsence] : No description provided.
FeatureTable[Design] : No description provided.
FeatureTable[Frequency] : No description provided.
FeatureTable[PercentileNormalized] : No description provided.
FeatureTable[Composition] : No description provided.
FeatureTable[Balance] : No description provided.
FeatureTable[RelativeFrequency] : No description provided.
DistanceMatrix : No description provided.
Phylogeny[Rooted] : A phylogenetic tree containing a defined root.
Phylogeny[Unrooted] : A phylogenetic tree not containing a defined root.
Hierarchy : No description provided.
PCoAResults : No description provided.
ProcrustesStatistics : No description provided.
SampleData[AlphaDiversity] : No description provided.
SampleData[Sequences] : Collections of sequences associated with specified samples (i.e., demultiplexed sequences).
SampleData[SequencesWithQuality] : Collections of sequences with quality scores associated with specified samples (i.e., demultiplexed sequences).
SampleData[JoinedSequencesWithQuality] : Collections of joined paired-end sequences with quality scores associated with specified samples (i.e., demultiplexed sequences).
SampleData[PairedEndSequencesWithQuality] : Collections of unjoined paired-end sequences with quality scores associated with specified samples (i.e., demultiplexed sequences).
MultiplexedSingleEndBarcodeInSequence : No description provided.
MultiplexedPairedEndBarcodeInSequence : No description provided.
Bowtie2Index : No description provided.
FeatureData[Taxonomy] : No description provided.
FeatureData[Sequence] : No description provided.
FeatureData[RNASequence] : No description provided.
FeatureData[PairedEndSequence] : No description provided.
FeatureData[PairedEndRNASequence] : No description provided.
FeatureData[AlignedSequence] : No description provided.
FeatureData[AlignedRNASequence] : No description provided.
FeatureData[Differential] : No description provided.
FeatureData[ProteinSequence] : No description provided.
FeatureData[AlignedProteinSequence] : No description provided.
FeatureData[BLAST6] : No description provided.
RawSequences : No description provided.
EMPSingleEndSequences : No description provided.
EMPPairedEndSequences : No description provided.
ErrorCorrectionDetails : No description provided.
SampleData[ArtificialGrouping] : No description provided.
TaxonomicClassifier : No description provided.
SampleData[DADA2Stats] : No description provided.
SampleEstimator[Classifier] : No description provided.
SampleEstimator[Regressor] : No description provided.
SampleData[BooleanSeries] : No description provided.
SampleData[RegressorPredictions] : No description provided.
SampleData[ClassifierPredictions] : No description provided.
FeatureData[Importance] : No description provided.
SampleData[Probabilities] : No description provided.
SampleData[TrueTargets] : No description provided.
QualityFilterStats : No description provided.
UchimeStats : No description provided.
SampleData[FirstDifferences] : No description provided.
DeblurStats : No description provided.
Placements : No description provided.
SeppReferenceDatabase : No description provided.

Generate data and render an import usage example

from qiime2.sdk import PluginManager
import qiime2.plugins

pm = PluginManager()
use = qiime2.plugins.ArtifactAPIUsage()

ex1 = pm.get_semantic_types()['Phylogeny[Unrooted]'].examples['Import unrooted phylogenetic tree']

ex1(use)

print(use.render())

d = use.get_example_data()

d['my-tree.tre'].save('my-tree.tre')

* artifact_format is now directory_format
* semantic types, rather than type expressions, are now registered to formats
@gregcaporaso gregcaporaso requested a review from ebolyen October 18, 2022 20:29
Copy link
Member

@ebolyen ebolyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one minor comment.

This is still a draft, and it'll take a bit for our CI to flush the latest framework out, but I see no reason not to merge this soon.

from q2_types.tree import NewickFormat

tree = TreeNode.read(StringIO(
'(SEQUENCE1:0.000000003,SEQUENCE2:0.000000003);'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the root be trifurcating in this particular example, since that's the common-ish convention?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Or we can switch it to Phylogeny[Rooted])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that! I updated to Phylogeny[Rooted] and set this as ready for review.

@gregcaporaso gregcaporaso marked this pull request as ready for review October 25, 2022 19:18
Copy link
Member

@ebolyen ebolyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gregcaporaso!

@ebolyen ebolyen merged commit 886a1dc into qiime2:master Oct 28, 2022
@gregcaporaso gregcaporaso deleted the ac-annotations branch October 31, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants