This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, re | |
def modpath(p, parent=None, base=None, suffix=None): | |
par, name = os.path.split(p) | |
name_no_suffix, suf = os.path.splitext(name) | |
if type(suffix) is str: | |
suf = suffix | |
if parent is not None: | |
par = parent | |
if base is not None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gwf import Workflow, AnonymousTarget | |
def mask_template(path): | |
inputs = {'path': path} | |
outputs = {'path': path + '.masked'} | |
options = {} | |
spec = """./some_command {}""".format(path) | |
return AnonymousTarget(inputs=inputs, outputs=outputs, options=options, spec=spec) | |
def step_one_template(path): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gwf import Workflow, AnonymousTarget | |
from groups import Group # separate Gist | |
def mask_template(path): | |
inputs = {'path': path} | |
outputs = {'path': path + '.masked'} | |
options = {} | |
spec = """./some_command {}""".format(path) | |
return AnonymousTarget(inputs=inputs, outputs=outputs, options=options, spec=spec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gwf import Workflow, AnonymousTarget | |
def mask_template(path): | |
inputs = {'path': path} | |
outputs = {'path': path + '.masked'} | |
options = {} | |
spec = """./some_command {}""".format(path) | |
return AnonymousTarget(inputs=inputs, outputs=outputs, options=options, spec=spec) | |
def step_one_template(path): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gwf import Workflow, AnonymousTarget | |
def mask_template(path): | |
inputs = {'path': path} | |
outputs = {'path': path + '.masked'} | |
options = {} | |
spec = """./some_command {}""".format(path) | |
return AnonymousTarget(inputs=inputs, outputs=outputs, options=options, spec=spec) | |
def step_one_template(path): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def optimize_dataframe(df): | |
converted_df = pandas.DataFrame() | |
floats_optim = (df | |
.select_dtypes(include=['float']) | |
.apply(pandas.to_numeric,downcast='float') | |
) | |
converted_df[floats_optim.columns] = floats_optim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export -f conda | |
export -f __conda_activate | |
export -f __conda_reactivate | |
export -f __conda_hashr | |
export -f __add_sys_prefix_to_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
overlap = (start1 <= start2 < end1 or | |
start1 <= end2 < end1 or | |
start2 <= start1 < end2 or | |
start2 <= end1 < end2) | |
# same as: | |
overlap = not (end1 <= start2 or end2 <= start1) | |
# same as: | |
overlap = not (end1 <= start2) and not (end2 <= start1) | |
# same as (by De Morgan's laws): | |
overlap = end1 > start2 and end2 > start1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%html | |
<style> table { font-variant-numeric: tabular-nums; } </style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
# proxies for internet access on the cluster | |
%env http_proxy=http://proxy-default:3128 | |
%env https_proxy=http://proxy-default:3128 | |
import numpy as np | |
import pandas as pd | |
from pandas import DataFrame, Series | |
import warnings |
OlderNewer