コード例 #1
0
    description=
    "TagDigger v. 1.1 barcode splitter command line script by Lindsay V. Clark"
)
parser.add_argument('-b',
                    '--barcodefile',
                    help='Name of barcode key file',
                    required=True)
parser.add_argument('-a',
                    '--adapter',
                    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]])
コード例 #2
0
print("Cut site: " + cutsite)

# set working directory for finding files
tagdigger_fun.set_directory_interactive()

# read in tags
tags = tagdigger_fun.readTags_interactive()

# sanitize
tags = tagdigger_fun.sanitizeTags(tags)
print("{} tag sequences remain.\n".format(len(tags[1])))

# read in key file
bckeys = None
while bckeys == None:
    bckeys = tagdigger_fun.readBarcodeKeyfile(
        input("Name of key file with barcodes: ").strip())
# 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'}:
コード例 #3
0
    thischoice = input("Use different directory for reading and writing files? (y/n) ").strip()
if thischoice.upper() == 'Y':
    dirchoice = ""
    while not os.path.isdir(dirchoice):
        dirchoice = input("New directory: ")
    os.chdir(dirchoice)

print("\nContents of current directory:")
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'}:
コード例 #4
0
    while thischoice not in {"1", "2", "3", "4"}:
        thischoice = input("Enter the number of the format of your tag file: ").strip()
    tagfile = input("Enter the file name: ").strip()
    tags = tagfunctions[thischoice](tagfile, toKeep=toKeep)
    print("")
# summarize results
print("{} tag sequences read.\n".format(len(tags[1])))

# sanitize
tags = tagdigger_fun.sanitizeTags(tags)
print("{} tag sequences remain.\n".format(len(tags[1])))

# read in key file
bckeys = None
while bckeys == None:
    bckeys = tagdigger_fun.readBarcodeKeyfile(input("Name of key file with barcodes: ").strip())
# 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"}:
コード例 #5
0
    writeMarkerKey = args.TASSELkeyFile != None
    tags = tagdigger_fun.readTags_TASSELSAM(args.TASSELSAM,
                                            toKeep=toKeep,
                                            binaryOnly=binaryOnly,
                                            writeMarkerKey=writeMarkerKey,
                                            keyfilename=args.TASSELkeyFile)
if tagformat[6]:
    tags = tagdigger_fun.readTags_pyRAD(args.pyRADalleles,
                                        toKeep=toKeep,
                                        binaryOnly=binaryOnly)
if tags == None:
    raise Exception("Problem reading tags.")
tags = tagdigger_fun.sanitizeTags(tags)

# read barcode file
bckeys = tagdigger_fun.readBarcodeKeyfile(args.barcodefile)
if bckeys == None:
    raise Exception("Problem reading barcode file.")
# check fastq files
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.")

# check binary SNPs for numeric genotype output
if args.outputgen != None:
    if set([t[-1] for t in tags[0]]) != {'0', '1'}:
        raise Exception(
            "Cannot output numeric genotypes for non-binary markers.")
コード例 #6
0
adaptersets = sorted(tagdigger_fun.adapters.keys())
for a in adaptersets:
    if enzchoice not in knownenzymes or enzchoice in a:
        print(a)
print("")
adaptchoice = ""
while adaptchoice not in adaptersets:
    adaptchoice = input("Choose an adapter set: ").strip()

# set working directory for finding files
tagdigger_fun.set_directory_interactive()

# 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'}: