conda安装

  1. #由一个多序列fasta文件系统抽样产生多个fasta文件
  2. fas = {}
  3. id = None
  4. #culledpdb.fasta.txt是从dunbrack lab的pisces工具拉出来的对uniprot进行去冗余后的一个fasta文件
  5. #sorted_id_len.txt也是,但只包含了序列长度和id号,用excel对序列排序了一遍
  6. with open('culledpdb.fasta.txt', 'r') as fh,open('sorted_id_len.txt','r')as fi:
  7. for line in fh:
  8. if line[0] == '>':
  9. header = line[1:].rstrip()
  10. id = header.split()[0]
  11. fas[id] = ['>'+id+'\n']
  12. else:
  13. fas[id].append(line)
  14. for id, seq in fas.items():
  15. fas[id] = ''.join(seq)
  16. #print(fas['3H05A'])
  17. lines = fi.readlines()
  18. for i in range(57,len(lines),115):
  19. with open ('%s.fasta' % lines[i].split()[0],'w' ) as fws:
  20. fws.write(fas[lines[i].split()[0]])
  21. #以下是安装hhblits,前提保证自己的家目录里面已安装conda
  22. #创建并切换到软件安装目录
  23. mkdir ~/software/hhsuite
  24. cd ~/software/hhsuite
  25. #创建一个新环境‘hhblits’,并安装hhsuite
  26. conda create -n hhblits -c conda-forge -c bioconda hhsuite
  27. #下载数据库,以BFD为例,很大所以-b放后台,-c断点续传
  28. mkdir ~/software/hhsuite/databases
  29. cd ~/software/hhsuite/databases
  30. wget -b -c -O bfd.tar.gz https://bfd.mmseqs.com/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt.tar.gz
  31. #解压数据库,nohup连用&放后台解压,标准输出到tar.log
  32. nohup tar -xzvf bfd.tar.gz >tar.log 2>&1 &
  33. #完成后,运行hhblits,使用单一序列.fasta搜索出其MSA
  34. conda activate hhblits
  35. hhblits -i query.fasta -o3am query.a3m -d ~/software/hhsuite/databases/bfd
  36. #若是有多个单一序列fasta文件需要运行可使用如下shell,database改成自己的,test100里放了100个fasta
  37. (base) [YangSY@mgt ~]$ vim test.sh
  38. #! /bin/sh
  39. for x in $(ls ~/test100)
  40. do
  41. hhblits -i ~/test100/$x -o ~/hh_output/"$x".hhr -d ~/databases/scop40
  42. done
  43. #或者写成一行命令
  44. for x in $(ls ~/test100); do hhblits -i ~/test100/$x -o ~/hh_output/"$x".hhr -d ~software/hhsuite/databases/scop40; done
  45. #运行sh并查看时间,输出到time.txt
  46. /usr/bin/time -o time.txt test.sh

源代码编译

首先:github下载原代码,尽量新的,放到服务器解压,cd到解压后的目录

  1. mkdir build && cd build
  2. # 这一步需要加载mpi module,学校hpc的话可以 module add mpi/openmpi/4.0.1/gnu/8.3.0
  3. cmake -DCMAKE_INSTALL_PREFIX=. ..
  4. make -j 4 && make install
  5. export PATH="$(pwd)/bin:$(pwd)/scripts:$PATH" #只保证在当前终端有效,并没有写进文件
  6. # 不写环境路径的话,可以cd到build下使用,将命令的hhblits换成./bin/hhblits,后面接 -i -o什么的

参照
hh-suite user guide 链接
hh-suite github 链接
hh-suite issues 链接