Skip to content

Instantly share code, notes, and snippets.

@johnbradley
johnbradley / TwoRepoProblem.md
Created May 16, 2024 14:28
Instructions to help with a duplicated private and public repos

Two Repo Problem

When working on a research project often the code is kept private until a paper is published. In conflict with this is the need to have a public repo to support some of the following needs:

  • Serve a website via a ghpages branch
  • Act as a placeholder for when the paper is published
  • Share previous code from earlier paper

The typical approach is to have one public git repo and one private git repo.

Merging Code Problem

from morphosource import search_media
from functools import wraps
from time import time
import requests
from bs4 import BeautifulSoup
def timing(f):
@wraps(f)
def wrap(*args, **kw):
ts = time()
@johnbradley
johnbradley / python-bin-dir
Created November 13, 2020 19:13
Command to print out the likely bin directory for console_scripts
python3 -c 'import sys; print(sys.exec_prefix + "/bin")'
@johnbradley
johnbradley / echo-passing-array.cwl
Last active December 3, 2019 21:09
CWL workflow that demonstrates a TypeError when run with toil
class: Workflow
cwlVersion: v1.1
requirements:
- class: SubworkflowFeatureRequirement
- class: MultipleInputFeatureRequirement
inputs:
str1:
type: string
default: "red"
str2:
import re
with open("toiloutput.log") as infile:
lines = infile.readlines()
jobs = {}
for line in lines:
time, end = line.strip().split(" ")
time = re.sub(r',.*', '', time)
{
"$graph": [
{
"class": "Workflow",
"label": "exomeseq-gatk4/v2.0.0",
"doc": "Whole Exome Sequence analysis using GATK4 - v2.0.0",
"requirements": [
{
"class": "ScatterFeatureRequirement"
},
{
"$graph": [
{
"class": "Workflow",
"label": "exomeseq-gatk3/v4.1.1",
"doc": "Whole Exome Sequence analysis using GATK3 - v4.1.1",
"requirements": [
{
"class": "ScatterFeatureRequirement"
},
{
"$graph": [
{
"class": "Workflow",
"doc": "Reverse the lines in a document, then sort those lines.",
"requirements": [
{
"class": "ScatterFeatureRequirement"
}
],
{
"class": "CommandLineTool",
"inputs": [
{
"type": "File",
"id": "#main/file1"
}
],
"outputs": [
{
@johnbradley
johnbradley / small_exome.py
Last active October 1, 2018 15:38
Example Bespin command line python script
# command line program to demonstrate how to run exomeseq workflow
# against some files stored in a DukeDS project.
# Should be run within a python enviroment that has installed `bespin-cli`.
# Assumes that bespin-cli and DukeDSClient config files are already setup.
# command line program to demonstrate how to run exomeseq workflow
# against some files stored in a DukeDS project
# does not handle a read split across multiple files
from __future__ import print_function