def split_fastafile(fastafile, maxreadlen=32000): pf = fastafile.split(".")[0] smallfastafile = pf + "-small.fasta" bigfastafile = pf + "-big.fasta" shredfastafile = pf + "-big.depth1.fasta" if need_update(fastafile, (smallfastafile, shredfastafile)): filter([fastafile, str(maxreadlen), "--less", "-o", smallfastafile]) filter([fastafile, str(maxreadlen), "-o", bigfastafile]) shred(["--depth=1", "--shift={0}".format(maxreadlen / 100), \ "--readlen={0}".format(maxreadlen), \ "--fasta", bigfastafile]) return smallfastafile, shredfastafile
def split_fastafile(fastafile, maxreadlen=32000): from jcvi.formats.fasta import filter pf = fastafile.split(".")[0] smallfastafile = pf + "-small.fasta" bigfastafile = pf + "-big.fasta" shredfastafile = pf + "-big.depth1.fasta" maxreadlen = str(maxreadlen) if need_update(fastafile, (smallfastafile, shredfastafile)): filter([fastafile, maxreadlen, "--less", "-o", smallfastafile]) filter([fastafile, maxreadlen, "-o", bigfastafile]) shred(["--depth=1", "--readlen={0}".format(maxreadlen), \ "--fasta", bigfastafile]) return smallfastafile, shredfastafile