Beispiel #1
0
#!/usr/bin/env python

"""Test libPoMo.cf.fasta_to_cf with IUPAC codes."""

import os
import libPoMo.cf as cf

######################################################################
print("##################################################")
test_sequence = "data/fasta-iupac.dat"
fn = "vcf-test-tmp.dat"
print("Convert", test_sequence, "to Counts File.")
cf.fasta_to_cf(test_sequence, fn, double_fixed_sites=True)
with open(fn) as file:
    for line in file:
        print(line, end='')
os.remove(fn)
Beispiel #2
0
parser.add_argument("fastaFile",
                    help="path to (gzipped) fasta file")
parser.add_argument("output",
                    help="name of (gzipped) outputfile in counts format")
parser.add_argument("-v", "--verbose", action="count",
                    help="turn on verbosity (-v or -vv)")
parser.add_argument("--iupac", action="store_true",
                    help="heteorzygotes are encoded with IUPAC codes")
# TODO
# parser.add_argument("-i", "--one-indiv", action="store_true",
#                     help="randomly choose one indivual per population")
args = parser.parse_args()

FaRefFN = args.fastaFile
output = args.output
vb = args.verbose
iupac_flag = args.iupac
# oneI = args.one_indiv

logging.basicConfig(format='%(levelname)s: %(message)s')
logger = logging.getLogger()
if args.verbose == 0:
    logger.setLevel(logging.WARN)
elif args.verbose == 1:
    logger.setLevel(logging.INFO)
elif args.verbose == 2:
    logger.setLevel(logging.DEBUG)

cf.fasta_to_cf(FaRefFN, output, double_fixed_sites=iupac_flag)
Beispiel #3
0
"""

parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=descr)

parser.add_argument("fastaFile", help="path to (gzipped) fasta file")
parser.add_argument("output", help="name of (gzipped) outputfile in counts format")
parser.add_argument("-v", "--verbose", action="count", help="turn on verbosity (-v or -vv)")
parser.add_argument("--iupac", action="store_true", help="heteorzygotes are encoded with IUPAC codes")
# TODO
# parser.add_argument("-i", "--one-indiv", action="store_true",
#                     help="randomly choose one indivual per population")
args = parser.parse_args()

FaRefFN = args.fastaFile
output = args.output
vb = args.verbose
iupac_flag = args.iupac
# oneI = args.one_indiv

logging.basicConfig(format="%(levelname)s: %(message)s")
logger = logging.getLogger()
if args.verbose == 0:
    logger.setLevel(logging.WARN)
elif args.verbose == 1:
    logger.setLevel(logging.INFO)
elif args.verbose == 2:
    logger.setLevel(logging.DEBUG)

cf.fasta_to_cf(FaRefFN, output, double_fixed_sites=iupac_flag)
Beispiel #4
0
#!/usr/bin/env python
"""Test libPoMo.cf.fasta_to_cf with IUPAC codes."""

import os
import libPoMo.cf as cf

######################################################################
print("##################################################")
test_sequence = "data/fasta-iupac.dat"
fn = "vcf-test-tmp.dat"
print("Convert", test_sequence, "to Counts File.")
cf.fasta_to_cf(test_sequence, fn, double_fixed_sites=True)
with open(fn) as file:
    for line in file:
        print(line, end='')
os.remove(fn)