Пример #1
0
 def testNumberDef(self):
     NumDef = Enumeration("NumDef",
                          (("neg", None, None, -2),
                           ("zero", None, None, 0),
                           ("pos", None, None, 2),
                           ("big", None, None, 3)))
     values = [(str(v), int(v)) for v in NumDef.values]
     self.assertEqual(values, [('neg', -2), ('zero', 0), ('pos', 2), ('big', 3)])
     self.assertEqual(NumDef.getByNumValue(2), NumDef.pos)
Пример #2
0
 def testBitSetValues(self):
     Stat = Enumeration("Stat",
                        ["okay",
                         ("notConserved","notConserved", ("no_alignment",)),
                         "bad_3_splice", "bad_5_splice"],
                        bitSetValues=True)
     self.assertEqual(Stat.okay, 1)
     self.assertEqual(Stat.notConserved, 2)
     self.assertEqual(Stat.bad_5_splice, 8)
     self.assertEqual(int(Stat.bad_5_splice), 8)
     self.assertEqual(Stat.maxNumValue, 8)
     vals = Stat.getValues(9)
     self.assertEqual(len(vals), 2)
     self.assertTrue(vals[0] is Stat.okay)
     self.assertTrue(vals[1] is Stat.bad_5_splice)
Пример #3
0
 def testAliases(self):
     Name = Enumeration("Name", ["Fred",  ("Rick", "Richard", ("Dick", "HeyYou")), ("Bill", "Willian")])
     self.assertEqual(Name.lookup("Richard"), Name.Rick)
     self.assertTrue(Name.lookup("Richard") is Name.Rick)
     self.assertEqual(Name.lookup("Dick"), Name.Rick)
     self.assertTrue(Name.lookup("Dick") is Name.Rick)
     self.assertTrue(Name.lookup("Rick") == Name.Rick)
     self.assertTrue(Name.lookup("HeyYou") == Name.Rick)
     self.assertTrue(Name.lookup("Fred") == Name.Fred)
     self.assertTrue(Name.lookup("Fred") is Name.Fred)
     self.assertTrue(str(Name.Rick) == "Richard")
Пример #4
0
# definitions, then create the enumerations from that.

# FIXME: sql select stuff is a bit hacky

BioType = Enumeration(
    "BioType",
    ("IG_C_gene", "IG_D_gene", "IG_J_gene", "IG_V_gene", "IG_LV_gene",
     "IG_C_pseudogene", "IG_D_pseudogene", "IG_pseudogene", "IG_J_pseudogene",
     "IG_V_pseudogene", "TR_gene", "TR_C_gene", "TR_D_gene", "TR_J_gene",
     "TR_V_gene", "ambiguous_orf", "antisense", "lincRNA", "Mt_rRNA",
     "Mt_tRNA", "Mt_tRNA_pseudogene", "TEC", "TR_pseudogene",
     "TR_J_pseudogene", "TR_V_pseudogene", "miRNA", "miRNA_pseudogene",
     "misc_RNA", "ncrna_host", "misc_RNA_pseudogene", "non_coding",
     "nonsense_mediated_decay", "polymorphic_pseudogene",
     "processed_pseudogene", "processed_transcript", "protein_coding",
     "pseudogene", "rRNA", "rRNA_pseudogene", "retained_intron",
     "retrotransposed", "scRNA", "scRNA_pseudogene", "snRNA",
     "snRNA_pseudogene", "snoRNA", "snoRNA_pseudogene", "tRNA_pseudogene",
     "transcribed_processed_pseudogene", "transcribed_unprocessed_pseudogene",
     "unitary_pseudogene", "transcribed_unitary_pseudogene",
     "unprocessed_pseudogene",
     ("overlapping_ncrna_3prime", "3prime_overlapping_ncrna"),
     ("overlapping_ncRNA_3prime",
      "3prime_overlapping_ncRNA"), "disrupted_domain", "sense_intronic",
     "sense_overlapping", "non_stop_decay", "translated_processed_pseudogene",
     "translated_unprocessed_pseudogene", "known_ncrna", "macro_lncRNA",
     "ribozyme", "scaRNA", "sRNA", "vaultRNA", "bidirectional_promoter_lncrna",
     "bidirectional_promoter_lncRNA"))
BioTag = Enumeration(
    "BioTag",
    (
        "2way_pseudo_cons",