r script is not working in snakemake
2
0
Entering edit mode
19 months ago

Hi everyone, I created a snake file to download GEO datasets, I get this error message

rule download:
output: downloads/GSE67311.tar
jobid: 0

/bin/sh: 1: 1: not found
Error submitting jobscript (exit code 127):

Will exit after finishing currently running jobs.
Exiting because a job execution failed. Look above for error message

Here is the snakefile

configfile: "config.yml"
rule all:
    input:
        expand("downloads/{sample}.tar", sample=config["samples"])
rule download:
    output:
        "downloads/{sample}.tar"
    shell:
        "Rscript GH.R"

Here is the R script

library(GEOquery)
getGEOSuppFiles(snakemake@input)

How can I solve this?

snakemake geoquery r • 1.7k views
ADD COMMENT
3
Entering edit mode
19 months ago

You have two choices and one problem

  • put GH.R in the special scripts directory, a recent Snakemake invention, and don't use RScript. You don't have input so you'll need to rethink that snakemake@input syntax.
  • use Rscript GH.R {wildcards.sample} but instead use args = commandArgs(trailingOnly=TRUE).
ADD COMMENT
0
Entering edit mode

still the same error message, here is what I did 1- moved to scripts folder, (NB. I am using wsl-2)

snake file

    configfile: "config.yml"
    rule all:
        input:
            expand("downloads/{sample}.tar", sample=config["samples"])
    rule download:
        output:
            "downloads/{sample}.tar"
        shell:
            "Rscript scripts/GH.R {wildcards.sample}"

the R script

args = commandArgs(trailingOnly=TRUE)

library(GEOquery)
getGEOSuppFiles("args")

Did I do it right ?

ADD REPLY
2
Entering edit mode

probably it should be:

getGEOSuppFiles(args[1])
ADD REPLY
0
Entering edit mode
19 months ago

Thank you, it did work this way. It downloaded one of the files and then had this error message, I increased the latency time and looked online for a solution, normally increase latency time solves the problem but it did not work for mine

 MissingOutputException in line 5 of /mnt/d/metaa/snakefile.smk:
    Job Missing files after 1000 seconds. This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait:
    /mnt/d/metaa/downloads/GSE67311.tar completed successfully, but some output files are missing. 2
    Shutting down, this might take some time.
    Exiting because a job execution failed. Look above for error message
    Complete log: .snakemake/log/2022-09-01T064501.006303.snakemake.log

snake file

configfile: "config.yml"
rule all:
    input:
        expand("/mnt/d/metaa/downloads/{sample}.tar", sample=config["samples"])
rule download:
    output:
        "/mnt/d/metaa/downloads/{sample}.tar"
    shell:
        "Rscript scripts/GH.R {wildcards.sample}"
ADD COMMENT
0
Entering edit mode

probably because you didn't tell getGEOSuppFiles where to put the files it downloaded. Try the baseDir argument. https://www.rdocumentation.org/packages/GEOquery/versions/2.38.4/topics/getGEOSuppFiles

You seem to be stabbing at making the Snakefile run instead of testing the individual compoennts. First run your script in an R session. Then using the Rscript. Then try running the download rule with one file target. Then try your all.

ADD REPLY

Login before adding your answer.

Traffic: 2571 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6