Why use Code Execution?
Built-in charts and variant filters handle common tasks well. Code Execution is for everything else — the analyses that require custom logic, advanced statistics, or visualizations that go beyond standard chart types.| Capability | Built-in Charts | Code Execution |
|---|---|---|
| Bar, pie, line charts | Yes | Yes |
| Heatmaps and clustered plots | No | Yes |
| Statistical tests and p-values | No | Yes |
| Custom filtering logic | No | Yes |
| Multi-step data pipelines | No | Yes |
| Publication-quality figures | No | Yes |
| R language support | No | Yes |
How it works
You ask for an analysis
Describe what you need in plain language. For example: “Create a heatmap of variant pathogenicity across genes in my case.”
Purna provisions a private server
A dedicated compute server is created and attached to your chat session. This server is private to you — no other user shares it.
Your variant data is loaded
Purna securely loads the relevant variant data from your selected case into the server environment, ready for analysis.
Code is written and executed
Purna writes the Python or R code, executes it on the server, and streams the results — text output, tables, charts, and images — back into your chat.
The server automatically pauses when not in use and shuts down after a period of inactivity. You are billed only for active server usage. See Billing for details.
Available libraries
Your compute server comes pre-loaded with a full scientific computing environment.Python
| Category | Libraries |
|---|---|
| Data science | pandas, NumPy |
| Visualization | matplotlib, seaborn, Plotly |
| Statistics | SciPy, statsmodels, scikit-learn, pingouin |
| Bioinformatics | Biopython, pysam, cyvcf2, pybedtools, pyvcf3, pyfaidx |
| Survival analysis | lifelines |
R
R is supported as an execution language with access to standard statistical and bioinformatics packages.System tools
samtools, bcftools, bedtools, and tabix are available for command-line genomic operations.Accessing your variant data
Purna automatically loads your case’s variant data when you start a code execution. There are two ways data is made available:Preloaded CSV
Variant data from your selected case is written as a CSV file into the server. Your code can load it directly withpd.read_csv(). The file includes columns for gene, chromosome, position, ref/alt alleles, zygosity, pathogenicity, consequence, gnomAD allele frequency, ClinVar significance, and rsID.
Direct data access
For larger datasets or advanced queries, Purna injects anexus module into your environment with functions that query your case data directly:
nexus.fetch_variants(filters)— Fetch variants matching specific criterianexus.fetch_all_variants()— Retrieve all variants with automatic paginationnexus.aggregate(group_by, metrics)— Run fast aggregations without loading individual recordsnexus.get_af_histogram(bins)— Get allele frequency distributionnexus.get_distribution(field)— Get value distribution for any fieldnexus.get_schema()— View all available fields
Use cases
Heatmaps and clustered visualizations
Standard chart types cannot produce heatmaps. With Code Execution, Purna can generate heatmaps showing variant pathogenicity across genes, allele frequency distributions across chromosomes, or any two-dimensional data matrix with color-coded values. Try: “Create a heatmap of variant consequence types across the top 20 genes in my case.”Advanced filtering and categorization
When built-in filters are not expressive enough, use code to apply multi-condition logic. For example, filter variants that are missense, have a gnomAD frequency below 0.01, are in genes on your cardiac panel, and have a SIFT score below 0.05 — all in one step. Try: “Filter for rare missense variants in cardiac genes with damaging SIFT predictions and show me a summary table.”Statistical analysis
Run chi-squared tests, Fisher’s exact tests, logistic regression, or survival analysis on your variant data. Compute odds ratios, confidence intervals, and p-values for variant enrichment across categories. Try: “Run a Fisher’s exact test comparing the proportion of pathogenic variants in coding vs non-coding regions.”Publication-quality figures
Generate multi-panel figures, violin plots, swarm plots, and annotated scatter plots suitable for manuscripts and presentations. Customize fonts, axis labels, legends, and color palettes. Try: “Create a violin plot of allele frequencies grouped by pathogenicity classification, with a log-scaled y-axis.”Variant prioritization pipelines
Build custom scoring or ranking logic. Combine ClinVar classification, allele frequency, consequence type, and conservation scores into a weighted composite score to prioritize variants for review. Try: “Score each variant based on pathogenicity, rarity, and functional impact, then rank the top 20.”Cohort and batch comparisons
Compare variant profiles across cases or samples. Identify shared variants, compute overlap statistics, or generate Venn diagrams. Try: “Compare the pathogenic variants in this case with the findings from my previous three cases.”Billing
Code Execution uses a private compute server provisioned on demand. You are billed based on server usage:- Server time is counted while the server is actively running code.
- Paused servers do not incur charges. Servers automatically pause between executions.
- Idle shutdown occurs after an extended period of inactivity, freeing all resources.
Each chat session gets its own server. Starting a new chat creates a new server. Returning to an existing chat resumes the same server with your previous state intact.
Tips for best results
Be specific about output
Tell Purna what format you want — a table, a plot, a single number, or a file. The more specific you are, the better the result.
Iterate in the same chat
Follow-up requests reuse the same server. Ask Purna to tweak the analysis, adjust a plot, or rerun with different parameters without starting over.
Use aggregations for speed
For summary statistics, ask Purna to use
nexus.aggregate() instead of loading all variants. This runs on the database and returns results much faster.Combine with built-in tools
Use built-in variant search to narrow your dataset first, then switch to Code Execution for custom analysis on the filtered results.
