|
| 1 | +rule all: |
| 2 | + input: |
| 3 | + "fastp/788707_20180129_S_R1.fastq.gz", |
| 4 | + "fastp/788707_20180129_S_R2.fastq.gz", |
| 5 | + "788707_20180129.bam.bai", |
| 6 | + "human/788707_20180129_S_R1.fastq.gz", |
| 7 | + "not_human/788707_20180129_S_R1.fastq.gz", |
| 8 | + |
| 9 | +rule run_fastp: |
| 10 | + input: |
| 11 | + r1 = "788707_20180129_S_R1.fastq.gz", |
| 12 | + r2 = "788707_20180129_S_R2.fastq.gz", |
| 13 | + ad = "IlluminaAdapters.fa" |
| 14 | + output: |
| 15 | + r1 = "fastp/788707_20180129_S_R1.fastq.gz", |
| 16 | + r2 = "fastp/788707_20180129_S_R2.fastq.gz" |
| 17 | + shell: |
| 18 | + """ |
| 19 | + fastp -n 1 -l 100 -i {input.r1} -I {input.r2} -o {output.r1} -O {output.r2} --adapter_fasta {input.ad} |
| 20 | + """ |
| 21 | + |
| 22 | +rule run_minimap: |
| 23 | + input: |
| 24 | + r1 = "fastp/788707_20180129_S_R1.fastq.gz", |
| 25 | + r2 = "fastp/788707_20180129_S_R2.fastq.gz", |
| 26 | + ref = "GCA_000001405.15_GRCh38_no_alt_plus_hs38d1_analysis_set.fna.gz" |
| 27 | + output: |
| 28 | + bam = "788707_20180129.bam" |
| 29 | + shell: |
| 30 | + """ |
| 31 | + minimap2 -t 16 --split-prefix=tmp$$ -a -xsr {input.ref} {input.r1} {input.r2} | samtools view -bh | samtools sort -o {output.bam} |
| 32 | + """ |
| 33 | + |
| 34 | +rule index_bam: |
| 35 | + input: |
| 36 | + bam = "788707_20180129.bam" |
| 37 | + output: |
| 38 | + bai = "788707_20180129.bam.bai" |
| 39 | + shell: |
| 40 | + """ |
| 41 | + samtools index {input.bam} |
| 42 | + """ |
| 43 | + |
| 44 | +rule human: |
| 45 | + input: |
| 46 | + bam = "788707_20180129.bam" |
| 47 | + output: |
| 48 | + r1 = "human/788707_20180129_S_R1.fastq.gz", |
| 49 | + r2 = "human/788707_20180129_S_R2.fastq.gz" |
| 50 | + shell: |
| 51 | + """ |
| 52 | + samtools fastq -F 3588 -f 65 {input.bam} | gzip -c > {output.r1}; |
| 53 | + samtools fastq -F 3588 -f 129 {input.bam} | gzip -c > {output.r2}; |
| 54 | + """ |
| 55 | + |
| 56 | +rule not_human: |
| 57 | + input: |
| 58 | + bam = "788707_20180129.bam" |
| 59 | + output: |
| 60 | + r1 = "not_human/788707_20180129_S_R1.fastq.gz", |
| 61 | + r2 = "not_human/788707_20180129_S_R2.fastq.gz" |
| 62 | + shell: |
| 63 | + """ |
| 64 | + samtools fastq -F 3584 -f 77 {input.bam} | gzip -c > {output.r1}; |
| 65 | + samtools fastq -F 3584 -f 141 {input.bam} | gzip -c > {output.r2}; |
| 66 | + """ |
| 67 | + |
| 68 | +rule assemble: |
| 69 | + input: |
| 70 | + r1 = "not_human/788707_20180129_S_R1.fastq.gz", |
| 71 | + r2 = "not_human/788707_20180129_S_R2.fastq.gz" |
| 72 | + output: |
| 73 | + directory("not_human_assembly") |
| 74 | + shell: |
| 75 | + """ |
| 76 | + spades.py --meta -1 {input.r1} -2 {input.r2} -o not_human_assembly -t 8 |
| 77 | + """ |
0 commit comments