示例#1
0
            yield batch

def worker(input):
    output = input.split(".",-1)[0] + '.extracted.fa'
    with open(output, 'w') as o:
        with open(input, 'rU') as i:
            SeqRecords = SeqIO.parse(i, 'fasta')
            SeqIO.write(stripPrimer(SeqRecords), o, 'fasta')


#remove logfile if exists
log_name = args.out + '.log'
if os.path.isfile(log_name):
    os.remove(log_name)

ufitslib.setupLogging(log_name)
FNULL = open(os.devnull, 'w')
cmd_args = " ".join(sys.argv)+'\n'
ufitslib.log.debug(cmd_args)
print "-------------------------------------------------------"

FileName = args.fasta
fwdLen = len(FwdPrimer)

if not args.trimming:
    ufitslib.log.info("Searching for primers, this may take awhile: Fwd: %s  Rev: %s" % (args.F_primer, args.R_primer))
else:
    ufitslib.log.info("Working on file: %s" % FileName)

if not args.cpus:
    cpus = multiprocessing.cpu_count()
                    action='store_true',
                    help='Remove Intermediate Files')
args = parser.parse_args()


def checkfastqsize(input):
    filesize = os.path.getsize(input)
    return filesize


#remove logfile if exists
log_name = args.out + '.ufits-unoise2.log'
if os.path.isfile(log_name):
    os.remove(log_name)

ufitslib.setupLogging(log_name)
FNULL = open(os.devnull, 'w')
cmd_args = " ".join(sys.argv) + '\n'
ufitslib.log.debug(cmd_args)
print "-------------------------------------------------------"

#initialize script, log system info and usearch version
ufitslib.SystemInfo()
#Do a version check
usearch = args.usearch
ufitslib.versionDependencyChecks(usearch)

#make tmp folder
tmp = args.out + '_tmp'
if not os.path.exists(tmp):
    os.makedirs(tmp)