Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/test' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-badretdin committed Aug 10, 2022
2 parents f8c8990 + 733ab71 commit bd40b1d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 39 deletions.
37 changes: 5 additions & 32 deletions progs/align_filter.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,14 @@ label: "align_filter"
class: CommandLineTool

baseCommand: align_filter
# this is only one example
#
#
#
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/system/2018-03-13.build2663/bin/align_filter \
# -onon-match \
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/data56/Mycoplasma_genitalium_G37/Mycoplasma_genitalium_External_PGAP.4585524/4829637/align_filter_sa.455675142/out/align-nomatch.asn \
# -asn-cache \
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/data56/Mycoplasma_genitalium_G37/Mycoplasma_genitalium_External_PGAP.4585524/sequence_cache \
# -filter \
# 'pct_coverage \
# >= \
# 20' \
# -ifmt \
# seq-align \
# -input-manifest \
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/data56/Mycoplasma_genitalium_G37/Mycoplasma_genitalium_External_PGAP.4585524/4829637/align_filter_sa.455675142/inp/align.mft \
# -logfile \
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/data56/Mycoplasma_genitalium_G37/Mycoplasma_genitalium_External_PGAP.4585524/4829637/align_filter_sa.455675142/log/align_filter.log \
# -o \
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/data56/Mycoplasma_genitalium_G37/Mycoplasma_genitalium_External_PGAP.4585524/4829637/align_filter_sa.455675142/out/align.asn
#
#
#
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/system/2018-03-13.build2663/bin/gp_register_stats \
# -ifmt \
# seq-align \
# -input \
# /panfs/pan1.be-md.ncbi.nlm.nih.gov/gpipe/bacterial_pipeline/data56/Mycoplasma_genitalium_G37/Mycoplasma_genitalium_External_PGAP.4585524/4829637/align_filter_sa.455675142/out/align.asn
#
#
#
requirements:
- class: InlineJavascriptRequirement
- class: InitialWorkDirRequirement
listing:
- entryname: aligns.mft
entry: ${var blob = '# aligns.mft created for align_filter from input "input" Array of Files\n'; for (var i = 0; i < inputs.input.length; i++) { blob += inputs.input[i].path + '\n'; } return blob; }
- entryname: subject_allowlist.mft
entry: ${var blob = '# subject_allowlist.mft created for align_filter from input "subject_allowlist" File\n'; if ( inputs.subject_allowlist == null) { return blob; } else { blob += inputs.subject_allowlist.path + '\n'; return blob; }}

inputs:
asn_cache:
Expand Down Expand Up @@ -71,6 +41,9 @@ inputs:
prefix: -nogenbank
subject_allowlist:
type: File?
subject_allowlist_mft:
type: string?
default: subject_allowlist.mft
inputBinding:
prefix: -subject-allowlist
onon_match_name:
Expand Down
21 changes: 14 additions & 7 deletions scripts/pgap.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def __init__(self, params, local_input, pipeline):
else:
self.submol = None
self.yaml = self.create_inputfile(local_input)
if (self.params.docker_type == 'singularity'):
if self.params.docker_type in ['singularity', 'apptainer']:
self.make_singularity_cmd()
elif (self.params.docker_type == 'podman'):
elif self.params.docker_type == 'podman':
self.make_podman_cmd()
else:
self.make_docker_cmd()
Expand Down Expand Up @@ -395,7 +395,7 @@ def check_runtime_setting(settings, value, min):
if settings[value] != 'unlimited' and settings[value] < min:
print('WARNING: {} is less than the recommended value of {}'.format(value, min))

if (self.params.docker_type == 'singularity'):
if (self.params.docker_type in ['singularity', 'apptainer']):
singularity_docker_image = self.params.docker_image if self.params.args.container_path else "docker://"+self.params.docker_image
cmd = [self.params.docker_cmd, 'exec', '--bind', '{}:/cwd:ro'.format(os.getcwd()), singularity_docker_image,
'bash', '-c', 'df -k /cwd /tmp ; ulimit -a ; cat /proc/{meminfo,cpuinfo}']
Expand Down Expand Up @@ -486,7 +486,12 @@ def __init__(self, args):
self.ani_hr_output = None
self.branch = self.get_branch()
self.repo = self.get_repo()
self.install_dir = os.environ.get('PGAP_INPUT_DIR',os.environ['HOME']+'/.pgap')

if platform.system() == 'Windows':
self.install_dir = os.environ.get('PGAP_INPUT_DIR',os.environ['USERPROFILE']+'/.pgap')
else:
self.install_dir = os.environ.get('PGAP_INPUT_DIR',os.environ['HOME']+'/.pgap')

self.local_version = self.get_local_version()
if self.args.no_internet:
self.remote_versions = [self.local_version]
Expand Down Expand Up @@ -604,7 +609,7 @@ def get_output_dir(self):
return outputdir

def get_docker_info(self):
docker_type_alternatives = ['docker', 'podman', 'singularity']
docker_type_alternatives = ['docker', 'podman', 'singularity', 'apptainer']
if self.args.docker:
self.docker_cmd = shutil.which(self.args.docker)
else:
Expand Down Expand Up @@ -653,6 +658,8 @@ def str2sec(s):
return str2sec(self.args.timeout)

def update(self):
print(f"installation directory: {self.install_dir}")
subprocess.run(["/bin/df", "-k", self.install_dir])
self.update_self()
threads = list()
docker_thread = mp.Process(target = self.install_docker, name='docker image pull')
Expand All @@ -674,7 +681,7 @@ def update(self):
self.write_version()

def install_docker(self):
if self.docker_type == 'singularity':
if self.docker_type in ['singularity', 'apptainer']:
sif = self.docker_image.replace("ncbi/pgap:", "pgap_") + ".sif"
try:
subprocess.run([self.docker_cmd, 'sif', 'list', sif],
Expand Down Expand Up @@ -847,7 +854,7 @@ def main():
If flag is set, run ANI first, then PGAP, overriding the organism name provided by the user in the input YAML with the value returned by ANI Predicted organism. Obviously both actions need to be requested for this flag to take effect
''')
parser.add_argument('-D', '--docker', metavar='path',
help='Docker-compatible executable (e.g. docker, podman, singularity), which may include a full path like /usr/bin/docker')
help='Docker-compatible executable (e.g. docker, podman, apptainer), which may include a full path like /usr/bin/docker')
parser.add_argument('-o', '--output', metavar='path', default='output',
help='Output directory to be created, which may include a full path')
parser.add_argument('-t', '--timeout', default='24:00:00', help=argparse.SUPPRESS)
Expand Down

0 comments on commit bd40b1d

Please sign in to comment.