Mercurial > repos > greg > ideas_preprocessor
comparison ideas_preprocessor.xml @ 2:248b5f72fc02 draft
Uploaded
| author | greg |
|---|---|
| date | Tue, 23 Jan 2018 10:48:31 -0500 |
| parents | f060a0fbd4fe |
| children | f577a83e86c4 |
comparison
equal
deleted
inserted
replaced
| 1:91c5dbb14a13 | 2:248b5f72fc02 |
|---|---|
| 10 <command detect_errors="exit_code"><![CDATA[ | 10 <command detect_errors="exit_code"><![CDATA[ |
| 11 #set tmp_dir = "tmp" | 11 #set tmp_dir = "tmp" |
| 12 #set prep_input_config = "prep_input_config.txt" | 12 #set prep_input_config = "prep_input_config.txt" |
| 13 #set prep_output_config = "prep_output_config.txt" | 13 #set prep_output_config = "prep_output_config.txt" |
| 14 #set specify_genomic_window = $specify_genomic_window_cond.specify_genomic_window | 14 #set specify_genomic_window = $specify_genomic_window_cond.specify_genomic_window |
| 15 #set windows_positions_by_chroms_config = "windows_positions_by_chroms_config.txt" | 15 mkdir $tmp_dir && |
| 16 mkdir $output.files_path && | |
| 17 #if str($specify_genomic_window) == "yes": | |
| 18 ############################################## | |
| 19 ## Using a genomic window bed file, so categorize | |
| 20 ## the window positions by chromosome to enable | |
| 21 ## the IDEAS -inv option. | |
| 22 ############################################## | |
| 23 #set windows_positions_by_chroms_config = "windows_positions_by_chroms_config.txt" | |
| 24 cp '$gen_windows_positions_by_chroms_config' $windows_positions_by_chroms_config && | |
| 25 #end if | |
| 16 ############################################## | 26 ############################################## |
| 17 ## Create the config file and prepare the data | 27 ## Create the config file and prepare the data |
| 18 ############################################## | 28 ############################################## |
| 19 #set output_dir = $output_txt_dir | |
| 20 #set tmp_dir = "tmp" | |
| 21 mkdir '$output_txt_dir' && | |
| 22 cp '$gen_prep_input_config' $prep_input_config && | 29 cp '$gen_prep_input_config' $prep_input_config && |
| 23 sort $prep_input_config -o $prep_input_config && | 30 sort $prep_input_config -o $prep_input_config && |
| 24 Rscript '$__tool_directory__/ideas_preprocessor.R' | 31 Rscript '$__tool_directory__/ideas_preprocessor.R' |
| 25 --prep_input_config '$prep_input_config' | 32 --prep_input_config '$prep_input_config' |
| 33 #if str($specify_genomic_window) == "yes": | |
| 34 --prep_output_config '$prep_output_config' | |
| 35 --windows_positions_by_chroms_config '$windows_positions_by_chroms_config' | |
| 36 #end if | |
| 26 #if str($specify_genomic_window) == "yes": | 37 #if str($specify_genomic_window) == "yes": |
| 27 --bed_input '$specify_genomic_window_cond.bed_input' | 38 --bed_input '$specify_genomic_window_cond.bed_input' |
| 28 #else: | 39 #else: |
| 29 --chrom_len_file '$chromInfo' | 40 --chrom_len_file '$chromInfo' |
| 30 --window_size $specify_genomic_window_cond.window_size | 41 --window_size $specify_genomic_window_cond.window_size |
| 37 #end for | 48 #end for |
| 38 --restrict_to_chroms ",".join(chroms) | 49 --restrict_to_chroms ",".join(chroms) |
| 39 #end if | 50 #end if |
| 40 #end if | 51 #end if |
| 41 --reads_per_bp $reads_per_bp | 52 --reads_per_bp $reads_per_bp |
| 42 #if str($blacklist_input) not in ["None", ""]: | 53 #if str($exclude_input) not in ["None", ""]: |
| 43 --exclude_input '$exclude_input' | 54 --exclude_input '$exclude_input' |
| 44 #end if | 55 #end if |
| 45 --output '$output' | 56 --output '$output' |
| 46 --output_files_path '$output.files_path' | 57 --output_files_path '$output.files_path' |
| 47 &> ideas_preprocessor_log.txt; | 58 &> ideas_preprocessor_log.txt; |
| 48 if [[ $? -ne 0 ]]; then | 59 if [[ $? -ne 0 ]]; then |
| 49 cp ideas_preprocessor_log.txt '$output'; | 60 cp ideas_preprocessor_log.txt '$output'; |
| 50 exit 1; | 61 exit 1; |
| 51 fi | 62 fi |
| 52 ############################################## | |
| 53 ## Coerce the prepMat config output to the | |
| 54 ## format expected by IDEAS. | |
| 55 ############################################## | |
| 56 && cut -d' ' $prep_input_config -f1,2 > file1.txt | |
| 57 && ls $tmp_dir/*.bed.gz > file2.txt | |
| 58 && paste <(cat file1.txt) <(cat file2.txt) -d' ' > $prep_output_config | |
| 59 #if str($specify_genomic_window) == "yes": | |
| 60 ############################################## | |
| 61 ## Using a genomic window bed file, so categorize | |
| 62 ## the window positions by chromosome to enable | |
| 63 ## the IDEAS -inv option. | |
| 64 ############################################## | |
| 65 && cp '$gen_windows_positions_by_chroms_config' $windows_positions_by_chroms_config | |
| 66 #end if | |
| 67 ]]></command> | 63 ]]></command> |
| 68 <configfiles> | 64 <configfiles> |
| 69 <configfile name="gen_prep_input_config"><![CDATA[#if str($cell_type_epigenetic_factor_cond.cell_type_epigenetic_factor) == "extract": | 65 <configfile name="gen_prep_input_config"><![CDATA[#if str($cell_type_epigenetic_factor_cond.cell_type_epigenetic_factor) == "extract": |
| 70 #set input_name_positions = $cell_type_epigenetic_factor_cond.input_name_positions | 66 #set input_name_positions = $cell_type_epigenetic_factor_cond.input_name_positions |
| 71 #for $i in $cell_type_epigenetic_factor_cond.input: | 67 #for $i in $cell_type_epigenetic_factor_cond.input: |
| 80 #set epigenetic_factor_name = $file_name.split("-")[1] | 76 #set epigenetic_factor_name = $file_name.split("-")[1] |
| 81 #else: | 77 #else: |
| 82 #set cell_type_name = $file_name.split("-")[1] | 78 #set cell_type_name = $file_name.split("-")[1] |
| 83 #set epigenetic_factor_name = $file_name.split("-")[0] | 79 #set epigenetic_factor_name = $file_name.split("-")[0] |
| 84 #end if | 80 #end if |
| 85 ${cell_type_name} ${epigenetic_factor_name} ${i} ${i.filename} ${i.ext} | 81 ${cell_type_name} ${epigenetic_factor_name} ${i} ${file_name} ${i.ext} |
| 86 #end for | 82 #end for |
| 87 #else: | 83 #else: |
| 88 #for $input_items in $cell_type_epigenetic_factor_cond.input_repeat: | 84 #for $input_items in $cell_type_epigenetic_factor_cond.input_repeat: |
| 89 ${input_items.cell_type_name} ${input_items.epigenetic_factor_name} ${input_items.input} ${input_items.input.filename} ${input_items.input.ext} | 85 ${input_items.cell_type_name} ${input_items.epigenetic_factor_name} ${input_items.input} ${file_name} ${input_items.input.ext} |
| 90 #end for | 86 #end for |
| 91 #end if]]></configfile> | 87 #end if]]></configfile> |
| 92 <configfile name="gen_windows_positions_by_chroms_config"><