コード例 #1
0
def main(args):
	ref = args.ref
	r1 = args.r1
	r2 = args.r2
	prefix = args.prefix
	threads = args.threads

	stats = {}
	fastqqc = ps.qc_fastq(prefix,r1,r2)
	stats["fastq_mean_read_len"] = fastqqc.mean_read_len
	stats["fastq_read_num"] = fastqqc.read_num


	fastq = ps.fastq(prefix,ref,r1,r2,threads=threads)

	fastq.illumina(mapper="bowtie2")

	bam_file = "%s.bam" % prefix

	bam = ps.bam(bam_file,prefix,ref)
	bam.gbcf(vtype="snps",threads=threads,call_method=args.call_method)

	bamqc = bam.get_bam_qc()
	cov_plot = "%s.cov.png" % (prefix)
	bamqc.plot_cov("Chromosome",cov_plot)
	stats["bam_pct_reads_mapped"] = bamqc.pct_reads_mapped
	stats["bam_med_dp"] = bamqc.med_dp
	stats["bam_depth_10"] = bamqc.genome_cov[10]
	stats["bam_depth_5"] = bamqc.genome_cov[5]

	json.dump(stats,open("%s.stats.json" % prefix,"w"))
	O = open("%s.log"%prefix,"w")
	for x in ["fastq_mean_read_len","fastq_read_num","bam_pct_reads_mapped","bam_med_dp","bam_depth_5","bam_depth_10"]:
		O.write("%s\t%s\n" % (x,stats[x]))
	O.close()
コード例 #2
0
ファイル: mapping.py プロジェクト: jodyphelan/pathogenseq
def main(args):
	if not args.prefix:
		ps.log("Please specify prefix with -p")
		quit(1)
	if not args.ref:
		ps.log("Please use --ref to provide a reference... Exiting",ext=T)
	x= ps.fastq(args.prefix,args.ref,args.r1,args.r2,threads=args.threads)
	x.illumina(mapper=args.mapper)
コード例 #3
0
ファイル: mapping.py プロジェクト: jodyphelan/pathogenseq
def main(args):
    if not args.prefix:
        ps.log("Please specify prefix with -p")
        quit(1)
    if not args.ref:
        ps.log("Please use --ref to provide a reference... Exiting", ext=T)
    x = ps.fastq(args.prefix, args.ref, args.r1, args.r2, threads=args.threads)
    x.illumina(mapper=args.mapper)
コード例 #4
0
def main(args):
    if not args.prefix:
        print "Please specify prefix with -p"
        quit(1)
    x = pathogenseq.fastq(args.prefix,
                          args.ref,
                          args.r1,
                          args.r2,
                          threads=args.threads)
    x.illumina(mapper=args.mapper)
コード例 #5
0
def main(args):
    ref = args.ref
    r1 = args.r1
    r2 = args.r2
    prefix = args.prefix
    threads = args.threads

    stats_file = "%s.stats.json" % prefix
    gc_file = "%s.gc_skew.json" % prefix
    cov_file = "%s.regions.cov.json" % prefix
    stats = OrderedDict()
    fq = ps.fastq(prefix, ref, r1, r2, threads=threads)
    fq_qc = fq.get_fastq_qc()
    if args.centrifuge:
        t1, t2 = fq_qc.run_centrifuge(args.centrifuge, False, threads)
        stats["centrifuge_top_hit"] = t1
        stats["centrifuge_top_hit_num_reads"] = t2
    stats["mean_read_len"] = fq_qc.mean_read_len
    stats["median_read_len"] = fq_qc.median_read_len
    stats["read_num"] = fq_qc.read_num
    bam = fq.illumina(mapper=args.mapper)

    if not args.nobamstats:
        bam_qc = bam.get_bam_qc()
        stats["med_dp"] = bam_qc.med_dp
        stats["pct_reads_mapped"] = bam_qc.pct_reads_mapped
        stats["genome_cov_1"] = bam_qc.genome_cov[1]
        stats["genome_cov_10"] = bam_qc.genome_cov[10]
        fasta = ps.fasta(ref).fa_dict
        for seq in fasta:
            cov_png = "%s.%s.cov.png" % (prefix, seq)
            bam_qc.plot_cov(seq, cov_png, primers=args.primers)
        if args.bed_cov: bam_qc.save_cov(cov_file, args.bed_cov)
    bam_qc.extract_gc_skew(gc_file)
    variants = bam.gbcf(primers=args.primers,
                        chunk_size=args.window,
                        call_method=args.call_method)
    bcfstats = variants.load_stats()
    stats["hom_variants"] = bcfstats["PSC"][prefix]["nNonRefHom"]
    stats["het_variants"] = bcfstats["PSC"][prefix]["nHets"]
    stats["hom_ref"] = bcfstats["PSC"][prefix]["nRefHom"]
    json.dump(stats, open(stats_file, "w"))
