help='Name of the adapter set', required=True, choices=sorted(tagdigger_fun.adapters.keys())) args = parser.parse_args() bckeys = tagdigger_fun.readBarcodeKeyfile(args.barcodefile, forSplitter=True) if bckeys == None: raise Exception("Problem reading barcode file.") adapter = tagdigger_fun.adapters[args.adapter] enzyme = args.adapter[:args.adapter.find("-")] cutsite = tagdigger_fun.enzymes[enzyme] fqfiles = sorted(bckeys.keys()) fqok = [tagdigger_fun.isFastq(f) for f in fqfiles] if not all(fqok): print("Cannot read the following as FASTQ files:") print([fqfiles[i] for i in range(len(fqfiles)) if not fqok[i]]) raise Exception("Cannot read all FASTQ files.") for f in fqfiles: tagdigger_fun.barcodeSplitter(f, bckeys[f][0], bckeys[f][1], cutsite=cutsite, adapter=adapter)
thisdircontents = os.listdir('.') for i in thisdircontents: print(i) # read in key file bckeys = None while bckeys == None: bckeys = tagdigger_fun.readBarcodeKeyfile(input("\nName of key file with barcodes: ").strip(), forSplitter=True) # summarize fqfiles = sorted(bckeys.keys()) for f in fqfiles: print("File {}: {} barcodes".format(f, len(bckeys[f][0]))) print("") # check that FASTQ files are okay fqok = [tagdigger_fun.isFastq(f) for f in fqfiles] while not all(fqok): print("Cannot read the following as FASTQ files:") for f in range(len(fqok)): if not fqok[f]: print(fqfiles[f]) thischoice = '0' while thischoice not in {'1', '2', '3'}: thischoice = input(''' Press 1 to re-read key file, 2 to search for FASTQ files in a different directory, or 3 to try reading the same FASTQ files again: ''').strip() if thischoice == '1': bckeys = None while bckeys == None: bckeys = tagdigger_fun.readBarcodeKeyfile(input("\nName of key file with barcodes: ")) fqfiles = sorted(bckeys.keys())