Last active
July 16, 2026 11:46
-
-
Save vjcitn/e1edc651b3b355d90885fd755051d8ae to your computer and use it in GitHub Desktop.
Antigravity dialog to enumerate 1000 genomes data resources in a workspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This was produced in AnVIL using vjcitn/anvbiocagy:0.0.2 custom environment, after invoking "agy" and authenticating | |
| ──────────────────────────────────────────────────────────── | |
| > please write some R code that will produce a markdown table of the key data resources in this workspace | |
| ● ListDir(/home/jupyter) | |
| ● Bash(find . -maxdepth 3 -not -path '*/.*') | |
| ● ListDir(/home/jupyter/packages) | |
| ● Bash(find . -type f -not -path '*/.*') | |
| ● Bash(find . -maxdepth 2 -not -path '*/.cache*' -not -path '*/.local*' -not -path '*/.gemini*' -not -path '*/.config*' -not - | |
| ...) | |
| ● Bash(Rscript -e "print(sessionInfo())") | |
| ● Bash(df -h) | |
| ● Bash(Rscript -e "rownames(installed.packages())") | |
| ● Bash(find /home/jupyter -name "*.csv" -o -name "*.tsv" -o -name "*.json" -o -name "*.rds" -o -name "*.RData" -o -name | |
| "*.xls...) | |
| ● Bash(Rscript -e "head(as.data.frame(data(package = 'datasets')\$results), 10)") | |
| ● Bash(env) | |
| ● Bash(Rscript -e "library(AnVIL); ls('package:AnVIL')") | |
| ● Bash(Rscript -e "library(AnVIL); avtables()") | |
| ● Bash(Rscript -e "library(AnVIL); avbucket()") | |
| ● Bash(Rscript -e "getAnywhere('avbucket')") | |
| ● Bash(Rscript -e "library(AnVILGCP); ls('package:AnVILGCP')") | |
| ● Bash(Rscript -e "library(AnVIL); avstorage()") | |
| ● Bash(Rscript -e "library(AnVIL); head(avfiles_ls(), 20)") | |
| ● Bash(Rscript -e "library(AnVILGCP); head(avfiles_ls(), 20)") (ctrl+o to expand) | |
| [Background Task 832c2146-cbb8-4d20-9d26-53f67f8eca61/task-40 Finished] | |
| Exit Code: 0 | |
| Output: | |
| Registered S3 method overwritten by 'AnVILGCP': | |
| method from | |
| print.gcloud_sdk_result GCPtools | |
| [1] "gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0/1000G_biallelic.chr22.common.snps.vcf.gz" | |
| [2] "gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0/1000G_biallelic.chr22.common.snps.vcf.gz.tbi" | |
| [3] "gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0/9ec5a818-ee58-47c0-a7d2-ee1d82f76785/1000g_test/" | |
| [4] "gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0/plink.bed" | |
| [5] "gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0/plink.bim" | |
| [6] "gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0/plink.fam" | |
| ● Bash(gsutil ls gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0) | |
| ● Bash(gcloud storage ls gs://fc-secure-e139331a-8ad5-4636-820c-e68cb7268ca0) | |
| ● Bash(Rscript -e "library(AnVIL); library(knitr); kable(avtables(), format = 'markdown')") | |
| ● Bash(Rscript -e 'suppressPackageStartupMessages({library(AnVIL); library(knitr)}); cat(kable(avtables(), format = | |
| "markdown"...) | |
| ● Bash(Rscript -e 'suppressWarnings(suppressMessages({library(AnVIL); library(knitr)})); cat(kable(avtables(), format = | |
| "markd...) | |
| ● Create(/home/jupyter/list_resources.R) | |
| ● Bash(chmod +x /home/jupyter/list_resources.R) | |
| ● Bash(/home/jupyter/list_resources.R) | |
| ● Bash(Rscript -e 'library(AnVIL); tables <- avtables(); tables$colnames <- sapply(strsplit(tables$colnames, ", "), | |
| function(c...) | |
| ● Bash(Rscript -e 'library(AnVIL); tables <- avtables(); tables$colnames <- sapply(strsplit(tables$colnames, ", "), | |
| function(c...) | |
| ● Create(/home/jupyter/list_resources.R) | |
| ● Bash(/home/jupyter/list_resources.R) (ctrl+o to expand) | |
| I have created an R script that queries the workspace data resources using the AnVIL package and formats them as a clean, | |
| markdown-friendly table. | |
| The R script has been saved to list_resources.R. | |
| ### R Code | |
| #!/usr/bin/env Rscript | |
| # Suppress startup messages and warnings when loading packages | |
| suppressWarnings(suppressPackageStartupMessages({ | |
| library(AnVIL) | |
| library(knitr) | |
| })) | |
| # Retrieve workspace tables | |
| tables <- avtables() | |
| # Shorten the column list to avoid overly wide tables | |
| tables$colnames <- sapply(strsplit(tables$colnames, ", "), function(cols) { | |
| if (length(cols) > 4) { | |
| paste0(paste(cols[1:4], collapse = ", "), ", ...") | |
| } else { | |
| paste(cols, collapse = ", ") | |
| } | |
| }) | |
| # Output the tables as a markdown table | |
| cat(kable(tables, format = "markdown"), sep = "\n") | |
| ### Generated Markdown Table | |
| Running this script produces the following table of the key data resources (workspace tables) in this AnVIL workspace: | |
| table │ count │ colnames | |
| ───────────────────────────┼───────┼─────────────────────────────────────────────────────────────────────────────────────── | |
| participant │ 3202 │ participant_id, pfb:center_name, pfb:datarepo_row_id, pfb:experiment_id, ... | |
| anvil_biosample │ 6404 │ anvil_biosample_id, pfb:apriori_cell_type, pfb:biosample_id, pfb:datarepo_row_id, ... | |
| anvil_donor │ 3202 │ anvil_donor_id, pfb:datarepo_row_id, pfb:donor_id, pfb:genetic_ancestry, ... | |
| qc_result_sample │ 3184 │ qc_result_sample_id, pfb:cram, pfb:datarepo_row_id, pfb:freemix, ... | |
| sample_set │ 2 │ sample_set_id, pfb:datarepo_row_id, pfb:downsampled_gds, pfb:downsampled_vcf, ... | |
| file_inventory │ 26016 │ file_inventory_id, pfb:content_type, pfb:crc32c, pfb:datarepo_row_id, ... | |
| pedigree │ 3202 │ pedigree_id, pfb:datarepo_row_id, pfb:familyid, pfb:fatherid, ... | |
| workspace_attributes │ 24 │ workspace_attributes_id, pfb:attribute, pfb:datarepo_row_id, pfb:ingest_provenance, .. | |
| sample │ 3202 │ sample_id, pfb:cram, pfb:datarepo_row_id, pfb:gvcf, ... | |
| anvil_activity │ 25863 │ anvil_activity_id, pfb:activity_id, pfb:activity_type, pfb:datarepo_row_id, ... | |
| anvil_file │ 26016 │ anvil_file_id, pfb:data_modality, pfb:datarepo_row_id, pfb:drs_uri, ... | |
| anvil_dataset │ 1 │ anvil_dataset_id, pfb:consent_group, pfb:data_modality, pfb:data_use_permission, ... | |
| anvil_project │ 1 │ anvil_project_id, pfb:datarepo_row_id, pfb:funded_by, pfb:generated_dataset_id, ... | |
| duos_dataset_registration │ 1 │ duos_dataset_registration_id, pfb:dataset_id, pfb:description, pfb:duos_id, ... | |
| ### Summary of Work | |
| 1. Discovered Workspace Data Resources: Searched the local workspace and identified that the data resources are hosted as | |
| Terra/AnVIL workspace data tables. | |
| 2. Wrote R Code: Created a clean script that uses AnVIL::avtables to fetch the metadata and knitr::kable to format the | |
| result. The script also truncates long lists of columns to keep the markdown table readable. | |
| 3. Saved and Tested: Saved the script to list_resources.R, made it executable, and ran it to verify its output. | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's some more dialog: