Skip to content
Snippets Groups Projects
Commit 151b3efb authored by Rohmer Coralie's avatar Rohmer Coralie
Browse files

fix

parent 745fc121
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,12 @@ REF_ECOLI="GCF_004358385.1_ASM435838v1_genomic.fna"
READS_CCN="ERR4352155.fastq"
READS_BMB="ERR4352154.fastq"
READS_ILLUMINA_CCN="ERR1308732.fastq"
READS_ILLUMINA_BMB="ERR1308675.fastq"
REF_CCN="ccnscafold.fa"
REF_BMB="bmbscafold.fa"
ID_YEAST=["CCN","BMB","diploid"]
ID=["CCN_yeast","BMB_yeast","diploid_yeast","ecoli_hifi","ecoli_illumina"]
CONFIGS=["","_clustal","_tcoffee"]
READS_HUMAN="reads.fastq"
REF_HUMAN="chm13.draft_v1.1.fasta"
......@@ -36,11 +39,9 @@ REF_HUMAN="chm13.draft_v1.1.fasta"
#-------------------------------------------------------------------------------
rule all :
input :
expand(os.path.join('simulated_data','config_simulated_{id}_{error}.yaml'), id=ID_SIM ,error=ERROR_SIM),
os.path.join('ecoli_hifi_data','config_ecoli_hifi.yaml'),
os.path.join('ecoli_illumina_data','config_ecoli_illumina.yaml'),
expand(os.path.join('yeast_data','config_{id}_yeast.yaml'), id=ID_YEAST),
os.path.join('human_data','aln_nanopore_ref_chm13.sam')
expand(os.path.join('configuration_files','config{config}_simulated_{id}_{error}.yaml'), config=CONFIGS, id=ID_SIM ,error=ERROR_SIM),
expand(os.path.join('configuration_files','config{config}_{id}.yaml'), config=CONFIGS,id=ID),
#os.path.join('human_data','aln_nanopore_ref_chm13.sam')
#-------------------------------------------------------------------------------
# Human data
#-------------------------------------------------------------------------------
......@@ -64,12 +65,13 @@ rule download_human_ref :
ref=os.path.join('human_data',REF_HUMAN),
chrX=os.path.join('human_data',"ref_chrX_W.fasta"),
message :
"Download nanopore reads for human data"
"Download nanopore ref for human data"
log:
os.path.join('logs','human_data','2_download_ref.log')
conda:
"env_conda/gzip.yaml"
shell:
'set +o pipefail;'
'wget https://s3-us-west-2.amazonaws.com/human-pangenomics/T2T/CHM13/assemblies/chm13.draft_v1.1.fasta.gz -o {log};'
'gunzip ' + REF_HUMAN + '.gz >>{log} 2>&1;'
'mv ' + REF_HUMAN + ' {output.ref};'
......@@ -145,6 +147,7 @@ rule select_hifi_reads_ecoli :
conda:
"env_conda/seqkit.yaml"
shell:
'set +o pipefail;'
'seqkit sort -l -r {input} 2>{log}|head -100000 >{output} 2>{log}'
rule assembly_hifi_reads_ecoli :
......@@ -159,7 +162,7 @@ rule assembly_hifi_reads_ecoli :
conda:
"env_conda/flye.yaml"
shell:
'flye --pacbio-hifi {input} --genome-size 5m --threads ' + THREAD + ' -i 2 -o assembly_hifi >{log} 2>&1'
'flye --pacbio-hifi {input} --genome-size 5m --threads ' + THREAD + ' -i 2 -o ecoli_hifi_data/assembly_hifi >{log} 2>&1'
rule extract_first_contig_hifi_reads :
input :
......@@ -171,14 +174,15 @@ rule extract_first_contig_hifi_reads :
log:
os.path.join('logs','ecoli_hifi_data','6_extract_first_contig_hifi_reads.log')
shell:
'cat {input}|tr "\n" "@"|sed "s/@>/\n>/g"|sed "s/@/\n/;s/@//g"|head -2 >{output} 2>{log}'
'set +o pipefail;'
'cat {input}|tr "\\n" "@"|sed "s/@>/\\n>/g"|sed "s/@/\\n/;s/@//g"|head -2 >{output} 2>{log}'
rule configuration_file_ecoli_hifi_data:
input :
ref=os.path.join('ecoli_hifi_data','ref_ecoli_hifi.fasta'),
reads=os.path.join('ecoli_hifi_data',READS_NANOPORE_ECOLI_HIFI)
output :
ref=os.path.join('ecoli_hifi_data','config_ecoli_hifi.yaml')
ref=os.path.join('before_configuration_files','config_ecoli_hifi.yaml')
message :
"Configuration file for ecoli hifi"
log:
......@@ -332,7 +336,7 @@ rule configuration_file_ecoli_illumina_data:
ref=os.path.join('ecoli_illumina_data','ref_illumina_ecoli.fasta'),
reads=os.path.join('ecoli_illumina_data',READS_NANOPORE_ECOLI_ILLUMINA)
output :
ref=os.path.join('ecoli_illumina_data','config_ecoli_illumina.yaml')
ref=os.path.join('before_configuration_files','config_ecoli_illumina.yaml')
message :
"Configuration file for ecoli illumina"
log:
......@@ -399,31 +403,116 @@ rule gunzip_BMB_yeast_reads :
shell:
'gunzip {input} >{log} 2>&1'
rule download_reduced_ref_CCN:
rule download_CCN_yeast_reads_illumina :
output :
os.path.join('yeast_data',READS_ILLUMINA_CCN + '.gz')
message :
"Download CCN reads illumina for yeast data"
log:
os.path.join('logs','yeast_data','5_download_CCN_reads_illumina.log')
conda:
"env_conda/fastq-dump.yaml"
shell:
'fastq-dump --gzip --split-spot ERR1308732 >{log} 2>&1;'
'mv ' + READS_ILLUMINA_CCN + '.gz {output}'
rule gunzip_CCN_yeast_reads_illumina :
input :
os.path.join('yeast_data',READS_ILLUMINA_CCN + '.gz')
output :
os.path.join('yeast_data',READS_ILLUMINA_CCN)
message :
"Decompress illumina reads for CCN yeast"
log:
os.path.join('logs','yeast_data','6_gunzip_CCN_reads_illumina.log')
conda:
"env_conda/gzip.yaml"
shell:
'gunzip {input} >{log} 2>&1'
rule download_BMB_yeast_reads_illumina :
output :
os.path.join('yeast_data',READS_ILLUMINA_BMB + '.gz')
message :
"Download BMB reads illumina for yeast data"
log:
os.path.join('logs','yeast_data','7_download_BMB_reads_illumina.log')
conda:
"env_conda/fastq-dump.yaml"
shell:
'fastq-dump --gzip --split-spot ERR1308675 >{log} 2>&1;'
'mv ' + READS_ILLUMINA_BMB + '.gz {output}'
rule gunzip_BMB_yeast_reads_illumina :
input :
os.path.join('yeast_data',READS_ILLUMINA_BMB + '.gz')
output :
os.path.join('yeast_data',READS_ILLUMINA_BMB)
message :
"Decompress illumina reads for BMB yeast"
log:
os.path.join('logs','yeast_data','8_gunzip_BMB_reads_illumina.log')
conda:
"env_conda/gzip.yaml"
shell:
'gunzip {input} >{log} 2>&1'
rule assembly_illumina_reads_CCN :
input :
illumina=os.path.join('yeast_data',READS_ILLUMINA_CCN + '.gz'),
nanopore=os.path.join('yeast_data',READS_CCN)
output:
os.path.join('yeast_data','assembly_illumina_CCN','contigs.fasta')
message :
"Assembly illumina reads for CCN yeast data with spades"
log:
os.path.join('logs','yeast_data','9_assembly_illumina_reads_ccn.log')
conda:
"env_conda/spades.yaml"
shell:
'spades.py --12 {input.illumina} --nanopore {input.nanopore} -o yeast_data/assembly_illumina_CCN --only-assembler -t '+THREAD+' >{log} 2>&1'
rule assembly_illumina_reads_BMB :
input :
illumina=os.path.join('yeast_data',READS_ILLUMINA_BMB + '.gz'),
nanopore=os.path.join('yeast_data',READS_BMB)
output:
ref=os.path.join('yeast_data',REF_CCN),
reduced_ref=os.path.join('yeast_data',"reduced_CCN.fasta")
os.path.join('yeast_data','assembly_illumina_BMB','contigs.fasta')
message :
"Download reference for CCN yeast"
"Assembly illumina reads for BMB yeast data with spades"
log:
os.path.join('logs','yeast_data','5_download_reduced_CCN_ref.log')
os.path.join('logs','yeast_data','10_assembly_illumina_reads_BMB.log')
conda:
"env_conda/spades.yaml"
shell:
#'wget https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/005/845/GCF_000005845.2_ASM584v2/GCF_000005845.2_ASM584v2_genomic.fna.gz -o {log} ;'
'cp ' + REF_CCN + ' {output.ref};'
'head -42442 {output.ref} |tail -11976 >{output.reduced_ref} 2>>{log}'
'spades.py --12 {input.illumina} --nanopore {input.nanopore} -o yeast_data/assembly_illumina_BMB --only-assembler -t '+THREAD+' >{log} 2>&1'
rule download_reduced_ref_BMB:
rule reduced_ref_CCN:
input :
os.path.join('yeast_data','assembly_illumina_CCN','contigs.fasta')
output :
ref=os.path.join('yeast_data',REF_BMB),
reduced_ref=os.path.join('yeast_data',"reduced_BMB.fasta")
os.path.join('yeast_data',"reduced_CCN.fasta")
message :
"Download reference for BMB yeast"
"Reduced reference for CCN yeast"
log:
os.path.join('logs','yeast_data','6_download_reduced_BMB_ref.log')
os.path.join('logs','yeast_data','11_reduced_CCN_ref.log')
shell:
#'wget https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/005/845/GCF_000005845.2_ASM584v2/GCF_000005845.2_ASM584v2_genomic.fna.gz -o {log} ;'
'cp ' + REF_BMB + ' {output.ref};'
'head -15288 {output.ref} >{output.reduced_ref} 2>>{log}'
'set +o pipefail;'
'head -42442 {input} |tail -11976 >{output} 2>>{log}'
rule reduced_ref_BMB:
input :
os.path.join('yeast_data','assembly_illumina_BMB','contigs.fasta')
output :
os.path.join('yeast_data',"reduced_BMB.fasta")
message :
"Reduced reference for BMB yeast"
log:
os.path.join('logs','yeast_data','12_reduced_BMB_ref.log')
shell:
'set +o pipefail;'
'head -15288 {input} >{output} 2>>{log}'
rule align_ref_BMB_ref_CCN :
input :
......@@ -434,7 +523,7 @@ rule align_ref_BMB_ref_CCN :
message :
"Align BMB ref with CCN ref with minimap"
log:
os.path.join('logs','yeast_data','7_align_ref_BMB_ref_CCN.log')
os.path.join('logs','yeast_data','13_align_ref_BMB_ref_CCN.log')
conda:
"env_conda/minimap2.yaml"
shell:
......@@ -448,7 +537,7 @@ rule reads_map_region_yeast :
message:
"Reads map region for yeast data"
log:
os.path.join('logs','yeast_data','8_reads_map_region.log')
os.path.join('logs','yeast_data','14_reads_map_region.log')
conda:
"env_conda/perl.yaml"
shell :
......@@ -464,7 +553,7 @@ rule region_seq_yeast :
message:
"Region seq for yeast data"
log:
os.path.join('logs','yeast_data','9_region_seq_yeast.log')
os.path.join('logs','yeast_data','15_region_seq_yeast.log')
shell :
'DEB=158700;END=453600;'
'echo $DEB >{output.start};'
......@@ -476,11 +565,11 @@ rule configuration_file_CCN_yeast_data:
ref=os.path.join('yeast_data','ref_ccn.fasta'),
reads=os.path.join('yeast_data',READS_CCN)
output :
os.path.join('yeast_data','config_CCN_yeast.yaml')
os.path.join('before_configuration_files','config_CCN_yeast.yaml')
message :
"Configuration file for CCN yeast data"
log:
os.path.join('logs','yeast_data','10_configuration_file_CCN_yeast_data.log')
os.path.join('logs','yeast_data','16_configuration_file_CCN_yeast_data.log')
shell:
'PATH_DATA=`pwd`;'
'echo -e "N: CCN_yeast" >{output};'
......@@ -492,11 +581,11 @@ rule configuration_file_BMB_yeast_data:
ref=os.path.join('yeast_data','ref_bmb.fasta'),
reads=os.path.join('yeast_data',READS_BMB)
output :
os.path.join('yeast_data','config_BMB_yeast.yaml')
os.path.join('before_configuration_files','config_BMB_yeast.yaml')
message :
"Configuration file for BMB yeast data"
log:
os.path.join('logs','yeast_data','11_configuration_file_BMB_yeast_data.log')
os.path.join('logs','yeast_data','17_configuration_file_BMB_yeast_data.log')
shell:
'PATH_DATA=`pwd`;'
'echo -e "N: BMB_yeast" >{output};'
......@@ -512,8 +601,9 @@ rule diploid_reads:
message :
"Creation of diploid yeast reads"
log:
os.path.join('logs','yeast_data','12_diploid_reads.log')
os.path.join('logs','yeast_data','18_diploid_reads.log')
shell:
'set +o pipefail;'
'cat {input.bmb} |head -260000 >{output};'
'cat {input.ccn} |head -260000 >>{output}'
......@@ -525,7 +615,7 @@ rule diploid_reads_shuffle:
message :
"Shuffle diploid reads for yeast data"
log:
os.path.join('logs','yeast_data','13_diploid_reads_shuffle.log')
os.path.join('logs','yeast_data','19_diploid_reads_shuffle.log')
shell:
'./src/shuffle_fastq.pl {input} >{output} 2>{log}'
......@@ -538,7 +628,7 @@ rule align_ref_BMB_ref_CCN_exonerate :
message :
"Align BMB ref with CCN ref with exonerate"
log:
os.path.join('logs','yeast_data','14_align_ref_BMB_ref_CCN_exonerate.log')
os.path.join('logs','yeast_data','20_align_ref_BMB_ref_CCN_exonerate.log')
conda:
"env_conda/exonerate.yaml"
shell:
......@@ -552,7 +642,7 @@ rule ref_diploide :
message :
"Creation of diploid yeast ref"
log:
os.path.join('logs','yeast_data','15_ref_diploid.log')
os.path.join('logs','yeast_data','21_ref_diploid.log')
conda:
"env_conda/python3.yaml"
shell:
......@@ -563,11 +653,11 @@ rule configuration_file_diploid_yeast_data:
ref=os.path.join('yeast_data','ref_diploid.fasta'),
reads=os.path.join('yeast_data','diploid_reads_shuffle.fastq')
output :
os.path.join('yeast_data','config_diploid_yeast.yaml')
os.path.join('before_configuration_files','config_diploid_yeast.yaml')
message :
"Configuration file for diploid yeast data"
log:
os.path.join('logs','yeast_data','16_configuration_file_diploid_yeast_data.log')
os.path.join('logs','yeast_data','22_configuration_file_diploid_yeast_data.log')
shell:
'PATH_DATA=`pwd`;'
'echo -e "N: diploid_yeast" >{output};'
......@@ -693,7 +783,7 @@ rule configuration_file_simulated_data:
ref=os.path.join('simulated_data',REF_SIM),
reads=os.path.join('simulated_data','simulated_{id_sim}_{error_sim}_0001.fastq')
output :
ref=os.path.join('simulated_data','config_simulated_{id_sim}_{error_sim}.yaml')
ref=os.path.join('before_configuration_files','config_simulated_{id_sim}_{error_sim}.yaml')
message :
"Configuration file for simulated data ({wildcards.id_sim}_{wildcards.error_sim})"
log:
......@@ -704,3 +794,61 @@ rule configuration_file_simulated_data:
'echo -e "N: $NAME_SIMULATED" >{output};'
'echo -e "I: $PATH_DATA/{input.ref}" >>{output};'
'echo -e "R: $PATH_DATA/{input.reads}" >>{output}'
#-------------------------------------------------------------------------------
# Configuration files
#-------------------------------------------------------------------------------
rule configuration_files:
input :
os.path.join('before_configuration_files','config_{id}.yaml')
output :
os.path.join('configuration_files','config_{id}.yaml')
message :
"Configuration files ({wildcards.id})"
log:
os.path.join('logs','configuration_files','1_configuration_files_{id}.log')
shell:
'cp {input} {output};'
'echo -e "D: [10,20,50,100,150,200]" >>{output};'
'echo -e "S: [100,200,500,1000,2000,5000,10000]" >>{output};'
'echo -e "T: 50" >>{output};'
'echo -e "M: [muscle,mafft,poa,spoa,abpoa,kalign,kalign3]" >>{output};'
'echo -e "O: 10" >>{output}'
rule configuration_files_for_clustal:
input :
os.path.join('before_configuration_files','config_{id}.yaml')
output :
os.path.join('configuration_files','config_clustal_{id}.yaml')
message :
"Configuration files for clustal ({wildcards.id})"
log:
os.path.join('logs','configuration_files','2_configuration_files_for_clustal_{id}.log')
shell:
'set +o pipefail;'
'head -1 {input}| sed "s/$/_clustal/" >{output};'
'tail -2 {input} >>{output};'
'echo -e "D: [10,20,50,100,150,200]" >>{output};'
'echo -e "S: [100,200,500,1000,2000,5000,10000]" >>{output};'
'echo -e "T: 50" >>{output};'
'echo -e "M: [clustalo]" >>{output};'
'echo -e "O: 10" >>{output}'
rule configuration_files_for_tcoffee:
input :
os.path.join('before_configuration_files','config_{id}.yaml')
output :
os.path.join('configuration_files','config_tcoffee_{id}.yaml')
message :
"Configuration files for tcoffee ({wildcards.id})"
log:
os.path.join('logs','configuration_files','3_configuration_files_for_tcoffee_{id}.log')
shell:
'set +o pipefail;'
'head -1 {input}| sed "s/$/_tcoffee/" >{output};'
'tail -2 {input} >>{output};'
'echo -e "D: [10,20,50,100,150,200]" >>{output};'
'echo -e "S: [100,200,500,1000,2000,5000,10000]" >>{output};'
'echo -e "T: 50" >>{output};'
'echo -e "M: [tcoffee]" >>{output};'
'echo -e "O: 10" >>{output}'
File deleted
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/coralie/LogicielLocal/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/coralie/LogicielLocal/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/coralie/LogicielLocal/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/coralie/LogicielLocal/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment