def read_known_motifs(motif_dbs, _DEBUG = False): """Given a list of xml file names, this function tries to load the motifs in those databases """ DATA_DIR = os.path.join(settings.DEPLOY_DIR, 'database') known_motifs = MotifList() for db in motif_dbs: if _DEBUG: print "loading (time): %s (%s)" % (db, time.ctime()) tmp = MotifList() tmp.from_xml_file(os.path.join(DATA_DIR, db)) known_motifs.extend(tmp) if _DEBUG: print "load Complete (time): %s (%s)" % (db, time.ctime()) return known_motifs
def read_known_motifs(motif_dbs, _DEBUG=False): """Given a list of xml file names, this function tries to load the motifs in those databases """ DATA_DIR = os.path.join(settings.DEPLOY_DIR, 'database') known_motifs = MotifList() for db in motif_dbs: if _DEBUG: print("loading (time): %s (%s)" % (db, time.ctime())) tmp = MotifList() tmp.from_xml_file(os.path.join(DATA_DIR, db)) known_motifs.extend(tmp) if _DEBUG: print("load Complete (time): %s (%s)" % (db, time.ctime())) return known_motifs
if opts.new_motifs_dir is None: new_motifs_path = opts.new_motifs_file else: new_motifs_path = os.path.join(opts.new_motifs_dir, opts.new_motifs_file) # set BED file path bed_path = os.path.join(opts.bed_dir, opts.bed_file) # set FASTA file path fasta_path = os.path.join(opts.fasta_dir, opts.fasta_file) # retrieve known motifs motifs = MotifList() if known_motifs_path is not None: motifs.from_xml_file(known_motifs_path) # retrieve new motifs if new motifs file is specified by user if new_motifs_path is not None: new_motifs = MotifList() new_motifs.from_xml_file(new_motifs_path) #motifs.append(new_motifs) motifs += new_motifs # scan all motifs for the desired motif ID if opts.pssm_file is None: for motif in motifs: if motif.id == motif_id: desired_motif = motif break else: #use a pssm as the flatfile
else: if opts.new_motifs_dir is None: new_motifs_path = opts.new_motifs_file else: new_motifs_path = os.path.join(opts.new_motifs_dir, opts.new_motifs_file) # set BED file path bed_path = os.path.join(opts.bed_dir, opts.bed_file) # set FASTA file path fasta_path = os.path.join(opts.fasta_dir, opts.fasta_file) # retrieve known motifs motifs = MotifList() if known_motifs_path is not None: motifs.from_xml_file(known_motifs_path) # retrieve new motifs if new motifs file is specified by user if new_motifs_path is not None: new_motifs = MotifList() new_motifs.from_xml_file(new_motifs_path) #motifs.append(new_motifs) motifs += new_motifs # scan all motifs for the desired motif ID if opts.pssm_file is None: for motif in motifs: if motif.id == motif_id: desired_motif = motif break else: #use a pssm as the flatfile