parameters: (prm)
docstring: calculate peaks/signals for the TSS, body, and TES regions
    calculate GC contenct and effective length
    learn prior from training set and derived priors for all isoforms
docstring_summary: calculate peaks/signals for the TSS, body, and TES regions
    calculate GC contenct and effective length
    learn prior from training set and derived priors for all isoforms
docstring_tokens: calculate peaks / signals for the TSS body and TES regions calculate GC contenct and effective length learn prior from training set and derived priors for all isoforms
function: def genPriorByPeakSignalGCLen(prm):
    """
    calculate peaks/signals for the TSS, body, and TES regions
    calculate GC contenct and effective length
    learn prior from training set and derived priors for all isoforms
    """
    ## calculate GC contect for isoforms
    trid2seq = Util.getFastaID2Seq(prm.ffasta)
    with open(prm.fall_tr_gc, 'w') as f_fall_tr_gc:
      f_fall_tr_gc.write("trid\tGC_fraction\n")
      for tr in prm.transcripts:
        gc_frac = Util.getGCFraction(trid2seq[tr.transcript_id])
        f_fall_tr_gc.write("%s\t%.2f\n" % (tr.transcript_id, gc_frac) )
  
    with open(prm.fsppout_target, 'r') as f_fsppout_target:
      words = f_fsppout_target.read().split("\t")
      prm.chipseq_target_fraglen = int(words[2])
  
    ## prepare a feature file of peaks and signals for all isoforms,
    ## isoforms in training set will be labeled
    if not os.path.exists(prm.fchipseq_peaks):
      sys.exit("File not exists: %s\n" % prm.fchipseq_peaks)
    Util.runCommand('/bin/env', 'Rscript', prm.rnaseq_rscript,
                    'prepPeakSignalGCLenFeatures', prm.prsem_rlib_dir,
                    prm.fall_tr_crd, prm.ftraining_tr_crd, prm.fall_tr_features,
                    prm.fisoforms_results, prm.FLANKING_WIDTH,
                    prm.partition_model, prm.fchipseq_peaks,
                    prm.fchipseq_target_signals, prm.fall_tr_gc, prm.num_threads,
                    prm.chipseq_target_fraglen, quiet=prm.quiet)
  
    if not os.path.exists(prm.fall_tr_gc):
      sys.exit("Failed to generate file: %s\n" % prm.fall_tr_gc)
  
    ## learn and generate prior for all transcripts
    Util.runCommand('/bin/env', 'Rscript', prm.rnaseq_rscript,
                    'genPriorByPeakSignalGCLen', prm.prsem_rlib_dir,
                    prm.fall_tr_features, prm.partition_model, prm.fall_tr_prior,
                    quiet=prm.quiet)
  
    if not os.path.exists(prm.fall_tr_prior):
      sys.exit("Failed to generate file: %s\n" % prm.fall_tr_prior)
function_tokens: def genPriorByPeakSignalGCLen ( prm ) : ## calculate GC contect for isoforms trid2seq = Util . getFastaID2Seq ( prm . ffasta ) with open ( prm . fall_tr_gc , 'w' ) as f_fall_tr_gc : f_fall_tr_gc . write ( "trid\tGC_fraction\n" ) for tr in prm . transcripts : gc_frac = Util . getGCFraction ( trid2seq [ tr . transcript_id ] ) f_fall_tr_gc . write ( "%s\t%.2f\n" % ( tr . transcript_id , gc_frac ) ) with open ( prm . fsppout_target , 'r' ) as f_fsppout_target : words = f_fsppout_target . read ( ) . split ( "\t" ) prm . chipseq_target_fraglen = int ( words [ 2 ] ) ## prepare a feature file of peaks and signals for all isoforms, ## isoforms in training set will be labeled if not os . path . exists ( prm . fchipseq_peaks ) : sys . exit ( "File not exists: %s\n" % prm . fchipseq_peaks ) Util . runCommand ( '/bin/env' , 'Rscript' , prm . rnaseq_rscript , 'prepPeakSignalGCLenFeatures' , prm . prsem_rlib_dir , prm . fall_tr_crd , prm . ftraining_tr_crd , prm . fall_tr_features , prm . fisoforms_results , prm . FLANKING_WIDTH , prm . partition_model , prm . fchipseq_peaks , prm . fchipseq_target_signals , prm . fall_tr_gc , prm . num_threads , prm . chipseq_target_fraglen , quiet = prm . quiet ) if not os . path . exists ( prm . fall_tr_gc ) : sys . exit ( "Failed to generate file: %s\n" % prm . fall_tr_gc ) ## learn and generate prior for all transcripts Util . runCommand ( '/bin/env' , 'Rscript' , prm . rnaseq_rscript , 'genPriorByPeakSignalGCLen' , prm . prsem_rlib_dir , prm . fall_tr_features , prm . partition_model , prm . fall_tr_prior , quiet = prm . quiet ) if not os . path . exists ( prm . fall_tr_prior ) : sys . exit ( "Failed to generate file: %s\n" % prm . fall_tr_prior )