def test_parse(self): """ Runs WormBase.parse() and outputs dot file for each allele This is less of a unit test and more for viewing the output of an entire run on a single allele, dot files can be converted to images using scripts/dot-to-svg.sh """ for variant in VARIANTS: with self.subTest(variant_id=variant): self.tearDownAndSetUp() self.gwascatalog.rawdir = RAW_PATH + '/' + variant self.gwascatalog.parse() dot_file_path = DOT_PATH + variant + ".dot" with open(dot_file_path, 'w') as dot_file: rdf2dot(self.gwascatalog.graph, dot_file) # debug LOG.debug( "Reference graph: %s", self.gwascatalog.graph.serialize( format="turtle").decode("utf-8")) reference_ttl = TTL_PATH + variant + '.ttl' self.assertTrue( TestUtils.test_graph_equality(reference_ttl, self.gwascatalog.graph))
def test_parse(self): for rcv in RCVS: output_nt = rcv + '.nt' input_xml = rcv + '.xml.gz' reference_ttl = TTL_PATH + rcv + '.ttl' with self.subTest(rcv=rcv): mock_args = [ "test_clinvar.py", "--inputdir", XML_PATH, "--filename", input_xml, "--mapfile", MAP_FILE, "--destination", NT_PATH, "--output", output_nt ] patch('sys.argv', mock_args).start() clinvar_parse() query_graph = RDFGraph() query_graph.bind_all_namespaces() query_graph.parse(NT_PATH + output_nt, format='nt') with open(reference_ttl, 'r') as ref_fh: ref_graph = "\n".join(ref_fh.readlines()) # debug LOG.debug( "Reference graph: %s", query_graph.serialize(format="turtle").decode("utf-8")) # Convert output from ClinVar parse to dot then png dot_file_path = DOT_PATH + rcv + ".dot" with open(dot_file_path, 'w') as dot_file: rdf2dot(query_graph, dot_file) self.assertTrue( TestUtils.test_graph_equality(ref_graph, query_graph))
def test_parse(self): """ Runs WormBase.parse() and outputs dot file for each allele This is less of a unit test and more for viewing the output of an entire run on a single allele, dot files can be converted to images using scripts/dot-to-svg.sh """ graph_opts = {'rankdir': 'LR'} for gene in GENES: with self.subTest(gene_id=gene): self.tearDownAndSetUp() self.wormbase.rawdir = RAW_PATH + '/' + gene self.wormbase.version_num = 'test_version' self.wormbase.parse() dot_file_path = DOT_PATH + gene + ".dot" with open(dot_file_path, 'w') as dot_file: rdf2dot(self.wormbase.graph, dot_file, graph_opts)
def test_parse(self): """ Runs FlyBase.parse() and outputs dot file for each allele This is less of a unit test and more for viewing the output of an entire run on a single allele, dot files can be converted to images using scripts/dot-to-svg.sh """ graph_opts = { 'rankdir': 'LR' } for allele in ALLELES: with self.subTest(allele_id=allele): self.tearDownAndSetUp() self.flybase.rawdir = RAW_PATH + '/' + allele self.flybase.parse() dot_file_path = DOT_PATH + allele + ".dot" with open(dot_file_path, 'w') as dot_file: rdf2dot(self.flybase.graph, dot_file, graph_opts)