示例#1
0
    def map(self):
        sf = pysam.Samfile(self.input)
        rgs = [i['ID'] for i in sf.header["RG"]]
        sf.close()
        self.newsams = [
            os.path.join(os.getcwd(), str(uuid.uuid4())) + ".sam"
            for i in range(len(rgs))
        ]

        for readgroup, samout in zip(rgs, self.newsams):
            append = "--substitutionrate={0} -g {1} -h {1} -M {2} -o {3} --logfile={3}.log --readgroup=ID:{4} --outputformat=sam -v 3 ".format(
                self.subrate, self.ref, self.input, samout, readgroup)

            if self.keepgoodreads: stampyCmd += " --bamkeepgoodreads "
            if self.alignquals: stampyCmd += " --alignquals "
            if self.baq: stampyCmd += " --baq "

            cmd, stdout, stderr, errcode = COMPASSCFG["tools"][
                "stampy"].execute(append=append)
            cmd, stdout, stderr, errcode = "", "", "", 0
            LE.debug(StringIO(stdout), "stdout")
            LE.debug(StringIO(stderr), "stderr")

            if errcode:
                LE.critical("Stampy execution failed {0}".format(errcode))
                raise Exception("Stampy execution failed {0}".format(errcode))

            self.insertsizes[readgroup] = self.generateSeqStats(samout)
示例#2
0
    def markDuplicates(self):
        cmd, stdout, stderr, errcode = COMPASSCFG['tools']['picard'].execute(
            source='path',
            file='MarkDuplicates.jar',
            prepend='java -jar',
            append=
            "I={0} O={0}.dedup METRICS_FILE={1}_metrics.txt ASSUME_SORTED=true VERBOSITY=DEBUG VALIDATION_STRINGENCY=SILENT"
            .format(self.output, self.input))
        LE.debug(StringIO(stdout), "stdout")
        LE.debug(StringIO(stderr), "stderr")

        if errcode:
            LE.critical("MarkDuplicates execution failed {0}".format(errcode))
            raise Exception(
                "MarkDuplicates execution failed {0}".format(errcode))

        shutil.move(self.output + ".dedup", self.output)
示例#3
0
    def markDuplicates(self):
        cmd, stdout, stderr, errcode = COMPASSCFG["tools"]["picard"].execute(
            source="path",
            prepend="java -jar",
            file="MarkDuplicates.jar",
            append=
            "I={0} O={1}.dedup METRICS_FILE=a.txt ASSUME_SORTED=true VERBOSITY=DEBUG VALIDATION_STRINGENCY=SILENT"
            .format(self.output, self.output))
        LE.debug(StringIO(stdout), "stdout")
        LE.debug(StringIO(stderr), "stderr")

        if errcode:
            LE.critical("MarkDuplicates execution failed {0}".format(
                md.returncode))
            raise Exception("MarkDuplicates execution failed {0}".format(
                md.returncode))

        shutil.move(self.output + ".dedup", self.output)
示例#4
0
            parser.add_argument(i[0],
                                dest=i[1],
                                help=i[4],
                                default=False,
                                action='store_true')
        else:
            parser.add_argument(i[0], dest=i[1], help=i[4], default="DISABLED")
    args = parser.parse_args()

    try:
        for i in FILTERS.availableFilters():
            value = getattr(args, i[1])
            if value and value != "DISABLED":
                FILTERS.setUpFilter(i[1], value)
    except ParameterError as e:
        LE.critical("Parameter setup Error: {0}".format(e.message))
        dump_exc()

    try:
        vcfFile = GormVcf(args.invcf)
        FILTERS.filterVcf(vcfFile,
                          outvcf_path=args.outvcf,
                          outvcfIndel=args.outvcfIndel,
                          outfasta=args.outfasta,
                          stats=args.outstats,
                          guuid=args.guuid,
                          refid=args.ref_id)
        print("Done")
    except:
        dump_exc()