Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows issue fix #14

Open
wants to merge 5 commits into
base: seriatim
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions bin/passim.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
@echo off
call %~dp0seriatim --all-pairs ^
--fields "xxhash64(series)^ as^ gid" -f gid^<gid2 %*

:: Replace special characters <, >, |, & in all arguments with a placeholder
:: which will be replaced with the original character in seriatim.py
:: NB: unfortunately, this does not work with the equals sign; use _EQ_, _LTE_ and _GTE_ instead.

:: make sure variables are not expanded before the script is run:
SETLOCAL EnableDelayedExpansion

:: first, set up an empty variable that will contain all modified variables:
set modifiedArgs=

:: loop through all arguments passed to the script (%*)
:: and replace all special characters in them
:: finally, add each argument to the modified arguments list
for %%i in (%*) do (
set arg=%%i
set arg=!arg:^<=_LT_!
set arg=!arg:^>=_GT_!
set arg=!arg:^|=_PIPE_!
set arg=!arg:^&=_AMPERSAND_!
set modifiedArgs=!modifiedArgs! !arg!
echo !arg!
)
::echo MODIFIED ARGS:
::echo %modifiedArgs%

echo %~dp0seriatim.cmd --all-pairs --fields "xxhash64(series) as gid" -f gid_LT_gid2 %modifiedArgs%
call %~dp0seriatim.cmd --all-pairs --fields "xxhash64(series) as gid" -f gid_LT_gid2 %modifiedArgs%
9 changes: 9 additions & 0 deletions passim/seriatim.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@ def clusterJoin(self, config, corpus):

setattr(DataFrame, 'clusterJoin', clusterJoin)

def replace_placeholders(s):
try:
return s.replace("_LT_", "<").replace("_LTE_", "<=").replace("_GT_", ">").replace("_GTE_", ">=").replace("_PIPE_", "|").replace("_AMPERSAND_", "&")
except:
return s

def main(args):
parser = argparse.ArgumentParser(description='Passim Alignment',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
Expand Down Expand Up @@ -597,6 +603,9 @@ def main(args):
parser.add_argument('outputPath', metavar='<path>', help='output')
config = parser.parse_args(args)

# replace placeholders in the relevant arguments:
config.filterpairs = replace_placeholders(config.filterpairs)
config.link_features = replace_placeholders(config.link_features)
print(config)

spark = SparkSession.builder.appName('Passim Alignment').getOrCreate()
Expand Down