Views
No views yet
transformers.pipeline call. The output of the call is a Python string containing the path to the written GFF file.1from transformers import pipeline
2
3pipe = pipeline(
4 task="genatator-pipeline",
5 model="AIRI-Institute/genatator-pipeline",
6 trust_remote_code=True,
7 device=0,
8 dtype="float32",
9)
10
11output_path = pipe(
12 "genome.fasta",
13 output_gff_path="genome.gff",
14)
15print(output_path)1from transformers import pipeline
2
3pipe = pipeline(
4 task="genatator-pipeline",
5 model="AIRI-Institute/genatator-pipeline",
6 trust_remote_code=True,
7 device=0,
8 dtype="float32",
9 edge_model_path="AIRI-Institute/genatator-moderngena-base-multispecies-edge-model",
10 region_model_path="AIRI-Institute/genatator-moderngena-base-multispecies-region-model",
11 transcript_type_model_path="AIRI-Institute/genatator-caduceus-ps-multispecies-transcript-type",
12 segmentation_model_path="AIRI-Institute/genatator-caduceus-ps-multispecies-segmentation",
13 edge_context_length=1024,
14 region_context_length=8192,
15 transcript_type_context_length=250000,
16 segmentation_context_length=250000,
17 edge_average_token_length=9.0,
18 region_average_token_length=9.0,
19 edge_max_genomic_chunk_ratio=1.5,
20 region_max_genomic_chunk_ratio=1.5,
21 edge_drop_last=False,
22 region_drop_last=False,
23 edge_apply_sigmoid=False,
24 region_apply_sigmoid=False,
25 transcript_type_apply_sigmoid=True,
26 segmentation_apply_sigmoid=True,
27 edge_gap_token_id=5,
28 region_gap_token_id=5,
29)
30
31output_path = pipe(
32 "genome.fasta",
33 output_gff_path="genome.gff",
34 edge_context_fraction=0.5,
35 region_context_fraction=0.5,
36 gene_finding_use_reverse_complement=True,
37 transcript_type_use_reverse_complement=True,
38 segmentation_use_reverse_complement=True,
39 lp_frac=0.05,
40 pk_prom=0.1,
41 pk_dist=50,
42 pk_height=None,
43 interval_window_size=2_000_000,
44 max_pairs_per_seed=10,
45 gene_finding_global_chunk_size=70_000_000,
46 prob_threshold=0.5,
47 zero_fraction_drop_threshold=0.01,
48 transcript_type_threshold=0.5,
49 splice_filter=True,
50 deduplicate=True,
51 intronic_filtering=True,
52 keep_longest_terminal_variant=True,
53 predict_internal_structure=True,
54 transcript_coloring_thresholds="auto",
55 use_cds_heuristic=True,
56 save_intermediate_files=False,
57 intermediate_output_dir=None,
58 pairing_progress_every=1000,
59 chunk_log_every=1000,
60 shift=None,
61)
62print(output_path)task — Hugging Face task name for this custom pipeline. Use "genatator-pipeline".model — Hugging Face repository or local directory containing the GENATATOR pipeline wrapper. For the published version, use "AIRI-Institute/genatator-pipeline".trust_remote_code — Must be True because the pipeline uses custom Python code from the model repository. Without it, Transformers will not load the custom pipeline class.device — CUDA GPU index used for inference, for example 0 for the first GPU. CPU execution with device=-1 is not supported currently.dtype — Tensor dtype used when loading the stage models. Only "float32" is supported currently.edge_model_path — Repository or local path for the edge model. This model predicts transcript boundary signals, namely TSS and PolyA signals on both strands.region_model_path — Repository or local path for the region model. This model predicts strand-specific intragenic signal that is used to remove weak candidate transcript intervals.transcript_type_model_path — Repository or local path for the transcript-type classifier. This model labels each retained candidate interval as mRNA or lnc_RNA.segmentation_model_path — Repository or local path for the segmentation model. This model predicts the internal exon, intron, and CDS structure of each retained interval.edge_context_length — Token length of each edge-model input window, including tokenizer system tokens. Larger values give the edge model more context, but also increase memory use.region_context_length — Token length of each region-model input window, including tokenizer system tokens. The default is 8192 tokens, matching the gene-finding benchmark and manuscript configuration.transcript_type_context_length — Maximum token length passed to the transcript-type model for each candidate interval. Only the leading prefix up to this context is evaluated, so sequence beyond this limit is ignored by the classifier.segmentation_context_length — Nucleotide length of each segmentation-model block inside a retained interval. Segmentation blocks are processed consecutively and without overlap.edge_average_token_length — Estimated average number of nucleotides represented by one edge-model tokenizer token. The pipeline uses this value to convert token context length into genomic window length before tokenization.region_average_token_length — Estimated average number of nucleotides represented by one region-model tokenizer token. The pipeline uses this value to convert token context length into genomic window length before tokenization.edge_max_genomic_chunk_ratio — Maximum expansion ratio for edge-model genomic extraction before tokenizer truncation. It gives the tokenizer extra nucleotide sequence so the final tokenized window can be filled reliably.region_max_genomic_chunk_ratio — Maximum expansion ratio for region-model genomic extraction before tokenizer truncation. It plays the same role as edge_max_genomic_chunk_ratio, but for the region model.edge_context_fraction — Fractional overlap between consecutive edge-model genomic windows. Higher overlap can smooth boundary predictions, but it increases the number of model calls.region_context_fraction — Fractional overlap between consecutive region-model genomic windows. Higher overlap can make intragenic masks more stable, but it increases computation time.edge_drop_last — If True, the final incomplete edge-model window is omitted. The default is False, which keeps the final window so the end of the sequence is still processed.region_drop_last — If True, the final incomplete region-model window is omitted. The default is False, which keeps the final window so the end of the sequence is still processed.edge_gap_token_id — Token ID used to correct edge-model offset mappings for gap tokens. Most users should keep the default unless they change the tokenizer.region_gap_token_id — Token ID used to correct region-model offset mappings for gap tokens. Most users should keep the default unless they change the tokenizer.gene_finding_global_chunk_size — Maximum nucleotide length of each global chunk used by the edge model only. For each global chunk, the pipeline computes edge predictions, runs FFT smoothing and peak calling inside that chunk, keeps only sparse peak coordinates, discards the raw edge predictions, and then moves to the next chunk if the DNA sequence is longer.lp_frac — Fraction of the Fourier spectrum retained by the low-pass smoother before peak detection. Smaller values produce smoother boundary tracks and can remove local noise.pk_prom — Minimum peak prominence used during TSS and PolyA boundary detection. Higher values make peak calling more conservative.pk_dist — Minimum nucleotide distance between neighboring peaks of the same boundary class. This helps avoid calling several nearby peaks for one broad signal.pk_height — Optional minimum peak height after smoothing. Use None to disable this extra height filter.interval_window_size — Maximum distance allowed when pairing a TSS peak with a PolyA peak on the same strand. Candidate transcript intervals longer than this pairing window are not created.max_pairs_per_seed — Maximum number of nearest PolyA partners retained for each TSS seed. Larger values create more candidate intervals and can increase downstream computation.prob_threshold — Threshold used to convert region-model intragenic signal into a binary mask. A base is considered intragenic only when the model signal is above this threshold.zero_fraction_drop_threshold — Maximum tolerated fraction of non-intragenic bases inside a candidate interval. Intervals with a larger fraction below prob_threshold are discarded.gene_finding_use_reverse_complement — Enables reverse-complement averaging for the edge and region models. This can improve strand-aware interval discovery, but it roughly doubles gene-finding model calls.transcript_type_use_reverse_complement — Enables reverse-complement averaging for transcript-type classification. The forward and reverse-complement scores are averaged before the final mRNA or lnc_RNA decision.segmentation_use_reverse_complement — Enables reverse-complement averaging for segmentation. This can stabilize structure prediction, but it increases segmentation compute cost.edge_apply_sigmoid — Applies an additional sigmoid to edge-model output channels before token-to-nucleotide projection. The default is False, because the published edge model outputs are already expected in the correct scale.region_apply_sigmoid — Applies an additional sigmoid to region-model output channels before token-to-nucleotide projection. The default is False, because the published region model outputs are already expected in the correct scale.transcript_type_apply_sigmoid — Applies sigmoid to single-logit transcript-type outputs before thresholding. For multi-logit outputs, the pipeline uses softmax instead.segmentation_apply_sigmoid — Applies an additional sigmoid to segmentation-model output channels before structural decoding. The default is True for the published segmentation setup.transcript_type_threshold — Threshold applied to the predicted lnc_RNA probability. Intervals at or above this value are labeled lnc_RNA, and intervals below it are labeled mRNA.splice_filter — Enables splice-motif filtering and terminal splice-boundary correction for exon and CDS segments. This post-processing step can remove or adjust segments that disagree with expected splice signals.deduplicate — Removes duplicate final transcript predictions. This is applied near the end of GFF generation to avoid repeated identical transcripts.intronic_filtering — Drops transcript predictions whose segmentation starts or ends with the intron class. This removes predictions that appear to begin or end inside an intron.keep_longest_terminal_variant — For overlapping transcripts with the same internal structure, keeps the longest terminal variant. This reduces redundant terminal variants that differ mainly by transcript ends.predict_internal_structure — Controls whether the pipeline continues past interval discovery into transcript-type classification, segmentation, and GFF generation. Keep it as True for normal annotation output.use_cds_heuristic — Replaces predicted CDS segments with the exon-derived CDS heuristic used in the accompanying benchmark code. This affects mRNA transcripts only, and no CDS is emitted for lnc_RNA transcripts.transcript_coloring_thresholds — Controls transcript color bins in the output GFF. Use "auto" to split the observed segmentation-confidence range into four bins, or provide a custom list of exactly four thresholds.#66cc66, light green.#006400, dark green.#dcdcff, light blue.#0c0c78, dark blue.save_intermediate_files — If True, writes gene-finding intermediate artifacts for each FASTA record. In the memory-efficient path, these are compact edge peak .npz files, compact intragenic-mask .npz files, .bed interval files, and a compressed .h5 debug dump when h5py is installed.intermediate_output_dir — Output directory for intermediate artifacts. If omitted, intermediate files are written next to the input FASTA file.pairing_progress_every — Logging interval, measured in TSS seeds, during candidate interval construction. Increase it for less frequent logs.chunk_log_every — Logging interval, measured in genomic chunks, during edge and region inference. Increase it for less frequent logs on large genomes.shift — Coordinate offset applied to final GFF coordinates. Use an integer offset directly, or use "UCSC" to infer the offset from FASTA headers of the form chrom:start-end.output_gff_path — Path of the GFF file written by the pipeline call. If you do not provide it, the pipeline writes a default GFF path derived from the input FASTA path.gene_finding_global_chunk_size. After each global chunk is peak-called, the raw edge predictions are discarded and only sparse peak coordinates are kept.mRNA or lnc_RNA. Only the leading token prefix defined by transcript_type_context_length is evaluated.transcript_type_threshold.genemRNA or lnc_RNAexonCDS, for mRNA transcripts onlylnc_RNA transcripts.lncRNA_probability, mRNA_probability, exon_segmentation_confidence, cds_segmentation_confidence, segmentation_confidence, and color. Exon and CDS features include mean_probability, and intron features are not emitted in the output GFF.edge_model_path, AIRI-Institute/genatator-moderngena-base-multispecies-edge-modelregion_model_path, AIRI-Institute/genatator-moderngena-base-multispecies-region-modeltranscript_type_model_path, AIRI-Institute/genatator-caduceus-ps-multispecies-transcript-typesegmentation_model_path, AIRI-Institute/genatator-caduceus-ps-multispecies-segmentation.gff file.environment.yml before running the pipeline locally. This project currently requires a CUDA-capable GPU.1conda env create -f environment.yml
2conda activate genatator_pipeline1conda env create -n genatator_pipeline -f docker/conda-core.yml
2conda activate genatator_pipeline
3
4pip install torch==2.2.2+cu121 torchvision==0.17.2+cu121 torchaudio==2.2.2+cu121 --index-url https://download.pytorch.org/whl/cu121
5pip install causal-conv1d==1.4.0 --no-build-isolation
6pip install mamba-ssm==2.2.2 --no-build-isolation
7pip install packaging==26.0 ninja==1.13.0 psutil==7.2.2
8pip install flash-attn==2.6.3 --no-build-isolation
9pip install -r docker/requirements.txtgene feature for each predicted gene locus and one transcript feature for each predicted transcript. Exons and CDS features are derived from the segmentation stage, and CDS features are emitted only for transcripts classified as mRNA.lncRNA_probability attribute stores the score produced by the transcript-type model.docker/.docker build -f docker/Dockerfile -t genatator-pipeline:latest .docker run --gpus all --rm -p 3000:3000 -v "$(pwd)":/generated genatator-pipeline:latestPOST /api/genatator-pipeline/uploadfile containing FASTA, or form field dna.fasta_file, fai_file, gff_file, and archive.curl -X POST "http://localhost:3000/api/genatator-pipeline/upload" -F "file=@genome.fasta"