def main():
	print('Start reading links ...')
	readlink = ReadFile('Partition6467LinkData.csv')
	mp = readlink.readLinks()
	print('Links reading complete ...')
	# print('Unit ready ...')
	print('Start reading probe points ...')
	readprobe = ReadFile('Partition6467ProbePoints.csv')
	if (len(sys.argv) > 1):
		print('Start reading %d probes ...' % int(sys.argv[1]))

		prbs = readprobe.readProbes(int(sys.argv[1]))
	else:
		print('Start reading %d probes ...' % 5000)

		prbs = readprobe.readProbes()

	sampleIds = prbs.keys()
	# print(prbs.items())
	mtsq = list()
	print('Probes reading complete ...')
	for sid in sampleIds:
		print('Analyzing probes from sample No.%d ...' % sid)
		 # __init__(self, plist, mp):
		mc = Match(prbs[sid], mp)
		print('\tStart calculating candidate points ...')
		pcps = mc.probeCandidates()
		print('\tCandidate points calculating complete ...')
		print('\tStart matching sequence ...')
		mtsq.extend(mc.findMatchedSequence(pcps))
		print('\tSequence matching complete ...')

	print('Start writing matched sequence ...')
	wf = WriteFile()
	
	wf.writeMP(mtsq)
	print('Sequence writing complete ... ')
	print('Start calculating slopes ...')
	slope = Slope(mtsq, mp)
	slp = slope.calSlope()
	print('Slopes calculating complete ...')
	print('Start writing slopes ...')
	wf.writeS(slp)
	print('Slopes writing complete ...')
# Data class file 2/3: Calculate.py: Class: Calculate
# Data class file 3/3: WriteFile.py: Class: HypotenusePrintClass
# --------------------------------------------------------------------------------------------------------------------*

# IMPORT all four classes
from ReadFile import ReadFile

readfile = ReadFile()

from Calculate import Calculate

calculate = Calculate()

from WriteFile import WriteFile

writefile = WriteFile()

# MAIN PROGRAM---------------------------------------------------------------------------------------------------------*

# Read the input data name from keyboard and returns the file name
inputDatafileName = readfile.readInputFile()

# Calculated the row amount of the file
rowAmount = readfile.howManyLinesAreInTheInputFile(inputDatafileName)

# Prepares input data to file transforms it to array
xAndYconstraint = readfile.prepareDataForCalculation(inputDatafileName,
                                                     rowAmount)

resultDeposit = calculate.findTheMultiples(xAndYconstraint)
 def file_system(self):
     while True:
         # Features.feature_list(self)
         choice = input("\nChoose Your Option: ")
         if choice == '1':
             folder_name = input("\nEnter The Folder Name: ")
             folder_address = os.path.join(os.getcwd(), folder_name)
             CreateFolder.folder(self, folder_address)
             folder_location[folder_name] = folder_address
         elif choice == '2':
             file_name = input("\nEnter The File Name: ")
             file_address = os.path.join(os.getcwd(), file_name)
             CreateFile.create_file(self, file_address)
             file_location[file_name] = file_address
         elif choice == '3':
             while True:
                 print("Where You Want To Move?")
                 print("(1) File To Folder")
                 print("(2) Folder To Folder")
                 move = input("\nEnter Your Choice: ")
                 if move == '1':
                     source = input("\nEnter The Source File Name: ")
                     source_address = file_location[source]
                     destination = input(
                         "\nEnter The Destination Folder Name: ")
                     destination_address = folder_location[destination]
                     AddDirectory.add(self, source_address,
                                      destination_address)
                     file_location[source] = os.path.join(
                         destination_address, source)
                     break
                 elif move == '2':
                     source = input("\nEnter The Source Folder Name: ")
                     source_address = folder_location[source]
                     destination = input(
                         "Enter The Destination Folder Name: ")
                     destination_address = folder_location[destination]
                     AddDirectory.add(self, source_address,
                                      destination_address)
                     folder_location[source] = os.path.join(
                         destination_address, source)
                     break
                 else:
                     print("Invalid Input, Type 1 or 2")
         elif choice == '4':
             while True:
                 print("(1) Write in a New File")
                 print("(2) Write in an Existing File")
                 write_choice = input("\nChoose Your Option: ")
                 if write_choice == '1':
                     file = input("Enter The File Name: ")
                     file_address = os.path.join(os.getcwd(), file)
                     content = input(
                         "\nEnter The Content You Want To Write: ")
                     WriteFile.write(self, file_address, content)
                     file_location[file] = file_address
                     break
                 elif write_choice == '2':
                     file = input("\nEnter The File Name: ")
                     file_address = file_location[file]
                     content = input(
                         "\nEnter The Content You Want To Write: ")
                     WriteFile.write(self, file_address, content)
                     break
                 else:
                     print("Invalid Input, Type 1 or 2")
         elif choice == '5':
             file = input("\nEnter The File Name: ")
             file_address = file_location[file]
             ReadFile.read(self, file_address)
         elif choice == '6':
             file = input("\nEnter File Name: ")
             file_address = file_location[file]
             ClearFile.clear(self, file_address)
         elif choice == '7':
             file = input("\nEnter File Name: ")
             file_address = file_location[file]
             ContentLength.get_length(self, file_address)
         elif choice == '8':
             folder = input("\nEnter Folder Name: ")
             folder_address = folder_location[folder]
             FolderSize.folder_size(self, folder_address)
         elif choice == '9':
             required_folder = input("\nEnter Folder Name: ")
             FolderFiles.file_list(self, folder_location[required_folder])
         elif choice == '10':
             folder = input("\nEnter Folder Name: ")
             WalkTree.tree(self, folder_location[folder])
         elif choice == '11':
             print(os.getcwd())
         elif choice == '12':
             FolderFiles.file_list(self, os.getcwd())
         elif choice == '13':
             print("\nGood Bye. See you Soon")
             exit()
         else:
             print("\nInvalid Choice")
示例#4
0
文件: AutoCode.py 项目: jbo2014/AntOA
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from FetchStruct import FetchStruct
from WriteFile import WriteFile

space = "Model"
csdir = "E:/GitHubs/AntOA/Model"
connname = "SQLDB"

fetch = FetchStruct()  #所有实体表的所有列
rows = fetch.GetStructRows(r'localhost', r'sa', r'123@abc', r'AntOA')

writer = WriteFile(space, csdir)

length = len(rows)
columns = []  # 一个实体表的所有列
for i, row in enumerate(rows):
    columns.append(row)
    if (i + 1 == length or rows[i + 1]['TABLE_NAME'] != ''):
        writer.WriteEntityFile(columns, rows)
        writer.WriteMapFile(columns)
        columns = []
writer.WriteConnectFile(connname, rows)
示例#5
0
文件: makescript.py 项目: bruceg/spac
def write(targets, filename='make.py'):
	out = WriteFile(filename)
	out.write(header)
	recurse('all', targets, out)
	out.close()