Best Python code snippet using localstack_python
cluster_information.py
Source:cluster_information.py
...21 22 self.config = parse(self.cluster_xml_file)23 def get_username(self):24 return get_tag_text(self.config, "username")25 def get_java_opts(self):26 return get_tag_text(self.config, "java_opts")27 def get_index_directory(self):28 return get_tag_text(self.config, "index_directory");29 def get_master_node_machine(self):30 master_node = self.config.getElementsByTagName("master_node")[0]31 id = NodeXmlReader.get_cluster_id(master_node)32 ip = NodeXmlReader.get_cluster_ip(master_node)33 client_ip = NodeXmlReader.get_client_ip(master_node)34 client_port = NodeXmlReader.get_client_port(master_node)35 java_opts = NodeXmlReader.get_java_opts(master_node)36 if java_opts is "":37 java_opts = self.get_java_opts()38 username = self.get_username()39 return Machine(id, ip, username, client_ip, client_port, java_opts)40 def get_node_machine_list(self):41 nodes = []42 username = self.get_username()43 for node in self.config.getElementsByTagName("node"):44 id = NodeXmlReader.get_cluster_id(node)45 ip = NodeXmlReader.get_cluster_ip(node)46 java_opts = NodeXmlReader.get_java_opts(node)47 if java_opts is "":48 java_opts = self.get_java_opts()49 nodes.append(Machine(id, ip, username, "", "", java_opts))50 return nodes51class NodeXmlReader(object):52 ''' --------------------------------------------------------------------------53 Node Specific Functions54 -------------------------------------------------------------------------- '''55 @staticmethod56 def get_cluster_id(node):57 return get_tag_text(node, "id")58 @staticmethod59 def get_cluster_ip(node):60 return get_tag_text(node, "cluster_ip")61 @staticmethod62 def get_client_ip(node):63 return get_tag_text(node, "client_ip")64 @staticmethod65 def get_client_port(node):66 return get_tag_text(node, "client_port")67 @staticmethod68 def get_java_opts(node):69 return get_tag_text(node, "java_opts")70def get_tag_text(xml_node, tag):71 values = xml_node.getElementsByTagName(tag)72 if len(values) > 0:73 return get_text(values[0])74 else:75 return ""76def get_text(xml_node):77 rc = []78 for node in xml_node.childNodes:79 if node.nodeType == node.TEXT_NODE:80 rc.append(node.data)81 return ''.join(rc)82class Machine:83 java_opts = ""84 log_path = ""85 port = ""86 87 def __init__(self, id, ip, username, client_ip="", client_port="", java_opts=""):88 self.id = id89 self.ip = ip90 self.username = username91 self.client_ip = client_ip92 self.client_port = client_port93 self.java_opts = java_opts94 95 def get_id(self):96 return self.id97 98 def get_ip(self):99 return self.ip100 101 def get_java_opts(self):102 return self.java_opts103 104 def get_client_ip(self):105 return self.client_ip106 107 def get_client_port(self):108 return self.client_port109 110 def get_username(self):111 return self.username112 113 def get_log_path(self):114 return self.log_path115 ...
genomicsdbimport.py
Source:genomicsdbimport.py
1import os2from snakemake.shell import shell3from snakemake_wrapper_utils.java import get_java_opts4extra = snakemake.params.get("extra", "")5java_opts = get_java_opts(snakemake)6gvcfs = list(map("--variant {}".format, snakemake.input.gvcfs))7db_action = snakemake.params.get("db_action", "create")8if db_action == "create":9 db_action = "--genomicsdb-workspace-path"10elif db_action == "update":11 db_action = "--genomicsdb-update-workspace-path"12else:13 raise ValueError(14 "invalid option provided to 'params.db_action'; please choose either 'create' or 'update'."15 )16log = snakemake.log_fmt_shell(stdout=True, stderr=True)17shell(18 "gatk --java-options '{java_opts}' GenomicsDBImport {extra} "19 "{gvcfs} "...
filter_by_info.py
Source:filter_by_info.py
...5__contact__ = "j.sendrowski18@gmail.com"6__date__ = "2022-05-31"7from snakemake.shell import shell8from snakemake_wrapper_utils.java import get_java_opts9java_opts = get_java_opts(snakemake)10vcf = snakemake.input.vcf11filter = snakemake.params.filter12out = snakemake.output[0]13shell(f"gatk --java-options '{java_opts}' SelectVariants -V {vcf} -O {out} "...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!