def test_all(self):
     logger.setLevel(logging.DEBUG)    
     os.chdir("..")
     self.setUpForward()
     self.run_tests()
     self.setUpReverse()
     self.run_tests()        
 def test_all(self):
     logger.setLevel(logging.DEBUG)
     os.chdir("..")
     self.setUpForward()
     self.run_tests()
     self.setUpReverse()
     self.run_tests()
    	
    v = MetadataUtils(command_line_args = args)

    # this will read the args and ini file and return a dictionary

    data_object = v.validate_args()
#    for attr in dir(data_object):
#        print("obj.%s = %s" % (attr, getattr(data_object, attr)))



    # set logging


    print("\nLog Level set to:", args.loglevel)
    logger.setLevel(args.loglevel.upper() )

    logger.info("Starting pipeline")
    ##############
    #
    #  Test cl parameters
    #
    ##############
    # CL RULES:
    # for ini file:  (no plurals)
    # 1) CL: input_dir ONLY shall be supplied on CL - no input filenames
    #
    # 2) All input files should be in the same directory AND of the same format
    #
    # 3) Supply a input_file_suffix on the CL if there are varying file types in the
    #       input_dir and you only are using some (default will read all files)
 data_object['file_type'] = args.file_type
 data_object['file_base'] = args.file_base
 
 if data_object['site'] == 'vamps':
     #db_host = 'vampsdb'
     db_host = 'bpcdb2'
     #db_name = 'vamps'
     db_name = 'vamps_user_uploads'
     db_home = '/xraid2-2/vampsweb/vamps/'
 else:
     #db_host = 'vampsdev'
     db_host = 'bpcdb2'
     #db_name = 'vamps'
     db_name = 'vampsdev_user_uploads'
     db_home = '/xraid2-2/vampsweb/vampsdev/'
 
 loggerlevel = logging.DEBUG
 
 
 logger.setLevel(loggerlevel) 
 
 obj=ConMySQL.New(db_host, db_name, db_home)
 
 data_object['db_conn'] = obj.get_conn() 
 
 runDict = trim_file(data_object)
 
 push_to_database(data_object, runDict)
 
 data_object['db_conn'].close()    
 logger.info("Finished:trim "+ args.runcode)
Exemple #5
0
    if args.platform not in C.known_platforms:
        sys.exit("unknown platform - Exiting")

    v = MetadataUtils(command_line_args=args)

    # this will read the args and ini file and return a dictionary

    data_object = v.validate_args()
    #    for attr in dir(data_object):
    #        print("obj.%s = %s" % (attr, getattr(data_object, attr)))

    # set logging

    print("\nLog Level set to:", args.loglevel)
    logger.setLevel(args.loglevel.upper())

    logger.info("Starting pipeline")
    ##############
    #
    #  Test cl parameters
    #
    ##############
    # CL RULES:
    # for ini file:  (no plurals)
    # 1) CL: input_dir ONLY shall be supplied on CL - no input filenames
    #
    # 2) All input files should be in the same directory AND of the same format
    #
    # 3) Supply a input_file_suffix on the CL if there are varying file types in the
    #       input_dir and you only are using some (default will read all files)
        def test_trim_anchor(self):
            seq = "GGGCACACATTT"
            anchors = ["CACACA"]
            #find it in the exact spot we expect it
            exact, exactTrimmedOff, trimmed_sequence = trim_anchor_helper("Test Anchor", anchors, 0, 6, 3, seq)
            self.assertEqual((exact, exactTrimmedOff, trimmed_sequence), ("CACACA", "TTT", "GGGCACACA"))

            seq = "GGCACACATTT"
            anchors = ["CACACA"]
            #find it in an acceptable spot just before it so we give it a freedom of 1
            exact, exactTrimmedOff, trimmed_sequence = trim_anchor_helper("Test Anchor", anchors, 1, 6, 3, seq)
            self.assertEqual((exact, exactTrimmedOff, trimmed_sequence), ("CACACA", "TTT", "GGCACACA"))

            seq = "GGGGCACACATTT"
            anchors = ["CACACA"]
            #find it in an acceptable spot just AFTER it so we give it a freedom of 1
            exact, exactTrimmedOff, trimmed_sequence = trim_anchor_helper("Test Anchor", anchors, 1, 6, 3, seq)
            self.assertEqual((exact, exactTrimmedOff, trimmed_sequence), ("CACACA", "TTT", "GGGGCACACA"))


        def simple_replace_test(self, placeholder_base, new_x, new_y):
            result_template_strings = ["xA", "xC", "xG", "xT", "yA", "yC", "yG", "yT"]
            self.assertEqual(set(expand(placeholder_base + "N")), set(self.replace_template_xy(result_template_strings, new_x, new_y)))

    print("expanded: " + str(expand(revcomp("GTGAATCATCGAYTCTTTGAAC"))))


    logger.setLevel(logging.DEBUG)
    unittest.main()

            seq = "GGCACACATTT"
            anchors = ["CACACA"]
            #find it in an acceptable spot just before it so we give it a freedom of 1
            exact, exactTrimmedOff, trimmed_sequence = trim_anchor_helper(
                "Test Anchor", anchors, 1, 6, 3, seq)
            self.assertEqual((exact, exactTrimmedOff, trimmed_sequence),
                             ("CACACA", "TTT", "GGCACACA"))

            seq = "GGGGCACACATTT"
            anchors = ["CACACA"]
            #find it in an acceptable spot just AFTER it so we give it a freedom of 1
            exact, exactTrimmedOff, trimmed_sequence = trim_anchor_helper(
                "Test Anchor", anchors, 1, 6, 3, seq)
            self.assertEqual((exact, exactTrimmedOff, trimmed_sequence),
                             ("CACACA", "TTT", "GGGGCACACA"))

        def simple_replace_test(self, placeholder_base, new_x, new_y):
            result_template_strings = [
                "xA", "xC", "xG", "xT", "yA", "yC", "yG", "yT"
            ]
            self.assertEqual(
                set(expand(placeholder_base + "N")),
                set(
                    self.replace_template_xy(result_template_strings, new_x,
                                             new_y)))

    print "expanded: " + str(expand(revcomp("GTGAATCATCGAYTCTTTGAAC")))

    logger.setLevel(logging.DEBUG)
    unittest.main()