alphagenome.models.dna_client.DnaClient#
- class alphagenome.models.dna_client.DnaClient(*, channel, model_version=None, metadata=())[source]#
Client for interacting with a DNA model server.
- channel#
gRPC channel to the DNA model server.
- metadata#
Metadata to send with each request.
- model_version#
Optional model version to use for the DNA model server. If none provided, the default model version will be used.
Methods#
Table
|
Get the metadata for a given organism. |
|
Generate predictions for a given DNA interval. |
|
Generate predictions for a sequence of DNA intervals. |
|
Generate predictions for a given DNA sequence. |
|
Generate predictions for a given DNA sequence. |
|
Generate predictions for a given DNA variant. |
|
Generate predictions for a given DNA variant. |
|
Generate interval scores for a single given interval. |
|
Generate interval scores for a sequence of intervals. |
|
Generate in-silico mutagenesis (ISM) variant scores for a given interval. |
|
Generate variant scores for a single given DNA variant. |
|
Generate variant scores for a sequence of variants. |
- DnaClient.output_metadata(organism=Organism.HOMO_SAPIENS)[source]#
Get the metadata for a given organism.
- Parameters:
organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to get metadata for.- Return type:
- Returns:
OutputMetadata for the provided organism.
- DnaClient.predict_interval(interval, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms)[source]#
Generate predictions for a given DNA interval.
- Parameters:
interval (
Interval) – DNA interval to make prediction for.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.requested_outputs (
Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.ontology_terms (
Iterable[OntologyTerm|str] |None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.
- Return type:
- Returns:
Output for the provided DNA interval.
- DnaClient.predict_intervals(intervals, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, progress_bar=True, max_workers=5)[source]#
Generate predictions for a sequence of DNA intervals.
- Parameters:
intervals (
Sequence[Interval]) – DNA intervals to make predictions for.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the predictions.requested_outputs (
Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.ontology_terms (
Iterable[OntologyTerm|str] |None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.progress_bar (
bool(default:True)) – If True, show a progress bar.max_workers (
int(default:5)) – Number of parallel workers to use.
- Return type:
- Returns:
Outputs for the provided DNA intervals.
- DnaClient.predict_sequence(sequence, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, interval=None)[source]#
Generate predictions for a given DNA sequence.
- Parameters:
sequence (
str) – DNA sequence to make prediction for.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.requested_outputs (
Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.ontology_terms (
Iterable[OntologyTerm|str] |None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.interval (
Optional[Interval] (default:None)) – Optional interval from which the sequence was derived. This is used as the interval in the output TrackData.
- Return type:
- Returns:
Output for the provided DNA sequence.
- DnaClient.predict_sequences(sequences, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, progress_bar=True, max_workers=5, intervals=None)[source]#
Generate predictions for a given DNA sequence.
- Parameters:
sequences (
Sequence[str]) – DNA sequences to make predictions for.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.requested_outputs (
Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.ontology_terms (
Iterable[OntologyTerm|str] |None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.progress_bar (
bool(default:True)) – If True, show a progress bar.max_workers (
int(default:5)) – Number of parallel workers to use.intervals (
Optional[Sequence[Interval]] (default:None)) – Optional intervals from which the sequences were derived. This is used as the interval in the output TrackData. Must be the same length assequencesif provided.
- Return type:
- Returns:
Outputs for the provided DNA sequences.
- DnaClient.predict_variant(interval, variant, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms)[source]#
Generate predictions for a given DNA variant.
- Parameters:
interval (
Interval) – DNA interval to make prediction for.variant (
Variant) – DNA variant to make prediction for.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.requested_outputs (
Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.ontology_terms (
Iterable[OntologyTerm|str] |None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.
- Return type:
- Returns:
Variant output for the provided DNA interval and variant.
- DnaClient.predict_variants(intervals, variants, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, progress_bar=True, max_workers=5)[source]#
Generate predictions for a given DNA variant.
- Parameters:
intervals (
Interval|Sequence[Interval]) – DNA interval(s) to make predictions for.variants (
Sequence[Variant]) – DNA variants to make prediction for.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.requested_outputs (
Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.ontology_terms (
Iterable[OntologyTerm|str] |None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.progress_bar (
bool(default:True)) – If True, show a progress bar.max_workers (
int(default:5)) – Number of parallel workers to use.
- Return type:
- Returns:
Variant outputs for each DNA interval and variant pair.
- DnaClient.score_interval(interval, interval_scorers=(), *, organism=Organism.HOMO_SAPIENS)[source]#
Generate interval scores for a single given interval.
- Parameters:
interval (
Interval) – Interval to make prediction for.interval_scorers (
Sequence[TypeVar(IntervalScorerTypes, bound=GeneMaskScorer)] (default:())) – Sequence of interval scorers to use for scoring. If no interval scorers are provided, the recommended interval scorers for the organism will be used.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.
- Return type:
- Returns:
List of
AnnDatainterval scores.
- DnaClient.score_intervals(intervals, interval_scorers=(), *, organism=Organism.HOMO_SAPIENS, progress_bar=True, max_workers=5)[source]#
Generate interval scores for a sequence of intervals.
- Parameters:
intervals (
Sequence[Interval]) – Sequence of DNA intervals to make prediction for.interval_scorers (
Sequence[TypeVar(IntervalScorerTypes, bound=GeneMaskScorer)] (default:())) – Sequence of interval scorers to use for scoring. If no interval scorers are provided, the recommended interval scorers for the organism will be used.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.progress_bar (
bool(default:True)) – If True, show a progress bar.max_workers (
int(default:5)) – Number of parallel workers to use.
- Return type:
- Returns:
List of
AnnDatalists corresponding to score_interval outputs for each interval.
- DnaClient.score_ism_variants(interval, ism_interval, variant_scorers=(), *, organism=Organism.HOMO_SAPIENS, progress_bar=True, max_workers=5)[source]#
Generate in-silico mutagenesis (ISM) variant scores for a given interval.
- Parameters:
interval (
Interval) – DNA interval to make the prediction for.ism_interval (
Interval) – Interval to perform ISM.variant_scorers (
Sequence[TypeVar(VariantScorerTypes,CenterMaskScorer,ContactMapScorer,GeneMaskLFCScorer,GeneMaskActiveScorer,GeneMaskSplicingScorer,PolyadenylationScorer,SpliceJunctionScorer)] (default:())) – Sequence of variant scorers to use for scoring each variant. If no variant scorers are provided, the recommended variant scorers for the organism will be used.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.progress_bar (
bool(default:True)) – If True, show a progress bar.max_workers (
int(default:5)) – Number of parallel workers to use.
- Return type:
- Returns:
List of variant scores for each variant in the ISM interval.
- DnaClient.score_variant(interval, variant, variant_scorers=(), *, organism=Organism.HOMO_SAPIENS)[source]#
Generate variant scores for a single given DNA variant.
- Parameters:
interval (
Interval) – DNA interval to make prediction for.variant (
Variant) – DNA variant to make prediction for.variant_scorers (
Sequence[TypeVar(VariantScorerTypes,CenterMaskScorer,ContactMapScorer,GeneMaskLFCScorer,GeneMaskActiveScorer,GeneMaskSplicingScorer,PolyadenylationScorer,SpliceJunctionScorer)] (default:())) – Sequence of variant scorers to use for scoring. If no variant scorers are provided, the recommended variant scorers for the organism will be used.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.
- Return type:
- Returns:
List of
AnnDatavariant scores.
- DnaClient.score_variants(intervals, variants, variant_scorers=(), *, organism=Organism.HOMO_SAPIENS, progress_bar=True, max_workers=5)[source]#
Generate variant scores for a sequence of variants.
- Parameters:
intervals (
Interval|Sequence[Interval]) – DNA interval(s) to make prediction for. If a single interval is provided, then the same interval will be used for all variants.variants (
Sequence[Variant]) – Sequence of DNA variants to make prediction for.variant_scorers (
Sequence[TypeVar(VariantScorerTypes,CenterMaskScorer,ContactMapScorer,GeneMaskLFCScorer,GeneMaskActiveScorer,GeneMaskSplicingScorer,PolyadenylationScorer,SpliceJunctionScorer)] (default:())) – Sequence of variant scorers to use for scoring. If no variant scorers are provided, the recommended variant scorers for the organism will be used.organism (
Organism(default:<Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.progress_bar (
bool(default:True)) – If True, show a progress bar.max_workers (
int(default:5)) – Number of parallel workers to use.
- Return type:
- Returns:
List of
AnnDatalists corresponding to score_variant outputs for each variant.