@follows( buildBAMStats )
    @files( [ ( [ ("%s%s.bam" % (x,y), "%s%s.readstats" % (x,y))  for y in REPLICATES],
                "%s.norm.bam" % x) for x in TRACKS_EXPERIMENTS ] )
    def normalizeBAMPerExperiment( infiles, outfile ):
        '''build a normalized BAM file such that all
        files have approximately the same number of 
        reads.


        Duplicated reads are removed at the same time.

        Merge reads from several replicates.
        '''
        PipelineChipseq.buildNormalizedBAM( infiles, outfile )

    ############################################################
    ############################################################
    ############################################################
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD.py/normalizeBAMPerExperiment/original