コード例 #6
0
def main(args):
    ref = args.ref
    r1 = args.reads
    prefix = args.prefix
    threads = args.threads

    stats_file = "%s.stats.json" % prefix
    gc_file = "%s.gc_skew.json" % prefix
    cov_file = "%s.regions.cov.json" % prefix
    stats = OrderedDict()
    fq = ps.fastq(prefix, ref, r1, threads=threads)
    fq_qc = fq.get_fastq_qc()
    stats["mean_read_len"] = fq_qc.mean_read_len
    stats["median_read_len"] = fq_qc.median_read_len
    stats["read_num"] = fq_qc.read_num
    if args.centrifuge:
        t1, t2 = fq_qc.run_centrifuge(args.centrifuge, False, threads)
        stats["centrifuge_top_hit"] = t1
        stats["centrifuge_top_hit_num_reads"] = t2
    bam = fq.minION()
    bam_qc = bam.get_bam_qc()
    stats["med_dp"] = bam_qc.med_dp
    stats["pct_reads_mapped"] = bam_qc.pct_reads_mapped
    stats["genome_cov_1"] = bam_qc.genome_cov[1]
    stats["genome_cov_10"] = bam_qc.genome_cov[10]
    fasta = ps.fasta(ref).fa_dict
    for seq in fasta:
        cov_png = "%s.%s.cov.png" % (prefix, seq)
        bam_qc.plot_cov(seq, cov_png, primers=args.primers)
    bam_qc.extract_gc_skew(gc_file)
    if args.bed_cov: bam_qc.save_cov(cov_file, args.bed_cov)
    variants = bam.pileup2vcf(indels=False)
    bcf = bam.gbcf(threads=threads,
                   primers=args.primers,
                   chunk_size=args.window)
    bcf.generate_consensus(ref)
    bcfstats = bcf.load_stats()
    stats["hom_variants"] = bcfstats["PSC"][prefix]["nNonRefHom"]
    stats["het_variants"] = bcfstats["PSC"][prefix]["nHets"]
    stats["hom_ref"] = bcfstats["PSC"][prefix]["nRefHom"]
    json.dump(stats, open(stats_file, "w"))
コード例 #7
0
def main(args):
	ref = args.ref
	r1 = args.r1
	r2 = args.r2
	prefix = args.prefix
	threads = args.threads


	stats_file = "%s.stats.json" % prefix
	gc_file = "%s.gc_skew.json" % prefix
	cov_file = "%s.regions.cov.json" % prefix
	stats = OrderedDict()
	fq = ps.fastq(prefix,ref,r1,r2,threads=threads)
	fq_qc = fq.get_fastq_qc()
	if args.centrifuge:
		t1,t2 = fq_qc.run_centrifuge(args.centrifuge,False,threads)
		stats["centrifuge_top_hit"] = t1
		stats["centrifuge_top_hit_num_reads"] = t2
	stats["mean_read_len"] = fq_qc.mean_read_len
	stats["median_read_len"] = fq_qc.median_read_len
	stats["read_num"] = fq_qc.read_num
	bam = fq.illumina(mapper=args.mapper)

	if not args.nobamstats:
		bam_qc = bam.get_bam_qc()
		stats["med_dp"] = bam_qc.med_dp
		stats["pct_reads_mapped"] = bam_qc.pct_reads_mapped
		stats["genome_cov_1"] = bam_qc.genome_cov[1]
		stats["genome_cov_10"] = bam_qc.genome_cov[10]
		fasta = ps.fasta(ref).fa_dict
		for seq in fasta:
			cov_png = "%s.%s.cov.png" % (prefix,seq)
			bam_qc.plot_cov(seq,cov_png,primers=args.primers)
		if args.bed_cov: bam_qc.save_cov(cov_file,args.bed_cov)
	bam_qc.extract_gc_skew(gc_file)
	variants = bam.gbcf(primers=args.primers,chunk_size=args.window,call_method=args.call_method)
	bcfstats = variants.load_stats()
	stats["hom_variants"] = bcfstats["PSC"][prefix]["nNonRefHom"]
	stats["het_variants"] = bcfstats["PSC"][prefix]["nHets"]
	stats["hom_ref"] = bcfstats["PSC"][prefix]["nRefHom"]
	json.dump(stats,open(stats_file,"w"))
コード例 #8
0
import argparse
import json

ref = sys.argv[1]
r1 = sys.argv[2]
r2 = sys.argv[3]
prefix = sys.argv[4]
threads = sys.argv[5]

stats = {}
fastqqc = ps.qc_fastq(prefix,r1,r2)
stats["fastq_mean_read_len"] = fastqqc.mean_read_len
stats["fastq_read_num"] = fastqqc.read_num


fastq = ps.fastq(prefix,ref,r1,r2,threads=threads)

fastq.illumina(mapper="minimap2")

bam_file = "%s.bam" % prefix

bam = ps.bam(bam_file,prefix,ref)
bam.gbcf(vtype="snps",threads=threads)

bamqc = bam.get_bam_qc()
cov_plot = "%s.cov.png" % (prefix)
bamqc.plot_cov("Chromosome",cov_plot)
stats["bam_pct_reads_mapped"] = bamqc.pct_reads_mapped
stats["bam_med_dp"] = bamqc.med_dp
stats["bam_depth_10"] = bamqc.genome_cov[10]
stats["bam_depth_5"] = bamqc.genome_cov[5]
コード例 #9
0
prefix = sys.argv[4]
threads = sys.argv[5]

stats = {}
fastqqc = ps.qc_fastq(prefix, r1, r2, threads=threads)
stats["fastq_mean_read_len"] = fastqqc.mean_read_len
stats["fastq_read_num"] = fastqqc.read_num

fr1, fr2, tmp = fastqqc.run_centrifuge("/opt/storage2/jody/software/p+h+v",
                                       mtb_tax, threads)
stats["centrifuge_top_hit"] = tmp[0]
stats["centrifuge_pct_reads"] = tmp[1]

newfastqqc = ps.qc_fastq(prefix, fr1, fr2, threads=threads)

fastq = ps.fastq(prefix, ref, fr1, fr2, threads=threads)

fastq.illumina(mapper="bowtie2")

bam_file = "%s.bam" % prefix

bam = ps.bam(bam_file, prefix, ref, threads=threads)
bam.gbcf(vtype="snps", threads=threads, call_method="low")

bamqc = bam.get_bam_qc()
cov_plot = "%s.cov.png" % (prefix)
bamqc.plot_cov("Chromosome", cov_plot)
stats["bam_pct_reads_mapped"] = bamqc.pct_reads_mapped
stats["bam_med_dp"] = bamqc.med_dp
stats["bam_depth_10"] = bamqc.genome_cov[10]
stats["bam_depth_5"] = bamqc.genome_cov[5]
コード例 #10
0
threads = sys.argv[5]

stats = {}
fastqqc = ps.qc_fastq(prefix,r1,r2,threads=threads)
stats["fastq_mean_read_len"] = fastqqc.mean_read_len
stats["fastq_read_num"] = fastqqc.read_num


fr1,fr2,tmp = fastqqc.run_centrifuge("/opt/storage2/jody/software/p+h+v",mtb_tax,threads)
stats["centrifuge_top_hit"] = tmp[0]
stats["centrifuge_pct_reads"] = tmp[1]


newfastqqc = ps.qc_fastq(prefix,fr1,fr2,threads=threads)

fastq = ps.fastq(prefix,ref,fr1,fr2,threads=threads)

fastq.illumina(mapper="bowtie2")

bam_file = "%s.bam" % prefix

bam = ps.bam(bam_file,prefix,ref,threads=threads)
bam.gbcf(vtype="snps",threads=threads,call_method="low")

bamqc = bam.get_bam_qc()
cov_plot = "%s.cov.png" % (prefix)
bamqc.plot_cov("Chromosome",cov_plot)
stats["bam_pct_reads_mapped"] = bamqc.pct_reads_mapped
stats["bam_med_dp"] = bamqc.med_dp
stats["bam_depth_10"] = bamqc.genome_cov[10]
stats["bam_depth_5"] = bamqc.genome_cov[5]