LiftOver TAB pipeline user Kantale
From PyPedia
Contents |
[edit] Documentation
Liftover tab separated files between different references.
[edit] Parameters
<inputs> <param name="input_filename" type="file" value="" label="Input filename: "/> <param name="output_filename" type="data" value="" label="output filename: "/> <param name="chromosome_column" type="eval" value="0" label="Column index (starting from 0) where the chromosome information is: "/> <param name="position_column" type="eval" value="1" label="Column index (starting from 0) where the position information is: "/> <param name="reference_column" type="eval" value="2" label="Column index (starting from 0) where the reference information is: "/> <param name="temp_dir" type="data" value="" label="Temporary directory for intermediate files. Leave empty for /tmp: "/> <param name="source_reference" type="select" label="Source reference: "> <option value="hg18">hg18</option> <option value="hg19">hg19</option> </param> <param name="target_reference" type="select" label="Target reference: "> <option value="hg19">hg19</option> <option value="hg18">hg18</option> </param> <param name="constants" type="data" value="" label="Article that contains the constant values: "/> <param name="execute_environment" type="select" label="Execute environment: "> <option value="shell">remote shell</option> <option value="pbs">pbs Cluster</option> <option value="nowhere">do not execute</option> </param> </inputs>
[edit] Return
A list that contains the pipeline.
[edit] See also
Genetic_liftover_user_Kantale, Run_pipeline_user_Kantale
[edit] Code
def LiftOver_TAB_pipeline_user_Kantale( input_filename = None, output_filename = None, chromosome_column = None, position_column = None, reference_column = None, source_reference = None, target_reference = None, temp_dir = None, constants = None, execute_environment = "nowhere", ): if not temp_dir: temp_dir = Request_temporary_directory_user_Kantale() if type(constants).__name__ == "str": if constants.strip(): constants = Import_WikiPL_article_user_Kantale(constants)() else: raise Exception("Constants have not been set") if source_reference == "hg18" and target_reference == "hg19": chain_file = constants["path_to_hg18ToHg19.over.chain"] elif source_reference == "hg19" and target_reference == "hg18": chain_file = constants["path_to_hg19ToHg18.over.chain"] else: raise Exception("Invalid source / target selection") if source_reference == "hg18": # fasta_source_path = constants["path_to_fasta_hg18"] fasta_source_path = constants["path_to_fasta_hg18_2"] elif source_reference == "hg19": # fasta_source_path = constants["path_to_fasta_hg19"] fasta_source_path = constants["path_to_fasta_hg19_g1k"] else: raise Exception("Invalid selection for parameter: source_reference. Available values: hg18 and hg19") if target_reference == "hg18": dict_target_path = constants["path_to_dict_hg18_2"] elif target_reference == "hg19": dict_target_path = constants["path_to_dict_hg19_2"] else: raise Exception("Invalid selection for parameter: target_reference. Available values: hg18 and hg19") Execute_command_user_Kantale(command = "mkdir -p " + temp_dir) input_basename = Get_basename_of_filename_user_Kantale(input_filename) pipeline = [] if execute_environment == "pbs": pipeline += [{ "name" : "Push the button", "command" : "Wait_while_file_exists", "params" : { "filename" : temp_dir + "/delete.me", "create_file" : True }, "prereq" : [], "mem" : "1GB", "walltime" : "1:00:00", }] pipeline += [{ "name" : "Convert tab to to VCF", "command" : "Convert_tab_file_to_VCF_user_Kantale", "params" : { "input_filename" : input_filename, "tab_format" : {"chromosome" : chromosome_column, "position" : position_column, "rs" : reference_column}, "output_filename" : temp_dir + "/" + input_basename + ".vcf", }, "prereq" : ["Push the button"] if execute_environment == "pbs" else [], "mem" : "4gb", "walltime" : "24:00:00", }] pipeline += [{ "name" : "LiftOver VCF", "command" : "Genetic_liftover_user_Kantale", "params" : { "input_VCF_filename" : temp_dir + "/" + input_basename + ".vcf", "output_VCF_filename" : temp_dir + "/" + input_basename + ".lo.vcf", "chain_file" : chain_file, "temp_dir" : temp_dir, "path_to_GATK" : constants["path_to_GATK"], "path_to_vcf_sort" : constants["path_to_vcf_sort"], "fasta_source_path" : fasta_source_path, "dict_target_path" : dict_target_path, "replace_arithmetic_to_chr" : False, "filter_new_reference" : False, }, "prereq" : ["Convert tab to to VCF"], "mem" : "16GB", "walltime" : "24:00:00", }] vcf_to_tab = constants["path_to_vcf_to_tab"] vcf_to_tab_path = Get_path_of_filename_user_Kantale(vcf_to_tab) vcf_to_tab_basename = Get_basename_of_filename_user_Kantale(vcf_to_tab) #To use vcftools run the command: # "command" = "cd " + vcf_to_tab_path + " ; cat " + temp_dir + "/" + input_basename + ".lo.vcf | perl " + vcf_to_tab_basename + " > " + output_filename , pipeline += [{ "name" : "Convert liftovered VCF to tab", "command" : "Convert_VCF_to_TAB_user_Kantale", "params" : { "input_filename" : temp_dir + "/" + input_basename + ".lo.vcf", "output_filename" : temp_dir + "/" + input_basename + ".lo.tab", "print_header" : True, }, "prereq" : ["LiftOver VCF"], "mem" : "4GB", "walltime" : "24:00:00", }] pipeline += [{ "name" : "Create output file", "command" : "Merge_columns_of_files_user_Kantale", "params": { "input_filenames" : [temp_dir + "/" + input_basename + ".lo.tab"], "input_columns" : [[(0,0), (1,1), (2,2)]], "ignore_first_lines" : [None], "output_filename" : output_filename }, "prereq" : ["Convert liftovered VCF to tab"], "mem" : "4GB", "walltime" : "24:00:00", }] if execute_environment == "shell": Run_pipeline_user_Kantale( pipeline = pipeline, temp_dir = temp_dir + "/shell", push_the_button = temp_dir + "/delete.me", ) elif execute_environment == "pbs": Run_pipeline_user_Kantale( pipeline = pipeline, temp_dir = temp_dir + "/pbs", push_the_button = temp_dir + "/delete.me", pbsStats = constants["pbsStats"], delay = 5, ) elif execute_environment == "nowhere": pass #Do nothing else: raise Exception("Unknown Execution environment: " + str(execute_environment)) return pipeline
[edit] Unit Tests
def uni1(): return True
[edit] Development Code
def LiftOver_TAB_pipeline_user_Kantale(): pass
[edit] Permissions
[edit] Documentation Permissions
Kantale
[edit] Code Permissions
Kantale
[edit] Unit Tests Permissions
Kantale