MCPcopy Create free account
hub / github.com/modelscope/modelscope / run_mmseqs2

Function run_mmseqs2

modelscope/preprocessors/science/uni_fold.py:42–232  ·  view source on GitHub ↗
(
        x,
        prefix,
        use_env=True,
        use_templates=False,
        use_pairing=False,
        host_url='https://api.colabfold.com')

Source from the content-addressed store, hash-verified

40
41
42def run_mmseqs2(
43 x,
44 prefix,
45 use_env=True,
46 use_templates=False,
47 use_pairing=False,
48 host_url='https://api.colabfold.com') -> Tuple[List[str], List[str]]:
49 submission_endpoint = 'ticket/pair' if use_pairing else 'ticket/msa'
50
51 def submit(seqs, mode, N=101):
52 n, query = N, ''
53 for seq in seqs:
54 query += f'>{n}\n{seq}\n'
55 n += 1
56
57 res = requests.post(
58 f'{host_url}/{submission_endpoint}',
59 data={
60 'q': query,
61 'mode': mode
62 })
63 try:
64 out = res.json()
65 except ValueError:
66 out = {'status': 'ERROR'}
67 return out
68
69 def status(ID):
70 res = requests.get(f'{host_url}/ticket/{ID}')
71 try:
72 out = res.json()
73 except ValueError:
74 out = {'status': 'ERROR'}
75 return out
76
77 def download(ID, path):
78 res = requests.get(f'{host_url}/result/download/{ID}')
79 with open(path, 'wb') as out:
80 out.write(res.content)
81
82 # process input x
83 seqs = [x] if isinstance(x, str) else x
84
85 mode = 'env'
86 if use_pairing:
87 mode = ''
88 use_templates = False
89 use_env = False
90
91 # define path
92 path = f'{prefix}'
93 if not os.path.isdir(path):
94 os.mkdir(path)
95
96 # call mmseqs2 api
97 tar_gz_file = f'{path}/out_{mode}.tar.gz'
98 N, REDO = 101, True
99

Callers 1

get_msa_and_templatesMethod · 0.85

Calls 9

submitFunction · 0.85
statusFunction · 0.85
indexMethod · 0.80
openMethod · 0.80
replaceMethod · 0.80
downloadFunction · 0.70
appendMethod · 0.45
updateMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…