Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Feb 13, 2017
2 parents 7ac45d4 + e777ad7 commit a2bbe11
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 56 deletions.
73 changes: 43 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
# First, ignore everything
*
# Now, whitelist anything that's a directory
!*/
# ignore test results

tests/test/*

#keep everything in data
!metadata/*
results_pipeline/
results_analysis
resources/
pipelines/pypiper
# ignore built docs
doc/build/*

# And all the file types you're interested in.
!*.sh
!*.R
!*.pl
!*.py
!*.c
!*.md
!*.sub
!*readme.txt*
!*README.txt*
!*readme.md*
!*README.md*
!*.rst
# generic ignore list:

!*.xlsx
!*.yaml
!*.tsv
# Compiled source
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Packages
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases
*.log
*.sql
*.sqlite

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

#make sure to track .gitignore
!.gitignore
# Gedit temporary files
*~

# ignore test results
tests/test/*
# libreoffice lock files:
.~lock*
52 changes: 27 additions & 25 deletions looper/looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,31 +239,33 @@ def run(prj, args, remaining_args):
# these arguments, then it should list looper_args=True and then we
# should add the arguments to the command string.

# Check for a pipeline config file
if hasattr(prj, "pipeline_config"):
# Index with 'pl_id' instead of 'pipeline' because we don't care about
# parameters here.
if hasattr(prj.pipeline_config, pl_id):
# First priority: pipeline config specified in project config
pl_config_file = getattr(prj.pipeline_config, pl_id)
if pl_config_file: # make sure it's not null (which it could be provided as null)
if not os.path.isfile(pl_config_file):
print("Pipeline config file specified but not found: " + pl_config_file)
raise IOError(pl_config_file)
print("Found config file:" + getattr(prj.pipeline_config, pl_id))
# Append arg for config file if found
cmd += " -C " + pl_config_file

# Append output parent folder
cmd += " -O " + prj.metadata.results_subdir

# Append arg for cores (number of processors to use)
if submit_settings["cores"] > 1:
cmd += " -P " + submit_settings["cores"]

# Append arg for memory
if submit_settings["mem"] > 1:
cmd += " -M " + submit_settings["mem"]
if pipeline_interface.uses_looper_args(pl_id):

# Check for a pipeline config file
if hasattr(prj, "pipeline_config"):
# Index with 'pl_id' instead of 'pipeline' because we don't care about
# parameters here.
if hasattr(prj.pipeline_config, pl_id):
# First priority: pipeline config specified in project config
pl_config_file = getattr(prj.pipeline_config, pl_id)
if pl_config_file: # make sure it's not null (which it could be provided as null)
if not os.path.isfile(pl_config_file):
print("Pipeline config file specified but not found: " + pl_config_file)
raise IOError(pl_config_file)
print("Found config file:" + getattr(prj.pipeline_config, pl_id))
# Append arg for config file if found
cmd += " -C " + pl_config_file

# Append output parent folder
cmd += " -O " + prj.metadata.results_subdir

# Append arg for cores (number of processors to use)
if submit_settings["cores"] > 1:
cmd += " -P " + submit_settings["cores"]

# Append arg for memory
if submit_settings["mem"] > 1:
cmd += " -M " + submit_settings["mem"]

# Add the command string and job name to the submit_settings object
submit_settings["JOBNAME"] = sample.sample_name + "_" + pipeline
Expand Down
10 changes: 9 additions & 1 deletion looper/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def check_sheet(self, dtype):
missing = [col for col in req if col not in self.df.columns]

if len(missing) != 0:
raise ValueError("Annotation sheet is missing columns: %s" % " ".join(missing))
raise ValueError("Annotation sheet (" + str(self.csv) + ") is missing columns: %s" % " ".join(missing))

def make_sample(self, series):
"""
Expand Down Expand Up @@ -1242,6 +1242,14 @@ def select_pipeline(self, pipeline_name):

return(self.looper_config[pipeline_name])

def uses_looper_args(self, pipeline_name):
config = self.select_pipeline(pipeline_name)

if hasattr(config, "looper_args") and config.looper_args:
return True
else:
return False

def get_pipeline_name(self, pipeline_name):
"""
:param pipeline_name: Name of pipeline.
Expand Down
1 change: 1 addition & 0 deletions tests/data/a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the content of test file a.
1 change: 1 addition & 0 deletions tests/data/b1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the content of test file b1.
1 change: 1 addition & 0 deletions tests/data/b2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the content of test file b2.
1 change: 1 addition & 0 deletions tests/data/b3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the content of test file b3.
1 change: 1 addition & 0 deletions tests/data/c.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the content of test file c.
Binary file added tests/data/d-bamfile.bam
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/merge.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sample_name,file,file2,dcol1,col_modifier
b,src1,src1,src1,1
b,src1,src1,src1,2
b,src1,src1,src1,3
12 changes: 12 additions & 0 deletions tests/pipe_nolooperargs/config/pipeline_interface.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
testpipeline.sh:
name: test_pipeline
looper_args: False
arguments:
"--input": file
resources:
default:
file_size: "0"
cores: "8"
mem: "32000"
time: "2-00:00:00"
partition: "longq"
2 changes: 2 additions & 0 deletions tests/pipe_nolooperargs/config/protocol_mappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
testlib: testpipeline.sh
testngs: testngs.sh
3 changes: 3 additions & 0 deletions tests/pipe_nolooperargs/pipelines/testngs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo $@
3 changes: 3 additions & 0 deletions tests/pipe_nolooperargs/pipelines/testpipeline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo $@
5 changes: 5 additions & 0 deletions tests/samples.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sample_name,library,file,file2,organism,nonmerged_col,data_source,dcol2
a,testlib,src3,src3,,src3,src3,
b,testlib,,,,src3,src3,src1
c,testlib,src3,src3,,src3,src3,
d,testngs,src2,src3,human,,src3,

0 comments on commit a2bbe11

Please sign in to comment.