INNER CODE UNIT · C

frac

lh3/seqtk · seqtk.c:1248

	frac = atof(argv[optind+1]);
	if (frac >= 1.0) num = (uint64_t)(frac + .499), frac = 0.;
	else if (twopass) {
		fprintf(stderr, "[W::%s] when sampling a fraction, option -2 is ignored.", __func__);
		twopass = 0;
	}
	if (kr == 0) kr = kr_srand(11);

	if (!twopass) { // the streaming version
		kseq_t *buf = 0;
		if (num > 0) buf = calloc(num, sizeof(kseq_t));
		if (num > 0 && buf == NULL) {
			fprintf(stderr, "[E::%s] Could not allocate enough memory for %" PRIu64 " sequences. Exiting...\n", __func__, num);
			free(kr);
			return 1;
		}

		fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…