Snakemake. Problem with awk

1

Hi!

I have a problem with the awk that looks like this:

awk: cmd. line:1: {if(NR%4==1) {printf("">%s
awk: cmd. line:1:                         ^ syntax error
[Wed Jun 30 16:46:02 2021]
Error in rule univec:
    jobid: 0
    output: out_univec/SRR13510812_1.fasta, out_univec/SRR13510812_2.fasta

RuleException:
CalledProcessError in line 63 of /storage1/kaman/Ldec_all/snakefile:
Command 'set -euo pipefail;  cat out/SRR13510812_1_nohg38.fastq | awk '{if(NR%4==1) {printf("">%s

my code looks like this. I guess I somehow need to screen part of awk command

rule univec:
        input: data1=config["out"] + "{sample}_1_nohg38.fastq", data2=config["out"] + "{sample}_2_nohg38.fastq"
        output: output1=config["out_univec"] + "{sample}_1.fasta", output2=config["out_univec"] + "{sample}_2.fasta"
        run:
                shell("""cat {input.data1} | awk '{{if(NR%4==1) {{printf("">%sn"",substr($0,2));}} else if(NR%4==2) print;}}' > {output.output1}""")
                shell("""cat {input.data2} | awk '{{if(NR%4==1) {{printf("">%sn"",substr($0,2));}} else if(NR%4==2) print;}}' > {output.output2}""")

Thanks!


awk


Snakemake

• 97 views



Source link