Ejemplo n.º 1
0
 def test_run(self):
     """listdict initialization"""
     d = {"a": 1, "b": 2}
     ld = util.listdict(d)
     ld["a"].append(2)
     self.assertTrue(ld["a"] == [1, 2])
     self.assertTrue(ld["b"] == [2])
Ejemplo n.º 2
0
 def test_run(self):
     """listdict initialization"""
     d = {'a': 1, 'b': 2}
     ld = util.listdict(d)
     ld['a'].append(2)
     self.assertTrue(ld['a'] == [1, 2])
     self.assertTrue(ld['b'] == [2])
Ejemplo n.º 3
0
 def test_run(self):
     """listdict"""
     ld = util.listdict()
     ld["a"].append(1)
     ld["a"].append(2)
     self.assertTrue(ld["a"] == [1, 2])
Ejemplo n.º 4
0
 def test_run(self):
     """listdict"""
     ld = util.listdict()
     ld['a'].append(1)
     ld['a'].append(2)
     self.assertTrue(ld['a'] == [1, 2])
Ejemplo n.º 5
0
	query_keys = []
	if not options.query_orf is []:
		# Specific ORF(s)
		query_keys += options.query_orf
	if not options.query_gene is []:
		# Specific gene(s)
		query_keys += [gene_orf_dict[k] for k in options.query_gene] # if k.startswith(options.query_gene)])
	if len(query_keys) == 0:
		# Go through all proteins in database
		query_keys = all_keys
	
	# Load domain/color boundaries
	if not os.path.isfile(options.in_domain_fname):
		raise IOError("# Error: file {} does not exist".format(options.in_domain_fname))
	dlr = util.DelimitedLineReader(file(options.in_domain_fname, 'r'), header=True)
	domain_boundaries = util.listdict()
	domain_colors = util.listdict()
	for flds in dlr.dictentries:
		orf = flds['orf']
		score = flds['p.value']
		#if orf in query_keys:
		#	print orf, score, flds['start'], flds['end'], flds['sequence']
		if score < options.score_threshold:
			domain_boundaries[orf].append((flds['start'], flds['end']))
			domain_colors[orf].append(flds['color'].replace("0x","#"))
	
	# Remove gaps?
	if options.degap:
		for k in query_keys:
			prot_dict[k] = prot_dict[k].replace("-",'')
	
Ejemplo n.º 6
0
        query_keys += options.query_orf
    if not options.query_gene is []:
        # Specific gene(s)
        query_keys += [gene_orf_dict[k] for k in options.query_gene
                       ]  # if k.startswith(options.query_gene)])
    if len(query_keys) == 0:
        # Go through all proteins in database
        query_keys = all_keys

    # Load domain/color boundaries
    if not os.path.isfile(options.in_domain_fname):
        raise IOError("# Error: file {} does not exist".format(
            options.in_domain_fname))
    dlr = util.DelimitedLineReader(file(options.in_domain_fname, 'r'),
                                   header=True)
    domain_boundaries = util.listdict()
    domain_colors = util.listdict()
    for flds in dlr.dictentries:
        orf = flds['orf']
        score = flds['p.value']
        #if orf in query_keys:
        #	print orf, score, flds['start'], flds['end'], flds['sequence']
        if score < options.score_threshold:
            domain_boundaries[orf].append((flds['start'], flds['end']))
            domain_colors[orf].append(flds['color'].replace("0x", "#"))

    # Remove gaps?
    if options.degap:
        for k in query_keys:
            prot_dict[k] = prot_dict[k].replace("-", '')