bcgsc/LongStitch

Add snakemake wrapper

Opened this issue · 5 comments

Hi Lauren,

Given the growing community of snakemake and also its broad application I suggest adding longstitch to a wrapper so it's easier to run it in a snakefile. So far it's a bit awkward.

Some more details here: https://snakemake.readthedocs.io/en/latest/snakefiles/modularization.html?highlight=wrapper

Cheers
Kristina

Hi Kristina,

Sure, I'm happy to look into that! Just so I know (I'm less familiar with snakefiles), could you explain what's awkward right now about calling the longstitch makefile itself within a rule in a snakefile?

Thanks!
Lauren

Its mostly the fact of running longstitch from the current directory (create symlinks and move the output to another directory). I am processing multiple samples with snakemake and I am trying to keep all the sample files under separate dir.

Just documenting our Slack conversation here!

For running LongStitch in a given directory, -C dir option of makefiles is useful. I'm going to look into adding another rule to the LongStitch make_links or similar that can take in the paths to the input files, and create soft-links in the working directory (or directory specified by -C)

This finally worked out

rules my_rule:
....
shell:
    """
    mkdir -p out_dir/{wildcards.sample} && \
    longstitch make_links -C {params.cur_dir}/out_dir/{wildcards.sample} reads_path={params.cur_dir}/{input.fastq} 
    draft_path={params.cur_dir}/{input.assembly} && \
    longstitch run -C {params.cur_dir}/out_dir/{wildcards.sample} out_prefix={wildcards.sample} draft={wildcards.sample} reads 
    {wildcards.sample}
    """
  • Anything after -C needs to be always full path
  • longstitch make_links requires full path for reads_path and draft_path
  • longstitch run doesn't require a full path for reads and draft

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your interest in LongStitch!