Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/soedinglab/hh-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-steinegger committed Apr 1, 2019
2 parents 5795a56 + 02f7c16 commit 9fda8e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
28 changes: 17 additions & 11 deletions scripts/cif2fasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
@author: Harald Voehringer
"""

import sys, os, glob, textwrap, itertools
from __future__ import print_function
import sys, os, glob, gzip, textwrap, itertools
from optparse import OptionParser
from collections import defaultdict
from os.path import splitext
Expand Down Expand Up @@ -43,17 +44,22 @@ def __init__(self, cif_path):
self.block = self.open_cif()

def open_cif(self):
""" Assumes a mmCif file and returns a data block used for subsequent procedures. """
""" Assumes a mmCIF or gzipped mmCIF file and returns a data block used for subsequent procedures. """
# The "usual" procedure to open a mmCIF with pdbX/mmCIF

with open(self.cif_path) as cif_fh:
data = []
reader = PdbxReader(cif_fh)
reader.read(data)
if len(data) == 0:
return None
else:
return data[0]
data = []
try:
with gzip.open(self.cif_path) as cif_fh:
reader = PdbxReader(cif_fh)
reader.read(data)
except IOError:
with open(self.cif_path) as cif_fh:
reader = PdbxReader(cif_fh)
reader.read(data)
if len(data) == 0:
return None
else:
return data[0]

def is_valid(self):
return self.block is not None
Expand Down Expand Up @@ -496,7 +502,7 @@ def get_paths(in_folder, out_folder):

for root, dirs, files in os.walk(in_folder):
for fname in files:
if fname.endswith(".cif"):
if fname.endswith(".cif") or fname.endswith(".cif.gz"):
in_path = os.path.join(root, fname)
out_file = in_path.split('/')[-1].split('.')[0] + ".fasta"
out_path = os.path.join(out_folder, out_file)
Expand Down
2 changes: 1 addition & 1 deletion scripts/hhpred/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ How to install hhpred:

2) download hhpred databases:
- hhpred needs hhm, a3m and pdb files for each template, all in the same folder
- goto http://wwwuser.gwdg.de/~compbiol/data/hhsuite/databases/hhsearch_dbs/
- goto http://wwwuser.gwdg.de/~compbiol/data/hhsuite/databases/hhsuite_dbs/
and download the latest
pdb70*.a3m.tar.gz, pdb70*.hhm.tar.gz, pdb70*.a3m.tar.gz
and extract them into your hhpred database folder
Expand Down

0 comments on commit 9fda8e0

Please sign in to comment.