Skip to content

Instantly share code, notes, and snippets.

@vjcitn
Last active July 16, 2026 11:46
Show Gist options
  • Select an option

  • Save vjcitn/e1edc651b3b355d90885fd755051d8ae to your computer and use it in GitHub Desktop.

Select an option

Save vjcitn/e1edc651b3b355d90885fd755051d8ae to your computer and use it in GitHub Desktop.
Antigravity dialog to enumerate 1000 genomes data resources in a workspace
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.
@vjcitn

vjcitn commented Jul 16, 2026

Copy link
Copy Markdown
Author

Here's some more dialog:

> Is there a VCF file for chromosome 17?  Or does the VCF data combine all chromosomes?
● Bash(Rscript -e "library(AnVIL); library(dplyr); af <- avtable('anvil_file'); cat('anvil_file vcf fi...) (ctrl+o to
expand)

  I am querying the  anvil_file  and  file_inventory  tables in R to search for files with "vcf" in their name or format
  to see if there are chromosome-specific VCF files (like chromosome 17) or a combined VCF. I will show the result
  shortly.

● Bash(Rscript -e "library(AnVIL); library(dplyr); af <- avtable('anvil_file'); print(af %>% filter(gr...) (ctrl+o to
expand)

  I am printing the full file names of some of the VCF files from the  anvil_file  table to see their naming convention.
  I will share the output in a moment.

● Bash(Rscript -e "library(AnVIL); library(dplyr); af <- avtable('anvil_file'); cat('Files containing ...) (ctrl+o to
expand)

  I am running queries to search the file names for the string "chr" or "17" to see if there are chromosome 17 specific
  files, and will report back as soon as the check completes.

▸ Thought for 1s, 348 tokens
  Analyzing File Lists

● Bash(Rscript -e "library(AnVIL); library(dplyr); af <- avtable('anvil_file'); print(af %>% filter(gr...) (ctrl+o to
expand)

  I am running a search query to specifically check for files named with "chr17" in the  anvil_file  table and get their
  file names, sizes, and DRS URIs. I will report the results once the task completes.

● Bash(Rscript -e "library(AnVIL); library(dplyr); af <- avtable('anvil_file'); print(af %>% filter(gr...) (ctrl+o to
expand)

  I am running a query to print all 16 rows matching "chr17" in full, along with their file sizes and DRS URIs, so we
  can verify exactly what chromosome 17 files exist. I will show the results shortly.

● Bash(Rscript -e "library(AnVIL); library(dplyr); af <- avtable('anvil_file'); res <- af %>% filter(g...) (ctrl+o to
expand)

  I am running a formatted print command to list each of the chromosome 17 files with their full, untruncated file
  names, sizes, and DRS URIs. I will show the list as soon as the print command finishes.

  Yes, there are VCF files specifically for Chromosome 17 in this workspace!

  Rather than combining all chromosomes into one massive, unwieldy VCF file, the joint-called cohort dataset (
  CCDG_13607_B01_GRM_WGS_2019-02-19 ) is split by chromosome.

  Here are the key Chromosome 17 VCF and related files available in the  anvil_file  table:

  ### 1. Joint-Called Chromosome 17 VCF Files

  • Raw VCF:  CCDG_13607_B01_GRM_WGS_2019-02-19_chr17.recalibrated_variants.vcf.gz  (~38.6 GB)
      • Index:  ..._chr17.recalibrated_variants.vcf.gz.tbi
  • Annotated VCF:  CCDG_13607_B01_GRM_WGS_2019-02-19_chr17.recalibrated_variants.annotated.vcf.gz  (~340.9 MB)
      • Index:  ..._chr17.recalibrated_variants.annotated.vcf.gz.tbi


  ### 2. Associated Annotation Tables (TXT format)

  These tab-separated files extract and annotate specific subsets of variants from the Chromosome 17 VCF:

  • All Annotated Variants:  ..._chr17.recalibrated_variants.annotated.txt  (~2.64 GB)
  • Coding Variants:  ..._chr17.recalibrated_variants.annotated.coding.txt  (~27.9 MB)
  • Rare Coding Variants:  ..._chr17.recalibrated_variants.annotated.coding_rare.txt  (~27.0 MB)
  • Clinical Variants:  ..._chr17.recalibrated_variants.annotated.clinical.txt  (~669 KB)
  ──────
  ### Individual Sample Data (Genomic VCFs)

  Note that if you look at individual sample-level data (like  HG02505.haplotypeCalls.er.raw.g.vcf.gz  shown in the
  sample  table), those raw single-sample gVCF files are not split and contain all chromosomes combined for that
  individual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment