deletes last semicolon from each line, and then replaces
all the semicolons with comma
'''
importfileinput
importsys
importcodecs
importos
withfileinput.input(inplace=True)asf:
withfileinput.input(inplace=True)asf1:
#Skips the first line in the csv file
next(f)
print("CCC,reserved,reserved,pIndex,wedgeWT,NA,NA,NA,NA,NA,xOffset,yOffset,zOffset,NA,NA,reserved,EulerZ(1),EulerZ(3),EulerX(2),reserved,CREATED WITH PEET Version 1.9.1 04/01/2014")
forlineinf:
#removes ; from the end of all lines where it appears
#leaves all other lines unchanged
line=line.rstrip('\n');
#if line.endswith(';'):
#line = line[:-1]
#array that stores the index value of all the semicolons in the line
sc_pos_array=[ifori,xinenumerate(line)ifx==',']
#Multiplies and replaces x,y,z values by 2* the value
parser=argparse.ArgumentParser(description="Takes a PEET motif list (MOTL) file and duplicates the motif descriptor lines a specified number of times.")
# parser.add_argument("-f", "--file", help="create overlay for a single file",
parser.add_argument('-i','--input',nargs='?',default='.',help='Input file to process')
parser.add_argument('-o','--output',nargs='?',default='.',help='Output file to write to. If no argument is provided, a _mult suffix will be added to the original file name')
parser.add_argument('-n','--number',nargs='?',type=int,default='4',help='How many times to duplicate data lines')
parser.add_argument('-H','--headerLines',nargs='?',type=int,default='1',help='Number of header lines in file')
parser.add_argument('-it','--ignoreTail',nargs='?',type=int,default=0,help='Ignores the given number of columns at the end of the file when parsing')
parser.add_argument('-g','--graph',action='store_true',help='Store a graph of the corrected and uncorrected line intensities for debug purposes.')
args=parser.parse_args()
defrow_count(filename):
withopen(filename)asin_file:
returnsum(1for_inin_file)
ifargs.input=='.':
print("Missing input file");
print(parser.print_help())
sys.exit()
ifargs.output=='.':
inPath=os.path.splitext(args.input)
args.output=inPath[0]+"_mult"+inPath[1]
ifargs.number<1:
print("Data line duplication argument must be at least 1.")