Skip to content
Snippets Groups Projects
Commit 64a1240a authored by mirandaa's avatar mirandaa
Browse files

Update msconvert_maker.py

parent 3c9eabe3
No related merge requests found
import subprocess, os, argparse
#subprocess appears unused
def main():
#https://pythonmarketer.com/2018/08/25/gooey-gui-for-python-scripts/
parser = argparse.ArgumentParser(description='Use MSconvert to make time slices of raw files')
parser.add_argument('-r','--start',type=float, help='start time in minutes', default = 0)
parser.add_argument('-s','--step', type=float, help='step size in minutes', default= 0.5)
parser.add_argument('-e','--end', type=float, help='up to how many minutes', default= 20)
parser.add_argument('-b','--basename', help='basename to use for the output files', default='basename')
parser.add_argument('-x','--execute', action="store_true", help='execute the command?, \nmaybe msconvert_maker.py > outfile.bat', default=False)
args = parser.parse_args()
start = args.start
start = float(start)
start = start *60
base = args.basename
base = str(base)
step = args.step
step = float(step)
step = step * 60
stop = args.end
stop = float(stop)
stop = stop * 60
execute = args.execute
idx = 0
lines = []
while start < stop:
upto = start + step
line = f'msconvert .\*.d --outfile "{base}_{step}_{idx}m.mzml" --32 -v --filter "peakPicking cwt snr=0.1 peakSpace=0.1 msLevel=1-" --filter "scanTime [{start},{upto - 0.001}]" --filter "titleMaker <RunId>.<ScanNumber>.<ScanNumber>.<ChargeState>"'
lines.append(line)
start = upto
idx = idx + 1
# execute or print out
if execute:
for l in lines:
os.system(l)
else:
print('\n'.join(lines))
#main()
if __name__ == "__main__":
main()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment