Exemple #1
0
def params():
    parser = ArgumentParser(description="Create file with coverage of a region")
    parser = arguments.myargs(parser)
    parser.add_argument("--region", help="bed file with regions.")
    parser.add_argument("--reference", help="genome fasta file.")
    parser.add_argument("--out", help="output file.")
    parser.add_argument("bams", nargs="*", help="Bam files.")
    parser.add_argument("--run", required=True, help="type of analysis", choices=['complete', 'report', 'metrics', 'basic-bam', 'cg-vcf', 'stats-coverage', 'tstv', 'bias-coverage', 'plot', 'fastqc', 'final'])
    parser.add_argument("--n_sample", default=1000, help="sample bed files with this number of lines")
    parser.add_argument("--seed", help="replication of sampling")
    return parser
Exemple #2
0
    def test_cluster(self):
        def fake_fn(n, args):
            print 'inside function with %s' % n
            time.sleep(n * 2)

        start = time.time()
        parser = ArgumentParser(description="Test cluster")
        parser = arguments.myargs(parser)
        args = parser.parse_args()
        logger.info(args)
        resources = {'name': 'step1', 'mem': 1, 'cores': 1}
        cluster.send_job(fake_fn, [1, 2], args, resources)
        logger.info('It took %.3f minutes without ipython' %
                    ((time.time() - start) / 60))
Exemple #3
0
    samplenames = [os.path.splitext(os.path.basename(fn))[0] for fn in samples]
    if isinstance(region_bed, six.string_types):
        region_bed = pybedtools.BedTool(region_bed)
    with file_transaction(out_file) as tx_out_file:
        for line in region_bed:
            chrom = line.chrom
            start = max(line.start - PAD, 0)
            end = line.end + PAD
            df = _combine_regional_coverage(in_bams, samplenames, chrom,
                                            start, end, os.path.dirname(tx_out_file))
            df.to_csv(tx_out_file, mode='a', index=False, header=None)
    return out_file

if __name__ == "__main__":
    parser = ArgumentParser(description="Create file with coverage of a region")
    parser = arguments.myargs(parser)
    parser.add_argument("--region", help="bed file with regions.")
    parser.add_argument("--reference", help="genome fasta file.")
    parser.add_argument("--out", required=True, help="output file.")
    parser.add_argument("bams", nargs="*", help="Bam files.")
    parser.add_argument("--basic-bam", action="store_true", help="Calculate bam stats")
    parser.add_argument("--basic-vcf", action="store_true", help="Calculate vcf stats")
    parser.add_argument("--stats", action="store_true", help="Calculate stats for all regions.")
    parser.add_argument("--tstv", action="store_true", help="Calculate ts/tv ratio.")
    parser.add_argument("--bias", action="store_true", help="Calculate bias for all regions.")
    parser.add_argument("--plot", action="store_true", help="Calculate nt coverage for given regions.")
    parser.add_argument("--n_sample", default=1000, help="sample bed files with this number of lines")
    parser.add_argument("--seed", help="replication of sampling")
    args = parser.parse_args()

    if os.path.exists(args.out):
Exemple #4
0
import time
from argparse import ArgumentParser

from ichwrapper import arguments, cluster, fake
from ichwrapper.log import logger

if __name__ == "__main__":
        start = time.time()
        parser = ArgumentParser(description="Test cluster")
        parser = arguments.myargs(parser)
        parser.add_argument("--cmd", default=False, action='store_true')
        args = parser.parse_args()
        # args = parser.parse_args(["--parallel", "ipython", "--local"])
        logger.info(args)
        resources = {'name': 'step1', 'mem': 1, 'cores': 1}
        data = [{'num': 1}, {'num': 2}]
        data = cluster.update_samples(data, resources, args)
        cluster.send_job(fake.fake_fn, data, args, resources)
        if args.cmd:
            cluster.send_job(fake.fake_cmd_fn, data, args, resources)
        logger.info('It took %.3f minutes with ipython' % ((time.time()-start)/60))