• 大小: 1.84M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-05-09
  • 语言: Python
  • 标签: 深度学习  学习  

资源简介

深度学习(SPOT-RNA)

资源截图

代码片段和文件信息

import tensorflow as tf
import numpy as np
import os
from tqdm import tqdm
import argparse
from utils import create_tfr_files prob_to_secondary_structure
import time
start = time.time()
from argparse import RawTextHelpFormatter

parser = argparse.ArgumentParser()
parser.add_argument(‘--inputs‘ default=‘sample_inputs/2zzm-B.fasta‘ type=str help=‘Path to input file in fasta format accept multiple sequences as well in fasta format; default = ‘‘sample_inputs/2zzm-1-B.fasta‘‘\n‘ metavar=‘‘)
parser.add_argument(‘--outputs‘default=‘outputs/‘ type=str help=‘Path to output files; SPOT-RNA outputs at least three files .ct .bpseq and .prob files; default = ‘‘outputs/\n‘ metavar=‘‘)
parser.add_argument(‘--gpu‘ default=-1 type=int help=‘To run on GPU specifiy GPU number. If only one GPU in computer specifiy 0; default = -1 (no GPU)\n‘ metavar=‘‘)
parser.add_argument(‘--plots‘default=False type=bool help=‘Set this to “True“ to get the 2D plots of predicted secondary structure by SPOT-RNA; default = False\n‘ metavar=‘‘)
parser.add_argument(‘--motifs‘default=False type=bool help=‘Set this to “True“ to get the motifs of predicted secondary structure by SPOT-RNA; default = False\n‘ metavar=‘‘)
#parser.add_argument(‘--NC‘default=True type=bool help=‘Set this to “False“ to predict only canonical pairs; default = True\n‘ metavar=‘‘)
args = parser.parse_args()

os.environ[‘TF_CPP_MIN_LOG_LEVEL‘] = ‘3‘
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)

create_tfr_files(args.inputs)

with open(args.inputs) as file:
    input_data = [line.strip() for line in file.read().splitlines() if line.strip()]

count = int(len(input_data)/2)

ids = [input_data[2*i].replace(“>“ ““) for i in range(count)]
sequences = {}
for iI in enumerate(ids):
    sequences[I] = input_data[2*i+1].replace(“ “ ““).replace(“T“ “U“).upper()

os.environ[“CUDA_VISIBLE_DEVICES“]= str(args.gpu)
#os.environ[‘TF_CPP_MIN_LOG_LEVEL‘] = ‘3‘ 
NUM_MODELS = 5

test_loc = [“input_tfr_files/test_data.tfrecords“]

outputs = {}
mask = {}
def sigmoid(x):
    return 1/(1+np.exp(-np.array(x dtype=np.float128)))

for MODEL in range(NUM_MODELS):
    config = tf.compat.v1.ConfigProto()
    #config.gpu_options.allow_growth = True
    config.allow_soft_placement=True
    config.log_device_placement=False
    #session_conf = tf.ConfigProto(intra_op_parallelism_threads=1 inter_op_parallelism_threads=1)
    #sess = tf.Session(config=session_conf)
    print(‘\nPredicting for SPOT-RNA model ‘+str(MODEL))
    with tf.compat.v1.Session(config=config) as sess:
        saver = tf.compat.v1.train.import_meta_graph(‘SPOT-RNA-models‘+‘/model‘+str(MODEL)+‘.meta‘)
        saver.restore(sess‘SPOT-RNA-models‘+‘/model‘+str(MODEL))
        graph = tf.compat.v1.get_default_graph()
        init_test =  graph.get_operation_by_name(‘make_initializer_2‘)
        tmp_out = graph.get_tensor_by_name(‘output_FC/fully_connected/BiasAdd:0‘)
        name_tensor = graph.get_tensor_by_name(‘tensors_2/componen

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-03-05 00:34  SPOT-RNA-master\
     文件       16725  2020-03-05 00:34  SPOT-RNA-master\LICENSE
     文件        8845  2020-03-05 00:34  SPOT-RNA-master\README.md
     文件     1217434  2020-03-05 00:34  SPOT-RNA-master\SPOT-RNA-architecture.png
     文件        4188  2020-03-05 00:34  SPOT-RNA-master\SPOT-RNA.py
     文件      695802  2020-03-05 00:34  SPOT-RNA-master\VARNAv3-93.jar
     目录           0  2020-03-05 00:34  SPOT-RNA-master\__pycache__\
     文件       13869  2020-03-05 00:34  SPOT-RNA-master\__pycache__\utils.cpython-35.pyc
     文件       12314  2020-03-05 00:34  SPOT-RNA-master\__pycache__\utils.cpython-36.pyc
     目录           0  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\
     文件        3229  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\README
     目录           0  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\
     文件         787  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\SegmentGraph_README
     文件         553  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_PDB_650.bpseq
     文件        8361  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_PDB_650_PKGraph.svg
     文件       10976  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_PDB_650_all_SegGraph.svg
     文件        3916  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_PDB_650_pkf_SegGraph.svg
     文件        1603  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_RFAM_34891.bpseq
     文件        2596  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_RFAM_34891_PKGraph.svg
     文件        7495  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_RFAM_34891_all_SegGraph.svg
     文件        5785  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\bpRNA_RFAM_34891_pkf_SegGraph.svg
     文件       36467  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\Segment Graphs\drawSegmentGraphs.pl
     文件       46704  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\bpRNA.pl
     目录           0  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\bpRNA_1m\
     文件        5131  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\bpRNA_1m\Create_bpRNA_1m.zip
     文件      161020  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\bpRNA_1m\bpRNA_1m_DatabaseDiagram.pdf
     文件         851  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\bpRNA_1m\bpRNA_1m_README
     文件        1826  2020-03-05 00:34  SPOT-RNA-master\bpRNA-master\bpRNA_PDB_650.st
     目录           0  2020-03-05 00:34  SPOT-RNA-master\input_tfr_files\
     文件      623256  2020-03-05 00:34  SPOT-RNA-master\input_tfr_files\test_data.tfrecords
     目录           0  2020-03-05 00:34  SPOT-RNA-master\outputs\
............此处省略6个文件信息

评论

共有 条评论