Here contains the analysis pipeline for publication 
"Jagged ends of double-stranded DNA in plasma: detection, characterization and diagnostic applications"

This program is designed to analyze the jagged end nature of DNA which 
methylated cytosines are incorporated in end-repair and DNA is bisulfite-treated. 

This program supports Paired-end sequencing data aligned using bsmap.

Please prepare a bsp.list contains bsmap files. 
We have a bsp.list with a demo.seq contains 10 millions paired end reads aligned to hg19 genome using bsmap software
	(BSP format: id, seq, qual, map_flag, ref, ref_loc, strand, ins_size, refseq, mismatches, mismatches_info)


To run
sh wk.sh   
	
Pipeline output files and format
		1. demo.pairs.bed 
			(format: chr, start, end, read1_seq, read1_ref, read2_seq, read2_ref, 
			num_of_C_in_read1, num_of_T_in_read1, tot_num_of_CH_read1, 
			num_of_C_in_read2, num_of_T_in_read2, tot_num_of_CH_read2, 
			strand, jagged_end_position_in_read, jagged_end_length, jagged_end_info, blunt_end_info)

		2. demo.jlen.hist 
			(Row1: Method(CH), tot: num. of reads, exactJE: num. of jagged informative fragments, jagged_fragments_percentage)
			(Row2~below format: jagged end length, num. of fragments, percentage)

		3. demo.jagged.ends 
			(format: CH/CG context, Read1/Read2, Read_position, num_of_C, tot_bases, C%)

		4. demo.JE.exact.hist.v2
			(format: Size, Tot_fragments, informative_fragments, blunt_fragment_count, 
			CH_methylation_in_Read2, Average_jagged_end_length, Median_jagged_end_length)
			
