diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ad52a5dad8332451ef7a68cf2fa1ce902646f6..6c7922a1f6b2c36bfd3c2cf9ab81461ef56c6d7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,9 @@ # nf-core/hic: Changelog - ## v1.1dev +* Add --saveInteractionBAM option * Fix bug for reads extension _1/_2 (#30) - * Update manual (#28) ## v1.0 - 2019-05-06 diff --git a/bin/mapped_2hic_fragments.py b/bin/mapped_2hic_fragments.py index efa32e6d681c6fc1cbf60843bc588f1371de30f1..d4790ee3114a071cff3131543159d9124bbab1c6 100755 --- a/bin/mapped_2hic_fragments.py +++ b/bin/mapped_2hic_fragments.py @@ -53,7 +53,7 @@ def get_args(): "minInsertSize=", "maxInsertSize", "minFragSize", "maxFragSize", "minDist", - "gatg", "samOut", "verbose", "all", "help"]) + "gatg", "sam", "verbose", "all", "help"]) except getopt.GetoptError: usage() sys.exit(-1) @@ -442,7 +442,7 @@ def get_interaction_type(read1, read1_chrom, resfrag1, read2, # If returned InteractionType=None -> Same restriction fragment # and same strand = Dump interactionType = None - + if not read1.is_unmapped and not read2.is_unmapped and resfrag1 is not None and resfrag2 is not None: # same restriction fragment if resfrag1 == resfrag2: @@ -501,9 +501,9 @@ if __name__ == "__main__": minInsertSize = arg elif opt in ("-l", "--longestInsertSize"): maxInsertSize = arg - elif opt in ("-t", "--shortestFragmentSize"): + elif opt in ("-t", "--shortestFragmentLength"): minFragSize = arg - elif opt in ("-m", "--longestFragmentSize"): + elif opt in ("-m", "--longestFragmentLength"): maxFragSize = arg elif opt in ("-d", "--minCisDist"): minDist = arg @@ -613,6 +613,7 @@ if __name__ == "__main__": r2_chrom = None if r1_resfrag is not None or r2_resfrag is not None: + interactionType = get_interaction_type(r1, r1_chrom, r1_resfrag, r2, r2_chrom, r2_resfrag, verbose) dist = get_PE_fragment_size(r1, r2, r1_resfrag, r2_resfrag, interactionType) cdist = get_cis_dist(r1, r2) @@ -724,10 +725,14 @@ if __name__ == "__main__": if or1_resfrag is not None: or1_fragname = or1_resfrag.value['name'] - + else: + or1_fragname = 'None' + if or2_resfrag is not None: or2_fragname = or2_resfrag.value['name'] - + else: + or2_fragname = 'None' + cur_handler.write( or1.qname + "\t" + or1_chrom + "\t" + diff --git a/conf/hicpro.config b/conf/hicpro.config index 0a2c9b9e0db09f4f9861ba353b84a534820aba38..01b755a955c5aee521a6cf43b00847cfbc8d0cd3 100644 --- a/conf/hicpro.config +++ b/conf/hicpro.config @@ -38,5 +38,6 @@ params { saveReference = false saveAlignedIntermediates = false + saveInteractionBAM = false } diff --git a/main.nf b/main.nf index 1bd5a3a821f01b05887aa3dc1fefbee47a58fc34..31f73a8549e76b246fe05981c0c2735b5605090e 100644 --- a/main.nf +++ b/main.nf @@ -32,6 +32,8 @@ def helpMessage() { --fasta Path to Fasta reference --chromosome_size Path to chromosome size file --restriction_fragments Path to restriction fragment file (bed) + --saveReference Save reference genome to output folder. Default: False + --saveAlignedIntermediates Save intermediates alignment files. Default: False Options: --bwt2_opts_end2end Options for bowtie2 end-to-end mappinf (first mapping step). See hic.config for default. @@ -43,8 +45,9 @@ def helpMessage() { --max_restriction_framgnet_size Maximum size of restriction fragmants to consider. Default: None --min_insert_size Minimum insert size of mapped reads to consider. Default: None --max_insert_size Maximum insert size of mapped reads to consider. Default: None + --saveInteractionBAM Save BAM file with interaction tags (dangling-end, self-circle, etc.). Default: False - --dnase Run DNase Hi-C mode. All options related to restriction fragments are not considered. Default: false + --dnase Run DNase Hi-C mode. All options related to restriction fragments are not considered. Default: False --min_cis_dist Minimum intra-chromosomal distance to consider. Default: None --rm_singleton Remove singleton reads. Default: true @@ -65,10 +68,10 @@ def helpMessage() { Step options: - --skip_maps Skip generation of contact maps. Useful for capture-C. Default: false - --skip_ice Skip ICE normalization. Default: false - --skip_cool Skip generation of cool files. Default: false - --skip_multiQC Skip MultiQC. Default: false + --skip_maps Skip generation of contact maps. Useful for capture-C. Default: False + --skip_ice Skip ICE normalization. Default: False + --skip_cool Skip generation of cool files. Default: False + --skip_multiQC Skip MultiQC. Default: False AWSBatch options: --awsqueue The AWSBatch JobQueue that needs to be set when running on AWSBatch @@ -154,7 +157,7 @@ if ( params.splitFastq ){ raw_reads_full = raw_reads.concat( raw_reads_2 ) raw_reads = raw_reads_full.splitFastq( by: params.splitFastq , file: true) }else{ - raw_reads = raw_reads.concat( raw_reads_2 ) + raw_reads = raw_reads.concat( raw_reads_2 ).dump(tag: "data") } @@ -599,6 +602,10 @@ if (!params.dnase){ output: set val(sample), file("*.validPairs") into valid_pairs set val(sample), file("*.validPairs") into valid_pairs_4cool + set val(sample), file("*.DEPairs") into de_pairs + set val(sample), file("*.SCPairs") into sc_pairs + set val(sample), file("*.REPairs") into re_pairs + set val(sample), file("*.FiltPairs") into filt_pairs set val(sample), file("*RSstat") into all_rsstat script: @@ -612,9 +619,10 @@ if (!params.dnase){ if ("$params.max_insert_size".isInteger()) opts="${opts} -l ${params.max_insert_size}" if ("$params.min_restriction_fragment_size".isInteger()) opts="${opts} -t ${params.min_restriction_fragment_size}" if ("$params.max_restriction_fragment_size".isInteger()) opts="${opts} -m ${params.max_restriction_fragment_size}" + if (params.saveInteractionBAM) opts="${opts} --sam" """ - mapped_2hic_fragments.py -f ${frag_file} -r ${pe_bam} ${opts} + mapped_2hic_fragments.py -f ${frag_file} -r ${pe_bam} --all ${opts} """ } }