# Foundational Open Science Skills (FOSS) — full corpus
Each page below begins with its canonical URL followed by its original Markdown, OKF frontmatter included. Relative links have been rewritten to absolute URLs.
---8<--- https://unm-carc.github.io/foss/course/setup/
---
title: "Before FOSS Starts"
description: "Accounts to create and software to install before the first FOSS session, including notes for Windows users."
type: Guide
tags:
- Setup
- Accounts
- Software
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/installation.md"
title: "CyVerse FOSS: docs/installation.md"
author: "team:cyverse"
last_modified: "2024-09-05T10:56:33-07:00"
---
# Before FOSS Starts
Welcome to FOSS Online, we're happy you're here! To get you ready to hit the ground running, please set up the prerequisite accounts and software listed below before the course starts.
!!! note "Offering-specific links"
The Slack workspace and HackMD notes below were set up for the CyVerse-run offering of FOSS.
If you take FOSS through another offering, your instructors will share the equivalents.
## Account Creation
We will be using several services that require you to create a user account.
| Account | Notes |
| --- | --- |
| [:material-github: GitHub](https://github.com){target=_blank} | GitHub will be used to store lecture materials and your own work. We will use [GitHub Education](https://education.github.com/){target=_blank} and its free features for hands-on.
| [:material-docker: Docker](https://hub.docker.com){target=_blank} | Link your GitHub account to the DockerHub. |
| [:material-slack: Slack](https://uadatascience.slack.com/){target=_blank} | We use the `UA Data Science` Slack organization's foss channel, you should have received an invitation via email. You can use Slack in the browser, but the desktop app is usually less buggy. |
| [:material-language-markdown: HackMD](https://hackmd.io/){target=_blank} | We will use HackMD in order to facilitate daily discussions, questions and general notes. Link your HackMD using your GitHub account
| [Cyverse](https://user.cyverse.org/signup){target=_blank} | We will introduce you to Cyverse which is a powerful cloud computer with large data storage.
!!! info "Link to :material-language-markdown: HackMD"
https://hackmd.io/-4TgToyFRU2eX7lmDZLRnQ?both
??? tip "Dual Monitors vs Side-by-Side"
We strongly recommend you have dual monitors set-up while attending virtual FOSS Zoom lessons.
We will be doing a lot of screen-sharing, and this will make your own interactive sessions less visible, or you will have to make them less than full screen.
If you only have one monitor, make sure to exit full screen mode on Zoom and your browser, so you can view everything side-by-side
## Required Software
You will need to have the following software installed on your personal computer:
| Software | Notes |
| -------- | ----- |
| Web Browser | [:material-google-chrome: Chrome](https://www.google.com/chrome/dr/download/){target=_blank} or [:material-firefox: Firefox](https://www.mozilla.org/en-US/firefox/new/){target=_blank}. |
| Text Editor | [:material-microsoft-visual-studio-code: VS Code](https://code.visualstudio.com/download){target=_blank} or [SublimeText](https://www.sublimetext.com/){target=_blank} |
!!! warning "**Attention** :material-microsoft-windows: Windows users"
Much of what we are going to be teaching is based on open-source software which operates on cloud and is incompatible with Windows OS.
Unix-based systems such as Linux [:material-ubuntu: Ubuntu](https://ubuntu.com/){target=_blank} and [:material-apple: MacOS X](https://www.apple.com/macos/){target=_blank}, as many scientific tools require a Unix Operating System (OS).
There are a number of software that allow Windows users to execute Unix commands, however we recommend the use of [:material-microsoft-windows: Windows Subsystem for Linux (WSL) 2.0](https://docs.microsoft.com/en-us/windows/wsl/install){target=_blank}.
[:material-microsoft-visual-studio-code: VS Code](https://code.visualstudio.com/download){target=_blank} is a Microsoft product and integrates seamlessly with Unix systems, we therefore strongly encourage you to install Code on your Windows OS.
---
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/installation.md){target=_blank} (last source update 2024-09-05), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/course/schedule/
---
title: "Weekly Schedule and Communications"
description: "Week-by-week schedule of the Fall 2025 FOSS offering, with lesson topics and links to each session's HackMD notes."
type: Schedule
tags:
- Schedule
- Course
stale_after: "2025-11-19T00:00:00Z"
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/schedule.md"
title: "CyVerse FOSS: docs/schedule.md"
author: "team:cyverse"
last_modified: "2025-11-03T14:09:07-07:00"
---
# Weekly Schedule and Communications
This page records the dated Fall 2025 offering of FOSS, taught online by CyVerse; the dates and
HackMD links are kept for reference. The lessons themselves are self-paced and always available in
[Lessons](https://unm-carc.github.io/foss/lessons/).
Sessions met on Tuesdays, 11:00 am – 1:00 pm Arizona time, from September 2 to November 18, 2025.
!!! info "In Session Communication"
Communications within meeting are done through [**HackMD**](https://homepage.hackmd.io/){target=_blank}, a [Markdown](https://en.wikipedia.org/wiki/Markdown){target=_blank} based documentation tool that allows for multiple users to add notes at the same time.
Markdown is a lightweight and extremely simple text formatter used by platforms such as GitHub, GitLab and LLM chatbots such as ChatGPT to display text in an intended manner without using CSS or HTML.
If you are not familiar with Markdown, we highly suggest visiting the [Markdown Guide](https://www.markdownguide.org/){target=_blank} for quick reference.
Links to each week's HackMD are posted next to the Topic Overview column and made available prior to the session starting.
## Calendar
| Week | Date | Content | Topic Overview | HackMD link |
|---|---|---|---|---|
| **Week 1** | Sept. 2 | [Intro to Open Science](https://unm-carc.github.io/foss/lessons/01-open-science/) | - The big picture of what Open Science is and why do it. - How to apply the Open approach to various scientific processes and enhance your individual research. | [Session 1 HackMD](https://hackmd.io/@cyverse-foss/S1EsdPmqee){target=_blank} |
| **Week 2** | Sept. 9 | [Data management & Documentation](https://unm-carc.github.io/foss/lessons/02-data-management/) | - Inferring on the importance of data and how your project can benefit from successful data management, discussing DMPs, storage, sharing and licences. - Emphasizing the role of effective documentation for research and projects in the age of Open Science. | [Session 2 HackMD](https://hackmd.io/MByoWD6HRxmcZiD9N8644Q){target=_blank} |
| **Week 3** | Sept. 16 | [How to Talk to Computers](https://unm-carc.github.io/foss/lessons/03-talk-to-computers/) | - Learning of the command line, a more direct and powerful way to instruct your computer. - Introduction to the basics of the Unix Shell. - Why shell skills are useful for personal computing, cloud, and HPC. | [Session 3 HackMD](https://hackmd.io/dpcoltaSQ4WJ6Nz1moXBvw){target=_blank} |
| **Week 4** | Sept. 23 | [How to Talk to LLMs](https://unm-carc.github.io/foss/lessons/04-talk-to-llms/) | - Understanding how large language models (LLMs) work and how to effectively prompt them. - Exploring use cases for research and coding. - Limitations, biases, and ethical considerations when working with AI tools. | Session 4 HackMD |
| **Week 5** | Sept. 30 | [Reproducibility I: Version Control](https://unm-carc.github.io/foss/lessons/05-version-control/) | - Introduction to Git & GitHub as tools for personal and collaborative work through version tracking using GitHub. | Session 5 HackMD |
| **Week 6** | Oct. 7 | [Reproducibility II: Software Environments](https://unm-carc.github.io/foss/lessons/06-software-environments/) | - Reproducibility means for code to be executable on any machine; This session tackles this exact topic: computing enviroments and package managers ensure your analysis runs smoothly across machines. | Session 6 HackMD |
| **Week 7** | Oct. 14 | [Reproducibility III: Containers](https://unm-carc.github.io/foss/lessons/07-containers/) | - Continuing on reproducible analysis with software containers. - Introduction to container technology (e.g., Docker). - Running simple containers to illustrate how and why to use them. | Session 7 HackMD |
| **Week 8** | Oct. 21 | [Remote Computing: High Performance Computing (HPC)](https://unm-carc.github.io/foss/lessons/08-hpc/) | - What to do when your laptop won’t cut it for large-scale analysis. - Basics of high performance computing (HPC). - How to log on, navigate, and submit jobs to the University of Arizona HPC. | Session 9 HackMD |
| **Week 9** | Oct. 28 | [Remote Computing: CyVerse](https://unm-carc.github.io/foss/lessons/09-cyverse/) | - Introduction to CyVerse, a University of Arizona cloud computing platform, useful for storing data, executing pipelines and publishing datasets. | Session 8 HackMD |
| **Week 10** | Nov. 4 | [AI Models & Where to Find Them (Training Your Own AI Models)](https://tyson-swetnam.github.io/intro-gpt/agenda/#about){target=_blank} | - Overview of available AI models for research. - How to train, fine-tune, and deploy your own models. - Practical considerations: compute needs, datasets, and reproducibility. | Session 10 HackMD |
| **Week 11**| Nov. 11 | Help Session | We will take a break from new content and simply be available to answer any questions related to the workshop content including helping with your personal capstone projects. | - |
| **Week 12**| Nov. 18 | Capstone Presentations | Each Student will present their capstone project! | - |
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/schedule.md){target=_blank} (last source update 2025-11-03), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/course/code-of-conduct/
---
title: "Code of Conduct"
description: "Expected conduct for FOSS participants and how to report a violation."
type: Policy
tags:
- Policy
- Community
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/code_of_conduct.md"
title: "CyVerse FOSS: docs/code_of_conduct.md"
author: "team:cyverse"
last_modified: "2022-07-13T13:15:48+07:00"
---
# Code of Conduct
!!! note
This is the code of conduct CyVerse used for its FOSS offerings. If you take FOSS through
another organization, that organization's policies and reporting contacts apply.
In conjunction with for using CyVerse cyberinfrastructure, this Code of
Conduct applies to all Event participants and their activities while
using CyVerse resources and/or attending the Event.
CyVerse is dedicated to providing professional computational research
and educational experiences for all of our users, regardless of domain
focus, academic status, educational level, gender/gender
identity/expression, age, sexual orientation, mental or physical
ability, physical appearance, body size, race, ethnicity, religion (or
lack thereof), technology choices, dietary preferences, or any other
personal characteristic.
When using CyVerse or participating at an Event, we expect you to:
- Interact with others and use CyVerse professionally and ethically by
complying with our Policies.
- Constructively critize ideas and processes, not people.
- Follow the Golden Rule (treat others as you want to be treated) when
interacting online or in-person with collaborators, trainers, and
support staff.
- Comply with this Code in spirit as much as the letter, as it is
neither exhaustive nor complete in identifying any and all possible
unacceptable conduct.
We do not tolerate harassment of other users or staff in any form
(including, but not limited to, violent threats or language, derogatory
language or jokes, doxing, insults, advocating for or encouraging any of
these behaviors). Sexual language and imagery are not appropriate at any
time (excludes Protected Health Information in compliance with HIPAA).
Any user violating this Code may be expelled from the platform and the
workshop at CyVerse's sole discretion without warning.
To report a violation of this Code, directly message a trainer via Slack
or email with the following information:
- Your contact information
- Names (real, username, pseudonyms) of any individuals involved, and
or witness(es) if any.
- Your account of what occurred and if the incident is ongoing. If
there is a publicly available record (a tweet, public chat log,
etc.), please include a link or attachment.
- Any additional information that may be helpful in resolving the
issue.
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/code_of_conduct.md){target=_blank} (last source update 2022-07-13), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/course/glossary/
---
title: "Glossary & Acronyms"
description: "Definitions of the computing, open-science, and cyberinfrastructure terms and acronyms used throughout FOSS."
type: Reference
tags:
- Glossary
- Reference
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/glossary.md"
title: "CyVerse FOSS: docs/glossary.md"
author: "team:cyverse"
last_modified: "2022-07-15T16:10:54+07:00"
---
# Glossary & Acronyms
**A**
- **action:** automate a workflow in the context of CI/CD, see [GitHub Actions](https://github.com/features/actions){target=_blank}
- **agile:** [development methodology](https://en.wikipedia.org/wiki/Agile_software_development){target=_blank}
for organizing a team to complete tasks organized over short periods
called 'sprints'
- **allocation:** portion of a resource assigned to a particular
recipient, typical unit is a core or node hour
- **Anaconda:** open source data science platform.
[Anaconda.com](https://www.anaconda.com/){target=_blank}
- **application:** also called an 'app', a software designed to help
the user to perform specific task
- **awesome:** a curated set of lists that provide insight into
[awesome software projects on GitHub](https://github.com/topics/awesome-list){target=_blank}
- **AVU:** Attribute-Value-Unit a components for [iRODS
metadata](https://docs.irods.org/4.1.9/icommands/metadata/).
**B**
- **beta:** a software version which is not yet ready for
publication but is being tested
- **bash:** Bash is the GNU Project's shell, the [Bourne-Again
Shell](https://www.gnu.org/software/bash/)
- **biocontainer:** a community-driven project that provides the
infrastructure and basic guidelines to create, manage and distribute
bioinformatics packages (e.g conda) and containers (e.g docker,
singularity)
- **bioconda:** a channel for the conda package manager specializing
in bioinformatics software
**C**
- **CLI:** the UNIX shell [command line interface](https://en.wikipedia.org/wiki/Command-line_interface){target=_blank},
most typically BASH
- **command:** a set of instructions sent to the computer, typically
in a typed interface
- **conda:** an installation type of the Anaconda data science
platform. Command line application for managing packages and
environments
- **container:** virtualization of an operating system run within an
isolated user space
- **Continuous Integration:** (CI) is testing automation to check that
the application is not broken whenever new commits are integrated
into the main branch
- **Continuous Delivery:** (CD) is an extension of 'continuous
integration' to make sure that you can release new changes in a
sustainable way
- **Continuous Deployment:** a step further than 'continuous
delivery', every change that passes all stages of your production
pipeline is released
- **Continuous Development:** a process for iterative software
development and is an umbrella over several other processes
including 'continuous integration', 'continuous testing',
'continuous delivery' and 'continuous deployment'
- **Continuous Testing:** a process of testing and automating software
development.
- **CRAN:** The [Comprehensive R Archive
Network](https://cran.r-project.org/)
- **CyVerse tool:** Software program that is integrated into the back
end of the DE for use in DE apps
- **CyVerse app:** graphic interface of a tool made available for use
in the DE
**D**
- **Debian:** [a free OS](https://www.debian.org/){target=_blank}, base of other
Linux distributions such as Ubuntu
- **Development:** the environment on your computer where you write
code
- **DevOps** Software *Dev*elopment and information techology
*Op*erations techniques for shortening the time to change software
in relation to CI/CD
- **Discovery Environment (DE):** a data science workbench for running
executable, interactive, and high throughput applications in
[CyVerse DE](https://de.cyverse.org){target=_blank}
- **distribution:** abbreviated as 'distro', an operating system
made from a software collection based upon the Linux kernel
- **Docker:** [Docker](https://www.docker.com/){target=_blank} is an open source
software platform to create, deploy and manage virtualized
application containers on a common operating system (OS), with an
ecosystem of allied tools. A program that runs and handles
life-cycle of containers and images
- **DockerHub:** an official registry of docker containers, operated
by Docker. [DockerHub](https://hub.docker.com/){target=_blank}
- **DOI:** a digital object identifier. A persistant identifier
number, managed by the [doi.org](https://www.doi.org/){target=_blank}
- **Dockerfile:** a text document that contains all the commands you
would normally execute manually in order to build a Docker image.
Docker can build images automatically by reading the instructions
from a Dockerfile
**E**
- **environment:** software that includes operating system, database
system, specific tools for analysis
- **entrypoint:** In a Dockerfile, an ENTRYPOINT is an optional
definition for the first part of the command to be run
**F**
- **FOSS:** (1) [Free and Open Source Software](https://en.wikipedia.org/wiki/Free_and_open-source_software){target=_blank}, (2)
[Foundational Open Science Skills](https://cyverse.org/foss){target=_blank} - this class!
- **function:** a named section of a program that performs a specific
task
**G**
- **git:** a version control system software
- **gitter:** a Github based messaging service that uses markdown
[gitter.im](https://gitter.im){target=_blank}
- **GitHub:** a website for hosting `git` repositories - owned by
Microsoft [GitHub](https://github.com){target=_blank}
- **GitLab:** a website for hosting `git` repositories
[GitLab](https://gitlab.com){target=_blank}
- **GitOps:** using `git` framework as a means of deploying
infrastructure on cloud using Kubernetes
- **GPU:** graphic processing unit
- **GUI:** graphical user interface
**H**
- **hack:** a quick job that produces what is needed, but not well
- **HPC:** High Performance Computer, for large syncronous computation
- **HTC:** High Throughput Computer, for many parallel tasks
**I**
- **IaaS:** [Infrastructure as a Service](https://en.wikipedia.org/wiki/Infrastructure_as_a_service){target=_blank}.
online services that provide APIs
- **iCommands:** [command line application](https://docs.irods.org/master/icommands/user/){target=_blank} for
accessing iRODS Data Store
- **IDE:** integrated development environment, typically a graphical
interface for working with code language or packages
- **instance:** a single virtul machine
- **image:** self-contained, read-only 'snapshot' of your applications
and packages, with all their dependencies
- **iRODS:** an open source integrated Rule-Oriented Data Management
System, [iRODS.org](https://irods.org/){target=_blank}
**J**
- **Java:** programming language, class-based, object-oriented
- **JavaScript:** programming language
- **JSON:** Java Script Object Notation, data interchange format that
uses human-readable text
- **Jupyter(Hub,Lab,Notebooks):** an IDE, originally the
iPythonNotebook, operates in the browser [Project
Jupyter](https://jupyter.org/)
**K**
- **kernel:** central component of most operating systems (OS)
- **Kubernetes:** an open source container orchestration platform
created by Google [Kubernetes](https://kubernetes.io/){target=_blank} is often
referred to as `K8s`
**L**
- **lib:** a UNIX library
- **linux:** open source Unix-like operating system
**M**
- **makefile:** a file containing a set of directives used by a [make
build automation tool](https://www.gnu.org/software/make/)
- **markdown:** a lightweight markup language with plain text
formatting syntax
- **metadata::** data about data, useful for searching and querying
- **multi-thread:** a process which runs on more than one CPU or GPU
core at the same time
- **master node:** responsible for deciding what runs on all of the
cluster's nodes. Can include scheduling workloads, like
containerized applications, and managing the workloads' lifecycle,
scaling, and upgrades. The master also manages network and storage
resources for those workloads
- **Mac OS X:** Apple's popular desktop OS
**N**
- **node:** a computer, typically 1 or 2 core (with many threads)
server in a cloud or HPC center
**O**
- **ontology:** formal naming and structural hierarchy used to
describe data, also called a [knowledge
graph](https://en.wikipedia.org/wiki/Ontology_(information_science))
- **organization:** a group, in the context of GitHub a place where
developers contribute code to repositories
- **Operating System (OS):** software that manages computer hardware,
software resources, and provides common services for computer
programs
- **Open Science Grid (OSG):** national, distributed computing
partnership for data-intensive research
[opensciencegrid.org](https://opensciencegrid.org/){target=_blank}
- **ORCID:** Open Researcher and Contributor ID
([ORCiD](https://orcid.org/){target=_blank}), a persistent digital identifier that
distinguishes you from every other researcher
**P**
- **PaaS:** [Platform as Service](https://en.wikipedia.org/wiki/Platform_as_a_service){target=_blank} run
and manage applications in cloud without complexity of developing it
yourself
- **package:** an app designed for a particular langauge
- **package manager:** a collection of software tools that automates
the process of installing, upgrading, configuring, and removing
computer programs for a computer's operating system in a consistent
manner
- **Production:** environment where users access the final code after
all of the updates and testing
- **Python:** interpreted, high-level, general-purpose programming
language [Python.org](https://www.python.org/){target=_blank}
**Q**
- **QUAY.io:** private Docker registry [QUAY.io](https://quay.io){target=_blank}
**R**
- **R:** data science programming language [R Project](https://cran.r-project.org/){target=_blank}
- **recipe file:** a file with installation scripts used for building
software such as containers, e.g. Dockerfile
- **registry:** a storage and content delivery system, such as that
used by Docker
- **remote desktop:** a VM with a graphic user interface accessed via
a browser
- **repo(sitory):** a directory structure for hosting code and data
- **RST:** ReStructuredText, a markdown type file
- **ReadTheDocs:** a web service for rendering documentation
[readthedocs.org](https://readthedocs.org){target=_blank} and
[readthedocs.com](https://readthedocs.com/){target=_blank}
- **root:** the administrative user on a linux kernel - use your
powers wisely
**S**
- **SaaS:** [Software as a Service](https://en.wikipedia.org/wiki/Software_as_a_service){target=_blank} web
based platform for using software
- **schema:** a metadata standard for labeling, tagging or coding for
recording & cataloging information or structuring descriptive
records. see [schema.org](https://schema.org/){target=_blank}
- **scrum:** daily set of tasks and evalautions as part of a sprint.
- **shell:** is a command line interface program that runs other
programs (may be complex, technical programs or very simple programs
such as making a directory). These simple, stand-alone programs are
called commands
- **Singularity:** a container software, used widely on HPC, created
by [SyLabs](https://sylabs.io/){target=_blank}; the open-source project continues as
[Apptainer](https://apptainer.org/){target=_blank}, which keeps `singularity` as a command alias
- **SLACK:** Searchable Log of All Conversation and Knowledge, a team
communication tool [slack.com](https://slack.com/){target=_blank}
- **sprint:** set period of time during which specific work has to be
completed and made ready for review
- **Singularity def file:** (definition file) recipe for building a
Singualrity container
- **Stage:** environment that is as similar to the production
environment as can be for final testing
**T**
- **tar:** software utility for collecting many files into one archive
file, often referred to as a tarball
- **tensor:** algebraic object that describes a linear mapping from
one set of algebraic objects to another
- **terminal:** a windowed emulator for directly enterinc commands to
a computer
- **thread:** a CPU process or a series of linked messages in a
discussion board
- **tool:** In the context of CyVerse Discovery Environment, a Docker
Container
- **TPU:** tensor processing unit
- **Travis:** [Travis-CI](https://travis-ci.org/){target=_blank}, a continuous
integration software
**U**
- **Ubuntu:** most popular [Linux OS
distribution](https://ubuntu.com/), based on Debian
- **UNIX:** operating system
- **user:** the profile under which applications are started and run,
`root` is the most powerful system administrator
**V**
- **VICE:** [Visual Interactive Computing
Environment](https://unm-carc.github.io/cyverse/discovery-environment/vice/overview/) -
Cyverse Data Science Workbench
- **virtual machine:** is a software computer that, like a physical
computer, runs an operating system and applications
**W**
- **waterfall:** software development broken into linear sequential
phases, similar to a Gantt chart
- **webGL:** JavaScript API for rendering interactive 2D and 3D
graphics within any compatible web browser without the use of
plug-ins
- **Windows:** Microsoft's most popular desktop OS
- **workspace:** (vs. repo)
- **worker node:** A cluster typically has one or more nodes, which
are the worker machines that run your containerized applications and
other workloads. Each node is managed from the master, which
receives updates on each node's self-reported status.
**X**
- **XML:** Extensible Markup Language, data interchange format that
uses human-readable text
**Y**
- **YAML:** YAML Ain't Markup Language, data interchange format that
uses human-readable text
**Z**
- **ZenHub:** team collaboration solution built directly into GitHub
that uses kanban style boards
- **Zenodo:** general-purpose open-access repository developed under
the European OpenAIRE program and operated by CERN
- **zip:** a compressed file format
- **zsh:** [Z-Shell](https://www.zsh.org/){target=_blank}, now the default shell on
new Mac OS X
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/glossary.md){target=_blank} (last source update 2022-07-15), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/01-open-science/
---
title: "Introduction to Open Science"
description: "What open science is, its six pillars (open access, data, educational resources, methodology, peer review, and source software), and why researchers practice it."
type: Lesson
tags:
- Open Science
- FAIR
- Open Access
- Peer Review
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/01_intro_open_sci.md"
title: "CyVerse FOSS: docs/01_intro_open_sci.md"
author: "team:cyverse"
last_modified: "2025-09-01T12:42:44-07:00"
---
# Introduction to Open Science
!!! success "Learning Objectives"
After this lesson, you should be able to:
- Explain what Open Science is
- Explain the components of Open Science
- Describe the behaviors of Open Science
- Explain why Open Science matters in education, research, and society
- Understand the advantages and the challenges to Open Science
## What is Open Science?
_"Open Science is transparent and accessible knowledge that is shared and developed through collaborative networks"_
[-Vincente-Saez & Martinez-Fuentes 2018](https://doi.org/10.1016/j.jbusres.2017.12.043){target=_blank}
_"Open Science is a collaborative and transparent approach to scientific research that emphasizes the accessibility, sharing, and reproducibility of data, methodologies, and findings to foster innovation and inclusivity"_
-ChatGPT
_"A series of reforms that interrogate every step in the research life cycle to make it more efficient, powerful and accountable in our emerging digital society"._
-Jeffrey Gillan
{ width="400" } The Research Life Cycle from [Open Science Framework](https://osf.io/){target=_blank}
!!! quote "Other Definitions"
"Open Science is defined as an inclusive construct that combines various movements and practices aiming to make multilingual scientific knowledge openly available, accessible and reusable for everyone, to increase scientific collaborations and sharing of information for the benefits of science and society, and to open the processes of scientific knowledge creation, evaluation and communication to societal actors beyond the traditional scientific community." - [UNESCO Definition](https://www.unesco.org/en/natural-sciences/open-science){target=_blank}
- [UNESCO's Recommendation on Open Science](https://unesdoc.unesco.org/ark:/48223/pf0000379949.locale=en){target=_blank}
"Open Science is the movement to make scientific research (including publications, data, physical samples, and software) and its dissemination accessible to all levels of society, amateur or professional..." [ :material-wikipedia: Wikipedia definition](https://en.wikipedia.org/wiki/Open_science){target=_blank}
## Foundational Open Science Skills
{ width="500" } Open Science Word Cloud by [Pownall et al. 2023](http://dx.doi.org/10.31234/osf.io/vypkb){target=_blank}_1. Building a culture of scientists eager to share research materials - such as data, code, methods, documentation, and early results - with colleagues and society at large, in addition to traditional publications_ _2. Mastery of digital tools to create reproducible science that others can build upon_ _3. Understanding the push towards increased transparency and accountability for those practicing science (ie., compliance)_ What is Open Science | The Royal Society
!!! info "Governamental footprints: 2023 vs 2025"
2023 was deemed the Year of Open Science, but recent changes at the administration level are seeing the approach to science being reshaped.
??? tip "2023: the Year of Open Science"
The White House, joined by 10 federal agencies, and a coalition of more than 85 universities, declared 2023 the Year of Open Science as a way to bring awareness to the benefits of Open Science and to steer the scientitic community towards its adoption.
In 2024, [the first year of Open Science was celebrated in an effort to continue the promotion of the Open Science movement](https://bidenwhitehouse.archives.gov/ostp/news-updates/2024/01/31/fact-sheet-biden-harris-administration-marks-the-anniversary-of-ostps-year-of-open-science/){target=_blank}. The goals and activities around the White House's promotion of Open Science were centered around five key themes:
- Strengthening Open Science Policies
- Investing in Open Science Infrastructures
- Supporting the Research Community in Building Open Science Skills
- Engaging Communities to Broaden Participation in Open Science
- Promoting Incentives for Open Research Practices
Grant funding organizations such as the NIH, NASA and the US Department of Agriculture were prompt at sustaining the White House' vision by releasing Open Science policy guidelines across the board.
Reflections on a Year of Open Science: Initiatives and Achievements Realized and Where to Next
??? warning "2025: Gold Standard Science"
After the recent Presidential elections of late 2024, the White House deprecated or ended nearly all of the scientific policies of the previous administration. This includes the 2023 "Open Science" mandates.
[Memorandums](https://www.whitehouse.gov/wp-content/uploads/2025/03/OSTP-Guidance-for-GSS-June-2025.pdf){target=_blank} by OSTP director Michael Kratsios and executive orders on ["Gold Standard Science"](https://www.whitehouse.gov/presidential-actions/2025/05/restoring-gold-standard-science/){target=_blank} retain language on the principles of Open Science, though [critics argue](https://www.science.org/content/article/what-does-trump-s-call-gold-standard-science-really-mean){target=_blank} political interference and scientific gate keeping may hinder what types of science is allowed to be funded under the current administration.
!!! quote "2025 Executive Orders"
* [REMOVING BARRIERS TO AMERICAN LEADERSHIP IN ARTIFICIAL INTELLIGENCE, January 23, 2025](https://www.whitehouse.gov/presidential-actions/2025/01/removing-barriers-to-american-leadership-in-artificial-intelligence/){target=_blank}
* [OMB Accelerating Federal Use of AI through Innovation, Governance, and Public Trust, April 3, 2025](https://www.whitehouse.gov/wp-content/uploads/2025/02/M-25-21-Accelerating-Federal-Use-of-AI-through-Innovation-Governance-and-Public-Trust.pdf){target=_blank}
* [Fact Sheet: Eliminating Barriers for Federal Artificial Intelligence Use and Procurement, April 7, 2025](https://www.whitehouse.gov/fact-sheets/2025/04/fact-sheet-eliminating-barriers-for-federal-artificial-intelligence-use-and-procurement/){target=_blank}
* [ADVANCING ARTIFICIAL INTELLIGENCE EDUCATION FOR AMERICAN YOUTH, April 23, 2025](https://www.whitehouse.gov/presidential-actions/2025/04/advancing-artificial-intelligence-education-for-american-youth/){target=_blank}
* [Restoring Gold Standard Science, May 23, 2025](https://www.whitehouse.gov/presidential-actions/2025/05/restoring-gold-standard-science/){target=_blank}
* [Fact Sheet: President Donald J. Trump is Restoring Gold Standard Science in America](https://www.whitehouse.gov/fact-sheets/2025/05/fact-sheet-president-donald-j-trump-is-restoring-gold-standard-science-in-america/){target=_blank}
* [Kratsios June 23, 2025 Memorandum](https://www.whitehouse.gov/wp-content/uploads/2025/03/OSTP-Guidance-for-GSS-June-2025.pdf){target=_blank}
---
---
## :material-pillar: 6 Pillars of Open Science
|**
Open Access Publications :material-pillar:
**|**
Open Data :material-pillar:
**|**
Open Educational Resources :material-pillar:
**|**
Open Methodology :material-pillar:
**|**
Open Peer Review :material-pillar:
**|**
Open Source Software :material-pillar:
**|
|:-:|:-:|:-:|:-:|:-:|:-:|
??? question "Wait, how many pillars :material-pillar: of Open Science Are There Really?"
The number can be from [4 :material-pillar:](https://narratives.insidehighered.com/four-pillars-of-open-science/){target=_blank} to [8 :material-pillar:](https://www.ucl.ac.uk/library/research-support/open-science/8-pillars-open-science){target=_blank}
### **
:material-pillar: Open Access Publications
**
[{width=210 target=_blank }](https://en.wikipedia.org/wiki/Open_access){target=_blank}
!!! quote "Definition"
"Open access is a publishing model for scholarly communication that makes research information available to readers at no cost, as opposed to the traditional subscription model in which readers have access to scholarly information by paying a subscription (usually via libraries)." -- [OpenAccess.nl](https://www.openaccess.nl/en/what-is-open-access){target=_blank}
!!! example "Open Access Journal Examples"
Major publishers have provided access points for publishing your work
- [AAAS Science](https://www.science.org/content/page/open-access-aaas){target=_blank}
- [Nature](https://www.nature.com/nature-portfolio/open-access){target=_blank}
- [American Geophysical Union](https://www.agu.org/Publish-with-AGU/Publish/Open-Access){target=_blank}
- [Open Research Europe](https://open-research-europe.ec.europa.eu/){target=_blank}
- [PLOS](https://plos.org/){target=_blank}
- [MDPI](https://www.mdpi.com/){target=_blank}
- [Ecosphere](https://esajournals.onlinelibrary.wiley.com/journal/21508925){target=_blank}
#### Types of Publishing Business Models
1. **Subscription model** - the author pays a smaller fee (or no fee) for the article to be published. The publisher then sells subscription access to the article (usually to institutes of higher education).
2. **Open Access model** - The author pays a larger fee to make the article freely available to anyone through a Creative Commons license.
- Open Access publishing in Nature costs $12,290!
- Open Access publising in PlosOne costs $2,290
#### Research Article Versions
1. **Preprint** - In academic publishing, a preprint is a version of scholary paper that precedes formal peer-review and publication in a scientific journal. The preprint may be available, often as a non-typeset version available for free online.
??? example "Pre-print Services"
- [ASAPbio Pre-Print Server List](https://asapbio.org/preprint-servers){target=_blank} - ASAPbio is a scientist-driven non-profit promoting transparency and innovation comprehensive list of pre-print servers inthe field of life science communication.
- [ESSOar](https://www.essoar.org/){target=_blank} - Earth and Space Science Open Archive hosted by the American Geophysical Union.
- [Peer Community In (PCI)](https://peercommunityin.org/){target=_blank} a free recommendation process of scientific preprints based on peer reviews
- [OSF.io Preprints](https://osf.io/preprints/){target=_blank} are partnered with numerous projects under the "-rXivs"
??? tip "The rXivs"
- [AfricArXiv](https://osf.io/preprints/africarxiv/){target=_blank}
- [AgrirXiv](https://cabidigitallibrary.org/journal/agrirxiv){target=_blank}
- [Arabixiv](https://arabixiv.org/discover){target=_blank}
- [arXiv](https://arxiv.org/){target=_blank} - is a free distribution service and an open-access archive for 2,086,431 scholarly articles in the fields of physics, mathematics, computer science, quantitative biology, quantitative finance, statistics, electrical engineering and systems science, and economics.
- [BioHackrXiv](https://biohackrxiv.org/){target=_blank}
- [BioRxiv](https://www.biorxiv.org/){target=_blank} - is an open access preprint repository for the biological sciences.
- [BodorXiv](https://bodoarxiv.wordpress.com/){target=_blank}
- [EarthArXiv](https://eartharxiv.org/){target=_blank} - is an open access preprint repository for the Earth sciences.
- [EcsArXiv](https://ecsarxiv.org/){target=_blank} - a free preprint service for electrochemistry and solid state science and technology
- [EdArXiv](https://edarxiv.org/){target=_blank} - for the education research community
- [EngrXiv](https://engrxiv.org/){target=_blank} for the engineering community
- [EvoEcoRxiv](https://www.ecoevorxiv.com/){target=_blank} - is an open acccess preprint repository for Evolutionary and Ecological sciences.
- [MediArXiv](https://mediarxiv.com/){target=_blank} for Media, Film, & Communication Studies
- [MedRxiv](https://www.medrxiv.org/){target=_blank} - is an open access preprint repository for Medical sciences.
- [PaleorXiv](https://paleorxiv.org/){target=_blank} - is an open access preprint repository for Paleo Sciences
- [PsyrXiv](https://psyarxiv.com/){target=_blank} - is an open access preprint repository for Psychological sciences.
- [SocArXiv](https://socopen.org/){target=_blank} - is an open access preprint repository for Social sciences.
- [SportrXiv](https://sportrxiv.org/){target=_blank} - is an open access preprint for Sports sciences.
- [ThesisCommons](https://thesiscommons.org/){target=_blank} - open Theses
2. **Author's accepted manuscript (AAM)** - includes changes that came about during peer-review process. It is a non-typeset or formatted article. This often had an embargo period of 12-24 months
3. **Published version of record (VOR)** - includes stylistic edits, online & print formatting. This is the version that publishers claim ownership of with copyrights or exclusive licensing.
??? tip "Copyrights and Science Publishing"
Upon completion of a peer-reviewed science paper, the author typically 1. signs over the copyright of the paper to the publisher or 2. signs an exclusive license agreement with the publisher
For example authors that publish in [_Science_](https://www.science.org/content/page/science-journals-editorial-policies#copyright-license-to-publish){target=_blank} retain their copyright but sign a 'license to pubish' agreement with AAAS
Elsevier requires authors to sign over copyright of the article but authors retains some rights of distribution
- [Elesevier summary of copyright policies](https://www.elsevier.com/about/policies-and-standards/copyright#1-author-rights){target=_blank}
- [Elesevier article sharing policy](https://www.elsevier.com/about/policies-and-standards/sharing){target=_blank}
- [Wiley policy on self-archiving](https://authorservices.wiley.com/author-resources/Journal-Authors/licensing/self-archiving.html){target=_blank}
- [Springer Nature copyright policies](https://www.springer.com/gp/open-access/publication-policies/copyright-transfer#:~:text=Springer%20Nature%20authors%20retain%20copyright,found%20in%20our%20publishing%20policies.){target=_blank}
---
### **
:material-pillar: Open Data
**
!!! quote "Definitions"
“Open data and content can be freely used, modified, and shared by anyone for any purpose” - [The Open Definition](https://opendefinition.org/){target=_blank}
"Open data is data that can be freely used, re-used and redistributed by anyone - subject only, at most, to the requirement to attribute and sharealike." - [Open Data Handbook](https://opendatahandbook.org/guide/en/what-is-open-data/){target=_blank}
[:material-wikipedia: Wikipedia definition](https://en.wikipedia.org/wiki/Open_data){target=_blank}
Data are the foundation for any scientific endeavor. A lot of thought needs to go into how to best collect, store, analyze, curate, share, and archive data.{ width="400" } DIKW Pyramid
#### FAIR Principles
In 2016, the [FAIR Guiding Principles](https://www.nature.com/articles/sdata201618){target=_blank} for scientific data management and stewardship were published in *Scientific Data*.
_**Findable:**_
Making data discoverable by the wider academic community and the public
_**Accessible:**_
Using unique identifiers, metadata and a clear use of language and access protocols
_**Interoperable:**_
Applying standards to encode and exchange data and metadata
_**Reusable:**_
Enabling the repurposing of researach outputs to maximize their research potential
!!! tip "Reasons to Make your Data Open"
- Unnecessary duplication. Duplication of research is costly for society, and places unnecessary burden on heavily researched people and populations.
- The data underlying publications are maintained and accessible, allowing for validation of results.
- Data openness leads to more collaboration and advances research and innovation.
- Your research is more visible and has greater impact. Publications which allow access to the underlying data get more citations. Greater visibility also allows for better validation and scrutiny of findings.
- Other researchers can cite your data, which will drive up your citation number and increase your influence in your field of research.
- Storing your data in a public repository also provides you with secure and ongoing storage that may otherwise not be available to you.
-[Foster Open Science](https://www.fosteropenscience.eu/){target=_blank}
#### As Open as Possible, as Closed as Necessary
There are many circumstances where open data could be harmful:
- Data on human health
- Location of endangered species or archaeological sites
- Data that individuals or groups do not want to be public
??? tip "CARE Principles"
The [CARE Principles](https://www.gida-global.org/care){target=_blank} for Indigenous Data Governance were drafted at the International Data Week and Research Data Alliance Plenary co-hosted event "Indigenous Data Sovereignty Principles for the Governance of Indigenous Data Workshop," 8 November 2018, Gaborone, Botswana.
*Collective Benefit*
- C1. For inclusive development and innovation
- C2. For improved governance and citizen engagement
- C3. For equitable outcomes
*Authority to Control*
- A1. Recognizing rights and interests
- A2. Data for governance
- A3. Governance of data
*Responsibility*
- R1. For positive relationships
- R2. For expanding capability and capacity
- R3. For Indigenous languages and worldviews
*Ethics*
- E1. For minimizing harm and maximizing benefit
- E2. For justice
- E3. For future use
* Data for making [lethal weapons](https://www.theverge.com/2022/3/17/22983197/ai-new-possible-chemical-weapons-generative-models-vx){target=_blank}
!!! tip "Open vs. FAIR"
FAIR does not demand that data be open: See one definition of open: http://opendefinition.org/
Open data does not necessarily mean it is FAIR
!!! info "Additional Info"
- The Ethics of Geolocated Data from [UK Statistics Authority](https://uksa.statisticsauthority.gov.uk/publication/ethical-considerations-in-the-use-of-geospatial-data-for-research-and-statistics/pages/1/){target=_blank}
- Health information [US HIPAA](https://www.hhs.gov/hipaa/index.html){target=_blank}
- Indigenous data sovereignty: [CARE Principles for Indigenous Data Governance](http://doi.org/10.5334/dsj-2020-043){target=_blank} , [Global Indigenous Data Alliance (GIDA)](https://www.gida-global.org/care){target=_blank}, [First Nations OCAP® (Ownership Control Access and Possession)](https://fnigc.ca/ocap-training/){target=_blank}, [Circumpolar Inuit Protocols for Equitable and Ethical Engagement](https://www.arcus.org/arctic-info/archive/33236){target=_blank}
---
### **
:material-pillar: Open Educational Resources
**
[{width=240 target=_blank }](https://www.unesco.org/en/communication-information/open-solutions/open-educational-resources)
!!! quote "Definitions"
"Open Educational Resources (OER) are learning, teaching and research materials in any format and medium that reside in the public domain or are under copyright that have been released under an open license, that permit no-cost access, re-use, re-purpose, adaptation and redistribution by others." - [UNESCO](https://www.unesco.org/en/communication-information/open-solutions/open-educational-resources){target=_blank}
[:material-wikipedia: Wikipedia definition](https://en.wikipedia.org/wiki/Open_educational_resources){target=_blank}
??? example "Digital Literacy Organizations"
- [The Carpentries](https://carpentries.org/){target=_blank} - teaches foundational coding and data science skills to researchers worldwide
- [EdX](https://www.edx.org/){target=_blank} - Massively Open Online Courses (not all open) hosted through University of California Berkeley
- [EveryoneOn](https://www.everyoneon.org/ ){target=_blank} - mission is to unlock opportunity by connecting families in underserved communities to affordable internet service and computers, and delivering digital skills trainings
- [Global Digital Literacy Council](https://www.gdlcouncil.org/){target=_blank} - has dedicated more than 15 years of hard work to the creation and maintenance of worldwide standards in digital literacy
- [National Digital Equity Center](https://digitalequitycenter.org/about-us/){target=_blank} a 501c3 non-profit, is a nationally recognized organization with a mission to close the digital divide across the United States
- [National Digital Inclusion Allaince](https://www.digitalinclusion.org/){target=_blank} - advances digital equity by supporting community programs and equipping policymakers to act
- [Net Literacy](https://www.netliteracy.org/){target=_blank}
- [Open Educational Resources Commons](https://www.oercommons.org/){target=_blank}
- [Project Pythia](https://projectpythia.org/){target=_blank} is the education working group for Pangeo and is an educational resource for the entire geoscience community
- [Research Bazaar](https://researchbazaar.arizona.edu/){target=_blank} - is a worldwide festival promoting the digital literacy emerging at the centre of modern research
- [TechBoomers](https://techboomers.com/){target=_blank} - is an education and discovery website that provides free tutorials of popular websites and Internet-based services in a manner that is accessible to older adults and other digital technology newcomers
??? example "Educational Materials"
- [Teach Together](https://teachtogether.tech/en/index.html#){target=_blank} by Greg Wilson
- [DigitalLearn](https://www.digitallearn.org/){target=_blank}
---
### **
:material-pillar: Open Methodology
**
!!! quote "Definitions"
"An open methodology is simply one which has been described in sufficient detail to allow other researchers to repeat the work and apply it elsewhere." - [Watson (2015)](https://doi.org/10.1186/s13059-015-0669-2){target=_blank}
"Open Methodology refers to opening up methods that are used by researchers to achieve scientific results and making them publicly available." - [Open Science Network Austria](https://www.oana.at/en/about-open-science){target=_blank}
#### Sharing Research Computer Code
Scientists around the globe are creating computer code for scientific analysis. These are valuable contributions that need to be shared!
Platforms like [GitHub](https://github.com/search?q=open+science){target=_blank} and [GitLab](https://gitlab.com/explore/projects/topics/Open%20Science){target=_blank} are ideal for collaboratively developing code and sharing with the open internet. In FOSS, we will show you how to use Github for sharing code, [documentation](https://unm-carc.github.io/foss/lessons/02-data-management/#project-documentation), hosting websites, and [software version control](https://unm-carc.github.io/foss/lessons/05-version-control/).
#### Publishing Your Methods or Protocols
??? example "Platforms for Publishing Protocols & Bench Techniques"
- [BioProtocol](https://bio-protocol.org/Default.aspx){target=_blank}
- [Current Protocols](https://currentprotocols.onlinelibrary.wiley.com/){target=_blank}
- [Gold Biotechnology Protocol list](https://www.goldbio.com/search?q=&type=documentation&documentation_type=protocol){target=_blank}
- [JoVE](https://www.jove.com/){target=_blank} - Journal of Visualized Experiments
- [Nature Protocols](https://www.nature.com/nprot/){target=_blank}
- [OpenWetWare](https://openwetware.org/wiki/Main_Page){target=_blank}
- [Protocol Exchange](https://protocolexchange.researchsquare.com/){target=_blank}
- [Protocols Online](http://www.protocol-online.org/prot/){target=_blank}
- [:material-microscope: Protocols](https://www.protocols.io/){target=_blank}
- [SciGene](http://scigine.com/blog/){target=_blank}
- [Springer Nature Experiments](https://experiments.springernature.com/){target=_blank}
#### PreRegistration
Preregistration is detailing your research and analysis plan and submitting it to an online registry **before** you engage in the research.
{ width="500" } PreRegistration in the Research Life Cycle
??? question "Why Do This?"
Preregistration makes your process more open and records the difference between your initial research plan what you end up actually doing.
Preregistration separates _hypothesis-generating_ (exploratory) from _hypothesis-testing_ (confirmatory) research. Both are important. But the same data cannot be used to generate and test a hypothesis, which can happen unintentionally and reduce the credibility of your results.
It also helps us avoid practices like [p-hacking](https://en.wikipedia.org/wiki/Data_dredging){target=_blank} or [Hypothesizing After the Results are Known(HARKing)](https://en.wikipedia.org/wiki/HARKing){target=_blank}.
??? info "Additional Info"
Read this publication by [Nosek et al. 2018](https://www.pnas.org/doi/10.1073/pnas.1708274114){target=_blank}
Open Science Framework Preregistration https://www.cos.io/initiatives/prereg
---
### **
:material-pillar: Open Peer Review
**
!!! quote "Definitions"
Open peer review is an umbrella term for a number of overlapping ways that peer review models can be adapted in line with the aims of Open Science, including making reviewer and author identities open, publishing review reports and enabling greater participation in the peer review process.
- [-Ross-Hellauer et al. (2017)](https://doi.org/10.12688%2Ff1000research.11369.2){target=_blank}
- [:material-wikipedia: Wikipedia's definition](https://en.wikipedia.org/wiki/Open_peer_review){target=_blank}
#### Traditional Closed Peer-Review System
{ width="400" }
- Throughout and after the process, the author remains unaware of the reviewers' identities, while the reviewers know the identity of the authors.
- All communications between authors, reviewers and editors remains private
#### Complaints with the Traditional Closed Peer-Review System
- Unreliable and Inconsistent
- Delays and Expense
- Lack of Accountability and Risks of Subversion
- Social and Publication Biases
- Lack of Incentives
[_Ross-Hallauer 2017_](https://f1000research.com/articles/6-588/v2){target=_blank}
#### Open Peer-Review Ideas
{ width="500" } Open Peer Review Options at [PLOS](https://plos.org/resource/open-peer-review/){target=_blank}
[Defenders of the Traditional Peer-Review System](https://doi.org/10.1038/6295){target=_blank}
!!! tip "Example Open Peer-Review Systems"
[F1000Research](https://f1000research.com/about){target=_blank} An open research publishing platform that offers open peer review and rapid publication.
The article from [Ross-Hellauer et al. (2017)](https://doi.org/10.12688%2Ff1000research.11369.2){target=_blank} has open peer-reviews.
!!! info "Platforms for Reviewing Preprints"
- [PREreview](https://prereview.org/){target=_blank}
- [Sciety](https://sciety.org/){target=_blank}
- [PubPeer](https://pubpeer.com/){target=_blank}
- [ASAPbio](https://asapbio.org/){target=_blank}
---
### **
:material-pillar: Open Source Software
**
[{width=240 target=_blank }](https://opensource.org/){target=_blank}
!!! quote "Definitions"
"Open source software is code that is designed to be publicly accessible—anyone can see, modify, and distribute the code as they see fit. Open source software is developed in a decentralized and collaborative way, relying on peer review and community production." - [:material-redhat: Red Hat](https://www.redhat.com/en/topics/open-source/what-is-open-source){target=_blank}
[:material-wikipedia: Wikipedia definition](https://en.wikipedia.org/wiki/Open-source_software){target=_blank}
Research science (and also many companies) rely on open source software to operate
!!! tip "Open Source Software"
- Linux operating system and shell
- Python
- R
- git
- Conda
- Docker
- Cyverse
- Pytorch
- [Tyson's Awesome List](https://tyson-swetnam.github.io/awesome-open-science/software/){target=_blank}
When you create a new software, library, or package, you become its parent and guardian.
{ width="400" } Image Credit: [XKCD Dependency](https://m.xkcd.com/2347/){target=_blank}
---
## *WHY* do Open Science?
A paper from [Bartling & Friesike (2014)](https://doi.org/10.1007/978-3-319-00026-8){target=_blank} posits that there are 5 main schools of thought in Open Science, which represent 5 underlying motivations:
1. **Democratic school**: primarily concerned with making scholarly work freely available to everyone
2. **Pragmatic school**: primarily concerned with improving the quality of scholarly work by fostering collaboration and improving critiques
3. **Infrastructure school**: primarily focused on the platforms, tools, and services necessary to conduct efficient research, collaboration, and communication
4. **Public school**: primarily concerned with societal impact of scholarly work, focusing on engagement with broader public via citizen science, understandable scientific communication, and less formal communication
5. **Measurement school**: primarily concerned with the existing focus on journal publications as a means of measuring scholarly output, and focused on developing alternative measurements of scientific impact
{ width="700" } In [Bartling & Friesike (2014)](https://doi.org/10.1007/978-3-319-00026-8){target=_blank} Open Science: One Term, Five Schools of Thought
We have added another school of thought
6. **Compliance school**: government, universities, and granting agencies have embraced Open Science and are mandating some elements (e.g., data sharing with publications)
---
## Discussion Questions
??? question "Which of the :material-pillar: pillars of Open Science is nearest to your own heart?"
**:material-pillar: Open Access Publications**
**:material-pillar: Open Data**
**:material-pillar: Open Educational Resources**
**:material-pillar: Open Methodology**
**:material-pillar: Open Peer Review**
**:material-pillar: Open Source Software**
??? question "Are any of the :material-pillar: pillars more important than the others?"
??? question "Are there any :material-pillar: pillars not identified that you think should be considered?"
??? question "What characteristics might a paper, project, lab group require to qualify as doing *Open Science*"
??? question "What are some barriers to you, your lab group, or your domain doing Open Science?"
??? question "What motivates you to do Open Science?"
??? question "Do you feel that you fall into a particular "school"? If so, which one, and why?"
??? question "Are there any motivating factors for doing Open Science that don't fit into this framework?"
---
---
## Recommended Open Science Communities
[:material-school: Open Scholarship Grassroots Community Networks](https://docs.google.com/spreadsheets/d/1LNF5_bOkRV-RLIF4HYmu-gOemIa4IdfXEer89fM-Vy8/edit#gid=847887324){target=_blank}
??? info ":fontawesome-solid-earth-europe: International Open Science Networks"
- [Center for Scientific Collaboration and Community Engagement (CSCCE)](https://www.cscce.org/){target=_blank}
- [Center for Open Science (COS)](https://www.cos.io/){target=_blank}
- [Eclipse Science Working Group](https://science.eclipse.org/){target=_blank}
- [eLife](https://elifesciences.org/){target=_blank}
- [NumFocus](https://numfocus.org/){target=_blank}
- [Open Access Working Group](https://sparcopen.org/people/open-access-working-group/){target=_blank}
- [Open Research Funders Group](https://www.orfg.org/){target=_blank}
- [Open Science Foundation](https://osf.io/){target=_blank}
- [pyOpenSci](https://www.pyopensci.org/){target=_blank}
- [R OpenSci](https://ropensci.org/){target=_blank}
- [Research Data Alliance (RDA)](https://www.rd-alliance.org/){target=_blank}
- [The Turing Way](https://book.the-turing-way.org/){target=_blank}
- [UNESCO Global Open Science Partnership](https://www.unesco.org/en/open-science){target=_blank}
- [World Wide Web Consortium (W3C)](https://www.w3.org/){target=_blank}
??? info ":fontawesome-solid-earth-americas: US-based Open Science Networks"
- [CI Compass](https://ci-compass.org/){target=_blank} - provides expertise and active support to cyberinfrastructure practitioners at USA NSF Major Facilities in order to accelerate the data lifecycle and ensure the integrity and effectiveness of the cyberinfrastructure upon which research and discovery depend.
- [Earth Science Information Partners (ESIP) Federation](https://www.esipfed.org/){target=_blank} - is a 501(c)(3) nonprofit supported by NASA, NOAA, USGS and 130+ member organizations.
- [Internet2](https://internet2.edu/){target=_blank} - is a community providing cloud solutions, research support, and services tailored for Research and Education.
- [Minority Serving Cyberinfrastructure Consortium (MS-CC)](https://www.ms-cc.org/){target=_blank} envisions a transformational partnership to promote advanced cyberinfrastructure (CI) capabilities on the campuses of Historically Black Colleges and Universities (HBCUs), Hispanic-Serving Institutions (HSIs), Tribal Colleges and Universities (TCUs), and other Minority Serving Institutions (MSIs).
- [OpenScapes](https://www.openscapes.org/){target=_blank} - is an approach for doing better science for future us
- [The Quilt](https://www.thequilt.net/){target=_blank} - non-profit regional research and education networks collaborate to develop, deploy and operate advanced cyberinfrastructure that enables innovation in research and education.
??? info ":fontawesome-solid-earth-oceania: Oceania Open Science Networks"
- [New Zealand Open Research Network](https://nzorn.netlify.app/){target=_blank} - New Zealand Open Research Network (NZORN) is a collection of researchers and research-associated workers in New Zealand.
- [Australia & New Zealand Open Research Network](https://www.anzopenresearch.org/){target=_blank} - ANZORN is a network of local networks distributed without Australia and New Zealand.
---
---
## Self Assessment
??? question "True or False: All research papers published in the top journals, like Science and Nature, are always Open Access?"
**False**
Major Research journals like [Science](https://www.science.org/content/page/open-access-aaas){target=_blank} and [Nature](https://www.nature.com/nature-portfolio/open-access){target=_blank} have an "Open Access" option when a manuscript is accepted, but they charge an extra fee to the authors to make those papers Open Access.
These [high page costs](https://www.science.org/content/article/9500-nature-journals-will-now-make-your-paper-free-read){target=_blank} are exclusionary to the majority of global scientists who cannot afford to front these costs out of pocket.
This will soon change, at least in the United States. The [Executive Branch of the federal government recently mandated](https://www.nature.com/articles/d41586-022-02351-1){target=_blank} that future federally funded research be made Open Access after 2026.
??? question "True or False: an article states all of the research data used in the experiments "are available upon request from the corresponding author(s)," meaning the data are "Open""
**False**
In order for research to be open, the data need to be freely available from a digital repository, like [Data Dryad](https://datadryad.org){target=_blank}, [Zenodo.org](https://zenodo.org){target=_blank}, or [CyVerse](https://cyverse.org/data-commons){target=_blank}.
Data that are 'available upon request' do not meet the FAIR data principles.
??? question "Using a version control system to host the analysis code and computational notebooks, and including these in your Methods section or Supplementary Materials, is an example of an Open Methodology?"
**Yes!**
Using a VCS like GitHub or GitLab is a great step towards making your research more reproducible.
Ways to improve your open methology can include documentation of your physical bench work, and even video recordings and step-by-step guides for every part of your project.
??? question "You are asked to review a paper for an important journal in your field. The editor asks if you're willing to release your identity to the authors, thereby "signing" your review. Is this an example of "Open Peer Review"?"
**Maybe**
There are many opinions on what 'open-review' should consist of. A reviewer signing their review and releasing their identity to the authors is a step toward a more open process. However, it is far less open than publishing the peer-review reports online next to the final published paper.
??? question "You read a paper where the author(s) wrote their own code and licensed as "Open Source" software for a specific set of scientific tasks which you want to replicate. When you visit their personal website, you find the GitHub repository does not exist (because its now private). You contact the authors asking for access, but they refuse to share it 'due to competing researchers who are seeking to steal their intellectual property". Is the software open source?"
**No**
Just because an author states they have given their software a permissive software license, does not make the software open source.
Always make certain there is a [LICENSE](https://choosealicense.com/licenses/){target=_blank} associated with any software you find on the internet.
In order for the software to be open, it must follow the [Open Source Initiative definition](https://opensource.org/osd){target=_blank}
---
---
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/01_intro_open_sci.md){target=_blank} (last source update 2025-09-01), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/02-data-management/
---
title: "Data Management and Documentation"
description: "The data life cycle, FAIR and CARE principles, data management plans, licensing, and tools for documenting research projects."
type: Lesson
tags:
- Data Management
- FAIR
- CARE
- Documentation
- Licensing
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/02_managing_data.md"
title: "CyVerse FOSS: docs/02_managing_data.md"
author: "team:cyverse"
last_modified: "2025-09-08T16:33:24-07:00"
---
# Data Management and Documentation
??? info "Relating to Open Science"
As you may recall, Open Science is an ideology built around the goal of making the science you work on clear and accessible to everyone.
Data management and documentation fit well within this framework, as they emphasize that the first person who needs to understand the science is the one doing it — **you**.
!!! success "Learning Objectives"
After this lesson, you should be able to:
- Recognize data as the foundation of open science and be able to describe the "life cycle of data"
- Use self-assessments to evaluate your current data management practices
- Cite tools and resources to improve your data management practices
- Know the biggest challenge to effective data management
??? question "How would you answer?"
- If you give your data to a colleague who has not been involved with your project, would they be able to make sense of it? Would they be able to use it properly?
- If you come back to your own data in five years, will you be able to make sense of it? Will you be able to use it properly?
- When you are ready to publish a paper, is it easy to find all the correct versions of all the data you used and present them in a comprehensible manner?
## Why should you care about data management?
!!! danger "The biggest challenge to data management is making it an afterthought. "
Poor data management doesn't have an upfront cost. **You can do substantial work before realizing you are in trouble.**
**The solution?** Make data management the first thing you consider when starting a research project.
Well-managed Data Sets:
- Can make life much easier for you and your collaborators
- Benefit the scientific research community by allowing others to reuse your data
- Are becoming required by most funders and many journals, which are requesting a submission of a Data Management Plan (DMP) with the initial submission of your proposal.
!!! info "The NSF is stepping in, getting stricter about data"
- Recent [Dear Colleague letter](https://www.nsf.gov/pubs/2019/nsf19069/nsf19069.jsp){target=_blank} from NSF's points out that:
- Open science promotes broader access to research data, enhancing public benefits and replicability.
- NSF requires (DMPs) in proposals, encouraging use of persistent IDs and machine-readable DMPs.
- NSF [proposal preparation guidelines](https://new.nsf.gov/policies/pappg/23-1/ch-2-proposal-preparation#2D2i-ii){target=_blank} now require at least the following:
- Proposals must include a 2-page DMP outlining data types, formats, sharing, and archiving.
- The DMP must address privacy, intellectual property, and reuse policies, and collaborative projects should submit one unified DMP.
- A DMP stating no detailed plan is needed is allowed with justification, and the DMP will be reviewed as part of the proposal's merit.
---
## What Classifies as Data?
Different types of data require different management practices. Here are some examples of what we can call Data (Adapted from DMPTool [Data management general guidance](https://dmptool.org/general_guidance#types-of-data){target=_blank}).
**Data Types**:
- **Text**: field or laboratory notes, survey responses
- **Numeric**: tables, counts, measurements
- **Audiovisual**: images, sound recordings, video
- **Models, computer code**
- **Discipline-specific**: FASTA in biology, FITS in astronomy, CIF in chemistry
- **Instrument-specific**: equipment outputs
**Data Sources**:
*Observational*
- Captured in real-time, typically outside the lab
- Usually irreplaceable and therefore the most important to safeguard
- Examples: Sensor readings, telemetry, survey results, images
*Experimental*
- Typically generated in the lab or under controlled conditions
- Often reproducible, but can be expensive or time-consuming
- Examples: gene sequences, chromatograms, magnetic field readings
*Simulation*
- Machine generated from test models
- Likely to be reproducible if the model and inputs are preserved
- Examples: climate models, economic models
*Derived / Compiled*
- Generated from existing datasets
- Reproducible, but can be very expensive and time-consuming
- Examples: text and data mining, compiled database, 3D models
---
## The Data Life Cycle
**Data management** is the set of practices that allow researchers to effectively and efficiently handle data throughout the data life cycle. Although typically shown as a circle (below) the actually life cycle of any data item may follow a different path, with branches and internal loops. Being aware of your data's future helps you plan how to best manage them.

The Data Life Cycle, from [Strasser *et al*](https://dataoneorg.github.io/Education/bestpractices/){target=_blank}.
??? info "Breaking down the Data Life Cycle Graph"
**Plan**
- Describe the data that will be compiled, and how the data will be managed and made accessible throughout its lifetime
- A good plan considers each of the stages below
**Collect**
- Have a plan for data organization in place before collecting data
- Collect and store observation metadata at the same time you collect the metadata
- Take advantage of machine generated metadata
**Assure**
- Record any conditions during collection that might affect the quality of the data
- Distinguish estimated values from measured values
- Double check any data entered by hand
- Perform statistical and graphical summaries (e.g., max/min, average, range) to check for questionable or impossible values.
- Mark data quality, outliers, missing values, etc.
**Describe**
- Comprehensive data documentation (i.e. **metadata**) is the key to future understanding of data. Without a thorough description of the context of the data, the context in which they were collected, the measurements that were made, and the quality of the data, it is unlikely that the data can be easily discovered, understood, or effectively used.
- Thoroughly describe the dataset (e.g., name of dataset, list of files, date(s) created or modified, related datasets) including the people and organizations involved in data collection (e.g., authors, affiliations, sponsor). Also include:
- An [ORCID](https://orcid.org/){target=_blank} (obtain one if you don't have one).
- The scientific context (reason for collecting the data, how they were collected, equipment and software used to generate the data, conditions during data collection, spatial and temporal resolution)
- The data themselves
- How each measurement was produced
- Units
- Format
- Quality assurance activities
- Precision, accuracy, and uncertainty
Some metadata standards you may want to consider:
- [DataCite](https://schema.datacite.org/){target=_blank} for publishing data
- [Dublin Core](http://www.dublincore.org/specifications/dublin-core/dcmi-terms/){target=_blank} for sharing data on the web
- [MIxS](https://press3.mcs.anl.gov/gensc/mixs/){target=_blank} Minimum Information for any (x) sequence
- [OGC standards](https://www.opengeospatial.org/docs/is){target=_blank} for geospatial data
??? tip "Ontologies provide standardization for metadata values"
Example of ontologies:
- [Environment Ontology](http://environmentontology.org/){target=_blank} terms for the MIxS standards
- [Plant Ontology](http://planteome.org/){target=_blank} for plant tissue types or development stages
- [FAIRSharing.org](https://fairsharing.org/){target=_blank} lists standards and ontologies for life sciences.
**Preserve**
In general, data must be preserved in an appropriate long-term archive (i.e. data center). Here are some examples:
- Sequence data should go to a national repository, frequently [NCBI](https://www.ncbi.nlm.nih.gov/){target=_blank}
- Identify data with value - it may not be necessary to preserve all data from a project
- The CyVerse [Data Commons](http://datacommons.cyverse.org/){target=_blank} provides a place to publish and preserve data that was generated on or can be used in CyVerse, where no other repository exists.
- See lists of repositories at [FAIRSharing.org](https://fairsharing.org/){target=_blank}
- See lists of repositories at [Data Dryad](https://datadryad.org/stash){target=_blank}
- Github repos can get DOIs through [Zenodo](https://guides.github.com/activities/citable-code/){target=_blank}
- Be aware of licensing and other intellectual property issues
- Repositories will require some kind of license, often the least restrictive (see for example [Creative Commons](https://creativecommons.org/){target=_blank})
- Repositories are unlikely to enforce reuse restrictions, even if you apply them.
**Discover**
- Good metadata allows you to discover your own data!
- Databases, repositories, and search indices provide ways to discover relevant data for reuse
- [Google dataset search](https://toolbox.google.com/datasetsearch){target=_blank}
- [DataOne](https://www.dataone.org/){target=_blank}
- [FAIRSharing.org](https://fairsharing.org/){target=_blank}
**Integrate**
- Data integration is a lot of work
- Standards and ontologies are key to future data integration
- Know the data before you integrate them
- Don't trust that two columns with the same header are the same data
- Properly cite the data you reuse!
- Use DOIs ([Digital Object Identifiers](https://en.wikipedia.org/wiki/Digital_object_identifier){target=_blank}) wherever possible
**Analyze**
- Follow open science principles for reproducible analyses (CyVerse, RStudio, notebooks, IDEs)
- State your hypotheses and analysis workflow before collecting data. Tools like [Open Science Framework](https://osf.io/){target=_blank} (OSF) allow you to make this public.
- Record all software, parameters, inputs, etc.
??? note "References and Resources"
- [DataOne best practices](https://dataoneorg.github.io/Education/bestpractices/){target=_blank}
- [Center for Open Science](https://cos.io/){target=_blank}
---
## Data Principles
{width="450"}
FAIR data, [NIH](https://www.nlm.nih.gov/oet/ed/cde/tutorial/02-200.html){target=_blank}.
{width="350"}
CARE data, [University of Arizona](https://swehsc.pharmacy.arizona.edu/news/using-care-principles-preserve-indigenous-data-sovereignty){target=_blank}.
!!! success "Learning Objectives"
- Recall the meaning of FAIR
- Understand why FAIR is a collection of principles (rather than rules)
- Understand CARE
### FAIR Principles
In 2016, the [**FAIR Guiding Principles**](https://www.nature.com/articles/sdata201618){target=_blank} for scientific data management and stewardship were published in Scientific Data.
Read it.
!!! tip "Why Principles?"
FAIR is a collection of principles. Ultimately, different communities within different scientific disciplines must work to interpret and implement these principles. Because technologies change quickly, focusing on the desired end result allows FAIR to be applied to a variety of situations now and in the foreseeable future.
**Findable**
- F1. (meta)data are assigned a globally unique and persistent identifier
- F2. data are described with rich metadata (defined by R1 below)
- F3. metadata clearly and explicitly include the identifier of the data it describes
- F4. (meta)data are registered or indexed in a searchable resource
**Accessible**
- A1. (meta)data are retrievable by their identifier using a standardized communications protocol
- A1.1 the protocol is open, free, and universally implementable
- A1.2 the protocol allows for an authentication and authorization procedure, where necessary
- A2. metadata are accessible, even when the data are no longer available
**Interoperable**
- I1. (meta)data use a formal, accessible, shared, and broadly applicable language for knowledge representation.
- I2. (meta)data use vocabularies that follow FAIR principles
- I3. (meta)data include qualified references to other (meta)data
**Reusable**
- R1. meta(data) are richly described with a plurality of accurate and relevant attributes
- R1.1. (meta)data are released with a clear and accessible data usage license
- R1.2. (meta)data are associated with detailed provenance
- R1.3. (meta)data meet domain-relevant community standard
!!! tip "Open vs. Public vs. FAIR"
Open: “Open data and content can be freely used, modified, and shared by anyone for any purpose”.
FAIR does **NOT** demand that data be open: See one definition of open:
http://opendefinition.org/.
### CARE Principles
!!! question "Who owns the açaí?"
The [CARE Principles](https://www.gida-global.org/care){target=_blank} for Indigenous Data Governance were drafted at the International Data Week and Research Data Alliance Plenary co-hosted event "Indigenous Data Sovereignty Principles for the Governance of Indigenous Data Workshop," 8 November 2018, Gaborone, Botswana.
**Collective Benefit**
- C1. For inclusive development and innovation
- C2. For improved governance and citizen engagement
- C3. For equitable outcomes
**Authority to Control**
- A1. Recognizing rights and interests
- A2. Data for governance
- A3. Governance of data
**Responsibility**
- R1. For positive relationships
- R2. For expanding capability and capacity
- R3. For Indigenous languages and worldviews
**Ethics**
- E1. For minimizing harm and maximizing benefit
- E2. For justice
- E3. For future use
!!! tip "Connecting FOSS and CARE: [Lydia Jennings](https://nativesoilnerd.com/){target=_blank}"
Dr. Lydia Jennings was a Data Science Fellow at the University of Arizona, who attended FOSS in Fall of 2022.
Lydia graduated from the University of Arizona's Department of Evironemtal Sciences, and has published a paper on the application of the CARE principles to ecology and biodiversity research.
Go Lydia!
[Appying the 'CARE Principles for Indigenous Data Governance' to ecology and biodiversity](https://www.nature.com/articles/s41559-023-02161-2){target=_blank}, *Nature Ecology & Evolution*, 2023.
### How to get to FAIR?
This is a question that only you can answer, that is because it depends on (among other things)
1. Your scientific discipline: Your datatypes and existing standards for what constitutes acceptable data management will vary.
2. The extent to which your scientific community has implemented FAIR: Some disciplines have significant guidelines on FAIR, while others have not addressed the subject in any concerted way.
3. Your level of technical skills: Some approaches to implementing FAIR may require technical skills you may not yet feel comfortable with.
While a lot is up to you, the first step is to evaluate how FAIR you think your data are:
??? question "Assessing the FAIRness of you data"
Thinking about a dataset you work with, complete the ARDC [FAIR assessment](https://ardc.edu.au/resource/fair-data-self-assessment-tool/){target=_blank} in your own time.
??? note "Resources"
- [The FAIR Guiding Principles for scientific data management and stewardship](https://www.nature.com/articles/sdata201618){target=_blank}
- [Wilkinson et al. (2016)](https://doi.org/10.1038/sdata.2016.18){target=_blank} established the guidelines to improve the Findability, Accessibility, Interoperability, and Reuse (FAIR) of digital assets for research.
- [Go-FAIR website](https://www.go-fair.org/fair-principles/){target=_blank}
- [Carroll *et al.* (2020)](http://doi.org/10.5334/dsj-2020-043){target=_blank} established the CARE Principles for Indigenous Data Governance. [full document :fontawesome-solid-file-pdf:](https://static1.squarespace.com/static/5d3799de845604000199cd24/t/5da9f4479ecab221ce848fb2/1571419335217/CARE+Principles_One+Pagers+FINAL_Oct_17_2019.pdf){target=_blank}
- [Indigenous Data Sovereignty Networks](https://indigenousdatalab.org/networks/){target=_blank}
---
## Data Self-assessment
!!! question "Activity"
In small groups, discuss the following questions.
1. What are the two or three data types that you most frequently work with?
- Think about the sources (observational, experimental, simulated, compiled/derived)
- Also consider the formats (tabular, sequence, database, image, etc.)
2. What is the scale of your data?
??? tip "Tip: think of the [Three V's](https://www.bigdataframework.org/four-vs-of-big-data/){target=_blank}"
- Volume: Size of the data (MBs, GBs, TBs); can also include how many files (e.g dozens of big files, or millions of small ones)
- Velocity: How quickly are these data produced and analyzed? A lot coming in a single batch infrequently, or, a constant small amount of data that must be rapidly analyzed?
- Variety: How many different data types (raw files? databases?)
A fourth V (Veracity) captures the need to make decisions about data processing (i.e., separating low- and high-quality data)
3. What is your strategy for storing and backing up your data?
4. What is your strategy for verifying the integrity of your data? (i.e. verifying that your data has not be altered)
5. What is your strategy for searching your data?
6. What is your strategy for sharing (and getting credit for) your data? (i.e. How will do you share with your community/clients? How is that sharing documented? How do you evaluate the impact of data shared? )
---
## Data Management Plans
"Those who fail to plan, plan to fail."
!!! success "Learning Objectives"
- Describe the purpose of a data management plan
- Describe the important elements of a data management plan
!!! quote "What is a DMP?"
"A data management plan or DMP is a formal document that outlines how data are to be handled both during a research project, and after the project is completed. The goal of a data management plan is to consider the many aspects of data management, metadata generation, data preservation, and analysis before the project begins; this may lead to data being well-managed in the present, and prepared for preservation in the future."
Source: [Wikipedia](https://en.wikipedia.org/wiki/Data_management_plan){target=_blank}.
Here are some [Example DMPs](https://dmptool.org/public_plans){target=_blank} made public from the DMPtool website. You can use these as example for creating your own DMP.
**Why bother with a DMP?**
??? question "How would you answer?"
Do you have a data management plan? If so, how do you use it?
Returning to the assertion that data (and its value) is at the foundation of your science, working without a data management plan should be considered scientific misconduct.
Those are strong words. And while we might have an intuition of the boundaries of research ethics - data mismanagement seems more like an annoyance than misconduct. However, if your mismanagement leads to error in your research data, or the inability to make publicly-funded research open to the public, these are serious consequences. Increasingly, funders realize this.
{width="450"}
"Europe 1916", by cartoonist Boardman Robinson, depicting the [carrot and stick metaphor](https://en.wikipedia.org/wiki/Carrot_and_stick){target=_blank}.
**Stick:**
- [You have to make one](https://www.nsf.gov/pubs/2019/nsf19069/nsf19069.jsp){target=_blank}.
- Reviewers definitely look at them, but they may not be enforced.
**Carrot:**
- Make your life easier.
- Planning for you project makes it run more smoothly.
- Avoid surprise costs.
!!! tip "DMPTools: making your (data) life a little easier"
Here are a couple of tools you can utilize in order to create a Data Management Plan:
- [Data Stewardship Wizard](https://ds-wizard.org/){target=_blank}.
- [DMPTool](https://dmptool.org/){target=_blank}.
---
## Licenses
By default, when you make creative work, that work is under exclusive copyright. This means that you have the right to decide how your work is used, and that others must ask your permission to use your work.
If you want your work to be Open and used by others, you need to specify how others can use your work. This is done by *licensing* your work.
!!! tip "License Examples"
- [MIT License](https://choosealicense.com/licenses/mit/){target=_blank}
- [GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/){target=_blank}
- FOSS material has been licensed using the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/){target=_blank}
### License Options from UArizona Library
{ width="600" } License options for University of [Arizona Research Data Repository (ReDATA)](https://data.library.arizona.edu/supported-platforms/redata){target=_blank}.
**Additional Info**
- General guidance on how to choose a license https://choosealicense.com/
- More good guidance on how to choose a license https://opensource.guide/legal/
- Licensing options for your [Github Repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository#choosing-the-right-license){target=_blank}
??? note "References and Resources"
- [NSF Guidelines on DMPs](https://www.nsf.gov/bio/biodmp.jsp){target=_blank}
- https://dmptool.org/general_guidance
- https://dmptool.org/public_templates
- Professional and scholarly societies, e.g., theEcological Society of America http://www.esa.org/esa/science/data-sharing/resources-and-tools/
- DataOne - https://dataoneorg.github.io/Education/bestpractices/
- Data Carpentry - http://datacarpentry.org/
- The US Geological Survey https://www.usgs.gov/data-management
- Repository registry (and search) service: http://www.re3data.org/
- Your university library
---
## :material-file-document-multiple: Project Documentation
_A great Open Scientist is someone who documents their work and shares it with the world. This means going well beyond peer-reviewed publications._
Here are some discussing points on *why* you should carry out documentation:
- Describe how to use or build your computer code or tools
- Share best practices for a method or protocol
- Create and share educational material so others in your field can learn from you
- Share a first-person account of your journey through a project
 Read more in depth on the documentation system here: https://documentation.divio.com
??? question "Explanining the quadrants"
- **Tutorials**: Lessons! Tutorials are lessons that take the reader by the hand to understand how the basics of a tool work. They are what your project needs in order to show a beginner that they can achieve something with it. The techical teaching we do in FOSS are mostly tutorials. For example, we do simple tutorials to teach the mechanics of version control.
- **How-to-guides**: Recipes! How-to-guides take the reader through the steps required to acheive a specific outcome or answer a specific question. An example how-to-guide could be a guide on how to install a specific software on a specific operating system.
- **References**: References offer technical descriptions of the machinery and how to operate it. References have one job only: to describe. They are code-determined, because ultimately that’s what they describe: key classes, functions, APIs, and so they should list things like functions, fields, attributes and methods, and set out how to use them.
- **Explanation**: Discussions! The aims of explanations are to clarify and illuminate a particular topic by broadening the documentation’s coverage of a topic.
### Tips for Great Documentation
- **:material-glasses: Clarity**: Documentation should be easy to understand with clear language and no ambiguity.
- **:octicons-circle-16: Completeness**: It must cover all essential details, leaving nothing crucial undocumented.
- **:fontawesome-solid-bullseye: Accuracy**: Information should be up-to-date and correct to prevent errors and misunderstandings.
- **:simple-instructure: Organization**: A logical structure and clear organization make it easy to navigate and find information.
- **:fontawesome-solid-exclamation: Relevance**: Documentation should focus on what's pertinent to its intended audience or purpose, avoiding unnecessary information.
### Public Repositories for Documentation
??? "*:simple-github: GitHub Readme*"
- On Github, good documentation starts with a robust ReadMe file. The ReadMe file is the first thing that people see when they visit your repository. It is a good place to explain what your project does, how to use it, and how to contribute to it. Here is an [example](https://github.com/jeffgillan/geospatial_pipeline){target=_blank}.
??? "*:simple-github: GitHub Wiki*"
- Also on Github, you can use the Wiki feature to create a separate space for documentation. The Wiki is a place to document your project in a way that is separate from the code. Here is an [example](https://github.com/ua-datalab/Geospatial_Workshops/wiki){target=_blank}
??? "*:simple-github: GitHub Pages*"
- [Github Pages](https://pages.github.com/){target=_blank} are hosted directly from your GitHub repository
- GitHub pages are free, fast, and easy to build, but limited in use
of subdomain or URLs
- You can pull templates from other GitHub users for your website, e.g. [:simple-jekyll: Jekyll themes](http://themes.jekyllrc.org/){target=_blank}
- This FOSS site is built with [Zensical](https://zensical.org/){target=_blank} (from the team behind Material for MkDocs) and published with [:simple-github: GitHub Pages](https://pages.github.com/){target=_blank}; the original CyVerse site used [:simple-markdown: MkDocs](https://www.mkdocs.org/){target=_blank} with the [Material](https://squidfunk.github.io/mkdocs-material/){target=_blank} theme.
- Other popular website generator for GitHub Pages is [:simple-bootstrap: Bootstrap.js](https://getbootstrap.com/){target=_blank}.
??? "*:simple-markdown: Material MkDocs*"
- [Material Design](https://squidfunk.github.io/mkdocs-material/){target=_blank} theme for MkDocs, a static site generator geared towards (technical) project documentation.
- Publish via GitHub Actions
- Uses open source Material or ReadTheDocs Themes
??? "*:simple-readthedocs: ReadTheDocs*"
- publishing websites via
[ReadTheDocs.com](https://readthedocs.com/dashboard/){target=_blank} costs money.
- You can work in an offline state, where you develop the materials
and publish them to your localhost using
[Sphinx](https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html){target=_blank}
- You can work on a website template in a GitHub repository, and
pushes are updated in near real time using ReadTheDocs.com.
- Here is example documentation of Pytorch using ReadTheDocs: [PyTorch](https://pytorch.org/docs/stable/index.html){target=_blank}.
??? "*:material-book-arrow-down: Bookdown*"
- [:material-book-arrow-down: Bookdown](https://bookdown.org/){target=_blank} is an open-source R package that facilitates writing books and long-form articles/reports with R Markdown.
- Bookdown websites can be hosted by [RStudio
Connect](https://www.rstudio.com/products/connect/){target=_blank}
- You can publish a Bookdown website using [Github
Pages](https://github.blog/2016-08-17-simpler-github-pages-publishing/){target=_blank}
??? "*:simple-r: Quarto*"
- [:simple-r: Quarto](https://quarto.org/){target=_blank} is an open-source scientific and technical publishing system built on Pandoc
- [Build a website](https://quarto.org/docs/websites/){target=_blank} using Quarto's template builder
- [Build with Github Pages](https://quarto.org/docs/publishing/github-pages.html){target=_blank}
??? "*:simple-jupyter: JupyterBook*"
- [Based on Project Jupyter](https://jupyterbook.org/en/stable/start/overview.html){target=_blank} `ipynb` and MarkDown
- Uses `conda` package management
??? "*:simple-git: GitBook*"
- [GitBook](https://docs.gitbook.com/){target=_blank} websites use MarkDown syntax
- Free for open source projects, paid plans are available
??? "*:simple-confluence: Confluence Wikis*"
- [:simple-confluence: Confluence Wikis](https://www.atlassian.com/software/confluence/use-cases/wiki){target=_blank} are another tool for documenting your work. You can see an example from [Cyverse](https://wiki.cyverse.org){target=_blank}.
!!! quote "Things to remember about Documentation"
- Documentation should be written in such a way that people who did not write the documentation can read and then use or read and then teach others in the applications of the material.
- Documentation is best treated as a living document, but version control is necessary to maintain it
- Technology changes over time, expect to refresh documentation every 3-5 years as your projects age and progress.
---
## Self Assessment
??? question "What is a Data Management Plan?"
**Important**: A data management plan (DMP) is now required aspect of publicly funded research.
DMPs are short, formal, documents outlining what types of data will be used, and what will be done with the data both during and after a research project concludes.
??? question "True or False: When science project funding ends, the data should end with it"
**False**
Data live on after a project ends.
Ensuring that data have a full lifecycle where they can be (re)hosted and made available after a project ends is critical to open science and reproducible research
??? danger "... or maybe?"
Sometimes destroying data is part of the life cycle of data - this may be required if data are sensitive and could be used unethically in the future, beyond the control of the original investigator team.
??? question "True or False: FAIR and CARE data principles are the same"
**False**
The CARE principles were created in order to help guide and answer when and how applying FAIR data principles to soverign indigenous-controlled data should be done and when it should not.
??? question "(1/2) Your project has been greenlit and you require to create a GitHub repository for your work; What you are working on is likely going to be used by others in your field, thus you want to use a licence that allow for others to access your work and make changes where needed. Which licence do you choose?"
**MIT License**
A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
??? question "(2/2) You approach your PI with the idea, and they're not happy with the choice. They are pushing to keep the attribution to your lab; Which license type would be useful in this situation?"
**CC By**
Rights are not waived, attribution is required.
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/02_managing_data.md){target=_blank} (last source update 2025-09-08), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/03-talk-to-computers/
---
title: "How to Talk to Computers"
description: "An introduction to the Unix shell: navigating directories, working with files, and automating tasks with shell scripts."
type: Lesson
tags:
- Command Line
- Shell
- Bash
- Linux
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/03_talk_to_computer.md"
title: "CyVerse FOSS: docs/03_talk_to_computer.md"
author: "team:cyverse"
last_modified: "2025-09-16T10:46:46-07:00"
---
# How to Talk to Computers
## The Command Line Interface
When using a computer, it is typical to use a keyboard and mouse to navigate a cursor across the screen or simply tap on the screens of our smart phones or tablets. Both of these methods make use of the Graphical User Interface (GUI) and have become central to the way we interact with computers. GUIs make computers so easy to use!
However, for a more direct and powerful way to instruct your computer, you should learn to use the **Command Line Interface (CLI)**. CLIs are found throughout all operating systems (Windows, MacOS, Linux) though they might have different commands and syntax.
For this FOSS lesson on CLI, we will focus on the Unix CLI which is present in MacOS and all Linux operating systems.
!!! warning "**Attention** :material-microsoft-windows: Windows users"
Much of what we are going to be teaching is based on open-source software which operates on cloud and is incompatible with Windows OS.
Unix-based systems such as Linux [:material-ubuntu: Ubuntu](https://ubuntu.com/){target=_blank} and [:material-apple: MacOS X](https://www.apple.com/macos/){target=_blank}, as many scientific tools require a Unix Operating System (OS).
There are a number of software that allow :material-microsoft-windows: Windows users to execute Unix commands, however we recommend the use of [:simple-linux: Windows Subsystem for Linux (WSL) 2.0](https://docs.microsoft.com/en-us/windows/wsl/install){target=_blank}.
??? tip "Quickstart installation of Window's WSL"
!!! warning "A system reboot is necessary"
1. Open :material-powershell: PowerShell in Administrator mode (open :octicons-search-16: Search and look for PowerShell, right click and select "Run as Administrator")
2. type `wsl --install`
3. Restart your machine
4. Open :octicons-search-16: Search and open :simple-linux: WSL; create a username and password, wait for it to finish setting up (should take a few minutes)
5. You're now ready to use :simple-linux: Linux on your Windows Machine!
??? question "Where is the WSL Home folder?"
The Home folders for Linux and Windows are different. The Windows path to the :simple-linux: WSL home folder is `\\wsl$\Ubuntu\home\`.
We suggest creating a bookmark in your Windows machine to allow quicker access to the :simple-linux: Linux partition (for quicker access to files).
To quickly open the folder, open :simple-linux: WSL and execute `explorer.exe .`. This will open a folder in Windows at the Linux Home folder.
---
## The Unix Shell
The CLI sees the computer stripped down to only a [Terminal](https://en.wikipedia.org/wiki/Terminal_emulator){target=_blank} from where one can run powerful commands executed through the [Shell](https://en.wikipedia.org/wiki/Shell_(computing){target=_blank}).
Though there are technical differences between them, the terms **Command Line Interface**, **Terminal**, **Shell**, and **BASH** will be used more or less interchangeably throughout the lesson.
{width=500} The Terminal shellQuick video on the shell.
## Accessing a Linux Shell on CyVerse
The CyVerse Discovery Environment includes CloudShell, a Linux terminal that runs in your browser, so you can follow this lesson without installing anything. (GitHub [Codespaces](https://github.com/features/codespaces){target=_blank} offers a similar browser-based Linux terminal attached to a GitHub repository.)
#### Steps to Launch the CLI on CyVerse
1. Navigate to the **CyVerse Discovery Environment**: https://de.cyverse.org/
!!! warning "You may need to first log in into the [User Portal](https://user.cyverse.org/){target=_blank} if this is your first time logging onto CyVerse."
{width=600}
2. On the left hand side, click the CloudShell button.
{width=600}
3. Your Terminal should be available within a few seconds.
{width=600}
## Introductory Shell Commands
The following tutorial material was taken from the [Carpentries' Shell Module](https://swcarpentry.github.io/shell-novice/){target=_blank}.
!!! info "Download Some Data from the Carpentries"
To follow along with the tutorial, please download and unzip this data. [shell-lesson-data.zip](https://swcarpentry.github.io/shell-novice/data/shell-lesson-data.zip){target=_blank}
??? tip "The Command Line Way to Download and Unzip!"
Execute the following commands:
```
$ wget https://swcarpentry.github.io/shell-novice/data/shell-lesson-data.zip
$ unzip shell-lesson-data.zip
```
### Navigation
{ width="300" } Linux Directory Structure
| Command | Explanation |
|---|---|
|`pwd`| print working directory |
|`ls`| list content of folder |
|`cd`| change directory |
By typing `pwd`, the current working directory is printed.
```
$ pwd
/home/jovyan/data-store
```
We can then use `ls` to see the contents of the current directory.
```
$ ls
shell-lesson-data/ shell-lesson-data.zip*
```
??? info "Command Flags"
Each command has **flags**, or options that you can specify. which are summoned with a `-`, such as ` -`.
```
$ ls -a -l -h
```
- The above command calls for the `-a` (all), `-l` (long), `-h` (human readable) flags. This causes `ls` to output a list of *all* files (inculding hidden files/folders) with human readable file size (e.g., it will list 3MB instead of 3000000), permissions, creator, and date of creation.
- If you do not know what flags are available, you can refer to the `man` command (or for many tools, use the `-h` (help) flag).
We can then move inside the folder of our choice doing `cd`. Doing `ls` following the opening of the folder of choice, will show the contents of the folder you just moved in. Feel free to explore the contents of the folders by using `cd` and `ls`.
```
$ cd shell-lesson-data
$ ls
exercise-data/ north-pacific-gyre/
$ ls exercise-data/
animal-counts/ creatures/ numbers.txt* proteins/ writing/
```
??? info "Tips for Directory Navigation"
`.` refers to *current* directory
`..` refers to *above* directory
`/` is the directory separator
`~` indicates the home directory
For example:
```
$ ls . # lists files and folders in the current directory
$ ls .. # lists files and folders in the above directory
$ ls ~ # lists files and folders in the home directory
$ ls ~/Documents # lists files and folders in Documents (a folder present in the home directory)
```
!!! tip "Use the Tab key to autocomplete"
You do not need to type the entire name of a folder or file. By using the tab key, the Shell will autocomplete the name of the files or folders. For example, typing the following
```
$ ls exer
```
and pressing the tab key, will result in autocompletion.
```
$ ls exercise-data/
```
You can then press tab twice, to print a list of the contents of the folder.
```
$ ls exercise-data/
animal-counts/ creatures/ numbers.txt proteins/ writing/
```
### Working with Files and Directories
| Command | Explanation |
|---|---|
|`mkdir`| make a directory |
|`touch`| creat empty file |
|`nano` or `vim`| text editors |
|`mv`| move command |
|`cp`| copy command |
|`rm`| remove command |
??? info "Help with Commands"
For every command, typing `man` (manual) before the command, will open the manual for said command.
```
$ man ls
```
- The above command will result in opening the *manual* for the `ls` command. You can exit the man page by pressing `q`.
Return to `shell-lesson-data`, and create a directory with `mkdir `.
```
$ mkdir my_folder
$ ls
exercise-data/ my_folder/ north-pacific-gyre/
```
Notice the new `my_folder` directory.
!!! danger "Naming your files"
It is strongly suggested that you avoid using spaces when naming your files. When using the Shell to communicate with your machine, a space can cause errors when loading or transferring files. Instead, use dashes (`-`), underscores (`_`), periods (`.`) and CamelCase when naming your files.
Acceptable naming:
```
$ mkdir my_personal_folder
$ mkdir my_personal-folder
$ mkdir MyPersonal.Folder
```
??? question "What will happen if you create a directory with spaces?"
You will obtain as many folders as typed words!
```
$ mkdir my folder
$ ls -F
exercise-data/ folder/ my/ north-pacific-gyre/
```
Notice the two folders `my` and `folder`.
Create an empty file with `touch `
```
$ touch new_file.txt
```
`touch` will create an **empty** file
Add text to the new file
```
nano new_file.txt
```
Use `mv ` to move your newly created file to the directory you created previously (you can then use `ls` to check if you successully moved the file).
```
$ ls
exercise-data/ new_file* my_folder/ north-pacific-gyre/
$ mv new_file.txt my_folder/
$ ls
exercise-data/ my_folder/ north-pacific-gyre/
$ ls my_folder/
new_file.txt*
```
`mv` can also be used to **rename** a file or folder with `mv `.
```
$ cd my_folder/
$ mv new_file my_file
$ ls
my_file*
```
`cp` is the command to copy a file with the syntax `cp `
```
$ cp my_file copy_my_file
$ ls
copy_my_file* my_file*
```
!!! note "Copying folders"
To copy folders and the content of these folders, you will have to use the `-r` flag (recursive) for `cp` in the following manner `cp -r ` (following example is from the `shell-lesson-data/` directory).
```
$ cp -r my_folder/ copy_my_folder
$ ls
copy_my_folder/ exercise-data/ my_folder/ north-pacific-gyre/
$ ls my_folder/
copy_my_file* my_file*
$ ls copy_my_folder/
copy_my_file* my_file*
```
To remove an unwanted file, use `rm `.
```
$ rm copy_my_file
$ ls
my_file
```
!!! note "Removing folders"
Save as the "Copying Folders" note, you have to use the `-r` flag to remove a folder `rm -r ` (following example is from the `shell-lesson-data/` directory).
```
$ rm -r copy_my_folder/
$ ls -F
exercise-data/ my_folder/ north-pacific-gyre/
```
---
### Shell Script
Here we are going to show an example command line automation using a shell script. This is what makes the command line powerful!
!!! tip "Shell Script"
A shell script is a file with the extension '.sh'. It is essentially a text file that lists out multiple shell commands. When the shell script is run, the computer will run all of the commands in sequence in an automated way.
Navigate to the `shell-lesson-data` directory
```
$ cd shell-lesson-data
```
Create the shell script
```
$ nano script.sh
```
The text editor Nano will pop up and it will be empty.
!!! example "Script exercises"
??? example "word counting"
```bash
#!/bin/bash
# Find haiku.txt starting from current directory
file_path=$(find . -name "haiku.txt" | head -n 1)
# Navigate to its directory
cd "$(dirname "$file_path")"
# Print absolute path
echo "haiku.txt found at: $(pwd)/haiku.txt"
# Define keyword to search
keyword="not"
# Count how many times the keyword appears
keyword_count=$(grep -o "$keyword" haiku.txt | wc -l)
# Extract and append keyword context
echo "" >> haiku.txt
echo "---- Keyword Summary ----" >> haiku.txt
echo "Keyword '$keyword' appears $keyword_count times" >> haiku.txt
echo "Summary generated on: $(date)" >> haiku.txt
echo "--------------------------" >> haiku.txt
# Show updated file
cat haiku.txt
```
??? example "Create a compressed backup with a timestamp"
```bash
#use Bash shell to run the following commands
#!/bin/bash
## Variables
#the directory you want to back up (e.g., shell-lesson-data)
SOURCE_DIR=$(find $PWD -type d -name "shell-lesson-data" 2>/dev/null)
#location where the backup will be stored
BACKUP_DIR="$PWD"
#used to create a unique name for each backup based on the current date and time
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
# name of the compressed backup file
ARCHIVE_NAME="backup_$TIMESTAMP.tar.gz"
# Create backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Create a compressed archive of the source directory
tar -czf "$BACKUP_DIR/$ARCHIVE_NAME" -C "$SOURCE_DIR" .
# Output the result
echo "Backup of $SOURCE_DIR completed!"
echo "Archive created at $BACKUP_DIR/$ARCHIVE_NAME"
```
Exit nano with `ctrl + x`
Modify permission to make the shell script executable
```
$ chmod +x script.sh
```
Run the shell script
```
$ ./script.sh
```
### More Carpentries Lessons on Linux Command line
- [Pipes and Filters](https://swcarpentry.github.io/shell-novice/04-pipefilter.html){target=_blank}
- [Loops](https://swcarpentry.github.io/shell-novice/05-loop.html){target=_blank}
- [Scripts](https://swcarpentry.github.io/shell-novice/06-script.html){target=_blank}
- [Finding Things](https://swcarpentry.github.io/shell-novice/07-find.html){target=_blank}
---
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/03_talk_to_computer.md){target=_blank} (last source update 2025-09-16), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/04-talk-to-llms/
---
title: "How to Talk to LLMs"
description: "How large language models work, prompt-engineering techniques such as priming, chaining, and the CRAFT framework, and AI coding tools for research."
type: Lesson
tags:
- LLMs
- Prompt Engineering
- AI
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/04_talk_to_llms.md"
title: "CyVerse FOSS: docs/04_talk_to_llms.md"
author: "team:cyverse"
last_modified: "2025-09-22T15:52:56-07:00"
---
# How to Talk to LLMs
---
[CyVerse Full Prompt Engineering Workshop](https://tyson-swetnam.github.io/intro-gpt){target=_blank}
---
!!! success "Learning Objectives"
- **Fundamentals**: How AI models process and respond to prompts
- **Modern Features**: Leveraging document uploads, web search, and multi-modal inputs
- **Best Practices**: Structured approaches to writing effective prompts
- **Advanced Techniques**: Context management, chaining, and custom instructions
---
## How is the AI revolution impacting Open Science?
!!! quote "Center for Open Science: [Evaluating AI’s Impact on Open Research Infrastructure](https://www.cos.io/blog/evaluating-ai-impact-on-open-research-infrastructure){target=_blank} "
!!! success ""*When used responsibly, it can support open models and data, accelerate discovery, and aid in the evaluation of research...* *... but it can also undermine credibility when used to plagiarize, fabricate findings, or mislead readers.* ""
!!! failure ""*With the emergence of generative AI, it has become very easy to create content that looks like a real research paper, but is not genuine research.*""
!!! quote "MDPI Blog: [How Artificial Intelligence is Accelerating Open Access Science](https://blog.mdpi.com/2025/09/09/open-science-artificial-intelligence/){target=_blank}"
!!! success ""*Artificial intelligence, like any new technology, presents both a threat and an opportunity. It requires reflection, adjustment, and adaptation.
If implemented carefully and thoughtfully, AI could help us respond to some of the issues that the Open Access scientific publishing industry currently faces. These include the increasing amounts of data being produced and also language barriers and imbalances in outputs between countries.
Further, AI could help to promote openness in datasets and content aggregators.*""
!!! failure ""*GPT is not fully reliable.
GPT training involves analysing a huge body of text and noticing patterns so it can predict the next word in a passage.
This results in human-like text, meaning it sounds like it’s written by a human but may not necessarily be by one. Similarly, it may sound like it is conveying meaning, but the argument or claim being made may be without evidence or structure.*""
!!! success ""*Artificial intelligence is changing Open Access; it’s changing everything. Ultimately, though, it’s a tool, so how it’s used determines its value.
If used carefully, AI could help advance Open Access by automating repetitive data-related tasks, making the translation process more interactive, and promoting openness in datasets and content aggregators.*
***However, attention must be paid to its flaws and potential for misuse.***""
{width=400} Rubber duck debugging (or rubberducking), [Wikipedia](https://en.wikipedia.org/wiki/Rubber_duck_debugging){target=_blank}
The AI revolution is here and it isn't going away any time soon. Tools such as ChatGPT, Machine Learning and Large Language Models (LLMs) present an opportunity that is as (probably) as impactful as the arrival of the internet for the average human. Over the course of decades, scientists have encouraged the application of techniques that are in the Open Science realm, but with AI, Open Science requires to revisit many of its pillars and values.
For example, the necessity of communicating with another person in order to review your work is quickly being overtaken by using LLMs to help improve and edit your work, challenging the topic of simple collaborations and peer review. In the case of building code, LLMs are a fantastic resource that can help removing typos, encourage conciseness, and create helpful comments.
However, these can act like echo chambers, where your expectations can lead to [**hallucinations** ](https://en.wikipedia.org/wiki/Hallucination_(artificial_intelligence){target=_blank}) or even pave the way to the ["new p-hacking": prompt-hacking](https://arxiv.org/pdf/2504.14571){target=_blank}.
Therefore, it is imperial that as scientists we embrace the discussion of AI in Open Science, understand how it can help us with our daily work and challenge ourselves to ensure that **science stays human**.
---
## LLM Chatbots for Open Science
Large Language Model (LLM) chatbots have fundamentally changed how we humans are going to interact with computers going forward. They provide a natural language interface to instruct computers to do many tasks including:
- Read, write, and summarize text
- Analyze data
- Explain techical topics
- Search the web and retrieve information
- Generate, optimize, and explain many types of computer code
- Understand and generate images
Current LLMs generally provide recommendation for how _you_ could do things. ie, they provide you code and text recommendations but don't actually execute anything. But these technologies are advancing quickly and new capabilities are developed and released constantly. Soon, [AI Agents](https://github.com/Significant-Gravitas/AutoGPT){target=_blank} could be everywhere executing on instructions in autonomous and semi-autonomous ways.
### Commercial Chatbots
- [:material-robot-outline: ChatGPT](https://openai.com/chatgpt){target=_blank}
- [:simple-google: Gemini](https://gemini.google.com/){target=_blank}
- [:simple-anthropic: Claude](https://www.anthropic.com/claude){target=_blank}
- [:octicons-copilot-16: Copilot](https://copilot.microsoft.com/){target=_blank}
### LLMs in 150 words (or less)
**How they're made**: LLMs work by training on vast amounts of text from the internet. They learn patterns, grammar, and context from this data. When you give them a prompt, they generate text based on what they've learned. Imagine a super-smart autocomplete for text, but it can also create entire paragraphs or articles.
**How they work**: LLMs don't understand like humans do. They predict what comes next in a sentence using math and probabilities. They don't have thoughts or feelings. They mimic human language but can make mistakes or write nonsense if not guided well.
**How you can use them**: They're incredibly versatile. You can use them for answering questions, writing essays, coding help, and more. ***But you must be cautious because they can generate biased or false information if not used responsibly***.
In a nutshell, LLMs are like super-powered text generators trained on the internet's vast knowledge.
⚠️⚠️ VERIFY EVERTHING CHATBOTS TELL YOU! ⚠️⚠️
---
### :material-robot-outline: Prompt Writing
LLM Chatbots are meant to be conversational. In general, you are asking the Chatbot questions (known as **Prompts**) and the Chatbot will respond with answers.
It is a bit of an artform to get the Chatbot to provide answers with the specificity and format that you want. An entire field of study has sprung up, called **Prompt Engineering**, is a technique of crafting effective instructions using AI large language models. With modern AI-powered tools like Claude Desktop, ChatGPT, Gemini, and NotebookLM offering capabilities to upload documents, search the web, and process multiple file types, mastering prompt engineering has become essential for productive AI interactions.
#### **Prompt Priming**
Provide lots of organized details to help the Chatbot understand the question and what it's task is. This could include adding a backstory or context for why you are asking the question. Be very specific in terms of what you want from the Chatbot and how you want it.
Zero-shot unconditioned prompts are likely to return the least specific responses. Responses are more likely to be useful when multiple specific output types are defined.
| Types of Priming | Example |
|------------------|---------|
| Zero (Shot) | "Write five examples of assessments for watershed health." |
| Single | "Write five examples of assessments for watershed health. Here is one example: Geomorphology" |
| Multiple | "Write five examples of assessments for watershed health related to geomorphology, water quality, and species diversity." |
#### **Linked Prompts**
Responses to prompts may not return the exact details or information that you are after the first time. Follow-up by rephrasing your prompts more carefully and continuing with iterative prompting can build upon your priors.
"Chain prompting" or "Linked Prompting" brings multiple prompts together.
| Linked Prompting | Examples |
|------------------|----------|
| Step 1: Priming | "I want you to act as an eminent hydrologist from CUASHI. Provide me with a list of the ten most important topics in hydrology over the last decade focused around research in the global south, working with indigenous communities, and traditional ecological knowledge systems." |
| Step 2: Summarizing | "Based on the list you just created, summarize the most pressing financial challenges faced by indigenous communities in the Global South, versus indigenous communities in North America, in less than 50 words." |
| Step 3: Try again with a web search (Control) | "Based on the results of web access, can you confirm the validity of the ten important topics and provide at least one reference to each." |
!!! tip "Encouraging the Chatbot to do Better"
Chatbot responses can be missing information or just plain wrong. When this occurs, you can point out the mistake and ask the Chatbot to provide a more complete or better answer. Don't settle for poor responses!
``` mermaid
graph LR
A[Priming] --> B{Result?};
B -->|Yes| C[Summarize];
C --> D[Quality Control];
D --> B;
B ----> E[Yay!];
```
#### Role Playing
Some people find that asking the Chatbot to adopt a persona will lead to better responses.
"I want you to act as ..." will establish what type of conversation you are planning to have.
| Types of Roles |
|---|
| Project Manager |
| Copywriter / Editor |
| Paper Reviewer |
| Teacher / Mentor / Advisor |
| Student / Learner / Participant |
| Software Engineer |
| DevOps Engineer |
| Linux Terminal |
| Python Interpreter |
| Web Browser |
---
## Understanding Modern AI Capabilities
### How AI Models Process Your Input
!!! info "The Processing Pipeline"
1. **Tokenization**: Your prompt is broken into smaller units (tokens)
2. **Context Assembly**: Uploaded documents and conversation history are included
3. **Attention Mechanism**: The model identifies relevant information
4. **Generation**: Response is produced token by token
5. **Formatting**: Output is structured according to your specifications
### The Foundation: Clear Instructions
Start with simple, direct prompts before advancing to complex techniques:
```markdown
# Basic Prompt
"Summarize this research paper in 3 bullet points"
```
```markdown
# Better Prompt
"As a research scientist, summarize the key findings from this paper
in 3 bullet points, focusing on methodology and results"
```
```markdown
# Best Prompt
"You are a research scientist reviewing papers for a journal.
Summarize the attached PDF in 3 bullet points that cover:
1. Research question and hypothesis
2. Methodology and sample size
3. Key findings and limitations
Format as a bullet list with sub-points for clarity."
```
### Core Features of Today's AI Tools
Modern AI assistants have evolved beyond simple text chat:
| Feature | :simple-claude: Claude | :material-robot-outline: ChatGPT | :simple-googlegemini: Gemini | :simple-notebooklm: NotebookLM | :material-microsoft: CoPilot |
|---------|--------|---------|--------|------------|---------|
| **Document Upload** | PDFs, text, code | PDFs, images, data | PDFs, images, GDrive | PDFs, Google Docs | PDFs, OneDrive |
| **Web Search** | Via MCP | Yes | Yes | Yes | Yes |
| **Context Window (tokens)** | 200K | 128K| 2M | Document-based | 128K |
| **File Analysis** | Yes | Yes | Yes | Deep analysis | Yes |
| **Code Execution** | Yes (MCP) | Yes | Yes | No | Yes |
### Working with Documents
Modern AI tools excel at document analysis. Here's how to maximize their potential:
!!! success "Document Upload Best Practices"
- **Specify the document**: "In the attached PDF..." or "Based on the uploaded spreadsheet..."
- **Direct attention**: "Focus on Section 3.2 of the document"
- **Request specific outputs**: "Create a table comparing the methods described in chapters 2 and 5"
- **Combine multiple sources**: "Compare the findings in these three papers"
#### Example: Multi-Document Analysis
```markdown
I've uploaded three research papers on climate change. Please:
1. Create a comparison table with columns for:
- Paper title and authors
- Methodology
- Key findings
- Limitations
2. Identify common themes across all papers
3. Highlight any contradictory findings
Format the response with clear headers and use markdown tables.
```
---
## The CRAFT Framework
For consistent, high-quality results, use the [CRAFT framework](https://www.geeky-gadgets.com/craft-prompt-framework/){target=_blank}:
| Action | Description |
|---|---|
| **Context** | Provide background information and set the scene |
| **Role** | Define who the AI should act as |
| **Action** | Specify exactly what you want done |
| **Format** | Describe how the output should be structured |
| **Tone** | Indicate the style and voice to use |
#### CRAFT Example
```markdown
Context: I'm preparing a grant proposal for NSF funding on AI in education
Role: Act as an experienced grant writer and education researcher
Action: Review my draft introduction and suggest improvements
Format: Provide feedback as tracked changes with explanations
Tone: Professional, constructive, and encouraging
```
---
## Advanced Techniques
### 1. Custom Instructions and System Prompts
Modern AI platforms allow you to set persistent instructions:
!!! example "'Custom Instructions' or 'System Instructions'"
Platforms like Gemini and Claude allow you to add "Custom Instructions" or "System Instructions" as prior prompts, which act as a global rule to subsequent prompt chaining.
For example:
```markdown
# Project Context
I'm a data scientist working on machine learning projects.
Always provide Python code examples using scikit-learn and pandas.
Include docstrings and type hints in all code.
# Response Preferences
- Be concise but thorough
- Explain complex concepts with analogies
- Always cite sources when making factual claims
```
### 2. Leveraging Web Search
Most featured GPTs now feature a web browse or search engine capability.
Enabling search allows the GPT to use document retrieval on websites and PDFs when reasoning out its response.
```markdown
Search for the latest research on the public health benefits of vaccination published in 2024.
Focus on:
- Papers from top conferences (AHA, ASPPH, NRHA, ICFMDP)
- mRNA
- Bird Flu and COVID
Summarize the top 5 papers with links to the originals.
```
### 3. Multi-Modal Prompting
Combine different input types for richer interactions:
```markdown
I've uploaded:
1. A screenshot of my dashboard
2. The underlying data in CSV format
3. Our brand guidelines PDF
Create a redesigned dashboard that:
- Improves data visualization based on best practices
- Adheres to our brand colors and fonts
- Highlights the KPIs mentioned in the data dictionary
```
### 4. Prompt Chaining
Build complex outputs through sequential prompts:
!!! tip "Effective Chaining Strategy"
1. **Start broad**: "Outline a research paper on sustainable AI"
2. **Zoom in**: "Expand section 3 on energy-efficient training methods"
3. **Refine**: "Add citations and make the tone more academic"
4. **Polish**: "Format according to IEEE standards"
### 5. Using Examples (Few-Shot Learning)
Provide examples to guide the AI's output:
```markdown
I need to classify customer feedback. Here are examples:
"The product arrived damaged" → Category: Shipping Issue
"Can't log into my account" → Category: Technical Support
"Love the new features!" → Category: Positive Feedback
Now classify these:
1. "The app keeps crashing on startup"
2. "Best purchase I've made this year"
3. "Package was left in the rain"
```
---
## Practical Applications
### Research and Analysis
```markdown
Analyze the attached dataset (CSV) and:
1. Identify statistical patterns and outliers
2. Create visualizations for the top 3 insights
3. Write a methods section describing the analysis
4. Suggest additional analyses based on the data
Use pandas profiling techniques and create matplotlib visualizations.
Include code that I can run locally.
```
### Writing and Editing
```markdown
I've uploaded my draft manuscript. Please:
1. Check for consistency in terminology throughout
2. Ensure all figures are referenced in the text
3. Verify the citation format matches APA 7th edition
4. Highlight any unclear passages
5. Suggest improvements for flow between sections
Provide a tracked-changes version and a summary of major edits.
```
### Code Development
```markdown
Based on the uploaded requirements document:
1. Create a Python class structure for the described system
2. Include comprehensive docstrings and type hints
3. Add unit tests for each method
4. Create a README with installation and usage instructions
5. Follow PEP 8 style guidelines
Use modern Python features (3.10+) and include error handling.
```
---
## Common Pitfalls and Solutions
### Pitfall 1: Vague Instructions
!!! failure "*Poor*: "Make this better""
!!! success "*Better*: "Improve this abstract by making it more concise (under 250 words), adding keywords, and ensuring it follows the journal's structure: background, methods, results, conclusions""
### Pitfall 2: Information Overload
!!! failure "*Poor*: "Uploading 50 documents without guidance""
!!! success "*Better*: "Focus on documents 1-3 which contain the methodology. Ignore the appendices.""
### Pitfall 3: Assuming Knowledge
!!! failure "*Poor*: "Fix the usual issues""
!!! success "*Better*: "Check for: passive voice, sentences over 25 words, undefined acronyms, and missing Oxford commas""
### Pitfall 4: No Output Format
!!! failure "*Poor*: "Summarize this""
!!! success "*Better*: Create an executive summary with: - 3-sentence overview - 5 key points as bullets - 1 paragraph on implications - Formatted with markdown headers"
---
## Prompting Chatbots for FOSS
#### Provide a general outline for a data management plan
```
I am writing a grant proposal to the National Science Foundation.
Could you please provide me a basic template for a data management plan (DMP) and
please provide url links to resources that can help me with NSF DMP requirements.
```
#### Provide a step-by-step recipe to create and serve an mkdocs website in Github
```
I would like to create a personal website using the MKdocs style
and host it on Github pages.
Could you please write me a step-by-step guide starting
with importing an existing github repository that has the mkdocs material.
```
#### Write shell commands and shell scripts
```
I would like to create a linux shell script to automate the backup of my working directory.
Could you please suggest a shell script that will copy my working directory
in a different directory and compress the file into an archive.
Please name the file based on the current time and date.
```
#### Write git commands
```
Could you please provide me a step-by-step workflow for using git with github?
I found a repository that I want to build on in Github.
I would like to work on the material on my local machine and then save it back up to github.
I would like to workflow to be for the linux command line.
```
#### Write download and conda commands
```
I am writing a lot of scripts using python. I have heard that environment managers such as conda may be useful to me.
I don't know anything about conda, so can you explain some things?
1. Give me a high level overview of what environment managers are and what conda is specifically.
2. Please create a step-by-step guide for downloading conda on my machine, and how to use conda to create custom environments.
3. Please explain and give my steps to share my environment with colleagues.
```
#### Write docker run commands
```
I would like to run a docker container that consists of a jupyter notebook.
Can you please suggest a docker run command that launches the jupyter notebook
and mounts a volume of data in it.
```
#### Write docker files
```
I would like to create a docker image that consists of R studio and
some customized Rcode. Can you tell me the steps to 1. make a dockerfile and
build the docker image; and 2. Upload the docker image to docker hub.
```
??? tip "ChatGPT :simple-awesomelists: Awesome Lists"
There is an ever changing meta-list of :simple-awesomelists: Awesome lists curated around ChatGPT plugins and extensions.
[:simple-github: search: `chatgpt+awesome`](https://github.com/search?q=awesome-chatgpt+&type=repositories&s=stars&o=desc)
Check out lists around:
[:simple-awesomelists: ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts){target=_blank}
[:simple-awesomelists: ChatGPT Data Science Prompts](https://github.com/travistangvh/ChatGPT-Data-Science-Prompts){target=_blank}
[:simple-awesomelists: API plugins, extensions, & applications](https://github.com/humanloop/awesome-chatgpt){target=_blank}
---
## Local LLMs vs APIs
### Managing API keys
#### Extension Installation
1. **Open VS Code**.
2. Navigate to the **Extensions view** by clicking the :material-puzzle-outline: icon in the Activity Bar on the side of the window or by pressing `Ctrl+Shift+X` (Windows/Linux) or `Cmd+Shift+X` (macOS).
3. In the search bar, type "**Cline**"
4. Find the official extension from the search results and click **Install**.
5. Once installed, you might need to **reload VS Code** if prompted.
#### Selecting an API
After installation, you'll typically need to configure an LLM API endpoint and key. Look for settings related to Roo Code or Cline in VS Code's settings (`Ctrl+,` or `Cmd+,`).
##### Google Gemini
1. Obtain your **Google Gemini API key** from [Google AI Studio](https://aistudio.google.com/){target=_blank} or Google Cloud Console.
2. In VS Code settings, search for "Roo Code Gemini" or a similar setting.
3. Enter your API key in the designated field (e.g., `Roo Code: Gemini API Key`).
4. You might also need to specify the model (e.g., `gemini-pro-2.5`).
##### Ollama (for Local Models)
[Ollama](https://ollama.com){target=_blank} allows you to run open-source LLMs locally.
1. Ensure **Ollama is installed and running** on your machine with the desired models downloaded (e.g., `ollama pull gemma3:1b`).
2. In VS Code settings for Roo Code/Cline, look for an option to specify the **Ollama API endpoint**. This is usually `http://localhost:11434` by default.
3. Select or specify the Ollama model you wish to use (e.g., `gemma`, `qwen`). No API key is typically needed for local Ollama usage directly, but the extension must be configured to point to the local server.
##### OpenAI Compatible
This is for services that adhere to the OpenAI API specification, which can include OpenAI itself or other providers like Azure OpenAI or local LLM servers.
1. Obtain your **API key** and **API base URL** (endpoint) from your provider.
* For OpenAI: Key from [platform.openai.com](https://platform.openai.com/api-keys){target=_blank}. Endpoint is typically `https://api.openai.com/v1`.
* For Azure OpenAI: Key and endpoint from your Azure deployment.
* For others: Refer to your provider's documentation.
2. In VS Code settings for Roo Code/Cline:
* Enter the API key (e.g., `Roo Code: OpenAI API Key`).
* Enter the API base URL if it's different from the default (e.g., `Roo Code: OpenAI API Base URL`).
* Select the desired model (e.g., `gpt-4o`).
##### Claude (via API)
If Roo Code/Cline supports direct Claude API integration (distinct from the Claude Desktop app):
1. Obtain your **Anthropic API key** from the [Anthropic Console](https://console.anthropic.com/){target=_blank}.
2. In VS Code settings for Roo Code/Cline, search for "Roo Code Claude" or a similar setting.
3. Enter your API key (e.g., `Roo Code: Claude API Key`).
4. Specify the Claude model you wish to use (e.g., `claude-4-sonnet`).
!!! tip "Restart for Changes"
After changing API settings, it's often a good idea to restart VS Code or the extension itself if it provides such an option, to ensure the new settings take effect.
---
## Setting up GitHub Copilot on VS Code Locally
GitHub Copilot is deeply integrated into the GitHub ecosystem and VS Code (local).
### In GitHub CodeSpaces
1. **Enable Copilot for your account**: Ensure you have an active GitHub Copilot subscription associated with your GitHub account.
2. **Launch a CodeSpace**: When you create or open a repository in GitHub CodeSpaces, Copilot is often enabled by default if your account has access.
3. **Check Status**: Look for the Copilot icon :octicons-copilot-16: in the status bar at the bottom of the VS Code interface within CodeSpaces. If it's not active, click it to see options or troubleshoot. You might need to authorize it for the specific CodeSpace.
### Extension Installation in VS Code (Desktop)
1. **Open VS Code**.
2. Navigate to the **Extensions view** (:material-puzzle-outline: or `Ctrl+Shift+X` / `Cmd+Shift+X`).
3. Search for "**GitHub Copilot**".
4. Find the official extension by GitHub and click **Install**.
5. **Sign In**: After installation, VS Code will prompt you to sign in with your GitHub account. Follow the prompts to authorize VS Code to use GitHub Copilot.
* If you're not prompted, you can often click the user icon in the bottom left of VS Code and sign in there, or find a "Sign In to GitHub Copilot" command in the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`).
6. Once signed in and with an active subscription, Copilot will be ready to assist you. You'll see its icon :octicons-copilot-16: in the status bar.
---
## Model Context Protocol (MCP)
Model context protocol (MCP) is an open-source standard created by Anthropic, designed to communicate with LLMs and other AI systems.
MCP establishes a common protocol (language) for an AI assistant ("client") to request information or to execute actions from an external service ("server").
MCP actions include reading the contents of files, querying other APIs or databases, writing new files or copying data, or executing commands. the MCP protocol defines the structure of the messages.
MCPs offer a powerful framework for enhancing scientific reproducibility.
- Standardized Data Access
- Containerized Computational environments
- Sharable Workflows
### MCPs for Coding and commands
A foundational MCP tool to use is the `filesystem` which gives the LLM the ability to `read`, `write`, and `execute` code on your computer or a remote server.
- Ask the LLM to create a new file
- Request the AI to refactor code or edit text in a file
- Search through your codebase for relevant functions
- Execute terminal commands
---
## Vibe Coding
Vibe coding refers to using an LLM to generate and edit code directly within your IDE (e.g., VS Code). This approach allows for a more fluid and interactive coding experience, where the LLM acts as a collaborative partner.
!!! warning "Allowing an LLM to execute code on your computer may be a violation of institutional security and privacy policy"
Coding tools like Cline and Windsurf give you the option to allow 'execution' of code on your machine.
You must understand the implications of giving these LLMs the authority to execute code on your computer and the network it is running upon.
!!! danger "Malicious code lives on the internet, and your Vibing LLM might install it while you're not paying attention"
Read more: [📰 Vibe Check: False Packages A New LLM Security Risk](https://hackaday.com/2025/04/12/vibe-check-false-packages-a-new-llm-security-risk/){target=_blank}
## Vibe Coding Platforms
| Emoji | Meaning |
|-------|---------|
| :material-microsoft-visual-studio-code: | VS Code |
| :octicons-codespaces-16: | GitHub CodeSpace |
| :material-apple: | Apple OS |
| :material-microsoft-windows: | Windows |
| :simple-gnubash: | Command Line Interface |
| :material-open-source-initiative: | Open Source |
| :material-license: | Licensed |
| :material-api: | API based |
* [:simple-anthropic: Claude Desktop](https://claude.ai/download){target=_blank} :material-apple: :material-microsoft-windows: :material-api:
An easy-to-install desktop platform that connects to Anthropic's powerful LLM API, and allows you to connect to MCP servers.
* [:material-cursor-default-click: Cursor](https://www.cursor.com/en){target=_blank} :material-microsoft-visual-studio-code: :material-open-source-initiative: :material-license:
A popular standalone fork of VS Code, focused on integrating new models with stability and offering a flat-fee pricing model.
* [:octicons-copilot-16: GitHub Copilot](https://github.com/features/copilot){target=_blank} :material-microsoft-visual-studio-code: :octicons-codespaces-16: :material-license: :material-api:
Integrated with VS Code and GitHub CodeSpaces, provides agentic coding with periodic performance fluctuations and tiered pricing.
* [:material-robot: Cline](https://github.com/cline/cline){target=_blank} :material-microsoft-visual-studio-code: :material-open-source-initiative: :material-api:
Open-source and model-agnostic, pioneering features like “bring your own model” (BYOM) and operating on a per-request billing structure.
* [:material-surfing: Windsurf](https://windsurf.com/editor){target=_blank} :material-microsoft-visual-studio-code: :material-license: :material-api:
Offers similar agentic and inline features with tiered pricing and a “just works” usability orientation.
---
## Quick Reference Card
!!! success "Prompt Engineering Checklist"
- [ ] **Clear objective**: What do you want to achieve?
- [ ] **Context provided**: Background information included?
- [ ] **Role defined**: Who should the AI act as?
- [ ] **Specific action**: Exact task described?
- [ ] **Output format**: Structure specified?
- [ ] **Examples given**: For complex tasks?
- [ ] **Constraints noted**: Length, style, or content limits?
- [ ] **Documents referenced**: If using uploads?
- [ ] **Follow-up planned**: For iterative improvement?
## Assessment Questions
??? question "How do modern AI tools handle uploaded documents?"
!!! success "Answer"
Modern AI tools process uploaded documents by:
- Converting them to text (OCR for images/PDFs)
- Adding them to the context window
- Allowing specific references ("In section 2.3...")
- Enabling cross-document analysis
- Maintaining document structure awareness
??? question "What's the most important element of an effective prompt?"
!!! success "Answer"
**Clarity of instruction** is paramount. The AI needs to understand:
- What you want done (action)
- How you want it done (format)
- Why you want it done (context)
Without clear instructions, even the most advanced AI will produce suboptimal results.
??? question "How can you ensure consistent outputs across multiple sessions?"
!!! success "Answer"
1. **Use custom instructions** (ChatGPT, Claude) or system prompts
2. **Create templates** for common tasks
3. **Save successful prompts** for reuse
4. **Use platform features** like GPTs or Projects
5. **Include examples** in your prompts
6. **Specify exact formats** with templates
??? question "True or False: Longer prompts always produce better results"
!!! failure "False"
Prompt quality matters more than length. A well-structured, concise prompt often outperforms a lengthy, unfocused one. However, providing sufficient context and clear instructions is important. Aim for:
- **Completeness** over brevity
- **Clarity** over complexity
- **Structure** over stream-of-consciousness
## Further Resources
- [:simple-claude: Anthropic's Prompt Engineering Guide](https://docs.anthropic.com/claude/docs/prompt-engineering){target=_blank}
- [:material-robot-outline: OpenAI's Best Practices](https://platform.openai.com/docs/guides/prompt-engineering){target=_blank}
- [:simple-googlegemini: Google's Gemini Prompting Strategies](https://ai.google.dev/gemini-api/docs/prompting-strategies){target=_blank}
- [:simple-github: Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts){target=_blank}
- [Learn Prompting Online Courses](https://learnprompting.org/){target=_blank}
---
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/04_talk_to_llms.md){target=_blank} (last source update 2025-09-22), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/05-version-control/
---
title: "Reproducibility I: Version Control"
description: "Version control with Git and GitHub: repositories, the commit-push-pull cycle, branching, pull requests, and handling large files."
type: Lesson
tags:
- Git
- GitHub
- Version Control
- Reproducibility
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/05_version_control.md"
title: "CyVerse FOSS: docs/05_version_control.md"
author: "team:cyverse"
last_modified: "2025-09-29T14:46:38-07:00"
---
# Reproducibility I: Version Control
!!! success "Learning Objectives"
After this lesson, you should be able to:
* Understand the basics of `git` as a resource for reproducible programming
* Describe tools and approaches to creating your `git` Repositories
* Describe best practices for maintaining GitHub Organizations and Repositories
* Maintain own GitHub user profile and repositories
Version control refers to keeping track of the version of a file, set of
files, or a whole project.
Some version control tools:
- :material-microsoft-office: Microsoft Office's [*Track Changes*](https://support.microsoft.com/en-au/office/track-changes-in-word-197ba630-0f5f-4a8e-9a77-3712475e806a){target=_blank} functionality
- :simple-apple: Apple's [*Time Machine*](https://support.apple.com/en-us/HT201250){target=_blank}
- :simple-googledocs: Google Docs' [*Version History*](https://support.google.com/docs/answer/190843?hl=en&co=GENIE.Platform%3DDesktop){target=_blank}
- :simple-git: [Git](https://git-scm.com/){target=_blank}
Version control is as much a philosophy as a set of tools; you don't
need to master Git to utilize version control (though it is certainly a
worthwhile tool for many researchers).
!!! info "Why Version Control Matters to Open Science"
GitHub is widely used to share code, build websites and documentation, manage workflows or simply allow for your work to be accessible everywhere.
Importantly, **git** is a tool that allows for your code to be accessed by machines which only allow for terminal use, making your code accessibility largely platform agnostic.
Let's recall a few of Open Science's goals: accessibility, reproducibility, collaboration and transparency. Working with GitHub allows for your work to attain all of these points:
- Accessibility: with your work being saved in the GitHub platform, either publically or privately, you're ensuring collaborators can access your work.
- Reproducibility: git saved content allows for accessing your work at different stages thanks to Version Control.
- Collaboration: GitHub is accessible everywhere (with an internet connection).
- Transparency: everything is tracked unless specified in the `.gitignore`, a special file that when populated correctly allows for certain files to be skipped when saving your work.
 We have all been here, taken by the [Software Carpentry Version Control lesson](https://swcarpentry.github.io/git-novice/01-basics.html){target=_blank}.
---
## :simple-git: Git vs. :simple-github: GitHub
**Git** is a command-line program for version control of repositories.
It keeps track of changes you make to files in your repository and
stores those changes in a *.git* folder in that repository.
These changes happen whenever you make a **commit**. Git stores the
history of these commits in a "tree", so you can go back to any
previous commit. By keeping track of the **differences** between
commits, Git can be much more efficient than storing an entire copy of
each version in a document's history.
You could utilize Git completely on its own, on your local computer, and
get a lot of benefits. You will have a history of the changes you made
to a project, allowing you to go back to any old version of your work.
However, where Git really shines is in *collaborative* work. In order to
effectively collaborate with others on a project, you need two basic
features: a way to allow people to work in parallel, and a way to host
repositories somewhere where everyone can access them. The first feature
is **branching**, which is part of Git, and the hosting part can be
taken care of by platforms like GitHub, GitLab, or Bitbucket. We will
focus on GitHub.
GitHub is a site that can remotely host your Git repositories. By
putting your repository onto GitHub, you get a backup of the repository,
a way to collaborate with others, and a lot of other features.
- **Git**:
- First developed in 2005, git is a version control software that allows users to make changes and add versions to their code.
- Changes and versions are saved locally.
- Accessible through the Shell.
- **GitHub**:
- First launched in 2008, its main focus is hosting and sharing code.
- Uses Git version control software.
- Changes and versions are saved online (requires an account).
- Mainly administered through the web (it also has a [desktop app](https://desktop.github.com/){target=_blank}).
- Acquired by Microsoft in 2018.
 Git vs GitHub, simplified
### Definitions
!!! info "Git-related Definitions"
**Platforms**:
- **Git**: tool for version control.
- **GitHub**: hosted server that is also interactive.
**Locations and directions**:
- **repo**: short for repository
- **local**: on your personal computer.
- **remote**: somewhere other than your computer. GitHub can host remote
repositories.
- **upstream**: primary or main branch of original repository.
- **downstream**: branch or fork of repository.
**Actions**:
- **clone**: copy of a repository that lives locally on your computer.
Pushing changes will affect the repository online.
- **pull**: getting latest changes to the repository on your local
computer.
- the **fetch** command does the same, however one needs to also **merge** the changes, whilst with pull, the merge action is automatic.
- **branch**: a history of changes to a repository. You can have parallel
branches with separate histories, allowing you to keep a "main"
version and development versions.
- **fork**: copy of someone else's repository stored locally on your
account. From forks, you can make pull requests to the main branch.
- **commit**: finalize a change.
- **push**: add changes back to the remote repository.
- **merge**: takes changes from a branch or fork and applies them to the
main.
!!! tip "These are also commands when paired with `git`!"
Using the following synthax `git ` one can trigger an action. An example is `git pull`, which will pull all of the latest changes in the remote repository.
**Functional**:
- **pull request**: proposed changes to/within a repository.
- **issue**: suggestions or tasks needed for the repository. Allows you to
track decisions, bugs with the repository, etc.
 Visualizing the commands through a workflow example (graphic's correction: ~~marged~~ merged)
---
## Introducing GitHub
Since we are talking about making science accessible, we invite you to use GitHub to save and share your code. Please start by creating a GitHub account at https://github.com/.
**User Profile**
Just like in any other social media platform, you can create a profile for yourself. This is where you can add a picture, a description of yourself, and a link to your website. You can also add your location, your organization, and your pronouns. You can have a list of your most important repositories and show off your daily contributions. You are able to customize your profile to your liking. Check out [this profile](https://github.com/Gchism94){target=_blank} for fancy example.

**Search**
At the top of most pages, is a search bar. Use this to find repositories, users, and organizations. You can also use it to search for specific code within a repository.

**Starring Repositories**
You can star repositories that you like. This is a way to bookmark repositories that you want to come back to later. You can also use this to show your appreciation for a repository. You can see all of your starred repositories by clicking on your profile picture and then clicking on **Your stars**.

**Creating Your Own Repository**
Repositories are where your code is stored. A suggestion is to have *one* repository for *one* project.
You can create repositories by clicking on the **Repositories** tab, and then clicking **New**.

Here, you can choose the name of your own repository, choose to make it private or public, adding a README and a licence. It is **strongly** recommended that you choose to add an empty README file.

!!! info "So, why a README?"
There are two main reasons why you would like a README file:
1. It adds structure to your repository *automatically* - otherwise you would need to create said structure by yourself (not recommended for beginners).
2. It is the "default" file that GitHub reads upon opening the repository. It can be treated as the go-to file that explains what the repository is for, what each file does, how to cite your reasearch, amongst other things.
!!! info "Adding a Licence"
The addition of a licence can heavily contribute to the shareability of your code. Make sure that whichever licence you choose is in line with your principals as well as your project's. GitHub comes with a list of licences which you can review. It is also common to choose a licence later on!
Ultimately, your new repository should look like the following screenshot. Notice the **LICENCE** document and the **README.md**

!!! info "Editing the README.md (and other text files on GitHub)"
The Github repository file has a **.md** extension which stands for Markdown. Markdown is a lightweight markup language for creating formatted text using a plain-text editor common throughout text files on the web. It uses symbols (*~-#`) for syntaxing text, and it is what GitHub (and this website!) use to format text. Markdown is easier to use than HTML. You can read more on Markdown on the [Markdown Guide](https://www.markdownguide.org/){target=_blank}.
---
## Practical Git Techniques
 The version control path sofware takes before release
!!! info "The basic Git life cycle"
When using Git for your version control, the usual life cycle is the following:
| Action| Explanation |
|---|---|
| 1. `git clone ` | Clones the target repository to your machine |
| 2. `git status` | Checks whether there are changes in the remote, original repository |
| 3. `git pull`| Pulls any change to your local repository |
| 4. `git add ` | Adds to a future commit any change |
| 5. `git commit -m ""` | Creates the commit and adds a descriptive message |
| 6. `git push` | Pushes the changes commited from local to the remote repository |
If there are no branches or external pull requests, the *basic* Git life cycle is summarizable like this:
```mermaid
graph LR
A[1. git clone] --> B[2. git status] -->C([differences from origin?]):::colorclass;
C-->|yes| D[3. git pull]--> E;
C-->|no| E[4. git add];
E-->F[5. git commit] -->G[6. git push];
G-->B;
classDef colorclass fill:#f96
```
After learning the basics of using Git, which you can learn with the
[Software Carpentry Git Lesson](https://swcarpentry.github.io/git-novice/){target=_blank}, there are some next
things that can be useful to learn. Here are a couple topics that are
worth digging into more:
- **:octicons-log-24: Using the Git log**
- You can access using **git log**
- Will show you your commit history
- Useful for figuring out where you need to roll back to
- **:material-keyboard-tab-reverse: Reverting**
- There are a lot of different ways to "undo" something in Git
- Some are safer, some are a bit riskier
- Depends on what stage of the commit process you're in
- **Here are some useful resources**:
- [*10 Common Git Problems and How to Fix Them*](https://www.codementor.io/@citizen428/git-tutorial-10-common-git-problems-and-how-to-fix-them-aajv0katd){target=_blank}
- [*"So you have a mess on your hands..."*](http://justinhileman.info/article/git-pretty/git-pretty.png){target=_blank}
- [*How to undo almost anything*](https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/){target=_blank}
- **:octicons-git-branch-24: Branching**
- This is important to learn if you're going to be doing any sort of collaboration
- Here is a fantastic resource for learning how git branching really works: https://learngitbranching.js.org/
- **you will probably have to deal with *merge conflicts* at some point**
- Merge conflicts happen when two branches are being merged, but they have *different* changes to the same part of a file
- Perhaps you are working on a feature branch, and you change line 61 in *file.R*, but someone else made a change to the main branch at line 61 in *file.R*. When you try to merge the feature and main branches, Git won't know which changes to line 61 in *file.R* are correct, and you will need to manually decide.
- Here are some good resources:
- [Resolving merge conflicts](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line){target=_blank}
- [git - ours & theirs, a CLI resource to help with conflicts](https://nitaym.github.io/ourstheirs/){target=_blank}
- **:simple-gitignoredotio: .gitignore**
- You often want Git to completely ignore certain files
- Generated files (like HTML files from Markdown docs)
- IDE-specific files like in *.RStudio* or *.vscode* folders
- **really big files, like data or images**
- If you accidentally commit a really big file, GitHub might not let you push that commit
- If you have a huge file in Git, your repository size can get way too big
- This is a pain to solve, so use the *.gitignore* file ahead of time, but if you need to fix this, here is a great resource:
- [Removing Large Files From git Using BFG and a Local Repository](https://necromuralist.github.io/posts/removing-large-files-from-git-using-bfg-and-a-local-repository/){target=_blank}
---
## Large Data and GitHub
GitHub allows commited files to be uploaded only if the file is of 100MB or less (with a warning being issued for files between 50MB and 100MB). Additionally, [GitHub recommends to keep repositories below the 1GB threshold](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github#repository-size-limits){target=_blank}, as this also allows for quicker cloning and sharing of the repository. If a large file has been uploaded by mistake and you wish to remove it, [you can follow these instrutctions](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github#removing-files-from-a-repositorys-history){target=_blank}.
If you *do* have to work with large files and Git, here are some questions to ask yourself:
- Is this data shareable?
- Are there alternative file hosting platforms I can use?
- How will this data impact the sharability of this repository?
- Am I using a .gitignore?
GitHub now offers the [**Git Large File Storage (:simple-gitlfs: Git LFS)**](https://git-lfs.com/){target=_blank}: the system works by storing references to the file in your repository, but not the file itself -- it creates a *pointer* file within the repo, and stores the file elsewhere. If you were to clone the repository, the pointer file will act as a map to show you how to obtain the original file.
Git LFS data upload limits are based on your GitHub subscription:
- 2 GB for GitHub free and GitHub Pro
- 4 GB for GitHub Team
- 5 GB for GitHub Enterprise Cloud
 A depiction of how the Git LFS pointer-repository relationship works.
---
## Useful GitHub Features
At its core, GitHub is just a place to host your Git repositories.
However, it offers a lot of functionality that has less to do with Git,
and more to do with **project management**. We will
walk through a few of these useful features.
- [**:octicons-issue-opened-16: Issues**](https://docs.github.com/en/issues){target=_blank}
- Issues let you plan out changes and suggestions to a repo
- Closing/reopening
- Labels
- Assigning
- Templates
- Numbering/mentioning
- [**:material-source-pull: Pull Requests**](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests){target=_blank}
- Pull requests are a way to request merging code from one branch to another
- typical workflow is for someone to fork a repo, then make a PR from that repo to another
- Reviews
- Commenting
- Merging
- Closing issues
- [**:octicons-organization-16: Organizations**](https://docs.github.com/en/organizations){target=_blank}
- You can use Organizations to organize sets of repositories
- Roles
- Teams
- GitHub documentation:
- **Other neat things**
- Permissions/collaborators
- GitHub Classroom
- Gists
- CSV and map rendering
- Code editor
---
## Beyond Git and GitHub
There are other platforms that address Version Control and have similar functionalities to GitHub:
- **[:material-gitlab: GitLab](https://gitlab.com/){target=_blank}**: An alternative to GitHub, GitLab offers both a cloud-hosted platform and a self-hosted option ([GitLab CE/EE](https://about.gitlab.com/install/ce-or-ee/){target=_blank}). It provides a comprehensive DevOps platform with built-in CI/CD, container registry, and more.
- **[:simple-bitbucket: Bitbucket](https://bitbucket.org/product/){target=_blank}**: Atlassian's Bitbucket is a Git repository hosting service that also supports Mercurial repositories. It offers integration with Jira, Confluence, and other Atlassian products.
- **[:simple-sourceforge: SourceForge](https://sourceforge.net/){target=_blank}**: A platform that provides Git and Subversion hosting, as well as tools for project management, issue tracking, and collaboration.
- **[:fontawesome-brands-aws: AWS CodeCommit](https://aws.amazon.com/codecommit/){target=_blank}**: Part of Amazon Web Services (AWS), CodeCommit is a managed Git service that integrates seamlessly with other AWS services.
- **[:material-microsoft-azure-devops: Azure DevOps Services (formerly VSTS)](https://azure.microsoft.com/en-us/products/devops){target=_blank}**: Microsoft's Azure DevOps Services offers Git repository hosting along with a wide range of DevOps tools for planning, developing, testing, and deploying software.
- **[:simple-mercurial: Mercurial](https://www.mercurial-scm.org/){target=_blank}**: Like Git, Mercurial is a distributed version control system, but with a different branching and merging model. It's an alternative to Git for version control.
---
## Adding Code to GitHub via Command Line
??? warning "Prerequisite: a GitHub account"
Navigate to the [GitHub website](https://github.com/){target=_blank} and click *Sign Up*, and follow the on screen instructions.
Through this exercise, users will learn to make changes using the command line. To remove potential issues with SSH and Tokens, we are going to carry out this exercise using :octicons-codespaces-16: **CodeSpaces**. To launch one, open your repository on GitHub, click the green **Code** button, and select **Create codespace on main** (see the [GitHub Codespaces quickstart](https://docs.github.com/en/codespaces/getting-started/quickstart){target=_blank}). A CyVerse CloudShell, described in [How to Talk to Computers](https://unm-carc.github.io/foss/lessons/03-talk-to-computers/#accessing-a-linux-shell-on-cyverse), works too.
??? warning "Adding Code Locally Using Your Machine"
This exercise can be carried out locally, on your machine. Here are the requisites and steps required to clone the repository and push changes back to GitHub.
!!! warning "Prerequisites"
??? info "Installing Git"
You can follow the official guidelines here: https://github.com/git-guides/install-git. Here we recommend how to install Git on your local machine.
??? info "Windows"
!!! warning "These instructions are for Windows users **NOT** using [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install){target=_blank}. If you do have WSL2, follow the **Unix** instructions."
1. Navigate to the [latest Git for Windows installer](https://gitforwindows.org/){target=_blank} and download the latest version.
2. Once the installer has started, follow the instructions as provided in the Git Setup wizard screen until the installation is complete.
3. Search and open **Git Bash**. From here, you should be able to run Git commands.
??? info "MacOS"
1. Install [Homebrew](https://brew.sh/){target=_blank} (a package manager for MacOS): `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
2. Install Git: `brew install git`
??? info "Unix"
The following command will install git and all related packages on your Unix machine.
```
$ sudo apt-get install -y git-all
```
You then need to choose between generating a **Personal Access Token** or using **SSH keys**. This is useful if you want to work locally and push your changes to GitHub.
??? info "Choice A: Generate a Personal Access Token"
You can follow the official documentation on how to generate Tokens [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens){target=_blank}. Following are quick steps you can follow in order to setup your account on your machine using tokens:
1. On your coumputer:
1. Clone your repository (`git clone `)
2. Make changes where necessary, and **add** (`git add `), **commit** (`git commit -m ""`) and **push** your changes (`git push origin`).
3. You should be prompted to logging in your GitHub account. Put your email **but not your password**. Instead, open your web browser and follow the steps below:
2. On GitHub:
1. Navigate to your GitHub Settings (You can access your account Settings from the drop down menu where your account icon is, on the top right of the screen)
2. Scroll to the bottom of the left hand side menu to find *Developer settings* and open it.
3. Click *Personal access tokens* > *Tokens (classic)*
4. Click *Generate new token* > *Generate new token (classic)*. You might need to input your Authentification code if you have enabled 2FA.
5. Give it a name, and all the scopes you require (tip: select all scopes and *No Expiration*), then click *Generate Token*. **Copy the new generated Token**
3. Back on your computer:
1. If you have been following the steps above, you should still be in your shell with GitHub still asking for your password.
2. **Paste** your Token here, and you should be logging in. Your changes should then be saved to GitHub.
??? info "Choice B: Connecting via SSH"
The process of connecting your computer to GitHub using an SSH key is more expedited (and probably less confusing).
As a setup step, see if your computer is already connected to GitHub by doing `ssh -T git@github.com`. If the response message is `git@github.com: Permission denied (publickey).` it signifies that your computer is not yet linked with GitHub. To link your computer to github to the following:
1. Generate an SSH key with a level of encryption that you prefer: `ssh-keygen -t ed25519 -C `. This command generates an SSH key with [ed25519](https://ed25519.cr.yp.to/){target=_blank} encryption (harder to crack!) and adds your email as "comment" (`-C`, will help recongizing the user adding the key). A number of additional questions are going to ask you where you'd like to save the key and whether you'd like to add a password for protection; unless you want to save it elsewhere, feel free to use the default options. Upon completion you should see something like this:
```
Your identification has been saved in /c/Users//.ssh/id_ed25519
Your public key has been saved in /c/Users//.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:SMSPIStNyA00KPxuYu94KpZgRAYjgt9g4BA4kFy3g1o
The key's randomart image is:
+--[ED25519 256]--+
|^B== o. |
|%*=.*.+ |
|+=.E =.+ |
| .=.+.o.. |
|.... . S |
|.+ o |
|+ = |
|.o.o |
|oo+. |
+----[SHA256]-----+
```
2. Upon generating the ssh key, copy it. You can reveal it by doing `cat ~/.ssh/id_ed25519.pub`.
3. In GitHub, go to your settings: click your account icon on top right, and from the drop down menu, select *Settings* and then *SSH and GPG keys*. Here, click on *New SSH Key*, where you can then paste the newly geneated key. Add a name reflecting your machine and save changes.
Optional: if you want to check if you successfully linked your computer to GitHub, do `ssh -T git@github.com`. You should receive the following message: `Hi ! You've successfully authenticated, but GitHub does not provide shell access.
Adding code locally is a more complex than adding code through the web page, but it allows for better control on what files you commit.
- To add or modify code locally, you need to **clone** the repository on your computer.
- You can then clone the repository by clicking on the **Code** button, and copying the link shown

- On your machine, open a terminal window and type the following command:
```
$ git clone # Replace with the link you copied such as below
$ git clone https://github.com/CosiMichele/FOSSF24-tutorial.git
Cloning into 'FOSSF24-tutorial_tutorial'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 13 (delta 5), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (13/13), 14.47 KiB | 90.00 KiB/s, done.
```
- Your code is now available to you on your machine, and you can add and modify files as needed.
!!! info "When using CodeSpaces, there is no need to clone your repository (steps for cloning are reported in the admonition above)."
You can now modify or add files locally. However you will still have to push changes to the repository. Prior to doing so there are a couple of steps you should do:
- `git status`: it checkes on the status of the repository (files that have been modified, deleted, added - from either local or in the online repository)
- `git pull`: it checks and "pulls" changes from the online repository to your local repository. It ensures that you are always updated on the repository files *and* it can save a lot of time in case there are clashing commits from different users.
To do so:
- **Add** all fiels you have modified and want to commit:
```
$ git add . # Recall that "." (period) stands for all files in a folder
```
- **Commit** the changes. When committing changes, you have to add a message (in quotation marks) with the `-m` flag. This message is a concise and descriptive few words about what you did:
```
$ git commit -m "locally added and modified files"
[main 05f0ef6] locally added and modified files
2 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 file_from_local.md
```
- push your changes with **push**:
```
$ git push
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 12 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 585 bytes | 32.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/CosiMichele/FOSSF24-tutorial.git
b649de3..05f0ef6 main -> main
```
You can now see the changes you made locally on the GitHub repository page.

## Branching
Branching allows you to develop your code whilst in a contained environment separate from your **main** environment. You can view the list and number of branches on the top of your repository.

!!! info "Why working on branches?"
Branches allow you to add/remove/change exisiting code independently from your main branch. This code can include alphas, betas and different versions of your code. Branches can be used to develop documentation or include different functionalitiets focused on Operating Systems and/or clusters and job schedulers. If needed, you can add these codes to your main branch later using [**pull requests**](#pull-requests).
To create a new branch select the :octicons-git-branch-16: branch icon (listing the number of branches). This will open the branch page, which will list all of the branches in this repository.

Select **New Branch** on the top right. Give the new branch a name of your choice, select the source of code (in this case the only source of code can be the main branch) and select **Create branch**.

You can now see the updated list of all your branches.

You can now use this new branch to create changes you are not yet ready to put in your main branch.
!!! warning "Want to delete a branch?"
You can delete a branch from the branch web page by clicking on the :octicons-trash-16: trash can icon. **Beware!** All the changes you've made on that branch will be deleted!
!!! info "Working on your machine?"
Once you create a branch online, you can change to the desired branch on your machine with `git switch `. Don't forget to push your changes first!
!!! tip "Pull and Tab"
- Don't forget to perform a `git pull`!
- Don't know your branches? Tab! When typing `git switch`, press tab to see the options of all the branches you've created.
## Pull Requests
Pull requests (PR) are proposed changes you can make on a repository. In this specific case, pull requests can be used to merge changes from a branch to another. Pull requests can also come from **forks** of your repository that another user or collaborator has made.
Assuming you have made changes in your branch (added a file, for example), a pop up will notify you that a branch has pushed some changes. In case you want to merge the branch and the main repository, you can review and merge by clicking the **Compare & pull request** button. However, you may want to wait until more changes are made.

Once you are ready to merge the changes onto your main branch, click on the :octicons-git-branch-16: branch icon, and select **New pull request** from the branch you have just made changes. This will open a new page which will list all the changes made showing all files that have been modified, added, or deleted. When you're done reviewing your changes, click **Create pull request**.

!!! info "Pay attention to the information on the PR page!"
The PR page will not only show you what changes you've made, but also where the changes are coming from (which branch), as well as reviewers, assigneers, labels and other information necessary when working on a big project. It will also show whether the changes are **Able** to be merged (:material-check:) or not (:octicons-x-16:)!
Upon createing the pull request, a new page will open which will test whether the changes can be merged automatically. Changes that are not able to be merged usually clash with other changes other collaborators have made - this will require your revision prior to merging the PR! After revision, select **Merge pull request** and **Confirm merge**.

Your main repository should now have the files created in your other branch and merged through the PR!

---
!!! tip "What about AI and Version Control?"
Although not directly connected, chatbots like ChatGPT can be extremely hepful with git based work.
For example, it isn't unlikely that you may have forgotten to **`git pull`** your changes before you make some more development, at which point you try to **`git push`** your work, which will likely result in failure and git suggesting *rebasing*. LLMs can do quick work to explain what rebasing is, and how to follow up if this issue happens or persists.
Additionally, LLMs can be used to quickly create documentation, add comments to your code and suggestions to improve your repository.
As Codespace is readily available, VSCode will allow you to use the free version of :octicons-copilot-16: CoPilot directly on the Codespace you create.
Similar to how you may be using LLMs as an assistant for your work, you can use these platforms to help with git/GitHub related work.
---
## Self Assessment
??? question "True or False: Using `Git` requires a GitHub account"
!!! failure "False"
`Git` is open source software.
GitHub is a privately owned (Microsoft) company
Other platforms like [GitLab](https://gitlab.com){target=_blank}, [GitBucket](https://gitbucket.github.io/){target=_blank}, and [GNU Savannah](https://savannah.gnu.org/){target=_blank} all offer `Git` as a version control system service.
??? question "True or False: Using `Git` is easy"
!!! failure "False"
Using `Git` can be frustrating to even the most experienced users
??? question "When you find a new repository on GitHub that you think can help your research, what are the first things you should do?"
!!! success "Look at the README.md"
Most GitHub repositories have a README.md file which explains what you're looking at.
!!! success "Look at the LICENSE"
Not all repositories are licensed the same way - be sure to check the LICENSE file to see whether the software is open source, or if it has specific requirements for reuse.
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/05_version_control.md){target=_blank} (last source update 2025-09-29), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/06-software-environments/
---
title: "Reproducibility II: Software Environments"
description: "Computing environments, the system PATH, and using Conda, pip, and renv to create, share, and reproduce software environments."
type: Lesson
tags:
- Conda
- Environments
- Package Managers
- Reproducibility
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/06_soft_env.md"
title: "CyVerse FOSS: docs/06_soft_env.md"
author: "team:cyverse"
last_modified: "2025-08-26T15:58:14-07:00"
---
# Reproducibility II: Software Environments
!!! success "Learning Objectives"
After this lesson, you should be able to:
* Understand the value of reproducible computing
* Know the challenges of reproducible computing
* Define a computing environment
* Share a software environment with a colleague
* Set up a software project with an environment
## Reproducible Scientific Computing
!!! quote "Defining Reproducibility"
"Reproducing the result of a computation means running the same software on the same input data and obtaining the same results." Rougier et al. 2016
"Getting someone else's code to run on my computer" - Anonymous
### Interactive (ie, point-and-click) Computing
{ width="150" }
!!! quote "Definition"
Manually navigating a mouse across a graphical user interface (GUI) and running commands by selecting from menu options.
#### Advantages
- Intuitive and easy to navigate a GUI and click buttons
#### Limitations
- It can be slow to sequence through hundreds of clicks to accomplish an analysis.
- Less reproducible - Cumbersome to write and follow a click-by-click tutorial
### Scripted Computing
{ width="400" }
!!! quote "Definition"
Removing the GUI and instead instructing the computer to run a series of custom commands using a scripting/coding language.
We are **automating** what used to take many manual clicks.
We can write scripts to install software, clean data, run analyses, and generate figures.
#### Advantages
- Much faster to run through commands
- The script runs identically every time, reducing the human element
- Easy for someone else to quickly reproduce the exact analysis and result
- Enables analysis tasks to scale up
#### Challenges
- Requires deeper computer knowledge
- More upfront effort to produce the script
!!! question "Discussion Question"
**What are some tasks you have automated or want to automate?**
- Have you ever successfully automated a task?
- Found a way to make something scale or take less time?
- What was the task, and how did you do it?
- Are there any things you wish you could automate?
- What are some barriers to automating them?
## Scripting Languages
The most common open-source scripting languages (for science) are Python, R, and shell (Bash).
 
If you recall from [lesson 3 _How to Talk to Computers_](https://unm-carc.github.io/foss/lessons/03-talk-to-computers/#shell-script), we ran a shell script to back up and compress files. The following admonitions show the original shell script as well as the same instructions in Python and R. Scripting languages are simply different ways to instruct a computer.
??? tip "Shell Script"
```
#use Bash shell to run the following commands
#!/bin/bash
## Variables
#the directory you want to back up (e.g., shell-lesson-data)
SOURCE_DIR=$(find / -type d -name "shell-lesson-data" 2>/dev/null) # Note: if you are working on your computer, this will look in every folder. Be careful with this line!
#location where the backup will be stored
BACKUP_DIR="$HOME/Backup"
#used to create a unique name for each backup based on the current date and time
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
# name of the compressed backup file
ARCHIVE_NAME="backup_$TIMESTAMP.tar.gz"
# Create backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Create a compressed archive of the source directory
tar -czf "$BACKUP_DIR/$ARCHIVE_NAME" -C "$SOURCE_DIR" .
# Output the result
echo "Backup of $SOURCE_DIR completed!"
echo "Archive created at $BACKUP_DIR/$ARCHIVE_NAME"
```
??? tip "Python"
```
import os
import subprocess
import shutil
from datetime import datetime
# Variables
# Find the source directory (e.g., shell-lesson-data)
def find_source_dir():
try:
# Run the 'find' command to locate the directory
result = subprocess.run(['find', '/', '-type', 'd', '-name', 'shell-lesson-data'],
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
source_dir = result.stdout.strip()
return source_dir
except Exception as e:
print(f"Error finding directory: {e}")
return None
# Set the backup directory to a folder called Backup in the home directory
backup_dir = os.path.join(os.path.expanduser("~"), "Backup")
# Create a unique timestamp for the backup
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
# Create the archive name with the timestamp
archive_name = f"backup_{timestamp}.tar.gz"
# Ensure backup directory exists
os.makedirs(backup_dir, exist_ok=True)
# Find source directory
source_dir = find_source_dir()
if source_dir:
# Create the compressed archive using tar
archive_path = os.path.join(backup_dir, archive_name)
try:
subprocess.run(['tar', '-czf', archive_path, '-C', source_dir, '.'], check=True)
print(f"Backup of {source_dir} completed!")
print(f"Archive created at {archive_path}")
except subprocess.CalledProcessError as e:
print(f"Error creating archive: {e}")
else:
print("Source directory not found!")
```
??? tip "R"
```
# Load necessary libraries
library(lubridate)
# Variables
# Function to find the source directory (e.g., shell-lesson-data)
find_source_dir <- function() {
result <- system("find / -type d -name 'shell-lesson-data' 2>/dev/null", intern = TRUE)
if (length(result) > 0) {
return(result[1]) # Return the first match, if any
} else {
return(NULL)
}
}
# Backup directory
backup_dir <- file.path(Sys.getenv("HOME"), "Backup")
# Create a unique timestamp for the backup
timestamp <- format(now(), "%Y-%m-%d_%H-%M-%S")
# Name of the compressed archive
archive_name <- paste0("backup_", timestamp, ".tar.gz")
# Ensure backup directory exists
if (!dir.exists(backup_dir)) {
dir.create(backup_dir, recursive = TRUE)
}
# Find the source directory
source_dir <- find_source_dir()
if (!is.null(source_dir)) {
# Create the compressed archive using tar
archive_path <- file.path(backup_dir, archive_name)
tar_command <- paste("tar -czf", shQuote(archive_path), "-C", shQuote(source_dir), ".")
# Run the tar command
system(tar_command)
cat("Backup of", source_dir, "completed!\n")
cat("Archive created at", archive_path, "\n")
} else {
cat("Source directory not found!\n")
}
```
Each language consist of base software (Python Standard Library or R Base Package) and MANY additional packages that can be downloaded and installed for increased capabilities.
## Computing Environment
A computing environment is the combination of hardware, software, and network resources that provide the infrastructure for computing operations and user interactions.
- **Hardware**: CPUs, GPUs, RAM
- **Operating system & version**: many flavors of Linux, MacOS, Windows
- **Software versions:** R, Python, etc.
- **Package versions:** specific R or Python packages, which often depend on other packages
{ width="400" } Python Package Dependency
!!! warning "**!!Very Important!!**"
#### The scripts you create:
* Were designed to work in _your_ specific computing environment
* May not work on someone else's computer because their computing environment is different
* May not work on your computer in the future, because your computing enviroment will probably change (eg., updated software versions)
### Software Dependency Hell
Sometimes, it can be _nearly impossible_ to get your computing environment correct enough to run someone else's code.
This can be caused by incorrect software versions of the packages you are using or their dependencies.
_Don't Dispair! There are solutions to avoid software dependency hell and ensure reproducibility from one computer to another_
## Software Installation
When you download and install software onto your computer, it will typically install it in a set of specific directories that we call the **System Path**.
### System Path
In the context of computing, the **system path**, often referred to simply as **PATH**, is the set of directories in which the operating system looks for executable files when a command is issued.
When you go to launch an application by clicking on a desktop icon or with a CLI command, the computer will search for the application within the PATH directories. If it finds the executable, it will launch.
!!! tip "Find the PATH on your computer"
In Linux and Mac Terminal
`echo $PATH`
In Windows Terminal
`$env:PATH`
Nice and Short Video Describing the PATH.
!!! warning "The PATH prefers one version of any given software."
## Environment Managers
One solution to software dependency hell is to use an Environment Manager
An environment manager allows you to create software installation directories (similar to PATH) that are **isolated** from your computer's PATH. You can create unique environments and install specific software version to run specific scripts.
### :simple-anaconda: Conda - Open Source Environment Manager
[Conda](https://docs.conda.io/en/latest/){target=_blank} is a popular and open source environment manager tool that can be installed on any operating system (Windows, MacOS, Linux).
* Users can create environments that have their own set of packages, dependencies, and even their own version of Python.
* Projects can have their own specific requirements without interfering with each other
* It allows for consistent and reproducible results across different systems and setups
{ width="450" } Conceptual Graphic 1{ width="400" } Conceptual Graphic 2
### :simple-r: [Renv](https://rstudio.github.io/renv/articles/renv.html){target=_blank}
* R package that allows you to create unique environments for an R project
## Sharing your Environment with Colleagues
Whether you are using Conda, Pip, or Renv, you should be able to share the specifications of your software environment so colleagues can reproduce the environment.
The general sharing workflow:
1. Output an _environment file_ that lists the software and versions of the environment
2. Share the file with colleagues through a platform like Github
3. Colleagues create an empty environment on their computer and populate it with the contents of the _environment file_
??? tip ":simple-anaconda: Conda to Share Environment"
### :simple-anaconda: [Conda](https://docs.conda.io/en/latest/){target=_blank}
1. Export your Conda Environment
```
conda env export > my_conda_env.yml
```
2. Share the .yml file through Github
3. Reproduce the Environment on a Different Computer
```
conda env create --file environment.yml
```
!!! success "Conda exports your Pip environment as well"
Exporting your environment using Conda (`conda env export > my_conda_env.yml`) will **ALSO** export your pip environment!
??? tip ":simple-python: Pip to Share Environment"
### :simple-python: Python
1. Export python libraries present in your environment
```
pip3 freeze > requirements.txt
```
2. Share the `requirements.txt` on Github
3. Reproduce the Environment on a Different Computer
```
pip install -r requirements.txt
```
??? tip ":simple-r: Renv to Share Environment"
### :simple-r: [Renv](https://rstudio.github.io/renv/articles/renv.html){target=_blank}
1. Create an isolated environment
```
renv::init()
```
2. Export R packages to the renv.lock file
```
renv:snapshot()
```
3. Share the `renv.lock`, `.Rprofile`, `renv/settings.json` and `renv/activate.R` files to Github
4. Reproduce the Environment on a Different Computer
```
renv::restore()
```
## Package Managers
A software tool to find, download, and install software packages to PATH or virtual environment
??? tip ":simple-anaconda: Conda"
### :simple-anaconda: [Conda](https://docs.conda.io/en/latest/){target=_blank}
**Software:** Python, R, Django, Celery, PostgreSQL, nginx, Node.js, Java programs, C and C++, Perl, and command line tools
**Repository:** [Conda-Forge](https://conda-forge.org/){target=_blank}.
??? tip ":simple-python: Pip"
### :simple-python: [Pip](https://pypi.org/project/pip/){target=_blank}
**Software:** python
**Repository:** [PyPi](https://pypi.org/){target=_blank}
**Note:** Pip can be used together with Conda environment manager.
??? tip ":simple-r: R"
### :simple-r: R
With the R language, a package manager is built directly into the R Base Package.
```
install.packages('ggplot2')
```
**Repository:** [R Comprehensive R Archive Network (CRAN)](https://cran.r-project.org/){target=_blank}
---
## Reproducibility Tutorial Using Conda
### Set Up
!!! note "OS of choice"
To get everyone on the same page, we will do this exercise together using the Linux terminal in Github Codespaces.
However, if you'd like to use your own computer feel free to! If you're on Mac or Linux, open your terminal; If you're on Windows, please use the Windows Subsystem for Linux (WSL) so you can follow along.
??? tip "How to Scroll in Cyverse (Tmux) Cloud Shell"
If you're using the Cyverse Cloud Shell, you can scroll up and down by pressing `Ctrl + b` and then `[` to enter scroll mode. You can then use the arrow keys to scroll up and down. Press `q` to exit scroll mode.
!!! note "The CLI in CyVerse is controlled with [Tmux](https://en.wikipedia.org/wiki/Tmux){target=_blank}, a software that allows to "window" the CLI; Here is a [cheat sheet](https://tmuxcheatsheet.com/){target=_blank} that will teach you more Tmux tricks!"
### Launch Github Codespaces
**1** Go to this [Github repository](https://github.com/cyverse-learning-materials/foss_conda_lesson){target=_blank} and Fork it (i.e., make a copy of it in your Github account).
{ width="550" }
**2** Click on the green "Code" button and select "Create Codespaces on main"
{ width="550" }
**3** After a few moments, you will be taken to a new browser window with a Linux terminal.
{ width="550" }
### Installing Conda
**If you are using Codespaces, Conda is already installed.**
When you download and install Conda it comes in two different flavors:
[Miniconda](https://docs.anaconda.com/free/miniconda/){target=_blank} - lightweight (500 mb) program that includes *Conda*, the environment and package manager, as well as a recent version of the Standard Python Library.
[Anaconda](https://anaconda.org/){target=_blank} - a larger (2.5GB) program that includes *Conda* and many more python libraries pre-installed (in Conda base environment), as well as graphical user interface, acccess to jupyter notebooks, and support for easily integrating the R language.
 Conda, Miniconda, and Anaconda. [Taken from *Getting Started with Conda, Medium*](https://medium.com/hydroinformatics/getting-started-with-conda-environment-332182d1e937){target=_blank}.
??? tip "Installing Conda"
For the appropriate installation package, visit https://docs.conda.io/en/latest/miniconda.html. ⚠️ Note: **If you are using the WSL, install the Linux version!!**
```
# Download conda and add right permissions
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # Modify this to match the OS you're using.
chmod +x Miniconda3-latest-Linux-x86_64.sh
# install conda silenty (-b) and update (-u) and initial conda run
./Miniconda3-latest-Linux-x86_64.sh -b -u
~/miniconda3/bin/conda init
# Restart bash so that conda is activated
source ~/.bashrc
```
You'll be able to tell when conda is active when next `(base)` is present next to the to the shell prompt such as
```
(base) user@machine
```
Conda should now be installed and can be used to install other necessary packages!
??? tip "Tip: slow Conda? Try Mamba."
Conda is known to take time processing some software installation. A solution is to use [Mamba](https://github.com/mamba-org/mamba){target=_blank}, a reimplementation of Conda in C++ for quicker queries and installations. Mamba is then invoked by using `mamba` instead of `conda` (whilst keeping options and the rest of the command synthax the same).
The quickest way to install mamba is with `conda install -c conda-forge mamba`, or follow the official installation documentation [here](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html){target=_blank}.
!!! tip "UNM CARC users"
On CARC clusters you do not need to install Conda yourself: load the
`miniconda3` module and create your environments from there. See
[Introduction to conda on CARC](https://carc.unm.edu/docs/software/conda-intro/){target=_blank}
for the details.
### Environment Management with Conda
When you start a Codespaces terminal, the prompt will look something like this:
```
@jeffgillan ➜ /workspaces/foss_conda_lesson (main) $
```
Type the following command to see the current conda environment.
```
conda info
```
Initialize conda by running the following commands.
```
conda init
exec $SHELL
```
View the list of conda environments. There should only be one environment called `base`.
```
conda env list
```
View the software installed in the base directory. Notice the version of Python.
```
conda list
```
Create our own custom environment (type `y` when prompted).
```
conda create --name myenv
```
Activate your new environment with
```
conda activate myenv
```
You will notice that the prompt changed to `(myenv)`
View the software that is installed in your new custom environment. It should be empty!
```
conda list
```
### Package management with Conda
Within your new custom environment (ie, myenv) download and install a specific version of python. This may take a few minutes to complete.
```
conda install python=3.9
```
View the new software that has been installed. Notice the version of Python is now 3.9. while the base is 3.12
```
conda list
```
Install Salmon (genomics software) using Conda
```
conda install -c bioconda salmon
```
!!! info "Conda channels"
Conda operates through **channels**, specififc repositories where packages are stored. Specific packages sometimes may appear in multiple channels, however it is always helpful to specify a channel with the `-c` flag.
### Share and Reproduce a Conda Environment
Export all of the software in your custom environment to a file
```
conda env export --no-builds > myenv.yml
```
Let's view the contents of the .yml file. It should contain all the software you installed in the environment. This `myenv.yml` file can be shared with a colleague so they can reproduce the same environment on their computer.
```
nano myenv.yml
```
Reproduce someone else's environment with `mandelbrot.yml` environment file located in the repository.
```
conda env create --file mandelbrot.yml
```
Activate the environment to use the software installed in the environment.
```
conda activate mandelbrot
```
Look at the software installed in the environment.
```
conda list
```
Run a python script that generates a Mandelbrot set
```
python3 mandelbrot.py
```
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/06_soft_env.md){target=_blank} (last source update 2025-08-26), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/07-containers/
---
title: "Reproducibility III: Containers"
description: "Why containers matter for reproducible research, core Docker commands, running an example container, and writing, building, and pushing a Dockerfile."
type: Lesson
tags:
- Docker
- Containers
- Reproducibility
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/07_containers.md"
title: "CyVerse FOSS: docs/07_containers.md"
author: "team:cyverse"
last_modified: "2025-10-14T10:43:02-07:00"
---
# Reproducibility III: Containers
!!! success "Learning Objectives"
After this lesson, you should be able to:
- Explain what containers are used for in reproducible research contexts
- Search for and run a Docker container locally or on a remote system
- Understand how version control and data can be used inside a container
- Understand the Dockerfile structure and fields
- Build, execute and push your own Docker image
## Reproducible Computer Code
Sharing your scientific analysis code with your colleagues is an essential pillar of Open Science that will help push your field forward.
There are, however, technical challenges that may prevent your colleagues from effectively running your code on their computers. In the previous lesson [Reproducibility II](https://unm-carc.github.io/foss/lessons/06-software-environments/) we described how [computing environments](https://unm-carc.github.io/foss/lessons/06-software-environments/#computing-environment) can lead the way of reproducibility by creating a "recipe" for replicating a computing environment.
There is another method to overcoming the replicability obstacle. Instead of recreating a computing environment, **why not package up the code _and_ all of the software and send it to your colleague?**
## What *are* containers?
A [container](https://www.docker.com/resources/what-container/){target=_blank} is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another
- Container images are a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings
- Each of these elements are specifically versioned and do not change
- The recipient does not need to *install* the software in the traditional sense
A useful analogy is to think of software containers as shipping containers. It allows us move cargo (software) around the world in standard way. The shipping container can be offloading and executed anywhere, as long the destination has a shipping port (i.e., Docker)
{ width="500" } Software Shipping Containers
Containers are similar to virtual machines (VMs), but are smaller and easier to share. A big distinction between Containers and VMs is what is within each environment: VMs require the OS to be present within the image, whilst containers rely on the host OS and the container engine (e.g., Docker Engine).
 Difference between Virtual Machines and Containers. Containers are a lot more portable as these do not require an OS to be bundled with the software. Figure source: [Microsoft Cloudblogs](https://cloudblogs.microsoft.com/opensource/2019/07/15/how-to-get-started-containers-docker-kubernetes/){target=_blank}.
## Containers for Reproducible Science
Software containers, such as those managed by Docker or Apptainer (formerly Singularity), are incredibly useful for reproducible science for several reasons:
#### Environment Consistency:
Containers encapsulate the software environment, ensuring that the same versions of software, libraries, and dependencies are used every time, reducing the "it works on my machine" problem.
- **Ease of Sharing**:
- Containers can be easily shared with other researchers, allowing them to replicate the exact software environment used in a study.
- **Platform Independence**:
- Containers can run on different operating systems and cloud platforms, allowing for consistency across different hardware and infrastructure.
- **Version Control**:
- Containers can be versioned, making it easy to keep track of changes in the software environment over time.
- **Scalability**:
- Containers can be easily scaled and deployed on cloud infrastructure, allowing for reproducible science at scale.
- **Isolation**:
- Containers isolate the software environment from the host system, reducing the risk of conflicts with other software and ensuring a clean and controlled environment.
The most common container software is [:material-docker: Docker](https://www.docker.com/){target=_blank}, which is a platform for developers and sysadmins to develop, deploy, and run applications with containers. [Apptainer](https://apptainer.org/docs/user/main/){target=_blank} (formerly, Singularity), is another popular container engine, which allows you to deploy containers on HPC clusters.
!!! tip "UNM CARC users"
CARC clusters run containers with Singularity/Apptainer rather than
Docker. Build and push your image with Docker (on your own computer or in
Codespaces), then pull and run it on CARC. See
[Singularity on CARC](https://carc.unm.edu/docs/software/singularity/){target=_blank},
which also shows how to find the available versions with
`module avail singularity`.
[DockerHub](https://hub.docker.com/){target=_blank} is the world's largest respository of container images. Think of it as the 'Github' of container images. It facilitates collaboration amongst developers and allows you to share your container images with the world. Dockerhub allows users to maintain different versions of container images.
!!! warning "While Docker allows you to quickly run software from other people, it may not work across every platform.
There are different CPU architectures (`arm`, `amd64`, `x64`, `x86`) deployed across cloud, computer workstations, laptops, and cellular phones. Docker containers and their software can be cross-compiled across architectures, but this must be done by the creators."
## Introduction to :material-docker: Docker

There are no specific skills needed for this tutorial beyond elementary command line ability and using a text editor.
We are going to be using [:material-github: GitHub CodeSpaces](https://github.com/features/codespaces){target=_blank} for the hands on portion of the workshop, which features [:material-microsoft-visual-studio-code: VS Code](https://code.visualstudio.com/){target=_blank} as a fully enabled development environment with Docker already installed.
Our instructions on starting a new CodeSpace are [here](https://unm-carc.github.io/container-camp/cloud/codespaces/){target=_blank}.
??? info "Installing Docker on your personal computer"
We are going to be using virtual machines on the cloud for this course, and we will explain why this is a good thing, but there may be a time when you want to run Docker on your own computer.
Installing Docker takes a little time but it is reasonably straight forward and it is a one-time setup.
Installation instructions from Docker Official Docs for common OS and chip architectures:
- [:fontawesome-brands-apple: Mac OS X](https://docs.docker.com/docker-for-mac/){target=_blank}
- [:fontawesome-brands-windows: Windows](https://docs.docker.com/docker-for-windows){target=_blank}
- [:fontawesome-brands-ubuntu: Ubuntu Linux](https://docs.docker.com/install/linux/docker-ce/ubuntu/){target=_blank}
## General Workflow

The container's life cycle. Figure source: [Tutorialspoint](https://www.tutorialspoint.com/docker/index.htm){target=_blank}.
### Images vs Containers
|| Image | Container |
|:---:|---|---|
| **What** | A snapshot of an application containing code, libraries, dependencides and files needed for the application to run | A runtime instance of the Docker image |
| **When** | Created through a Dockerfile | Runtime executed after Image is created |
| **Why** | Reproducibility and consistency! | Reproducibility and consistency! |
| **Where** | Stored in an online registry (e.g., [Docker Hub](https://hub.docker.com/){target=_blank}) | Executed on your machine |
---
## Fundamental Docker Commands :octicons-terminal-16:
Docker commands in the terminal use the prefix `docker`.
!!! note "For every command listed, the correct execution of the commands through the command line is by using `docker` in front of the command: for example `docker help` or `docker search`. Thus, every :material-docker: = `docker`."
!!! warning "To follow along, please start a Codespace in the following repository: **https://github.com/jeffgillan/r-script-containerized**. We are going to be using this repository throughout today, to learn docker commands, run docker containers and building our own container."
### :material-docker: help
Like many other command line applications the most helpful flag is the `help` command which can be used with the Management Commands:
```
$ docker
$ docker --help
```
### :material-docker: search
We talk about the concept of [Docker Registries](https://unm-carc.github.io/container-camp/docker/registry/){target=_blank} in the next section, but you can search the public list of registeries by using the `docker search` command to find public containers on the Official [Docker Hub Registry](https://hub.docker.com){target=_blank}:
```
$ docker search
```
### :material-docker: pull
Go to the [Docker Hub](https://hub.docker.com){target=_blank} and type `hello-world` in the search bar at the top of the page.
Click on the 'tag' tab to see all the available 'hello-world' images.
Click the 'copy' icon at the right to copy the `docker pull` command, or type it into your terminal:
```
$ docker pull hello-world
```
!!! note
If you leave off the `:` and the tag name, it will by default pull the `latest` image
```
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:bfea6278a0a267fad2634554f4f0c6f31981eea41c553fdf5a83e95a41d40c38
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest
```
Now try to list the files in your current working directory:
```
$ ls -l
```
??? question "Where is the image you just pulled?"
Docker saves container images to the Docker directory (where Docker is installed).
You won't ever see them in your working directory.
Use 'docker images' to see all the images on your computer:
```
$ docker images
```
### :material-docker: run
The single most common command that you'll use with Docker is `docker run` ([see official help manual](https://docs.docker.com/engine/reference/commandline/run/){target=_blank} for more details).
```
$ docker run hello-world:latest
```
In the demo above, you used the `docker pull` command to download the `hello-world:latest` image.
What about if you run a container that you haven't downloaded?
```
$ docker run alpine:latest
```
When you executed the command `docker run alpine:latest`, Docker first looked for the cached image locally, but did not find it, it then ran a `docker pull` behind the scenes to download the `alpine:latest` image and then execute your command.
### :material-docker: images
You can now use the `docker images` command to see a list of all the cached images on your system:
```
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
alpine latest c51f86c28340 4 weeks ago 1.109 MB
hello-world latest 690ed74de00f 5 months ago 960 B
```
??? info "Inspecting your containers"
To find out more about a Docker images, run `docker inspect hello-world:latest`
### :material-docker: ps
Now it's time to see the `docker ps` command which shows you all containers that are currently running on your machine.
```
docker ps
```
Since no containers are running, you see a blank line.
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
```
Let's try a more useful variant: `docker ps --all`
```
$ docker ps --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a5eab9243a15 hello-world "/hello" 5 seconds ago Exited (0) 3 seconds ago loving_mcnulty
3bb4e26d2e0c alpine:latest "/bin/sh" 17 seconds ago Exited (0) 16 seconds ago objective_meninsky
192ffdf0cbae opensearchproject/opensearch-dashboards:latest "./opensearch-dashbo…" 3 days ago Exited (0) 3 days ago opensearch-dashboards
a10d47d3b6de opensearchproject/opensearch:latest "./opensearch-docker…" 3 days ago Exited (0) 3 days ago opensearch-node1
```
What you see above is a list of all containers that you have run.
Notice that the `STATUS` column shows the current condition of the container: running, or as shown in the example, when the container was exited.
### :material-docker: stop
The `stop` command is used for containers that are actively running, either as a foreground process or as a detached background one.
You can find a running container using the `docker ps` command.
### :material-docker: rm
You can remove individual stopped containers by using the `rm` command. Use the `ps` command to see all your stopped contiainers:
```
@user ➜ /workspaces $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
03542eaac9dc hello-world "/hello" About a minute ago Exited (0) About a minute ago unruffled_nobel
```
Use the first few unique alphanumerics in the CONTAINER ID to remove the stopped container:
```
@user ➜ /workspaces (mkdocs ✗) $ docker rm 0354
0354
```
Check to see that the container is gone using `ps -a` a second time (`-a` is shorthand for `--all`; the full command is `docker ps -a` or `docker ps --all`).
### :material-docker: rmi
The `rmi` command is similar to `rm` but it will remove the cached images. Used in combination with `docker images` or `docker system df` you can clean up a full cache
```
docker rmi
```
```
@user ➜ /workspaces/ (mkdocs ✗) $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
opendronemap/webodm_webapp latest e075d13aaf35 21 hours ago 1.62GB
redis latest a10f849e1540 5 days ago 117MB
opendronemap/nodeodm latest b4c50165f838 6 days ago 1.77GB
hello-world latest feb5d9fea6a5 7 months ago 13.3kB
opendronemap/webodm_db latest e40c0f274bba 8 months ago 695MB
@user ➜ /workspaces (mkdocs ✗) $ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Deleted: sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412
Deleted: sha256:e07ee1baac5fae6a26f30cabfe54a36d3402f96afda318fe0a96cec4ca393359
@user ➜ /workspaces (mkdocs ✗) $
```
### :material-docker: system
The `system` command can be used to view information about containers on your cache, you can view your total disk usage, view events or info.
You can also use it to `prune` unused data and image layers.
To remove all cached layers, images, and data you can use the `-af` flag for `all` and `force`
```
docker system prune -af
```
### :material-docker: tag
By default an image will recieve the tag `latest` when it is not specified during the `docker build`
Image names and tags can be created or changed using the `docker tag` command.
```
docker tag imagename:oldtag imagename:newtag
```
You can also change the registry name used in the tag:
```
docker tag docker.io/username/imagename:oldtag harbor.cyverse.org/project/imagename:newtag
```
The cached image laters will not change their `sha256` and both image tags will still be present after the new tag name is generated.
---
## Run an Example Container
The example container is located in the following Github repository **https://github.com/jeffgillan/r-script-containerized**. The docker container launches Rstudio where a user can run an R script to convert a point cloud to a canopy height model (CHM).
{ width="600" }
Rstudio running in a container
#### 1. Launch Codespaces from the `r-script-containerized` repository
{ width="600" }
Launch CodeSpaces from the `r-script-containerized` repository
#### 2. On the codespaces terminal, run the following command to run the docker container:
```
docker run --rm -ti -e DISABLE_AUTH=true -v $(pwd):/home/rstudio/data -p 8787:8787 jeffgillan/pointcloud_to_chm:amd64
```
??? tip "Dissecting the Docker Run Command"
Within the command we are doing the following:
| Flag/Option | Explanation |
| --- | --- |
|`--rm` | Automatically remove the container when it exits |
|`-ti` | Allocate a pseudo-TTY (terminal) connected to the container’s stdin. It gives you an interactive terminal session in the container, allowing you to run commands in the container just as you would in a regular terminal window. |
| `-e DISABLE_AUTH=true` | Disable authentication for the Rstudio server |
| `-v $(pwd):/home/rstudio/data` | Mount the current working directory to the `/home/rstudio/data directory` in the container. This allows us to access the data on our local machine (in this case Codespaces) from within the container. The directory is where you should have pointcloud `.laz` files. |
|`-p 8787:8787` | Expose port 8787 on the container to port 8787 on the host machine. This allows us to access the Rstudio server from our web browser. |
| `jeffgillan/pointcloud_to_chm:amd64` | The name and version number of the docker image we want to run. In this case, we are running the `pointcloud_to_chm` image from the `jeffgillan` repository in Docker Hub. |
{ width="600" }
`docker run` command
#### 3. View Rstudio in a Browser
Open a new browser tab and navigate to `localhost:8787` to access the Rstudio server running in the container. In Codespaces you can click on _Ports_ and then _Open Browser_ to access the Rstudio server.
{ width="600" }
Rstudio running in a container
#### 4. Run the Script
Open the script `pointcloud_to_DTM.R`
Highlight all of the code and click *Run*
{ width="600" }
Upon completing the code, you should have a 2D plot of the tree
{ width="600" }
You should also have a new file called `chm.tif` in the mounted `data` folder. The `chm.tif` has been written to your local machine!
{ width="600" }
---
## Building Docker Images
:max_bytes(150000):strip_icc():format(webp)/Simply-Recipes-Rainbow-Layer-Cake-Lead-3-341176ca14d545229c16ce0e20cc1a64.jpg){ width="400" }
Docker Images are just like cakes: both are made of layers!
### Writing a Dockerfile
Create a file called `Dockerfile`, and add content to it as described below, e.g.
```
$ touch Dockerfile
```
Or, since we are using Codespaces, you can click the Create File button :material-file-plus: and name it `Dockerfile`
!!! tip "What is a Dockerfile?"
A Dockerfile is a text file that contains a list of commands, known as **instructions** used by Docker to build an image.
**If a *Docker Image* is a cake, the *Dockerfile* is the recipe!**
```
# Tells the Dockerfile which image to start from
FROM rocker/geospatial:4.2.3
# Sets the initial working directory inside the container
WORKDIR /home/rstudio
# Copies the R script file from your localdirectory to the container
COPY pointcloud_to_DTM.R .
# Installs an R package
RUN R -e "install.packages('RCSF', dependencies=TRUE, repos='http://cran.rstudio.com/')"
#Declare the port Rstudio will run on
EXPOSE 8787
# Starts the Rstudio server
CMD ["/init"]
```
#### Dockerfile Statements
??? abstract "ARG"
The only command that can come before a `FROM` statement is `ARG`
`ARG` can be used to set arguments for later in the build, e.g.,
```
ARG VERSION=latest
FROM ubuntu:$VERSION
```
??? abstract "FROM"
A valid `Dockerfile` must start with a `FROM` statement which initializes a new build stage and sets the **base image** for subsequent layers.
We’ll start by specifying our base image, using the FROM statement
```
FROM ubuntu:latest
```
If you are building on an `arm64` or Windows system you can also give the optional `--platform` flag, e.g.,
```
FROM --platform=linux/amd64 ubuntu:latest
```
??? question "When to use a multi-stage build pattern?"
Docker has the ability to build container images from one image, and run that "builder" image from a second "base" image, in what is called a "builder pattern".
Build patterns are useful if you're compiling code from (proprietary) source code and only want to feature the binary code as an executed function in the container at run time.
Build patterns can greatly reduce the size of your container.
You can use multiple `FROM` commands as build stages. The `AS` statement follows the `image:tag` as a psuedo argument.
```
# build stage
FROM golang:latest AS build-env
WORKDIR /go/src/app
ADD . /go/src/app
RUN go mod init
RUN cd /go/src/app && go build -o hello
# final stage
FROM alpine:latest
WORKDIR /app
COPY --from=build-env /go/src/app /app/
ENTRYPOINT ./hello
```
??? abstract "LABEL"
You can create labels which are then tagged as JSON metadata to the image
```
LABEL author="your-name"
LABEL email="your@email-address"
LABEL version="v1.0"
LABEL description="This is your first Dockerfile"
LABEL date_created="2022-05-13"
```
You can also add labels to a container when it is run:
```
$ docker run --label description="this label came later" ubuntu:latest
$ docker ps -a
$ docker inspect ###
```
??? abstract "RUN"
Different than the `docker run` command is the `RUN` build function. `RUN` is used to create new layers atop the "base image"
Here, we are going to install some games and programs into our base image:
```
RUN apt-get update && apt-get install -y fortune cowsay lolcat
```
Here we've installed `fortune` `cowsay` and `lolcat` as new programs into our base image.
!!! warning "Best practices for building new layers"
Ever time you use the `RUN` command it is a good idea to use the `apt-get update` or `apt update` command to make sure your layer is up-to-date. This can become a problem though if you have a very large container with a large number of `RUN` layers.
??? abstract "ENV"
In our new container, we need to change and update some of the environment flags. We can do this using the `ENV` command
```
ENV PATH=/usr/games:${PATH}
ENV LC_ALL=C
```
Here we are adding the `/usr/games` directory to the `PATH` so that when we run the new container it will find our newly installed game commands
We are also updating the "[locales](https://www.tecmint.com/set-system-locales-in-linux/){target=_blank}" to set the language of the container.
??? abstract "COPY"
The `COPY` command will copy files from the directory where `Dockerfile` is kept into the new image. You must specify where to copy the files or directories
```
COPY . /app
```
??? question "When to use `COPY` vs `ADD`"
`COPY` is more basic and is good for files
`ADD` has some extra features like `.tar` extraction and URL support
??? abstract "CMD"
The `CMD` command is used to run software in your image. In general use the ["command"] syntax:
```
CMD ["executable", "parameter1", "parameter2"]
```
??? abstract "ENTRYPOINT"
ENTRYPOINT works similarly to `CMD` but is designed to allow you to run your container as an executable.
```
ENTRYPOINT fortune | cowsay | lolcat
```
The default `ENTRYPOINT` of most images is `/bin/sh -c` which executes a `shell` command.
`ENTRYPOINT` supports both the `ENTRYPOINT ["command"]` syntax and the `ENTRYPOINT command` syntax
??? tip "What is an *entrypoint*?"
An entrypoint is the initial command(s) executed upon starting the Docker container. It is listed in the `Dockerfile` as `ENTRYPOINT` and can take 2 forms: as commands followed by parameters (`ENTRYPOINT command param1 param2`) or as an executable (`ENTRYPOINT [“executable”, “param1”, “param2”]`)
??? question "What is the difference in the `ENTRYPOINT` and `CMD`"
The CMD instruction is used to define what is execute when the container is run.
The ENTRYPOINT instruction cannot be overridden, instead it is appended to when a new command is given to the `docker run container:tag new-cmd` statement
the executable is defined with ENTRYPOINT, while CMD specifies the default parameter
??? abstract "USER"
Most containers are run as `root` meaning that they have super-user privileges within themselves
Typically, a new user is necessary in a container that is used interactively or may be run on a remote system.
During the build of the container, you can create a new user with the `adduser` command and set up a `/home/` directory for them. This new user would have something like 1000:1000 `uid:gid` permissions without `sudo` privileges.
As a last step, the container is run as the new `USER`, e.g.,
```
ARG VERSION=18.04
FROM ubuntu:$VERSION
RUN useradd ubuntu && \
chown -R ubuntu:ubuntu /home/ubuntu
USER ubuntu
```
??? abstract "EXPOSE"
You can open [ports](https://unm-carc.github.io/container-camp/docker/intro/#understanding-ports){target=_blank} using the `EXPOSE` command.
```
EXPOSE 8888
```
The above command will expose port 8888.
!!! note
Running multiple containers using the same port is not trivial and would require the usage of a web server such as [NGINX](https://www.nginx.com/){target=_blank}. However, you can have multiple containers interact with each other using [Docker Compose](https://docs.docker.com/compose/){target=_blank}.
### Summary of Instructions
| Instruction Command | Description |
| :---: | --- |
| `ARG` | Sets environmental variables during image building |
| `FROM` | Instructs to use a specific Docker image |
| `LABEL` | Adds metadata to the image |
| `RUN` | Executes a specific command |
| `ENV` | Sets environmental variables |
| `COPY` | Copies a file from a specified location to the image |
| `CMD` | Sets a command to be executed when running a container |
| `ENTRYPOINT` | Configures and run a container as an executable |
| `USER` | Used to set User specific information |
| `EXPOSE` | exposes a specific port |
---
### Building the Image
Once the Dockerfile has been created, we can build the image using the `docker build` command. At the codespaces terminal, run the following command:
```
docker build -t /pointcloud_to_chm:amd64 .
```
Example:
```
docker build -t jeffgillan/pointcloud_to_chm:amd64 .
```
??? "Dissecting the Docker Build Command"
- The `-t` flag allows us to tag the image with a name and version number.
- In the command you need to add your own DockerHub username instead of ``, which acts as the address to your own DockerHub Repository; `pointcloud_to_chm` is the name of the image, and `amd64` is the version tag.
- The `.` at the end of the command tells docker to look in the current directory for the dockerfile.
---
### Executable Images
```
_____________________________
< Avoid reality at all costs. >
-----------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
Thus far we have worked using interactive containers such as RStudio. Not all containers are interactive, many (if not most of) are executables: containerized software that can take the raw input and output data without requiring further work from the user.
Executable containers are usually called with
```
docker run /:
```
An easy to reproduce example is **Lolcow**, which builds a small executable that outputs a "quote of the day". It does not require any input and will output to the terminal directly.
You can run a prebuilt Lolcow with
```
docker run cosimichele/lolcow:f24
```
Here is the minimal recipie required to build Lolcow:
```
FROM --platform=linux/amd64 ubuntu:22.04
RUN apt-get update && apt-get install -y fortune cowsay lolcat
ENV PATH=/usr/games:${PATH}
ENV LC_ALL=C
ENTRYPOINT fortune | cowsay | lolcat
```
Once built, you can execute it with `docker run ` for something to brighten your day!
---
### Pushing to a Registry with :material-docker: docker push
By default `docker push` will upload your local container image to the [Docker Hub](https://hub.docker.com/){target=_blank}.
Also, make sure that your container has the appropriate [tag](#tag).
First, make sure to log into the Docker Hub, this will allow you to download private images, to upload private/public images:
```
docker login
```
Alternately, you can [link GitHub / GitLab accounts](https://hub.docker.com/settings/linked-accounts){target=_blank} to the Docker Hub.
To push the image to the Docker Hub:
```
docker push username/imagename:tag
```
---
---
### Exercises and Additional Dockerfiles
!!! success ""
We have a number of pre-written Dockerfiles that you can access in our [Intro 2 Docker Repository](https://github.com/cyverse-education/intro2docker){target=_blank}.
It contains:
- **Alpine**: a minimal Linux distribution
- **Cowsay**: will output wise messages when executed
- **Jupyter/minimal-notebook**: Jupyter Notebook accessible from your browser
- **rstudio/verse**: RStudio containing the Tidyverse data science packages
- **Ubuntu**
Clone our example repository, or work directly on the repository using Codespaces.
Clone command:
```
$ cd /workspaces
$ git clone https://github.com/cyverse-education/intro2docker
$ cd intro2docker/
```
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/07_containers.md){target=_blank} (last source update 2025-10-14), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/08-hpc/
---
title: "Remote Computing: HPC"
description: "Logging in to a high-performance computing cluster, submitting Slurm batch and interactive jobs, loading modules, and running Apptainer containers."
type: Lesson
tags:
- HPC
- Slurm
- Apptainer
- Remote Computing
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/09_HPC.md"
title: "CyVerse FOSS: docs/09_HPC.md"
author: "team:cyverse"
last_modified: "2025-10-21T10:26:16-07:00"
---
# Remote Computing: HPC

Singularity > Apptainer and working with the [SLURM workload manager](https://slurm.schedmd.com/documentation.html){target=_blank} (HPC scheduler).
!!! success "Expected Outcomes"
- Being able to log onto the HPC and start an interactive node
- Know basic HPC related commands
- Execute containerized code through Singularity/Apptainer
- Being able to search and load specific software
- Execute NextFlow scripts on the HPC
Through FOSS we have learned about container technology and how it can affect reproducibility by wrapping all the necessary components that allow a specific software to be executed.
Similar to Docker, Singularity/Apptainer is a powerful tool that enables researchers to package entire environments, including software dependencies and libraries, into a single executable file.
**Unlike other containerization platforms, Singularity/Apptainer is designed with [HPC](https://en.wikipedia.org/wiki/High-performance_computing){target=_blank} in mind, allowing seamless integration with cluster computing environments.**
The biggest difference between Docker and Singularity/Apptainer, is that with the latter *you do **not** require sudo priviledges*. Exciting!
In this workshop, we are going to learn how we can use Singularity/Apptainer on the UA HPC, covering orientation of the HPC, and executing Singularity/Apptainer control commands.
---
## A 10,000ft View of the HPC
**Official documentation: https://hpc.arizona.edu/**.
Here, we are going to concentrate on *HOW* to operate the HPC system as a general user.
!!! info "One example system"
The commands and output in this lesson come from the University of Arizona
(UA) HPC, where CyVerse originally taught FOSS. Every cluster has its own
hostnames, partitions, storage paths, and helper commands (such as UA's
`va` and `interactive`), but the ideas — login nodes, Slurm, modules, and
Apptainer — carry over to any HPC system.
!!! tip "UNM CARC users"
At UNM, practice on the CARC clusters instead: see
[logging in to CARC systems](https://carc.unm.edu/docs/getting-started/logging-in/){target=_blank},
the [introduction to Slurm on CARC](https://carc.unm.edu/docs/running-jobs/slurm-intro/){target=_blank}
for CARC partitions and job scripts, and
[storage on CARC](https://carc.unm.edu/docs/systems/storage/){target=_blank} for home,
scratch, and project paths.
!!! warning "Who is this lesson for?"
This workshop is primarely aimed to UA students, grad students, faculty and staff as being part of the University of Arizona grants you access to the UA HPC.
If you are not part of UA... *you're still very welcome to take part of this lesson!* You may not be able to execute the commands but you can still walk out of this with a good understanding of your institution's own HPC and Singularity/Apptainer. Everyone's welcome!
### Logging onto the HPC
If you have a UA account, to connect to the HPC you need to use `ssh` ([Secure Shell](https://en.wikipedia.org/wiki/Secure_Shell){target=_blank}). Open a terminal, and type:
```
ssh @hpc.arizona.edu
```
Type your UA password and if successful you'll be greeted with a two-factor login. Select which choice, and complete the authentification. Once you are past the authentification steps, you will enter the [Bastion server](https://en.wikipedia.org/wiki/Bastion_host){target=_blank}. This step has 2 purposes:
1. Protect from attacks.
2. Select what HPC system you want to use.
!!! warning "Note: the Bastion server is NOT YET the HPC! Here you cannot submit jobs or run analyes. Type `shell` in order to select what system you want to use."
The whole process (from logging to selecting the system) looks like the following:
```
ssh cosi@hpc.arizona.edu
(cosi@hpc.arizona.edu) Password:
(cosi@hpc.arizona.edu) Duo two-factor login for cosi
Enter a passcode or select one of the following options:
1. Duo Push to XXX-XXX-8418
2. SMS passcodes to XXX-XXX-8418
Passcode or option (1-2): 1
Success. Logging you in...
Last login: Tue Mar 26 14:52:39 2024 from dhcp-10-132-212-1.uawifi.arizona.edu
This is a bastion host used to access the rest of the RT/HPC environment.
Type "shell" to access the job submission hosts for all environments
-----------------------------------------
[cosi@gatekeeper ~]$ shell
Last login: Wed Mar 20 10:30:25 2024 from gatekeeper.hpc.arizona.edu
***
The default cluster for job submission is Puma
***
Shortcut commands change the target cluster
-----------------------------------------
Puma:
$ puma
(puma) $
Ocelote:
$ ocelote
(ocelote) $
ElGato:
$ elgato
(elgato) $
-----------------------------------------
[cosi@wentletrap ~]$ ocelote
(ocelote) [cosi@wentletrap ~]$
```
At this point you are in the Login Node, where you can submit jobs or ask for an interactive node.

A representation of what the HPC structure and its various nodes. [Source](https://uarizona.atlassian.net/wiki/spaces/UAHPC/pages/75989999/HPC+Quick+Start){target=_blank}.
### Choosing a System
In the example above, we chose the Ocelote system. Notice how there are 2 other choices: Puma and El Gato. Without going in too much detail, here are some of the statistics regarding the 3 HPC systems at the UA HPC.
|System|Year of Aquisition|Processors|RAM|GPU|
|-|-|-|-|-|
|Puma|2020|2x AMD Zen2 48 CPU (94 cores total)|512GB|6x Nvidia V100S|
|Ocelote|2016|2x Xeon E5-2695v3 14-core (28 cores total)|192GB|46x Nvidia P100|
|El Gato|2013|2x Xeon E5-2650v2 8-core (16 core total)|64GB|removed as obsolete|
Find the full systems specs at the [official UA HPC documentation resources page](https://uarizona.atlassian.net/wiki/spaces/UAHPC/pages/75990208/Compute+Resources){target=_blank}.
El Gato is the oldest system, and potentially not useful for heavy research. Puma is the newest and most requested, whislt Ocelote is the "middle child": not as popular but still able to pack a punch.
Depending on what your work is, your best bet would be Puma for heavy computation (if you are ok with waiting long queues); However, if your jobs aren't as taxing, then Ocelote could easily be a safe choice.
For this workshop, we are going to be using Ocelote.
### Checking Available Resources
#### Allocations
Once past the Bastion server and logged into the Ocelote login node, you are able to submit jobs or request an interactive node. Before you do so, it is wise to check your available resources. These resources are the ones made available to you by your PI or working group.
In order for you to check your resources, type `va`.
```
(ocelote) [cosi@wentletrap ~]$ va
Windfall: Unlimited
PI: parent_1743 Total time: 100000:00:00
Total used*: 1:00:00
Total encumbered: 0:00:00
Total remaining: 99999:00:00
Group: datalab Time used: 1:00:00 Time encumbered: 0:00:00
*Usage includes all subgroups, some of which may not be displayed here
```
`va` allows you to view all of the resources available from all the groups you are part of.
#### Storage
There are a number of ways one can approach storage on the HPC:
- Your own folder (in `/home/`): 50GB limit
- Your group (in `/groups/`): 500GB limit
- Your PI research (in `/xdisk/`): 20TB
Four the purpose of this workshop, we can access the datalab group storage in `/groups/cosi` (we will try and rename it in the future).
#### Queues and Submissions
One can check queue times and sumbissions by executing the SLURM command `squeue`. This will display the job id, submission type (standard, windfall, high priority), name of submission, user, status (queued, running), time elapsed, number of used nodes, and nodelist.
```
(ocelote) [cosi@wentletrap ~]$ squeue
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
2875825_[432-1000] standard qchem snanayak PD 0:00 1 (AssocGrpCPUMinutesLimit)
2890485 standard R92L_Met krishnag PD 0:00 1 (Dependency)
2890484 standard R92L_Met krishnag PD 0:00 1 (Dependency)
2890483 standard R92L_Met krishnag PD 0:00 1 (Dependency)
2881573 standard R92W_Met krishnag PD 0:00 1 (Dependency)
2881572 standard R92W_Met krishnag PD 0:00 1 (Dependency)
2802511 standard eigen krishnag PD 0:00 1 (Dependency)
2949224 standard brutefor theronir PD 0:00 1 (None)
2898419 standard start_so mmartino PD 0:00 1 (Dependency)
2898418 standard make_sor mmartino PD 0:00 1 (Dependency)
2898416 standard start_so mmartino PD 0:00 1 (Dependency)
2898415 standard make_sor mmartino PD 0:00 1 (Dependency)
2898410 standard start_so mmartino PD 0:00 1 (Dependency)
2898409 standard make_sor mmartino PD 0:00 1 (Dependency)
. . . . . . . .
. . . . . . . .
. . . . . . . .
2884142 windfall li_d_t_6 bubin R 2-06:58:50 1 i5n14
2884107 windfall li_d_t_4 bubin R 2-07:00:26 1 i6n8
2884098 windfall li_d_t_7 bubin R 2-07:00:50 1 i6n5
2880486 windfall be_10b teodar R 4-22:35:44 1 i16n5
2880487 windfall be_9b teodar R 4-22:35:44 1 i16n6
2880488 windfall be_7b teodar R 4-22:35:44 1 i16n12
2880489 windfall be_2b teodar R 4-22:35:44 1 i16n16
```
Likely, this will output 100s of lines, therefore if you want to check on your own job, you could use the CLI and `grep` to select the running submission (e.g., `squeue | grep ` or `squeue --user $NETID`).
---
## HPC, SLURM and Jobs Submissions
SLURM not Slurm.
All of the UA HPC systems run on a workload manager and job scheduler named [SLURM](https://slurm.schedmd.com/documentation.html){target=_blank} (Simple Linux Utility for Resource Management). It's designed to manage and schedule computing resources such as CPUs, GPUs, memory, and storage across a cluster of interconnected nodes.
You can learn more on SLURM and HPC system commands [here](https://uarizona.atlassian.net/wiki/spaces/UAHPC/pages/75989875/Running+Jobs+with+Slurm){target=_blank}.
### Job Submissions
There are 2 ways one can submit jobs onto the HPC system. The first is to run a **batch job**, which is the more popular submission type, whilst the other is by requesting an **interactive node**.
#### Batch jobs
As we are not going to be using batch submissions, we are not going to be going into too much detail. However, here is what you need to know. For more details on running batch jobs, visit the [official documentation page on batch jobs](https://uarizona.atlassian.net/wiki/spaces/UAHPC/pages/75989875/Running+Jobs+with+Slurm){target=_blank}.
!!! note "Writing a Batch Script"
Batch scripts require a number of job **directives**. These are similar to the Dockerfile instructions, but instead of telling Docker how to build the image, these instead tell the SLURM system what to do with the job. The essential directives are the following:
|Directive|Purpose|
|-|-|
| `#SBATCH --account=group_name` | Specify the account where hours are charged. |
| `#SBATCH --partition=partition_name` | Set the job partition. This determines your job's priority and the hours charged. |
| `#SBATCH --time=DD-HH:MM:SS` | Set the job's runtime limit in days, hours, minutes, and seconds. A single job cannot exceed 10 days or 240 hours. |
| `#SBATCH --nodes=N` | Allocate N nodes to your job. |
| `#SBATCH --cpus-per-task=M` and `#SBATCH --ntasks=N` | ntasks specifies the number of tasks (or processes) the job will run. By default, you will be allocated one CPU/task. This can be increased by including the additional directive --cpus-per-task. |
| `#SBATCH --mem=Ngb` | Select N gb of memory per node. If "gb" is not included, this value defaults to MB. |
After setting your directives, you can instruct the HPC to do what you require similar to a bash script.
Here's an example of a batch job:
```
#!/bin/bash
#SBATCH --job-name=blast_job # Job name
#SBATCH --partition=standard # Sets the job priority to standard
#SBATCH --nodes=1 # Number of nodes
#SBATCH --ntasks=1 # Number of tasks (processes) per node
#SBATCH --cpus-per-task=4 # Number of CPU cores per task
#SBATCH --mem=8G # Memory per node (in this case, 8GB)
#SBATCH --time=02:00:00 # Time limit (HH:MM:SS)
# Load necessary modules
module load blast/2.12.0 # Load BLAST module (adjust version as needed)
# Change to the directory where the job will run
cd $SLURM_SUBMIT_DIR
# Define input and output files
query_file="query.fasta" # Input query file (FASTA format)
database_file="database.fasta" # BLAST database file (FASTA format)
output_file="blast_results.out" # Output file for BLAST results
# Run BLAST command
blastp -query $query_file -db $database_file -out $output_file -evalue 0.001 -num_threads $SLURM_CPUS_PER_TASK
```
!!! tip "Submitting a Batch Script"
- To submit jobs you need to use `sbatch`, such as `sbatch script.slurm`
- To cancel your job you do `scancel`, such as `scancel $JOBID` or `scancel -u $NETID`
This will submit your job to the queue. Execution will depend on your submission type (partition).
#### Launching an Interactive Node
An **interactive node**, unlike batch jobs which are run asynchronously, allows immediate access to compute. Similar to batch jobs, interactive nodes are submitted to the queue, but once available, you will receive a prompt for a node with the selected resources. Read more on how to launch interactive jobs in [the official documentation](https://uarizona.atlassian.net/wiki/spaces/UAHPC/pages/75989825/Interactive+Jobs){target=_blank}.
!!! tip "The Quick and Dirty"
Don't need a lot of resources and just want access to the compute?
Just type `interactive`.
Disclaimer: you may require to wait longer as your job is going to fall in the `windfall` queue.
Following are a list of useful flags (options) for setting up the interactive node.
|Flag|Default value| Description| Example|
|-|-|-|-|
| `-n` | 1 | Number of CPUs requested per node | interactive -n 8 |
| `-m` | 4GB | Memory per CPU | interactive -m 5GB |
| `-a` | none | Account (group) to charge | interactive -a datalab |
| `--partition=` | windfall | Partition to determine CPU time charges and is set to windfall when no account is specified, and is **set to standard when an account is provided.** | interactive --partition=windfall |
| `-t` | 01:00:00 | Time allocated to session. | interactive -t 08:00:00 |
| `-N` | 1 | Number of nodes. | There is no reason to exceed 1 node unless the number of CPUs requested is greater than the number of CPUs per node on a given cluster. | (in el gato, where number of CPU per node is 16 max ) interactive -n 32 -N 2 |
An example for an interactive node is:
```
interactive -n 8 -m 16GB -a datalab -t 02:00:00
```
The above example will request an interactive node with 8 cores, 16GB RAM, "charging" the datalab, running for 2 hours. Try it!
!!! note "Modules"
There are 100s of tools installed on the HPC, few of which are available on the login screen. These tools are available only during a batch job submission or within interactive jobs.
To see what tools are already running, or which are available, you will need to use the `module` command.
!!! tip "Helpful `module` commands"
|Command|Purpose|
|-|-|
|`module list`| Lists loaded modules|
|`module avail`| Lists available modules|
|`module spider`| Lists ALL modules|
|`module load`| Loads a module|
|`module help`| Help command!|
---
## Singularity/Apptainer
In 2021, the Sylabs, the developers behind the original Singularity, made a fork of the original project and renamed it [SingularityCE (Community Edition)](https://github.com/sylabs/singularity){target=_blank}. This would allow for the SingularityCE to be compliat with FOSS and allowing for the community to contribute to the builds. The Singularity team then joined the [Linux Foundation](https://en.wikipedia.org/wiki/Linux_Foundation){target=_blank} and decided to rename their effor to [**Apptainer**](https://github.com/apptainer/apptainer){target=_blank}.
The technology behind Singularity/Apptainer is similar to the one of Docker, but, as mentioned before, it was created with the HPC in mind, and therefore bypasses the requirement of sudo.
!!! note
Until now we have used Singularity/Apptainer to refer to the same software. Onwards, you can decide whether to use Singularity *OR* Apptainer; in order to keep up with the latest release, we are going to be executing apptainer commands. Apptainer also installs a `singularity` command as an alias, so older instructions that use `singularity` still work.
??? info "Docker vs SingularityCE & Apptainer in the blink of an eye"
**:material-open-source-initiative: Apptainer and SingularityCE are 100% compatible with Docker but they do have some distinct differences**
**:material-docker: Docker**
:octicons-container-24: Docker containers run as `root`
- This privilege is almost never supported by administrators of High Performance Computing (HPC) centers. Meaning Docker is not, and will likely never be, installed natively on your HPC cluster.
:octicons-container-24: uses compressed layers to create one image
**:material-open-source-initiative: SingularityCE & Apptainer**:
:octicons-container-24: Same user and group identity inside as outside the container
:octicons-container-24: User only has `root` privileges if elevated with `sudo` when the container is run
:octicons-container-24: Can run and modify any existing Docker image
- These key differences allow Singularity to be installed on most HPC centers. Because you can run virtually all Docker containers in Singularity, you can effectively run Docker on an HPC.
### General Executable Commands
Resources:
- https://unm-carc.github.io/container-camp/singularity/intro/
- https://unm-carc.github.io/container-camp/singularity/hpc/
- https://unm-carc.github.io/container-camp/singularity/advanced/
Apptainer’s [command line interface](https://apptainer.org/docs/user/main/cli.html){target=_blank} allows you to build and interact with containers transparently. You can run programs inside a container as if they were running on your host system. You can easily redirect IO, use pipes, pass arguments, and access files, sockets, and ports on the host system from within a container.
#### :octicons-container-24: help
The `help` command gives an overview of Apptainer options and subcommands as follows:
```
$ apptainer help pull
Pull an image from a URI
Usage:
apptainer pull [pull options...] [output file]
Description:
The 'pull' command allows you to download or build a container from a given
URI. Supported URIs include:
library: Pull an image from the currently configured library
library://user/collection/container[:tag]
docker: Pull a Docker/OCI image from Docker Hub, or another OCI registry.
docker://user/image:tag
shub: Pull an image from Singularity Hub
shub://user/image:tag
oras: Pull a SIF image from an OCI registry that supports ORAS.
oras://registry/namespace/image:tag
http, https: Pull an image using the http(s?) protocol
https://example.com/alpine.sif
Options:
--arch string architecture to pull from library (default
"amd64")
--arch-variant string architecture variant to pull from library
--dir string download images to the specific directory
--disable-cache do not use or create cached images/blobs
--docker-host string specify a custom Docker daemon host
--docker-login login to a Docker Repository interactively
-F, --force overwrite an image file if it exists
-h, --help help for pull
--library string download images from the provided library
--no-cleanup do NOT clean up bundle after failed build,
can be helpful for debugging
--no-https use http instead of https for docker://
oras:// and library:///... URIs
Examples:
From a library
$ apptainer pull alpine.sif library://alpine:latest
From Docker
$ apptainer pull tensorflow.sif docker://tensorflow/tensorflow:latest
$ apptainer pull --arch arm --arch-variant 6 alpine.sif docker://alpine:latest
From Shub
$ apptainer pull apptainer-images.sif shub://vsoch/apptainer-images
From supporting OCI registry (e.g. Azure Container Registry)
$ apptainer pull image.sif oras://.azurecr.io/namespace/image:tag
For additional help or support, please visit https://apptainer.org/help/
```
#### :octicons-container-24: search
Just like with Docker, you can `search` the Apptainer container [registries](https://apptainer.org/docs/user/1.0/library_api.html){target=_blank} for images.
```
$ apptainer search tensorflow
```
#### :octicons-container-24: pull
The easiest way to use a Apptainer is to `pull` an existing container from one of the Registries.
```
$ apptainer pull library://lolcow
```
Not only you can pull fromt the Apptainer registries/libraries, but you can pull from Docker.
```
$ apptainer pull docker://alpine
```
!!! note "In my humble opinion..."
This is whre Apptainer shines: you can pull from Docker and run Docker built images on the HPC! These are automatically converted to Apptainer images (`.sif`) and executable on the HPC!
!!! tip "... so where are the Apptainer `.sif` images stored?"
Right where in the directory you are pulling them to. Check with `cd`!
### Obtaining Images
As metioned earlier, you can use the `pull` command to download pre-built images from a number of Container Registries, here we'll be focusing on the [DockerHub](https://hub.docker.com/){target=_blank}.
Container Registries:
- `library://` - images hosted on Sylabs Cloud
- `docker://` - images hosted on Docker Hub
- `localimage://` - images saved on your machine
- `yum://` - yum based systems such as CentOS and Scientific Linux
- `debootstrap://` - apt based systems such as Debian and Ubuntu
- `arch://` - Arch Linux
- `busybox://` - BusyBox
- `zypper://` - zypper based systems such as Suse and OpenSuse
- `shub://` - (archived) images hosted on Singularity Hub, no longer maintained
#### Pulling an image from Singularity Hub
Similar to previous example, in this example I am pulling a base Ubuntu
container from Singularity-Hub:
```
$ apptainer pull shub://singularityhub/ubuntu
INFO: Downloading shub image
88.6MiB / 88.6MiB [=============================================================================] 100 % 39.1 MiB/s 0s
```
!!! tip "Re/naming"
You can give the the container using the `--name` flag: such as `apptainer pull --name my-own-ubuntu-pulled-image.sif shub://singularityhub/ubuntu`
#### Pulling an image from Docker Hub
This example pulls an `ubuntu:22.04` image from DockerHub and saves it to the working directory.
```
$ apptainer pull docker://ubuntu:22.04
INFO: Converting OCI blobs to SIF format
INFO: Starting build...
Getting image source signatures
Copying blob bccd10f490ab done
Copying config ca2b0f2696 done
Writing manifest to image destination
Storing signatures
2024/03/27 20:14:50 info unpack layer: sha256:bccd10f490ab0f3fba61b193d1b80af91b17ca9bdca9768a16ed05ce16552fcb
INFO: Creating SIF file...
```
### Interacting with Images
You can interact with images in several ways such as `run`, `shell` and `exec`.
For these examples we will use a `cowsay_latest.sif` image that can be pulled from the Docker Hub.
```
$ apptainer pull docker://tswetnam/cowsay
INFO: Converting OCI blobs to SIF format
INFO: Starting build...
Getting image source signatures
Copying blob 05e030abce7b done
Copying blob b4624b3efe06 done
Copying blob 6cf436f81810 done
Copying blob 987088a85b96 done
Copying blob d42beb8ded59 done
Copying config ee9e20351a done
Writing manifest to image destination
Storing signatures
2024/03/27 20:16:29 info unpack layer: sha256:6cf436f81810f067c6d4ffca6793eae7cb6d38456715b0707d8a5a2d1acccf12
2024/03/27 20:16:29 warn rootless{dev/full} creating empty file in place of device 1:7
2024/03/27 20:16:29 warn rootless{dev/null} creating empty file in place of device 1:3
2024/03/27 20:16:29 warn rootless{dev/ptmx} creating empty file in place of device 5:2
2024/03/27 20:16:29 warn rootless{dev/random} creating empty file in place of device 1:8
2024/03/27 20:16:29 warn rootless{dev/tty} creating empty file in place of device 5:0
2024/03/27 20:16:29 warn rootless{dev/urandom} creating empty file in place of device 1:9
2024/03/27 20:16:29 warn rootless{dev/zero} creating empty file in place of device 1:5
2024/03/27 20:16:30 info unpack layer: sha256:987088a85b9606eb474a365eb210db765ff0d011ee099a6e3de5087435c6f966
2024/03/27 20:16:30 info unpack layer: sha256:b4624b3efe0617e59ed3998407eafdbe1cb6451346a6cabd066b6e253f50efb1
2024/03/27 20:16:30 info unpack layer: sha256:d42beb8ded595df5627ad4ef31bf528a6fdbfbd11d82f9023152738d6b05a7fa
2024/03/27 20:16:30 info unpack layer: sha256:05e030abce7b562606031bcc54646a868984685f4c89c7c354f34f1f6e502917
INFO: Creating SIF file..
$ ls
alpine_latest.sif lolcow_latest.sif ubuntu_22.04.sif cowsay_latest.sif
```
#### :octicons-container-24: run
Apptainer containers contain [runscripts](https://www.sylabs.io/guides/3.0/user-guide/definition_files.html#runscript){target=_blank}. These are user defined scripts that define the actions a container should perform when someone runs it. The runscript can be triggered with the `run` command, or simply by calling the container as though it were an executable.
```
$ apptainer run cowsay_latest.sif
INFO: underlay of /etc/localtime required more than 50 (76) bind mounts
____________________________________
/ Q: Do you know what the death rate \
\ around here is? A: One per person. /
------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
#### :octicons-container-24: shell
The `shell` command allows you to spawn a new shell within your container and interact with it as though it were a small virtual machine.
```
$ apptainer shell cowsay_latest.sif
INFO: underlay of /etc/localtime required more than 50 (76) bind mounts
(ocelote) Apptainer>
```
The change in prompt indicates that you have entered the container (though you should not rely on that to determine whether you are in container or not).
Once inside of a Apptainer container, you are the same user as you are on the host system.
```
(ocelote) Apptainer> whoami
cosi
```
!!! tip "Type `exit` to exit the container."
!!! warning "The more you know :material-star-shooting:"
`shell` also works with the `library://`, `docker://`, and `shub://` URIs.
This creates an **ephemeral container**\* that disappears when the shell is
exited.
**Ephemeral container**\*: a short-lived container instance that is created dynamically to perform a specific task or process and then terminated once the task is complete. These containers are typically used for one-off jobs, temporary operations, or short-duration tasks within a larger computing environment.
#### :octicons-container-24: exec
The exec command allows you to execute a custom command within a container by specifying the image file. For instance, to execute the `cowsay` program within the `cowsay_latest.sif` container:
```
$ apptainer exec cowsay_latest.sif cowsay whoaaaa the grass is soooo green inside the HPC!
INFO: underlay of /etc/localtime required more than 50 (76) bind mounts
_________________________________________
/ whoaaaa the grass is soooo green inside \
\ the HPC! /
-----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
This also creates an ephemeral container that executes a command and disappears.
#### :octicons-container-24: inspect
The `inspect` command will provide information about labels, metadata, and environmental variables.
```
$ apptainer inspect cowsay_latest.sif
org.label-schema.build-arch: amd64
org.label-schema.build-date: Wednesday_27_March_2024_20:16:32_MST
org.label-schema.schema-version: 1.0
org.label-schema.usage.apptainer.version: 1.2.5-1.el7
org.label-schema.usage.singularity.deffile.bootstrap: docker
org.label-schema.usage.singularity.deffile.from: tswetnam/cowsay
```
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/09_HPC.md){target=_blank} (last source update 2025-10-21), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/09-cyverse/
---
title: "Remote Computing: CyVerse"
description: "An overview of the CyVerse cloud platform: the Discovery Environment, Data Store, Data Commons, analysis apps, and the analysis dashboard."
type: Lesson
tags:
- CyVerse
- Cloud Computing
- Data Store
- Remote Computing
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/08_remote_computing_cyverse.md"
title: "CyVerse FOSS: docs/08_remote_computing_cyverse.md"
author: "team:cyverse"
last_modified: "2025-10-27T14:59:39-07:00"
---
# Remote Computing: CyVerse
!!! warning "This page is a summary of what today's lesson is going to cover. For the information covered, we are going to rely on the CyVerse Learning documentation: https://unm-carc.github.io/cyverse/."
{ width="500" }
## CyVerse
Housed at the University of Arizona, [CyVerse](https://cyverse.org){target=_blank} is a one-of-a-kind cloud computing system for the academic and research communities. It's mission is to design, deploy and expand a national cyberinfrastructure for scientific research and to train scientists how to use it. **CyVerse is an excellent platform to make your research open and reproducible!**
Cyverse (originally called Iplant) has been in existence for 16 years; has spent $120M in research funds; has 135,000 registered users; and has facilitated 1,700 peer-reviewed publications across many scientific fields such as plant genetics, genomics, astronomy, geosciences, health, and agriculture.
{ width="500" }
**Cyverse is completely Free for University of Arizona students, staff, and faculty.**
* [Cyverse homepage](https://cyverse.org){target=_blank}
* [Cyverse Self-Guided Course](https://cyverse-learning-materials.github.io/cyverse_mooc/){target=_blank}
!!! success "Advantages of Cloud Computing"
* With cloud computing, you can avoid the upfront cost and complexity of owning and maintaining your own IT infrastructure
* Cloud computing allows groups or individuals to scale up (or down) their operations quickly as their computing needs change
* Cloud computing allows users to access their data and applications from anywhere, on any device, at any time
* Cloud empowers colleagues to work directly together on the same data, models, and applications
* Easily share your work with the world
## CyVerse Discovery Environment
The [CyVerse Discovery Environment](https://de.cyverse.org){target=_blank} is where users can store and share data as well as run analysis applications with the click of a button. It is backed by robust computing resources that can help scale your analysis beyond what is possible on your laptop.
## Data Storage and Sharing
Cyverse Data Store is the ideal cloud storage to host your large (or small) datasets, share data with colleagues, and meet publication/grant archival requirements.
* Cyverse Data Store is object cloud storage similar to Azure Blob, or Amazon S3
* Pro account has a 5TB limit
* [Moving data in or out of the Data Store](https://unm-carc.github.io/cyverse/data-store/){target=_blank} can be done through website or multiple command line tools
* Share your data with your colleagues and world with a URL
* Data can be public/private, shared with anyone, set permission levels
* Never lose your data due to hardware failure
[CyVerse Data Commons](https://datacommons.cyverse.org/){target=_blank} is our public facing data storage interface. It enables you to share data with people outside of CyVerse.
_**Community Released:**_ A folder of data you want to share with colleagues, stakeholders, or the entire world. You control read/write/own permissions and make it public or private.
_**Curated:**_ Data that is tied to a peer-reviewed publication and needs permanent archival. You can apply many types of metadata templates your data as well as receive a permanent DOI.
## Apps
The CyVerse Discovery Environment has a large number of analysis applications that can be run on your data. These applications are pre-installed and ready to use with a few clicks. You get to choose the amount of computing resources you need to run your analysis.
Apps come in two basics flavors:
* Executable Apps: Run a script or a series of scripts on your data
* Interactive Apps: Launch software such as Jupyter notebooks, RStudio, QGIS, VScode, and more
!!! tip "Important Notes"
* When you launch an app in Cyverse DE, you are actually launching containers such as Docker
* When you close the app, the container is destroyed but your data can be saved in the Data Store
## Analysis Dashboard
The Analysis Dashboard is where you can monitor the status of Apps you have launched
* Stop and Relaunch Apps
* Extend the time of an App (beyond 72 hours)
* View you history of Apps launched
!!! warning "Attention"
If you are not using an app, please shut it down!
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/08_remote_computing_cyverse.md){target=_blank} (last source update 2025-10-27), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/lessons/extra-nextflow/
---
title: "Extra: Workflows with Nextflow"
description: "A comparison of the Nextflow and Snakemake workflow managers and a hands-on RNA-seq tutorial that runs a Nextflow pipeline in a Conda environment."
type: Lesson
tags:
- Nextflow
- Snakemake
- Workflows
- Conda
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/nextflow.md"
title: "CyVerse FOSS: docs/nextflow.md"
author: "team:cyverse"
last_modified: "2024-07-02T16:37:25-07:00"
---
# Extra: Workflows with Nextflow
## Automation: Workflow Management with Nextflow and Snakemake
Workflow management is key to automation: it helps with bridging the gap between software, creating useful pipelines that help extracting information from data. Two examples of workflow management system popular (but not restricted to!) within the field of Bioinformatics are [Nextflow](https://www.nextflow.io/docs/latest/index.html){target=_blank} and [Snakemake](https://snakemake.readthedocs.io/en/stable/){target=_blank}.
Both workflow managers are powerful tools that tackle reproducibility and scalability, however the two have some key differences:
| Feature | Snakemake | Nextflow |
|---|---|---|
| Language style | Python-based DSL* |Groovy-based DSL* |
| Execution Model | Rule-based | Dataflow-driven |
| Parallelization and Resource Management |Implicit parallelization, limited resource management | Explicit parallelization, more flexible resource management |
| Integration | seamless with Python | seamless with Java** |
\* = Domain Specific Langauge
** = No, it does not mean you need to learn Java
Although there are differences between the two workflow managers, there are a number of features which both share:
- Available on all OS
- Well integrated with Conda
- Support the use of Containers
- Deployable on HPC systems
- Integrated error reporting
- Well established communities***
*** = It should be noted that Nextflow has a [community driven repository, nf-core](https://nf-co.re/){target=_blank}, where people can upload their Nextflow pipelines for others to use. Power to the people!
Both are incredibly powerful when it comes to creating pipelines, ultimately the choice on which to use depends on **you** (and the goal of your project).
Here are a couple of script examples for each workflow manager. Although different, the examples try to
1. Download a genome
2. Align reads using BWA ([Burrows-Wheeler Aligner](https://bio-bwa.sourceforge.net/){target=_blank} tool)
3. Gather aignment statistics using [Samtools](https://www.htslib.org/){target=_blank} (Sequence Alignment/Map)
**Snakemake:**
```
# Snakefile
# Define rule for downloading reference genome
rule download_reference_genome:
output:
"reference_genome.fa"
shell:
"wget http://example.com/reference_genome.fa"
# Define rule for aligning reads to the reference genome using BWA
rule align_reads:
input:
"reference_genome.fa",
fastq="data/{sample}.fastq"
output:
"aligned/{sample}.bam"
shell:
"bwa mem {input.reference_genome} {input.fastq} | samtools view -b - > {output}"
# Define rule to aggregate alignment statistics
rule aggregate_stats:
input:
expand("aligned/{sample}.bam", sample=config['samples'])
output:
"alignment_stats.txt"
shell:
"samtools flagstat {input} > {output}"
# Define samples
configfile: "config.yaml"
```
Notice how in the Snakefile above, there are a set number of rules that define input, output and commands.
**Nextflow:**
```
// main.nf
params.samples = ['sample1', 'sample2', 'sample3']
// Define process to download reference genome
process download_reference_genome {
output:
file('reference_genome.fa')
script:
"""
wget http://example.com/reference_genome.fa -O reference_genome.fa
"""
}
// Define process to align reads using BWA
process align_reads {
input:
file(reference_genome), file(fastq) from fastqs
output:
file("aligned/${sample}.bam")
script:
"""
bwa mem ${reference_genome} ${fastq} | samtools view -b - > aligned/${sample}.bam
"""
}
// Define process to aggregate alignment statistics
process aggregate_stats {
input:
set file(aligned_bam) from aligned_bams
output:
file("alignment_stats.txt")
script:
"""
samtools flagstat ${aligned_bam} > alignment_stats.txt
"""
}
// Define workflow execution
workflow {
// Define input data
Channel.fromPath("data/*.fastq").set { fastqs }
// Execute processes in parallel
download_reference_genome()
align_reads(fastqs)
aggregate_stats()
}
```
The Nextflow file "forces" you to know what you are expecting prior to execution by first defining what you want processes you need before defining the workflow script.
Although not shown here, Nextflow uses "Channels" to help with workflow execution. A channel can have one or more defined processes, but it can "wait": these processes wait until the input is ready before executing, thus creating the possibilty of an asynchronous processing pipeline (and parallel processing!). This is also what makes Nextflow able to manage resources better than Snakemake (the processes in "inactive" channels do not use resources until they are needed).
## Reproducibility Tutorial
This section is going to cover a short tutorial on reproducibility using software, tools and practices discussed today and throughout FOSS.
!!! note "OS of choice"
This tutorial will be performed using the [CyVerse CLI (Command Line Interface)](https://de.cyverse.org/apps/de/5f2f1824-57b3-11ec-8180-008cfa5ae621){target=_blank}. However, if you'd like to use your own computer feel free to! If you're on Mac or Linux, open your terminal; If you're on Windows, use the Windows Subsystem for Linux (WSL)
??? tip "How to Scroll in Cyverse(Tmux) Cloud Shell"
If you're using the Cyverse Cloud Shell, you can scroll up and down by pressing `Ctrl + b` and then `[` to enter scroll mode. You can then use the arrow keys to scroll up and down. Press `q` to exit scroll mode.
!!! success "Tutorial Goals"
- Run a small workflow using NextFlow
- Understand best practices for reproducing a workflow
- Apply FOSS procedures in order to enable easiness of reproducibility
### Prerequisites
What you'll be using:
- [GitHub](https://github.com/){target=_blank} (already installed)
- [Conda](https://docs.conda.io/en/latest/){target=_blank}
- [Mamba](https://mamba.readthedocs.io/en/latest/installation.html){target=_blank} (optional, recommended)
Installable through Conda/Mamba:
- [Nextflow](https://www.nextflow.io/docs/latest/index.html){target=_blank}
- [Salmon](https://salmon.readthedocs.io/en/latest/){target=_blank}
- [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/){target=_blank}
Installabe through Pip:
- [MultiQC](https://multiqc.info/docs/){target=_blank}
??? question "What's a Conda and how do I install it?"
[Conda](https://docs.conda.io/en/latest/){target=_blank} is a popular tool for installing software. Typically software you want to use requires other software (dependancies) to be installed. Conda can manage all of this for you. Each available Conda package is part of a “recipe” that includes everything you need to run your software. There are different versions of Conda, including some specific for bioinformatics like [Bioconda](https://bioconda.github.io/){target=_blank}.
The CyVerse CLI already comes with Conda installed; Please follow these steps in order to install [MiniConda](https://docs.conda.io/en/latest/miniconda.html){target=_blank} (the lightweight version of Conda) on your system.
For the appropriate installation package, visit https://docs.conda.io/en/latest/miniconda.html. ⚠️ Note: **If you are using the WSL, install the Linux version!!**
```
# Download conda and add right permissions
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # Modify this to match the OS you're using.
chmod +x Miniconda3-latest-Linux-x86_64.sh
# install conda silenty (-b) and update (-u) and initial conda run
./Miniconda3-latest-Linux-x86_64.sh -b -u
~/miniconda3/bin/conda init
# Restart bash so that conda is activated
source ~/.bashrc
```
You'll be able to tell when conda is active when next `(base)` is present next to the to the shell prompt such as
```
(base) user@machine
```
Conda should now be installed and can be used to install other necessary packages!
When you start a Cyverse Cloud shell, it will start you in the directory:
```
/home/user/work
```
Let's change to the Data-Store directory, where we will be working for the rest of the tutorial. This is the Cyverse cloud-storage directory where you can put all your data and files.
```
cd home
cd
```
Create our own environment (select `y` when prompted).
```
conda create --name myenv
```
Activate your new environment with
```
conda activate myenv
```
You can see the list of environments you can activate by doing
```
conda env list
```
### Package management with Conda
We are going to to use conda to install Mamba, NextFlow, Salmon and FastQC.
```
# Activate Conda using
conda activate
# Install Mamba
conda install -c conda-forge mamba
```
You can either use the anaconda website to search for packager, or use the [conda search feature](https://docs.conda.io/projects/conda/en/latest/commands/search.html){target=_blank} (but also, Google is your best friend.)
!!! note "Makes things faster with Mamba"
Mamba is a reimplemetation of Conda using the C++ language, allowing for much quicker Conda experience. The tutorial is going to use **Mamba** instead of **Conda**, but you can always replace `mamba` with `conda`!
!!! info "Conda channels"
Conda operates through **channels**, specififc repositories where packages are stored. Specific packages sometimes may appear in multiple channels, however it is always helpful to specify a channel with the `-c` flag.
Install Nextflow and verify its installation with the following commands:
```
# Install NextFlow
mamba install -c bioconda nextflow=22.10.6 # Press y when prompted with [Y/n]!
# verify the installation
nextflow -version
```
Now that you know how to install packages with Conda/Mamba, install Salmon and FastQC.
??? question "Installing Packages"
As an exercise, install Salmon and FastQC using Conda/Mamba.
??? tip "Need a hand?"
```
mamba install -c bioconda salmon
mamba install -c bioconda fastqc
```
Or you can do it with a single line (doable if packages are from the *same* channel)!
```
mamba install -c bioconda salmon fastqc
```
You can view the installed conda packages by doing
```
conda list
```
In order to make your environment reproducible, conda allows you to export your environment.
```
conda env export > my_conda_env.yml
```
### Package management with Pip
Pip works similarly to Conda, as Pip is the package management supported by the Python Software foundation. If you use Python for your work it is likely you have installed packages using Pip.
We only have to install a single package required for this tutorial, MultiQC. To install MultiQC using Pip, do:
```
pip install multiqc
```
Similar to Conda, you can export your pip environment by doing
```
pip3 freeze > my_pip_env.txt
```
!!! note "Why `pip3`?"
`pip3` makes sure you are using the Python 3 version of pip. Python 2 reached end of life in 2020, so on most current systems `pip` and `pip3` point to the same Python 3 installation.
!!! success "Conda exports your Pip environment as well"
Exporting your environment using Conda (`conda env export > my_conda_env.yml`) will **ALSO** export your pip environment!
### Workflow Tutorial using Nextflow
!!! info "...what are we doing?"
In this tutorial (now that we have set up the environment, repository and pushed our first commit) we are going to:
- Index a [transcriptome](https://en.wikipedia.org/wiki/Transcriptome){target=_blank} file and quantification of DNA reads (using [Salmon](https://salmon.readthedocs.io/en/latest/){target=_blank}).
- Perform quality controls (with [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/){target=_blank}).
- Create a [MultiQC](https://multiqc.info/docs/){target=_blank} report.
!!! warning "I Don't know DNA stuff, can I still do this?"
Absolutely yes! This tutorial is supposed to introduce you to the process of reproducibility using GitHub repositories, package managers and workflow managers! You do not need to understand what each file is as this is meant to show how to make your science reproducible. Focus on understanding the process and theory behind the tutorial rather than the files themselves :fontawesome-regular-face-smile-beam:.
Nextflow is a workflow manager, similar to [Snakemake](https://snakemake.readthedocs.io/en/stable/){target=_blank}. For this tutorial, we decided to use Nextflow as it is easier to learn, more intuitive and user friendly than Snakemake.
Download the required files ([nf_foss_tut.tar.gz](https://unm-carc.github.io/foss/assets/tutorials/nf_foss_tut.tar.gz)) with `wget` and use `tar` to decompress them:
```
wget -O nf_foss_tut.tar.gz https://unm-carc.github.io/foss/assets/tutorials/nf_foss_tut.tar.gz
tar -xvf nf_foss_tut.tar.gz
```
We can now look at the decompressed directory structure by using `tree nf_foss_tut` (if you don not have `tree` installed, you can install it with `sudo apt-get install tree` or `mamba install -c conda-forge tree`).
```
.
├── nf_foss_tut
│ ├── data
│ │ └── ggal
│ │ ├── gut_1.fq
│ │ ├── gut_2.fq
│ │ ├── liver_1.fq
│ │ ├── liver_2.fq
│ │ ├── lung_1.fq
│ │ ├── lung_2.fq
│ │ └── transcriptome.fa
│ ├── example_script.nf
│ ├── script1.nf
│ ├── script2.nf
│ └── script3.nf
2 directories, 11 files
```
!!! info "Files information"
- Scripts 1 through 3 (`script.nf`) and `example_script.nf` are the NextFlow files
- `.fq` are fastq files, containing DNA sequences and quality scores
- `transcriptome.fa` is all of the RNA data from the organism (*G.gallus*)
Let's look at one of the NextFlow files (`.nf`)
!!! info "Understanding the Nextflow synthax"
Nextflow is powerful workflow manager as it can be deployed on HPCs and Clouds. However, it does require a little effort in order to understand its synthax.
The synthax is broken down into:
- Defining parameters early
- Defining Processes to be executed
- Defining Channels (blocks that work asynchronously that encapsulate other processes)
More complex scripts include [operators](https://www.nextflow.io/docs/latest/operator.html){target=_blank} (channel manipulation) and [executors](https://www.nextflow.io/docs/latest/executor.html){target=_blank} (to run things on the cloud and HPC); Nextflow can also be used to run and orchestrate [containers](https://www.nextflow.io/docs/latest/container.html){target=_blank}.
As a good example, let's look at `example_script.nf`:
```
/*
* pipeline input parameters
*/
params.reads = "$baseDir/data/ggal/gut_{1,2}.fq" #
params.transcriptome = "$baseDir/data/ggal/transcriptome.fa" # The parameters are set early in the script
params.multiqc = "$baseDir/multiqc" #
params.outdir = "results" #
println """\ #
R N A S E Q - N F P I P E L I N E #
=================================== #
transcriptome: ${params.transcriptome} # Print statement that will show once the script
reads : ${params.reads} # is executed
outdir : ${params.outdir} #
""" #
.stripIndent() #
/*
* create a transcriptome file object given then transcriptome string parameter
*/
transcriptome_file = file(params.transcriptome) # Convert input file to string
/*
* define the `index` process that create a binary index
* given the transcriptome file
*/
process index { # First process, named "index"
conda "bioconda::salmon" # Defines what package is necessary
#
input: ##
file transcriptome from transcriptome_file ##
## Defines the input and output of the process
output: ##
file 'index' into index_ch ##
#
script: #
""" #
salmon index --threads $task.cpus -t $transcriptome -i index # Command to execute
""" #
} #
Channel # Channels allows for scripts to work asynchronously, without waiting for received process.
.fromFilePairs( params.reads ) # .fromFilePairs method creates a channel emitting the file pairs matching a "glob" pattern provided by the user.
.ifEmpty { error "Cannot find any reads matching: ${params.reads}" } # .ifEmpty emits a value specified if no input is found.
.set { read_pairs_ch } # .set operator assigns the channel to a variable whose name is specified as a closure parameter.
#
process quantification { # Second process, named "quantification"
conda "bioconda::salmon" # Defines what package is necessary
input: #
file index from index_ch ##
set pair_id, file(reads) from read_pairs_ch ##
## Defines the input and output of the process
output: ##
file(pair_id) into quant_ch ##
#
script: #
""" #
salmon quant --threads $task.cpus --libType=U -i index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id # Command to execute
""" #
}
```
Nextflow has in-depth documentation that can be found [here](https://www.nextflow.io/docs/latest/){target=_blank}.
The 3 scripts' tasks are:
- Script 1 creates the transcriptome index file, necessary for downstream processes.
- Script 2 collects read files by pairs (fastq files come in pairs) and performs quantification.
- Script 3 performs quality control and summarizes all findings in a single report.
#### Script 1: Indexing transcriptome
Execute script 1
```
nextflow run script1.nf
```
The output will be something similar to
```
N E X T F L O W ~ version 22.10.6
Launching `script1.nf` [admiring_banach] DSL1 - revision: 66baaf0091
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: /home/user/work/folder/nf_foss_tut/data/ggal/transcriptome.fa
reads : /home/user/work/folder/nf_foss_tut/data/ggal/*_{1,2}.fq
outdir : results
executor > local (1)
[f0/0a72bc] process > index [100%] 1 of 1 ✔
```
This is Nextflow's way of telling you that the process has been executed and completed. You should now have a new folder called `work`. Execute `tree work` to see what is inside the folder.
```
work
└── f0
└── 0a72bc4d10dba1df2899b0449519e9
├── index
│ ├── duplicate_clusters.tsv
│ ├── hash.bin
│ ├── header.json
│ ├── indexing.log
│ ├── quasi_index.log
│ ├── refInfo.json
│ ├── rsd.bin
│ ├── sa.bin
│ ├── txpInfo.bin
│ └── versionInfo.json
└── transcriptome.fa -> /home/user/work/folder/nf_foss_tut/data/ggal/transcriptome.fa
3 directories, 11 files
```
These are new index files from the transcriptome provided.
#### Script 2: collecting pairs and performing quantification
Execute with
```
nextflow run script2.nf -resume --reads 'data/ggal/*_{1,2}.fq'
```
The output should look like
```
N E X T F L O W ~ version 22.10.6
Launching `script2.nf` [stupefied_swirles] DSL2 - revision: d3b0d0121c
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: /home/user/work/folder/nf_foss_tut/data/ggal/transcriptome.fa
reads : data/ggal/*_{1,2}.fq
outdir : results
executor > local(3)
[c1/6ece54] process > index [100%] 1 of 1, cached: 1 ✔
[1b/10b8d5] process > quantification (1) [100%] 3 of 3 ✔
```
#### Script 3: QC and report
Execute with
```
nextflow run script3.nf -resume --reads 'data/ggal/*_{1,2}.fq'
```
The output should look like
```
N E X T F L O W ~ version 22.10.6
Launching `script3.nf` [voluminous_goodall] DSL1 - revision: d118356290
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: /home/user/work/folder/nf_foss_tut/data/ggal/transcriptome.fa
reads : data/ggal/*_{1,2}.fq
outdir : results
executor > local (4)
[c1/6ece54] process > index [100%] 1 of 1, cached: 1 ✔
[7a/4e9ce4] process > quantification (lung) [100%] 3 of 3, cached: 3 ✔
[34/d60dbb] process > fastqc (FASTQC on lung) [100%] 3 of 3 ✔
[e9/e7c392] process > multiqc [100%] 1 of 1 ✔
Done! Open the following report in your browser --> results/multiqc_report.html
```
As you can notice, the report is an `html` file that can be opened with a browser. Navigate to this file in the Cyverse Data Store and open it.
---
### Essential Exercise: Documenting your Work
**Document your work.** You should still be in your GitHub folder. Summarize your steps and work on your README file, and push your changes! This will ensure that your work and files are saved and have a valid version that you can come back to in the future if you ever require to.
!!! warning "Prerequisites"
You will require the following in case you want to add code locally.
??? info "Create a GitHub account"
Navigate to the [GitHub website](https://github.com/){target=_blank} and click *Sign Up*, and follow the on screen instructions.
**Installing Git**
You can follow the official guidelines here: https://github.com/git-guides/install-git. Here we recommend how to install Git on your local machine.
??? info "Windows"
!!! warning "These instructions are for Windows users **NOT** using [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install){target=_blank}. If you do have WSL2, follow the **Unix** instructions."
1. Navigate to the [latest Git for Windows installer](https://gitforwindows.org/){target=_blank} and download the latest version.
2. Once the installer has started, follow the instructions as provided in the Git Setup wizard screen until the installation is complete.
3. Search and open **Git Bash**. From here, you should be able to run Git commands.
??? info "MacOS"
1. Install [Homebrew](https://brew.sh/){target=_blank} (a package manager for MacOS): `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
2. Install Git: `brew install git`
??? info "Unix"
The following command will install git and all related packages on your Unix machine.
```
$ sudo apt-get install -y git-all
```
Additionally, you can choose between Generating a Personal Access Token or using SSH keys. This is useful if you want to work locally and push your changes to GitHub. We are going to cover this further in next week's lesson on [Version Control](https://unm-carc.github.io/foss/lessons/05-version-control/).
??? info "Choice A: Generate a Personal Access Token"
You can follow the official documentation on how to generate Tokens [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens){target=_blank}. Token setup is also covered in the [Version Control lesson](https://unm-carc.github.io/foss/lessons/05-version-control/#adding-code-to-github-via-command-line). Here's are quick steps you can follow in order to setup your account on your machine using tokens:
1. On your coumputer:
1. Clone your repository (`git clone `)
2. Make changes where necessary, and **add** (`git add `), **commit** (`git commit -m ""`) and **push** your changes (`git push origin`).
3. You should be prompted to logging in your GitHub account. Put your email **but not your password**. Instead, open your web browser and follow the steps below:
2. On GitHub:
1. Navigate to your GitHub Settings (You can access your account Settings from the drop down menu where your account icon is, on the top right of the screen)
2. Scroll to the bottom of the left hand side menu to find *Developer settings* and open it.
3. Click *Personal access tokens* > *Tokens (classic)*
4. Click *Generate new token* > *Generate new token (classic)*. You might need to input your Authentification code if you have enabled 2FA.
5. Give it a name, and all the scopes you require (tip: select all scopes and *No Expiration*), then click *Generate Token*. **Copy the new generated Token**
3. Back on your computer:
1. If you have been following the steps above, you should still be in your shell with GitHub still asking for your password.
2. **Paste** your Token here, and you should be logging in. Your changes should then be saved to GitHub.
??? info "Choice B: Connecting via SSH"
The process of connecting your computer to GitHub using an SSH key is more expedited (and probably less confusing).
As a setup step, see if your computer is already connected to GitHub by doing `ssh -T git@github.com`. If the response message is `git@github.com: Permission denied (publickey).` it signifies that your computer is not yet linked with GitHub. To link your computer to github to the following:
1. Generate an SSH key with a level of encryption that you prefer: `ssh-keygen -t ed25519 -C `. This command generates an SSH key with [ed25519](https://ed25519.cr.yp.to/){target=_blank} encryption (harder to crack!) and adds your email as "comment" (`-C`, will help recongizing the user adding the key). A number of additional questions are going to ask you where you'd like to save the key and whether you'd like to add a password for protection; unless you want to save it elsewhere, feel free to use the default options. Upon completion you should see something like this:
```
Your identification has been saved in /c/Users//.ssh/id_ed25519
Your public key has been saved in /c/Users//.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:SMSPIStNyA00KPxuYu94KpZgRAYjgt9g4BA4kFy3g1o
The key's randomart image is:
+--[ED25519 256]--+
|^B== o. |
|%*=.*.+ |
|+=.E =.+ |
| .=.+.o.. |
|.... . S |
|.+ o |
|+ = |
|.o.o |
|oo+. |
+----[SHA256]-----+
```
2. Upon generating the ssh key, copy it. You can reveal it by doing `cat ~/.ssh/id_ed25519.pub`.
3. In GitHub, go to your settings: click your account icon on top right, and from the drop down menu, select *Settings* and then *SSH and GPG keys*. Here, click on *New SSH Key*, where you can then paste the newly geneated key. Add a name reflecting your machine and save changes.
Optional: if you want to check if you successfully linked your computer to GitHub, do `ssh -T git@github.com`. You should receive the following message: `Hi ! You've successfully authenticated, but GitHub does not provide shell access.
??? question "What if my files are too big?"
You can always use a `.gitignore`, a file that within itself has defined what should be saved in GitHub when pushing a commit, and what shouldn't be saved. An alternative is to move your files outside of the respository that you're pushing ("stashing").
#### GitHub repository setup and documentation
Create a repository on GitHub to document your work:
- On [GitHub](https://github.com/){target=_blank}, navigate to your account page and create a new repository (add a README to create structure!)
- Clone your repository locally with `git clone .git` (find the url under the green **Code** button)
- Navigate to your cloned repository with `cd `. You should now be inside your repository.
- Move your environemnt files into your repository with `mv ../my_conda_env.yml ../my_pip_env.txt .`.
- Modify your README to reflect the work so far, with meaningful comments (remember that the README is formatted with markdown, a guide to markdown [here](https://www.markdownguide.org/basic-syntax/){target=_blank}). A well documented document may look similar to:
````
# reproducibility-tutorial
This repository contains information about the reproduciblility tutorial from [FOSS 2023 Spring](https://unm-carc.github.io/foss/lessons/extra-nextflow/#reproducibility-tutorial).
## Environment Setup
- Download conda and add right permissions
```
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
```
- Install conda silenty (-b), update (-u) and initial start
```
./Miniconda3-latest-Linux-x86_64.sh -b -u
~/miniconda3/bin/conda init
```
- Restart bash so that conda is activated
```
source ~/.bashrc
```
- Install Mamba
```
conda install -c conda-forge mamba
```
- Use environment files in this repo to recreate tutorial env
```
mamba env create -f my_conda_env.yml # Will also install pip packages
```
## Obtaining tutorial files
Tutorial files avaiable [here](https://unm-carc.github.io/foss/assets/tutorials/nf_foss_tut.tar.gz). Use `wget` to download appropriate files and decompress files with `tar -xvf`.
```
wget -O nf_foss_tut.tar.gz https://unm-carc.github.io/foss/assets/tutorials/nf_foss_tut.tar.gz
tar -xvf nf_foss_tut.tar.gz
```
## Workflow tutorial using Nextflow
Steps of the nextflow tutorial will be added in future commits.
````
- Add, commit and push your changes
```
git add .
git commit -m "documenting the tutorial"
git push
```
---
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/nextflow.md){target=_blank} (last source update 2024-07-02), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.
---8<--- https://unm-carc.github.io/foss/capstone/overview/
---
title: "Capstone Project Overview"
description: "Objectives, example projects, and presentation prompts for the FOSS capstone, in which learners apply a course skill to their own work."
type: Guide
tags:
- Capstone
- Projects
generated:
by: "claude/opus-5"
at: "2026-09-11T00:00:00Z"
sources:
- id: cyverse-foss
resource: "https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/final_project/overview.md"
title: "CyVerse FOSS: docs/final_project/overview.md"
author: "team:cyverse"
last_modified: "2024-10-10T09:02:48-07:00"
---
# Capstone Project Overview
The capstone project for FOSS is designed to give you the opportunity to apply some of the skills and ideas from the rest of the course to one of your own projects, get support and feedback from your peers, and share your experiences with the rest of the attendees.
---
## Objectives
- "Level up" the openness of an existing or planned project
- Apply a skill or concept from FOSS
- Discuss your applied skills/concepts with groupmates
- Determine possible next steps to "level up" your project
- Share your experiences with the rest of the attendees
---
## Description
Choose one (or more) skill(s) or concept(s) from FOSS and apply it to one of your own projects. Here are some example projects you might consider:
!!! tip "Example Projects"
- Make a fully developed Data Management Plan (DMP) for a current or future project
- Deposit your data in an open repository that is appropriate for your field (cannot be a previous effort)
- Create a Git repository that shares code or data from a current project. Must have a detailed README that explains exactly how colleagues would use the code or data. Repo should provide an 'environment' file that allows others to reproduce your environment on their computer OR the scripts should be containerized.
- Create a fully developed personal website hosted in Github
- Create documentation of a project, tool, or workflow using Mkdocs or similar template
- Develop an educational tutorial or how-to guide to teach colleagues some aspect of your research. Use mkdocs or similar template on the web.
- Pre-register a protocol on a platform like Open Science Framework
- Publish a protocol on protocols.io or other 'protocol' website
- Conduct an open peer-review of new research in a preprint server
- Demonstrate how you are using a remote computing resource to run your analyses (e.g., Cyverse, HPC)
You should have your skill/topic chosen by **Week 8**, and you will then
enter your name/topic into a spreadsheet (shared during the week 8 session). We'll use this to help learners find others working on similar projects.
- You can do a project completely solo
- You can work solo, but join a 'support group' to:
1. discuss your experiences applying your skill or concept
2. give each other help with sticking point you may encounter
- You can work directly with a FOSS colleague on a joint project
### Final Presentations
Each student or group will deliver a short (3-7 minute) presentation to the rest of the class on the final day of the course (see the [schedule](https://unm-carc.github.io/foss/course/schedule/))
Your short presentation should focus on the challenges and tips you may have for other FOSS attendees who want to utilize your skill or concept in the future. Here are some prompts that you should address during your presentation:
!!! tip "Presentation Thoughts"
- What was the general topic or skill that members of your group worked on?
- What are some challenges you encountered while working on your projects?
- Were you able to overcome these challenges? If so, how?
- Where did you look for help?
- Do any roadblocks remain? How might you try to overcome them?
- Are there any new things you learned while working on your project?
- Did you end up using any new or different tools?
- What are some tips you might have for other FOSS attendees who want to work on the same topic/skill in the future?
- Are there any pitfalls to avoid?
- What things do you want to do next?
- How might you "level up" in the current topic/skill compared to your project's current state?
- Are there any other FOSS skills that you want to tackle next? If so, how might they integrate with the topic/skill you focused on for your project?
Adapted from [CyVerse FOSS](https://github.com/CyVerse-learning-materials/foss/blob/86d4cc384976a59bd19cce2a6fdcf994b19051bd/docs/final_project/overview.md){target=_blank} (last source update 2024-10-10), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/foss/issues){target=_blank}.