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

Snakemake Pipeline Issue #2886

Closed
AzlanNI opened this issue May 20, 2024 · 2 comments
Closed

Snakemake Pipeline Issue #2886

AzlanNI opened this issue May 20, 2024 · 2 comments

Comments

@AzlanNI
Copy link

AzlanNI commented May 20, 2024

Hello together i am using Snakemake to create a tool with my different bash and python scripts. I am really new to Snakemake so i guess i am doing something wrong here. THis is my Skript

input_csv = os.getenv("INPUT_CSV")
output_dir = os.getenv("OUTPUT_DIR")
Motif_list = os.getenv("MOTIF_LIST")
data = pd.read_csv(input_csv)

input_base = os.path.splitext(os.path.basename(input_csv))[0]
updated_csv = os.path.join(output_dir, f"{input_base}_updated.csv")

bed_files = expand(os.path.join(output_dir, "{file_name}.bed"), file_name=data['File_name'].tolist())

rule all:
    input:
        updated_csv,
        bed_files

rule run_python_script:
    input:
        input_csv
    output:
        updated_csv
    shell:
        """
        python /Users/azlannisar/Desktop/Skripts/Check_python_snaky.py {input} {output}
        """

rule run_modkit:
    conda:
        "/Users/azlannisar/Snakemake_project_Mikrob/environment.yaml"
    input:
        csv_file=updated_csv
    output:
        os.path.join(output_dir, "{file_name}.bed")
    params:
        reference_path=lambda wildcards: data[data['File_name'] == wildcards.file_name].iloc[0]['Reference_path'],
        pod5_path=lambda wildcards: data[data['File_name'] == wildcards.file_name].iloc[0]['pod5_path']
    shell:
        """
        modkit pileup {params.pod5_path}/*_sorted.bam {output} --ref {params.reference_path}
        """

rule run_5mC_analysis_script:
    input:
        csv_list="/Users/azlannisar/Snakemake_Test/Data_Test2_updated.csv",
        motif_list="/Users/azlannisar/Motifs_5mC.txt"
    params:
        output_dir="/Users/azlannisar/Snakemake_Test"
    conda:
        "/Users/azlannisar/Snakemake_project_Mikrob/analysis.yaml"
    shell:
        """
        python /Users/azlannisar/Desktop/Skripts/analysis_5mC_script.py {input.csv_list} {params.output_dir} {input.motif_list}
        """

When i run this is runs the first two rules without problems gives me no Error and Skips the last rule. So i am confused why it is doing that. Since if i copy the last rule out into a seperate file and run is there it creates the outputs without problems. Maybe someone with more snakemake experience can help me out. Thanks and kind regards!
Azlan

@cmeesters
Copy link
Member

Your last rule has no output directive. Nor is it picked by all.

@AzlanNI
Copy link
Author

AzlanNI commented Jun 14, 2024

@cmeesters Thanks for ur answer i got it running for a while forgot to close the ticket sry!

@AzlanNI AzlanNI closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants