diff --git a/snakecnv/bin/parse.py b/snakecnv/bin/parse.py index 1822003f4c4d0b512f707741791ab728f43b8203..838e527fae6bc997f83bdf807e0c4ea92f7c28b1 100755 --- a/snakecnv/bin/parse.py +++ b/snakecnv/bin/parse.py @@ -19,7 +19,7 @@ tool_to_writer = {"pindel": PindelWriter, "delly": DellyWriter, def convert_svtool_to_vcf(reference, inputfile, gaps, outputfile, toolname, svtype, minlen=50, maxlen=5000000, - doNotFilter=False): + batch=None, doNotFilter=False): # The reference handle reference_handle = Fastafile(reference) if reference else None @@ -57,19 +57,18 @@ def convert_svtool_to_vcf(reference, inputfile, gaps, outputfile, eprint("Now writing the records") for record in records: + record.addbatch2Id(batch) SVWriter.write(record) SVWriter.close() eprint("%d records" % (len(records))) - # Removed, this is done by SVWriter.close() - # tabix_index(outputfile, force=True, preset='vcf') - -def parsing(reference, tooloutput, gaps, parseoutput, tool, svtype, doNotFilter): +def parsing(reference, tooloutput, gaps, parseoutput, tool, svtype, + doNotFilter, batch): #print("\n".join([reference, tooloutput, gaps, parseoutput, tool, svtype])) convert_svtool_to_vcf(reference, tooloutput, gaps, parseoutput, - tool, svtype, doNotFilter=doNotFilter) + tool, svtype, batch=batch, doNotFilter=doNotFilter) if __name__ == "__main__": @@ -90,6 +89,8 @@ if __name__ == "__main__": help="Tool name") parser.add_argument("-s", "--sv-type", required=True, help="Type of variant") + parser.add_argument("-b", "--batch", default=None, + help="the batch") parser.add_argument("-f", "--nofilter", action="store_true", default=False, help="Filter false : do not filter during parse") @@ -101,4 +102,6 @@ if __name__ == "__main__": parseoutput=args.output_vcf, tool=args.tool, svtype=args.sv_type, - doNotFilter=args.nofilter) + batch=args.batch, + doNotFilter=args.nofilter + ) diff --git a/snakecnv/detection.snk b/snakecnv/detection.snk index b978084dd7e6fbeb29b93026e0d5bb07d184bd19..6ea9bf0f646de5dff5e27b9b52a4526d943e0fe8 100644 --- a/snakecnv/detection.snk +++ b/snakecnv/detection.snk @@ -193,6 +193,7 @@ rule parsing: shell: "parse.py -r {input.reference} -i {input.tooloutput} -g {input.gaps} " "-o {output.parseoutput} -t {wildcards.tool} -s {wildcards.svtype} " + "-b {wildcards.batch} " "1>{log.stdout} 2>{log.stderr}" if "no_detection_index" not in config or not config["no_detection_index"]: