Commit b0ca6bc6 authored by peguerin's avatar peguerin
Browse files

update rules step 05

parent 8de0800f
### Assign each sequence to a taxon
rule assign_taxon:
input:
'../results/05_assignment/02_dereplicated/{run}.uniq.fasta'
output:
'../results/05_assignment/03_assigned/{run}.tag.u.fasta'
singularity:
config["singularity"]["obitools"]
params:
drun= lambda wildcards: dfpmr[dfpmr.projmarkrun == wildcards.run].to_dict('records')[0],
log:
'../logs/05_assignment/03_assign_taxon/{run}.log'
shell:
'''ecotag -d {params.drun[bdr]} -R {params.drun[fasta]} {input} > {output} 2> {log}'''
\ No newline at end of file
### Dereplicate and merge samples together
rule dereplicate_runs:
input:
'../results/05_assignment/01_runs/{run}.fasta'
output:
'../results/05_assignment/02_dereplicated/{run}.uniq.fasta'
singularity:
config["singularity"]["obitools"]
log:
'../logs/05_assignment/02_dereplicated/{run}.log'
shell:
'''obiuniq -m sample {input} > {output} 2> {log}'''
\ No newline at end of file
### Some unuseful attributes can be removed at this stage
rule rm_attributes:
input:
'../results/05_assignment/03_assigned/{run}.tag.u.fasta'
output:
'../results/05_assignment/04_formated/{run}.a.t.u.fasta'
singularity:
config["singularity"]["obitools"]
log:
'../logs/05_assignment/04_rm_attributes/{run}.log'
shell:
'''obiannotate --delete-tag=scientific_name_by_db --delete-tag=obiclean_samplecount \
--delete-tag=obiclean_count --delete-tag=obiclean_singletoncount \
--delete-tag=obiclean_cluster --delete-tag=obiclean_internalcount \
--delete-tag=obiclean_head --delete-tag=obiclean_headcount \
--delete-tag=id_status --delete-tag=rank_by_db --delete-tag=obiclean_status \
--delete-tag=seq_length_ori --delete-tag=sminL --delete-tag=sminR \
--delete-tag=reverse_score --delete-tag=reverse_primer --delete-tag=reverse_match --delete-tag=reverse_tag \
--delete-tag=forward_tag --delete-tag=forward_score --delete-tag=forward_primer --delete-tag=forward_match \
--delete-tag=tail_quality {input} > {output} 2> {log}'''
\ No newline at end of file
### The sequences can be sorted by decreasing order of count
rule sort_runs:
input:
'../results/05_assignment/04_formated/{run}.a.t.u.fasta'
output:
'../results/05_assignment/04_formated/{run}.s.a.t.u.fasta'
singularity:
config["singularity"]["obitools"]
log:
'../logs/05_assignment/05_sort_runs/{run}.log'
shell:
'''obisort -k count -r {input} > {output} 2> {log}'''
\ No newline at end of file
### Generate a table final results
rule table_runs:
input:
'../results/05_assignment/04_formated/{run}.s.a.t.u.fasta'
output:
'../results/06_final_tables/{run}.csv'
singularity:
config["singularity"]["obitools"]
params:
drun= lambda wildcards: dfpmr[dfpmr.projmarkrun == wildcards.run].to_dict('records')[0],
log:
'../logs/05_assignment/06_table_runs/{run}.log'
shell:
'''mkdir -p ../results/06_final_tables/{params.drun[projet]}/{params.drun[marker]}; obitab -o {input} > {output} 2> {log}'''
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment