def genChIPSeqSignalFilesFromReads(param):
  import ChIPSeqExperiment
  cse_target = ChIPSeqExperiment.initFromParam(param, 'multi-targets')
  cse_target.getFastqEncoding()
  cse_target.alignReadByBowtie()

  param.chipseqexperiment_target = cse_target
  for rep in cse_target.reps:
    ta = rep.tagalign
    param.targetid2fchipseq_alignment[ta.basename] = ta.fullname
def genChIPSeqPeakFileBySPPIDR(param):
  import ChIPSeqExperiment

  cse_target = ChIPSeqExperiment.initFromParam(param, 'target')
  cse_target.getFastqEncoding()
  cse_target.alignReadByBowtie()
  cse_target.poolTagAlign()

  param.chipseqexperiment_target = cse_target

  if param.chipseq_control_read_files is not None:
    cse_control = ChIPSeqExperiment.initFromParam(param, 'control')
    cse_control.getFastqEncoding()
    cse_control.alignReadByBowtie()
    cse_control.poolTagAlign()
    cse_target.callPeaksBySPP(cse_control.pooled_tagalign)
    cse_target.getPeaksByIDR(cse_control.pooled_tagalign)

    param.chipseq_peak_file = cse_target.final_peaks.fullname
    param.chipseqexperiment_control = cse_control
  else:
    pass  ## to-be-implemented, call peaks by MOSAiCS without ChIP-seq control