A phylogenetic tree pruning App Engine application written in Go 1.25.
Tree Pruner is a Google App Engine web application designed for phylogenetic tree pruning. It's part of the "Map of Life" project and specifically works with bird and shark phylogenetic trees from BirdTree.org and SharkTree.org.
- Phylogenetic Tree Pruning: Takes large phylogenetic trees and creates smaller, pruned versions containing only the species you specify
- Multiple Tree Sets: Supports various tree sets including:
- Ericson trees (All Species and Sequenced Species)
- Hackett trees (All Species and Sequenced Species)
- Stage2 trees with different configurations
- Random Sampling: Randomly samples from up to 10,000 trees in a given tree set
- Cloud Storage Integration: Uses Google Cloud Storage to store input trees and output results
- Web API: Provides REST endpoints for submitting jobs and checking results
- User submits a request with species names, tree set, sample size, and email
- System randomly selects trees from the specified tree set
- Each tree is pruned to contain only the requested species
- Results are compiled into a single output file
- User receives download link for results
- Go 1.25 or later
- Google Cloud SDK
- Access to Google Cloud Storage
- A Google Cloud project with App Engine enabled
-
Install Go 1.25:
# Download and install Go 1.25 from https://golang.org/dl/ go version # Should show go1.25.x
-
Set up Google Cloud Storage - the app expects specific bucket structure:
/data.vertlife.org/processing/{tree_base}/sources/single_trees/for input trees/data.vertlife.org/pruned_treesets/for output results
-
Install dependencies:
go mod tidy
# Set up authentication
export GOOGLE_APPLICATION_CREDENTIALS="path/to/your/service-account-key.json"
# Run the application
go run main.goThe app will be available at http://localhost:8080
-
Submit pruning job:
POST /api/prune- Parameters:
sample_size,tree_base,tree_set,species,email - Example:
http://localhost:8080/api/prune?sample_size=100&tree_set=EricsonStage1Full&species=Tinamus%20tao,Tinamus%20solitarius,Tinamus%20osgoodi,Tinamus%20major,Tinamus%20guttatus&email=user@example.com
- Parameters:
-
Check job status:
GET /api/result- Parameters:
job_id,email - Returns job status and download URL when complete
- Parameters:
-
Health check:
GET /- Returns service health status
# Deploy to Google App Engine
gcloud app deploy app.yaml- Language: Migrated from Python 2.7 to Go 1.25
- Framework: Replaced webapp2 with Gorilla Mux
- Storage: Updated to use Google Cloud Storage Go client library
- Performance: Go's compiled nature provides better performance
- Concurrency: Native goroutines for better concurrent processing
- Type Safety: Strong typing helps prevent runtime errors
- main.go: Main application with HTTP handlers
- app.yaml: App Engine configuration for Go 1.25
- go.mod: Go module dependencies
- Cloud Storage: Used for storing input trees and output results
- Background Processing: Uses goroutines for async job processing
- This is a simplified version that simulates tree pruning
- In production, you'd integrate with actual phylogenetic tree libraries
- The application maintains the same API interface as the original Python version
- All file operations use Google Cloud Storage instead of local filesystem