hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ff8907952a022948ed07c41c45d4055c9c79d440 | labstructbioinf/localpdb | localpdb/utils/prot.py | [
"MIT"
] | Python | parse_pdb_data | <not_specific> | def parse_pdb_data(entries_fn, entries_type_fn, res_fn, seqres_fn):
"""
Builds dataframe with the parsed raw PDB data
@param entries_fn: filename of the entries.idx file
@param entries_type_fn: filename of the pdb_entry_type.txt file
@param res_fn: filename of the resolution.idx file
@param seq... |
Builds dataframe with the parsed raw PDB data
@param entries_fn: filename of the entries.idx file
@param entries_type_fn: filename of the pdb_entry_type.txt file
@param res_fn: filename of the resolution.idx file
@param seqres_fn: filename of the pdb_seqres fasta file
@return: basic dataframes... | Builds dataframe with the parsed raw PDB data | [
"Builds",
"dataframe",
"with",
"the",
"parsed",
"raw",
"PDB",
"data"
] | def parse_pdb_data(entries_fn, entries_type_fn, res_fn, seqres_fn):
switch = os.path.isfile(entries_type_fn)
if not switch:
entries_type_fn = entries_fn
with open(entries_type_fn) as f:
entries_type = {key: (type_, method) for (key, type_, method) in list(map(str.split, f.readlines()))}
... | [
"def",
"parse_pdb_data",
"(",
"entries_fn",
",",
"entries_type_fn",
",",
"res_fn",
",",
"seqres_fn",
")",
":",
"switch",
"=",
"os",
".",
"path",
".",
"isfile",
"(",
"entries_type_fn",
")",
"if",
"not",
"switch",
":",
"entries_type_fn",
"=",
"entries_fn",
"wi... | Builds dataframe with the parsed raw PDB data | [
"Builds",
"dataframe",
"with",
"the",
"parsed",
"raw",
"PDB",
"data"
] | [
"\"\"\"\n Builds dataframe with the parsed raw PDB data\n @param entries_fn: filename of the entries.idx file\n @param entries_type_fn: filename of the pdb_entry_type.txt file\n @param res_fn: filename of the resolution.idx file\n @param seqres_fn: filename of the pdb_seqres fasta file\n @return:... | [
{
"param": "entries_fn",
"type": null
},
{
"param": "entries_type_fn",
"type": null
},
{
"param": "res_fn",
"type": null
},
{
"param": "seqres_fn",
"type": null
}
] | {
"returns": [
{
"docstring": "basic dataframes with per-structure and per-chain information",
"docstring_tokens": [
"basic",
"dataframes",
"with",
"per",
"-",
"structure",
"and",
"per",
"-",
"chain",
"information"... |
ff8907952a022948ed07c41c45d4055c9c79d440 | labstructbioinf/localpdb | localpdb/utils/prot.py | [
"MIT"
] | Python | is_nucl_seq | <not_specific> | def is_nucl_seq(seq):
"""
Determines whether sequence is nucleic acid sequence
:param seq: sequence to check
:return: True/False
"""
res = nuc_re.search(seq)
return not bool(res) |
Determines whether sequence is nucleic acid sequence
:param seq: sequence to check
:return: True/False
| Determines whether sequence is nucleic acid sequence | [
"Determines",
"whether",
"sequence",
"is",
"nucleic",
"acid",
"sequence"
] | def is_nucl_seq(seq):
res = nuc_re.search(seq)
return not bool(res) | [
"def",
"is_nucl_seq",
"(",
"seq",
")",
":",
"res",
"=",
"nuc_re",
".",
"search",
"(",
"seq",
")",
"return",
"not",
"bool",
"(",
"res",
")"
] | Determines whether sequence is nucleic acid sequence | [
"Determines",
"whether",
"sequence",
"is",
"nucleic",
"acid",
"sequence"
] | [
"\"\"\"\n Determines whether sequence is nucleic acid sequence\n :param seq: sequence to check\n :return: True/False\n \"\"\""
] | [
{
"param": "seq",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "seq",
"type": null,
"docstring": "sequence to check",
"docstring_tokens": [
"sequence",
"to",
... |
ff8907952a022948ed07c41c45d4055c9c79d440 | labstructbioinf/localpdb | localpdb/utils/prot.py | [
"MIT"
] | Python | is_nonstd_seq | <not_specific> | def is_nonstd_seq(seq):
"""
Determines whether sequence contains unknown ('X') residues
:param seq: sequence to check
:return: True/False
"""
res = nonstd_re.search(seq)
return not bool(res) |
Determines whether sequence contains unknown ('X') residues
:param seq: sequence to check
:return: True/False
| Determines whether sequence contains unknown ('X') residues | [
"Determines",
"whether",
"sequence",
"contains",
"unknown",
"(",
"'",
"X",
"'",
")",
"residues"
] | def is_nonstd_seq(seq):
res = nonstd_re.search(seq)
return not bool(res) | [
"def",
"is_nonstd_seq",
"(",
"seq",
")",
":",
"res",
"=",
"nonstd_re",
".",
"search",
"(",
"seq",
")",
"return",
"not",
"bool",
"(",
"res",
")"
] | Determines whether sequence contains unknown ('X') residues | [
"Determines",
"whether",
"sequence",
"contains",
"unknown",
"(",
"'",
"X",
"'",
")",
"residues"
] | [
"\"\"\"\n Determines whether sequence contains unknown ('X') residues\n :param seq: sequence to check\n :return: True/False\n \"\"\""
] | [
{
"param": "seq",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "seq",
"type": null,
"docstring": "sequence to check",
"docstring_tokens": [
"sequence",
"to",
... |
ff8907952a022948ed07c41c45d4055c9c79d440 | labstructbioinf/localpdb | localpdb/utils/prot.py | [
"MIT"
] | Python | parse_gz_fasta | null | def parse_gz_fasta(fn):
"""
Parser for PDB seqres fasta files. Faster than the Bio.SeqIO due to cleaned input format.
@param fn: filename with seqres records from the PDB
@return: (pdb_chain, sequence) pairs
"""
with gzip.open(fn, 'rt') as f:
data = f.readlines()
for i in range(0... |
Parser for PDB seqres fasta files. Faster than the Bio.SeqIO due to cleaned input format.
@param fn: filename with seqres records from the PDB
@return: (pdb_chain, sequence) pairs
| Parser for PDB seqres fasta files. Faster than the Bio.SeqIO due to cleaned input format. | [
"Parser",
"for",
"PDB",
"seqres",
"fasta",
"files",
".",
"Faster",
"than",
"the",
"Bio",
".",
"SeqIO",
"due",
"to",
"cleaned",
"input",
"format",
"."
] | def parse_gz_fasta(fn):
with gzip.open(fn, 'rt') as f:
data = f.readlines()
for i in range(0, len(data), 2):
pdb_chain = data[i].split()[0][1:]
seq = data[i+1].rstrip()
yield pdb_chain, seq | [
"def",
"parse_gz_fasta",
"(",
"fn",
")",
":",
"with",
"gzip",
".",
"open",
"(",
"fn",
",",
"'rt'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"readlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"data",
")",
",",
"2",... | Parser for PDB seqres fasta files. | [
"Parser",
"for",
"PDB",
"seqres",
"fasta",
"files",
"."
] | [
"\"\"\"\n Parser for PDB seqres fasta files. Faster than the Bio.SeqIO due to cleaned input format.\n @param fn: filename with seqres records from the PDB\n @return: (pdb_chain, sequence) pairs\n \"\"\""
] | [
{
"param": "fn",
"type": null
}
] | {
"returns": [
{
"docstring": "(pdb_chain, sequence) pairs",
"docstring_tokens": [
"(",
"pdb_chain",
"sequence",
")",
"pairs"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "fn",
"type": null,
"docstrin... |
091fc9a80140974fb7b9bbd8e111cb1d35d9af0d | labstructbioinf/localpdb | localpdb/plugins/PDBSeqresMapper.py | [
"MIT"
] | Python | map_pdb_feat_to_seqres | <not_specific> | def map_pdb_feat_to_seqres(self, value_dict, pdb_chain_id, na_value=0, regions=False):
"""
Maps pdb features onto the seqres sequence
:param value_dict: Dict with PDB resnames as keys and arbitrary values
:param pdb_chain_id: pdb_chain identifier
:param na_value: format for the m... |
Maps pdb features onto the seqres sequence
:param value_dict: Dict with PDB resnames as keys and arbitrary values
:param pdb_chain_id: pdb_chain identifier
:param na_value: format for the missing values in seqres (usually not all PDB resids are mapped onto seqres)
:param regions... | Maps pdb features onto the seqres sequence | [
"Maps",
"pdb",
"features",
"onto",
"the",
"seqres",
"sequence"
] | def map_pdb_feat_to_seqres(self, value_dict, pdb_chain_id, na_value=0, regions=False):
if pdb_chain_id not in self.lpdb._mapping_dict.keys():
raise ValueError('Mapping for id \'{}\' is not available!'.format(pdb_chain_id))
mapping_dict = self.get_pdbseqres_mapping(pdb_chain_id)
seqre... | [
"def",
"map_pdb_feat_to_seqres",
"(",
"self",
",",
"value_dict",
",",
"pdb_chain_id",
",",
"na_value",
"=",
"0",
",",
"regions",
"=",
"False",
")",
":",
"if",
"pdb_chain_id",
"not",
"in",
"self",
".",
"lpdb",
".",
"_mapping_dict",
".",
"keys",
"(",
")",
... | Maps pdb features onto the seqres sequence | [
"Maps",
"pdb",
"features",
"onto",
"the",
"seqres",
"sequence"
] | [
"\"\"\"\n Maps pdb features onto the seqres sequence\n :param value_dict: Dict with PDB resnames as keys and arbitrary values\n :param pdb_chain_id: pdb_chain identifier\n :param na_value: format for the missing values in seqres (usually not all PDB resids are mapped onto seqres)\n ... | [
{
"param": "self",
"type": null
},
{
"param": "value_dict",
"type": null
},
{
"param": "pdb_chain_id",
"type": null
},
{
"param": "na_value",
"type": null
},
{
"param": "regions",
"type": null
}
] | {
"returns": [
{
"docstring": "list of length equal to seqres sequence with mapped PDB values",
"docstring_tokens": [
"list",
"of",
"length",
"equal",
"to",
"seqres",
"sequence",
"with",
"mapped",
"PDB",
"values"
... |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | tableFormat | <not_specific> | def tableFormat(titleList, dataLists, rowJoiner=' '):
'''
generic table formatting, adapted to this simple case.
first row contains titles, all others contain values.
'''
# first, make sure all numeric entries get properly converted
rawRows = dataLists
rowLists = [titleList[:]]
for r in... |
generic table formatting, adapted to this simple case.
first row contains titles, all others contain values.
| generic table formatting, adapted to this simple case.
first row contains titles, all others contain values. | [
"generic",
"table",
"formatting",
"adapted",
"to",
"this",
"simple",
"case",
".",
"first",
"row",
"contains",
"titles",
"all",
"others",
"contain",
"values",
"."
] | def tableFormat(titleList, dataLists, rowJoiner=' '):
rawRows = dataLists
rowLists = [titleList[:]]
for r in rawRows:
rowLists.append([str(field) for field in r])
ml = max([len(r) for r in rowLists])
for r in rowLists:
if len(r) < ml:
r.extend([''] * (ml - len(r)))
w... | [
"def",
"tableFormat",
"(",
"titleList",
",",
"dataLists",
",",
"rowJoiner",
"=",
"' '",
")",
":",
"rawRows",
"=",
"dataLists",
"rowLists",
"=",
"[",
"titleList",
"[",
":",
"]",
"]",
"for",
"r",
"in",
"rawRows",
":",
"rowLists",
".",
"append",
"(",
"["... | generic table formatting, adapted to this simple case. | [
"generic",
"table",
"formatting",
"adapted",
"to",
"this",
"simple",
"case",
"."
] | [
"'''\n generic table formatting, adapted to this simple case.\n first row contains titles, all others contain values.\n '''",
"# first, make sure all numeric entries get properly converted",
"# bring all lists to equal length",
"# determine required width for each column",
"# remove trailing spaces... | [
{
"param": "titleList",
"type": null
},
{
"param": "dataLists",
"type": null
},
{
"param": "rowJoiner",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "titleList",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dataLists",
"type": null,
"docstring": null,
"docstring_... |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | load_remote_pdb | <not_specific> | def load_remote_pdb(pdbcode):
'''
obtain a pdb file by name from the protein data bank.
what kinds of plausibility checks to perform?
- the code should be four characters long
- be alphanumeric
'''
# urltemplate = 'http://dx.doi.org/10.2210/pdb%s/pdb'
urltemplate = "http://ftp.rcsb.org/d... |
obtain a pdb file by name from the protein data bank.
what kinds of plausibility checks to perform?
- the code should be four characters long
- be alphanumeric
| obtain a pdb file by name from the protein data bank.
what kinds of plausibility checks to perform.
the code should be four characters long
be alphanumeric | [
"obtain",
"a",
"pdb",
"file",
"by",
"name",
"from",
"the",
"protein",
"data",
"bank",
".",
"what",
"kinds",
"of",
"plausibility",
"checks",
"to",
"perform",
".",
"the",
"code",
"should",
"be",
"four",
"characters",
"long",
"be",
"alphanumeric"
] | def load_remote_pdb(pdbcode):
urltemplate = "http://ftp.rcsb.org/download/%s/pdb.gz"
pdbcode = pdbcode.split('.')[0].lower()
if len(pdbcode) != 4 or re.findall('\W', pdbcode):
raise PdbError('malformed pdb code')
url = urltemplate % pdbcode
request = urllib.urlopen(url)
binary = request.... | [
"def",
"load_remote_pdb",
"(",
"pdbcode",
")",
":",
"urltemplate",
"=",
"\"http://ftp.rcsb.org/download/%s/pdb.gz\"",
"pdbcode",
"=",
"pdbcode",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"if",
"len",
"(",
"pdbcode",
")",
"!=",
"... | obtain a pdb file by name from the protein data bank. | [
"obtain",
"a",
"pdb",
"file",
"by",
"name",
"from",
"the",
"protein",
"data",
"bank",
"."
] | [
"'''\n obtain a pdb file by name from the protein data bank.\n what kinds of plausibility checks to perform?\n - the code should be four characters long\n - be alphanumeric\n '''",
"# urltemplate = 'http://dx.doi.org/10.2210/pdb%s/pdb'",
"# pdb code looks o.k. - let's try"
] | [
{
"param": "pdbcode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pdbcode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | transformed | <not_specific> | def transformed(self, *coords):
'''
fill in new coordinates, leave descriptor template blank -
will be filled in later.
'''
return self.descriptor_template + self.coordinate_template % coords |
fill in new coordinates, leave descriptor template blank -
will be filled in later.
| fill in new coordinates, leave descriptor template blank
will be filled in later. | [
"fill",
"in",
"new",
"coordinates",
"leave",
"descriptor",
"template",
"blank",
"will",
"be",
"filled",
"in",
"later",
"."
] | def transformed(self, *coords):
return self.descriptor_template + self.coordinate_template % coords | [
"def",
"transformed",
"(",
"self",
",",
"*",
"coords",
")",
":",
"return",
"self",
".",
"descriptor_template",
"+",
"self",
".",
"coordinate_template",
"%",
"coords"
] | fill in new coordinates, leave descriptor template blank
will be filled in later. | [
"fill",
"in",
"new",
"coordinates",
"leave",
"descriptor",
"template",
"blank",
"will",
"be",
"filled",
"in",
"later",
"."
] | [
"'''\n fill in new coordinates, leave descriptor template blank -\n will be filled in later.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | _replicateChain | <not_specific> | def _replicateChain(self, chain):
'''
apply all applicable transformations to one chain and return all
resulting copies
'''
atoms = self.original_chains[chain]
replicated = []
# for i, matrix in enumerate(self.matrices):
for matrix in self.matrices:
... |
apply all applicable transformations to one chain and return all
resulting copies
| apply all applicable transformations to one chain and return all
resulting copies | [
"apply",
"all",
"applicable",
"transformations",
"to",
"one",
"chain",
"and",
"return",
"all",
"resulting",
"copies"
] | def _replicateChain(self, chain):
atoms = self.original_chains[chain]
replicated = []
for matrix in self.matrices:
transformed_atoms = []
for atom in atoms:
coords = []
x, y, z = atom.coords
for a,b,c,d in matrix:
... | [
"def",
"_replicateChain",
"(",
"self",
",",
"chain",
")",
":",
"atoms",
"=",
"self",
".",
"original_chains",
"[",
"chain",
"]",
"replicated",
"=",
"[",
"]",
"for",
"matrix",
"in",
"self",
".",
"matrices",
":",
"transformed_atoms",
"=",
"[",
"]",
"for",
... | apply all applicable transformations to one chain and return all
resulting copies | [
"apply",
"all",
"applicable",
"transformations",
"to",
"one",
"chain",
"and",
"return",
"all",
"resulting",
"copies"
] | [
"'''\n apply all applicable transformations to one chain and return all\n resulting copies\n '''",
"# for i, matrix in enumerate(self.matrices):"
] | [
{
"param": "self",
"type": null
},
{
"param": "chain",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chain",
"type": null,
"docstring": null,
"docstring_tokens": ... |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | collate | null | def collate(self):
'''
collate all replicated chains into final output
apply chain renaming and residue renumbering as
requested
'''
# first, assign available letters to chains.
orig_chains = set()
for rg in self.replication_groups:
orig_chains... |
collate all replicated chains into final output
apply chain renaming and residue renumbering as
requested
| collate all replicated chains into final output
apply chain renaming and residue renumbering as
requested | [
"collate",
"all",
"replicated",
"chains",
"into",
"final",
"output",
"apply",
"chain",
"renaming",
"and",
"residue",
"renumbering",
"as",
"requested"
] | def collate(self):
orig_chains = set()
for rg in self.replication_groups:
orig_chains.update(rg.replicated_chains.keys())
orig_chains = sorted(list(orig_chains))
def chain_position_generator(orig_pos):
chain_list = list(string.ascii_uppercase[orig_pos::len(orig_ch... | [
"def",
"collate",
"(",
"self",
")",
":",
"orig_chains",
"=",
"set",
"(",
")",
"for",
"rg",
"in",
"self",
".",
"replication_groups",
":",
"orig_chains",
".",
"update",
"(",
"rg",
".",
"replicated_chains",
".",
"keys",
"(",
")",
")",
"orig_chains",
"=",
... | collate all replicated chains into final output
apply chain renaming and residue renumbering as
requested | [
"collate",
"all",
"replicated",
"chains",
"into",
"final",
"output",
"apply",
"chain",
"renaming",
"and",
"residue",
"renumbering",
"as",
"requested"
] | [
"'''\n collate all replicated chains into final output\n apply chain renaming and residue renumbering as\n requested\n '''",
"# first, assign available letters to chains.",
"# make a generator for each original chain",
"# that will supply us with the next chain name",
"# and resi... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | output | <not_specific> | def output(self, filename='stuff'):
'''
return our collected results in one big string. This will
be the main part of the output pdb file.
'''
self.collate()
header = [self.title_template % filename]
header.append('by MakeMultimer.py (%s)' % url)
header.ap... |
return our collected results in one big string. This will
be the main part of the output pdb file.
| return our collected results in one big string. This will
be the main part of the output pdb file. | [
"return",
"our",
"collected",
"results",
"in",
"one",
"big",
"string",
".",
"This",
"will",
"be",
"the",
"main",
"part",
"of",
"the",
"output",
"pdb",
"file",
"."
] | def output(self, filename='stuff'):
self.collate()
header = [self.title_template % filename]
header.append('by MakeMultimer.py (%s)' % url)
header.append('')
if self.overflow_warnings:
header.append('The following errors occurred with naming and numbering:')
... | [
"def",
"output",
"(",
"self",
",",
"filename",
"=",
"'stuff'",
")",
":",
"self",
".",
"collate",
"(",
")",
"header",
"=",
"[",
"self",
".",
"title_template",
"%",
"filename",
"]",
"header",
".",
"append",
"(",
"'by MakeMultimer.py (%s)'",
"%",
"url",
")"... | return our collected results in one big string. | [
"return",
"our",
"collected",
"results",
"in",
"one",
"big",
"string",
"."
] | [
"'''\n return our collected results in one big string. This will\n be the main part of the output pdb file.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | parseBiomt | <not_specific> | def parseBiomt(self):
'''
carve up the file according to biomolecules, which are defined
in the REMARK 350 lines.
'''
bm_lines = [l[10:].strip() for l in self.pdb_lines if l.startswith('REMARK 350')]
if not bm_lines: # this file doesn't have any biomt instructions for ... |
carve up the file according to biomolecules, which are defined
in the REMARK 350 lines.
| carve up the file according to biomolecules, which are defined
in the REMARK 350 lines. | [
"carve",
"up",
"the",
"file",
"according",
"to",
"biomolecules",
"which",
"are",
"defined",
"in",
"the",
"REMARK",
"350",
"lines",
"."
] | def parseBiomt(self):
bm_lines = [l[10:].strip() for l in self.pdb_lines if l.startswith('REMARK 350')]
if not bm_lines:
raise PdbError('input file does not contain any BIOMT instructions')
biomolecules = []
in_group = False
group = []
bm_marker = 'BIOMOLE... | [
"def",
"parseBiomt",
"(",
"self",
")",
":",
"bm_lines",
"=",
"[",
"l",
"[",
"10",
":",
"]",
".",
"strip",
"(",
")",
"for",
"l",
"in",
"self",
".",
"pdb_lines",
"if",
"l",
".",
"startswith",
"(",
"'REMARK 350'",
")",
"]",
"if",
"not",
"bm_lines",
... | carve up the file according to biomolecules, which are defined
in the REMARK 350 lines. | [
"carve",
"up",
"the",
"file",
"according",
"to",
"biomolecules",
"which",
"are",
"defined",
"in",
"the",
"REMARK",
"350",
"lines",
"."
] | [
"'''\n carve up the file according to biomolecules, which are defined\n in the REMARK 350 lines.\n '''",
"# this file doesn't have any biomt instructions for us.",
"# OK, try to carve up the biomolecules",
"# start new group ?",
"# somehow parsing this again seems redundant.",
"# need... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | testHetatm | <not_specific> | def testHetatm(self, hetatm_line):
'''
determine whether or not a hetatm line should be kept.
we could extend this to filter out water for example.
Two conditions:
- chain identifier must be present
- depending on nowater option, water will be stripped
'''
... |
determine whether or not a hetatm line should be kept.
we could extend this to filter out water for example.
Two conditions:
- chain identifier must be present
- depending on nowater option, water will be stripped
| determine whether or not a hetatm line should be kept.
we could extend this to filter out water for example.
Two conditions:
chain identifier must be present
depending on nowater option, water will be stripped | [
"determine",
"whether",
"or",
"not",
"a",
"hetatm",
"line",
"should",
"be",
"kept",
".",
"we",
"could",
"extend",
"this",
"to",
"filter",
"out",
"water",
"for",
"example",
".",
"Two",
"conditions",
":",
"chain",
"identifier",
"must",
"be",
"present",
"depe... | def testHetatm(self, hetatm_line):
if self.options['nohetatm']:
return False
orig_chain = hetatm_line[21:22].strip()
if not orig_chain:
return False
hetatm_type = hetatm_line[17:20].upper()
if self.options['nowater'] and hetatm_type in ("HOH", "DOD", "WAT"... | [
"def",
"testHetatm",
"(",
"self",
",",
"hetatm_line",
")",
":",
"if",
"self",
".",
"options",
"[",
"'nohetatm'",
"]",
":",
"return",
"False",
"orig_chain",
"=",
"hetatm_line",
"[",
"21",
":",
"22",
"]",
".",
"strip",
"(",
")",
"if",
"not",
"orig_chain"... | determine whether or not a hetatm line should be kept. | [
"determine",
"whether",
"or",
"not",
"a",
"hetatm",
"line",
"should",
"be",
"kept",
"."
] | [
"'''\n determine whether or not a hetatm line should be kept.\n we could extend this to filter out water for example.\n Two conditions:\n - chain identifier must be present\n - depending on nowater option, water will be stripped\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "hetatm_line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hetatm_line",
"type": null,
"docstring": null,
"docstring_tok... |
30ab5852fc6eb78b6bd7cd85129beac61aac2585 | labstructbioinf/localpdb | localpdb/plugins/utils/MakeMultimer.py | [
"MIT"
] | Python | parseMolecule | <not_specific> | def parseMolecule(self):
'''
extract all chains from a pdb file. Problem: HETATM records may or may
not have a chain identifiers.
we will look at handling those unnamed hetero atoms again later, once
we get a better feel for the entire thing.
'''
atom_lines = []
... |
extract all chains from a pdb file. Problem: HETATM records may or may
not have a chain identifiers.
we will look at handling those unnamed hetero atoms again later, once
we get a better feel for the entire thing.
| extract all chains from a pdb file. Problem: HETATM records may or may
not have a chain identifiers.
we will look at handling those unnamed hetero atoms again later, once
we get a better feel for the entire thing. | [
"extract",
"all",
"chains",
"from",
"a",
"pdb",
"file",
".",
"Problem",
":",
"HETATM",
"records",
"may",
"or",
"may",
"not",
"have",
"a",
"chain",
"identifiers",
".",
"we",
"will",
"look",
"at",
"handling",
"those",
"unnamed",
"hetero",
"atoms",
"again",
... | def parseMolecule(self):
atom_lines = []
for line in self.pdb_lines:
if line.startswith('ATOM') and self.testAtom(line):
atom_lines.append(line)
elif line.startswith('HETATM') and self.testHetatm(line):
atom_lines.append(line)
chains = {}
... | [
"def",
"parseMolecule",
"(",
"self",
")",
":",
"atom_lines",
"=",
"[",
"]",
"for",
"line",
"in",
"self",
".",
"pdb_lines",
":",
"if",
"line",
".",
"startswith",
"(",
"'ATOM'",
")",
"and",
"self",
".",
"testAtom",
"(",
"line",
")",
":",
"atom_lines",
... | extract all chains from a pdb file. | [
"extract",
"all",
"chains",
"from",
"a",
"pdb",
"file",
"."
] | [
"'''\n extract all chains from a pdb file. Problem: HETATM records may or may\n not have a chain identifiers.\n we will look at handling those unnamed hetero atoms again later, once\n we get a better feel for the entire thing.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | __gen__url | <not_specific> | def __gen__url(self, file_type='', version=None):
"""
Generates download url for given file type based on the selected PDB mirror defined in the config file
@param file_type: file type
@return: url to download the file
"""
root = self.config['url']
proto = self.co... |
Generates download url for given file type based on the selected PDB mirror defined in the config file
@param file_type: file type
@return: url to download the file
| Generates download url for given file type based on the selected PDB mirror defined in the config file | [
"Generates",
"download",
"url",
"for",
"given",
"file",
"type",
"based",
"on",
"the",
"selected",
"PDB",
"mirror",
"defined",
"in",
"the",
"config",
"file"
] | def __gen__url(self, file_type='', version=None):
root = self.config['url']
proto = self.config['download_proto']
if file_type in ['entries', 'entries_type', 'bundles', 'resolution', 'seqres']:
ext = self.config['ftp_locs'][file_type]
url = f'{proto}://{root}/{ext}'
... | [
"def",
"__gen__url",
"(",
"self",
",",
"file_type",
"=",
"''",
",",
"version",
"=",
"None",
")",
":",
"root",
"=",
"self",
".",
"config",
"[",
"'url'",
"]",
"proto",
"=",
"self",
".",
"config",
"[",
"'download_proto'",
"]",
"if",
"file_type",
"in",
"... | Generates download url for given file type based on the selected PDB mirror defined in the config file | [
"Generates",
"download",
"url",
"for",
"given",
"file",
"type",
"based",
"on",
"the",
"selected",
"PDB",
"mirror",
"defined",
"in",
"the",
"config",
"file"
] | [
"\"\"\"\n Generates download url for given file type based on the selected PDB mirror defined in the config file\n @param file_type: file type\n @return: url to download the file\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "file_type",
"type": null
},
{
"param": "version",
"type": null
}
] | {
"returns": [
{
"docstring": "url to download the file",
"docstring_tokens": [
"url",
"to",
"download",
"the",
"file"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": n... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | __verify_timestamp | <not_specific> | def __verify_timestamp(self, fn, version=None):
"""
Verifies the timestamp of the downloaded file against the PDB version.
@param fn: filename of the file
@param version: PDB version
@return: True if timestamp matches the version, else False
"""
if version is None... |
Verifies the timestamp of the downloaded file against the PDB version.
@param fn: filename of the file
@param version: PDB version
@return: True if timestamp matches the version, else False
| Verifies the timestamp of the downloaded file against the PDB version. | [
"Verifies",
"the",
"timestamp",
"of",
"the",
"downloaded",
"file",
"against",
"the",
"PDB",
"version",
"."
] | def __verify_timestamp(self, fn, version=None):
if version is None:
version = self.version
timestamp = datetime.datetime.fromtimestamp((os.path.getmtime(fn)))
timestamp = f'{timestamp.year}{str(timestamp.month).zfill(2)}{str(timestamp.day).zfill(2)}'
out = timestamp == str(ve... | [
"def",
"__verify_timestamp",
"(",
"self",
",",
"fn",
",",
"version",
"=",
"None",
")",
":",
"if",
"version",
"is",
"None",
":",
"version",
"=",
"self",
".",
"version",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"(",
"os",
... | Verifies the timestamp of the downloaded file against the PDB version. | [
"Verifies",
"the",
"timestamp",
"of",
"the",
"downloaded",
"file",
"against",
"the",
"PDB",
"version",
"."
] | [
"\"\"\"\n Verifies the timestamp of the downloaded file against the PDB version.\n @param fn: filename of the file\n @param version: PDB version\n @return: True if timestamp matches the version, else False\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "fn",
"type": null
},
{
"param": "version",
"type": null
}
] | {
"returns": [
{
"docstring": "True if timestamp matches the version, else False",
"docstring_tokens": [
"True",
"if",
"timestamp",
"matches",
"the",
"version",
"else",
"False"
],
"type": null
}
],
"raises": [],
"par... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | download | <not_specific> | def download(self, file_type=''):
"""
Downloads the selected file type from the selected PDB mirror based on the generated URL.
@param file_type: file type to download.
@return: True if downloaded was completed and validated.
"""
if file_type in ['entries', 'bundles', 'en... |
Downloads the selected file type from the selected PDB mirror based on the generated URL.
@param file_type: file type to download.
@return: True if downloaded was completed and validated.
| Downloads the selected file type from the selected PDB mirror based on the generated URL. | [
"Downloads",
"the",
"selected",
"file",
"type",
"from",
"the",
"selected",
"PDB",
"mirror",
"based",
"on",
"the",
"generated",
"URL",
"."
] | def download(self, file_type=''):
if file_type in ['entries', 'bundles', 'entries_type', 'resolution', 'seqres']:
dest = f'{self.db_path}/data/{self.version}/pdb_{file_type}.txt'
if file_type == 'seqres':
dest = '{}.gz'.format(dest)
url = self.__gen__url(file_... | [
"def",
"download",
"(",
"self",
",",
"file_type",
"=",
"''",
")",
":",
"if",
"file_type",
"in",
"[",
"'entries'",
",",
"'bundles'",
",",
"'entries_type'",
",",
"'resolution'",
",",
"'seqres'",
"]",
":",
"dest",
"=",
"f'{self.db_path}/data/{self.version}/pdb_{fil... | Downloads the selected file type from the selected PDB mirror based on the generated URL. | [
"Downloads",
"the",
"selected",
"file",
"type",
"from",
"the",
"selected",
"PDB",
"mirror",
"based",
"on",
"the",
"generated",
"URL",
"."
] | [
"\"\"\"\n Downloads the selected file type from the selected PDB mirror based on the generated URL.\n @param file_type: file type to download.\n @return: True if downloaded was completed and validated.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "file_type",
"type": null
}
] | {
"returns": [
{
"docstring": "True if downloaded was completed and validated.",
"docstring_tokens": [
"True",
"if",
"downloaded",
"was",
"completed",
"and",
"validated",
"."
],
"type": null
}
],
"raises": [],
"param... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | fetch_major_revisions | <not_specific> | def fetch_major_revisions(self, merged=False):
"""
Check with RCSB graphql API for major revisions (i.e. the coordinate changes) for modified entries downloaded
by the self.download() function.
@param merged: Denotes whether modified entries are a weekly RCSB update or merged updates ove... |
Check with RCSB graphql API for major revisions (i.e. the coordinate changes) for modified entries downloaded
by the self.download() function.
@param merged: Denotes whether modified entries are a weekly RCSB update or merged updates over multiple versions.
@return: True if check succee... | Check with RCSB graphql API for major revisions for modified entries downloaded
by the self.download() function. | [
"Check",
"with",
"RCSB",
"graphql",
"API",
"for",
"major",
"revisions",
"for",
"modified",
"entries",
"downloaded",
"by",
"the",
"self",
".",
"download",
"()",
"function",
"."
] | def fetch_major_revisions(self, merged=False):
in_fn = f'{self.db_path}/data/{self.version}/modified_merged.txt' \
if merged else f'{self.db_path}/data/{self.version}/modified.txt'
out_fn = f'{self.db_path}/data/{self.version}/modified_major_merged.txt' \
if merged else f'{self.d... | [
"def",
"fetch_major_revisions",
"(",
"self",
",",
"merged",
"=",
"False",
")",
":",
"in_fn",
"=",
"f'{self.db_path}/data/{self.version}/modified_merged.txt'",
"if",
"merged",
"else",
"f'{self.db_path}/data/{self.version}/modified.txt'",
"out_fn",
"=",
"f'{self.db_path}/data/{se... | Check with RCSB graphql API for major revisions (i.e. | [
"Check",
"with",
"RCSB",
"graphql",
"API",
"for",
"major",
"revisions",
"(",
"i",
".",
"e",
"."
] | [
"\"\"\"\n Check with RCSB graphql API for major revisions (i.e. the coordinate changes) for modified entries downloaded\n by the self.download() function.\n @param merged: Denotes whether modified entries are a weekly RCSB update or merged updates over multiple versions.\n @return: True ... | [
{
"param": "self",
"type": null
},
{
"param": "merged",
"type": null
}
] | {
"returns": [
{
"docstring": "True if check succeeded, False otherwise",
"docstring_tokens": [
"True",
"if",
"check",
"succeeded",
"False",
"otherwise"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self"... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | update_versioning_log | <not_specific> | def update_versioning_log(self, modified_dict):
"""
Updates the versioning.log file that keeps the major modifications of PDB entries.
@param modified_dict: Revision data (dictionary from the self.fetch_major_revisions)
@return: True if update succeeded, False otherwise
"""
... |
Updates the versioning.log file that keeps the major modifications of PDB entries.
@param modified_dict: Revision data (dictionary from the self.fetch_major_revisions)
@return: True if update succeeded, False otherwise
| Updates the versioning.log file that keeps the major modifications of PDB entries. | [
"Updates",
"the",
"versioning",
".",
"log",
"file",
"that",
"keeps",
"the",
"major",
"modifications",
"of",
"PDB",
"entries",
"."
] | def update_versioning_log(self, modified_dict):
logs_fn = f'{self.db_path}/data/versioning.log'
try:
with open(logs_fn) as f:
ver_history = json.loads(f.read())
for pdb_id, rev_ver in modified_dict.items():
if pdb_id in ver_history.keys():
... | [
"def",
"update_versioning_log",
"(",
"self",
",",
"modified_dict",
")",
":",
"logs_fn",
"=",
"f'{self.db_path}/data/versioning.log'",
"try",
":",
"with",
"open",
"(",
"logs_fn",
")",
"as",
"f",
":",
"ver_history",
"=",
"json",
".",
"loads",
"(",
"f",
".",
"r... | Updates the versioning.log file that keeps the major modifications of PDB entries. | [
"Updates",
"the",
"versioning",
".",
"log",
"file",
"that",
"keeps",
"the",
"major",
"modifications",
"of",
"PDB",
"entries",
"."
] | [
"\"\"\"\n Updates the versioning.log file that keeps the major modifications of PDB entries.\n @param modified_dict: Revision data (dictionary from the self.fetch_major_revisions)\n @return: True if update succeeded, False otherwise\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "modified_dict",
"type": null
}
] | {
"returns": [
{
"docstring": "True if update succeeded, False otherwise",
"docstring_tokens": [
"True",
"if",
"update",
"succeeded",
"False",
"otherwise"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sel... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | rsync_pdb_mirror | <not_specific> | def rsync_pdb_mirror(self, format='pdb', update=False):
"""
Handles the RSYNC session with the PDB servers to download files in the selected format
@param format: file format to download ('pdb' or 'mmCIF')
@param update: denotes whether rsync will be in the update mode
@return: e... |
Handles the RSYNC session with the PDB servers to download files in the selected format
@param format: file format to download ('pdb' or 'mmCIF')
@param update: denotes whether rsync will be in the update mode
@return: exit code from the RSYNC (0 if run completed without errors)
... | Handles the RSYNC session with the PDB servers to download files in the selected format | [
"Handles",
"the",
"RSYNC",
"session",
"with",
"the",
"PDB",
"servers",
"to",
"download",
"files",
"in",
"the",
"selected",
"format"
] | def rsync_pdb_mirror(self, format='pdb', update=False):
url = self.config['rsync_url']
add_opts = self.config['rsync_opts']
local_mirror = self.db_path / 'mirror' / format
if format not in ['pdb', 'mmCIF']:
raise ValueError(f'Format \'{format}\' is not a valid. Only \'pdb\' a... | [
"def",
"rsync_pdb_mirror",
"(",
"self",
",",
"format",
"=",
"'pdb'",
",",
"update",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"config",
"[",
"'rsync_url'",
"]",
"add_opts",
"=",
"self",
".",
"config",
"[",
"'rsync_opts'",
"]",
"local_mirror",
"=",... | Handles the RSYNC session with the PDB servers to download files in the selected format | [
"Handles",
"the",
"RSYNC",
"session",
"with",
"the",
"PDB",
"servers",
"to",
"download",
"files",
"in",
"the",
"selected",
"format"
] | [
"\"\"\"\n Handles the RSYNC session with the PDB servers to download files in the selected format\n @param format: file format to download ('pdb' or 'mmCIF')\n @param update: denotes whether rsync will be in the update mode\n @return: exit code from the RSYNC (0 if run completed without ... | [
{
"param": "self",
"type": null
},
{
"param": "format",
"type": null
},
{
"param": "update",
"type": null
}
] | {
"returns": [
{
"docstring": "exit code from the RSYNC (0 if run completed without errors)",
"docstring_tokens": [
"exit",
"code",
"from",
"the",
"RSYNC",
"(",
"0",
"if",
"run",
"completed",
"without",
"er... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | check_lock | <not_specific> | def check_lock(self):
"""
Checks whether the lock on the localpdb db path is present.
@return: True or False for lock presence
"""
return Path(self.db_path / '.lock').is_file() |
Checks whether the lock on the localpdb db path is present.
@return: True or False for lock presence
| Checks whether the lock on the localpdb db path is present. | [
"Checks",
"whether",
"the",
"lock",
"on",
"the",
"localpdb",
"db",
"path",
"is",
"present",
"."
] | def check_lock(self):
return Path(self.db_path / '.lock').is_file() | [
"def",
"check_lock",
"(",
"self",
")",
":",
"return",
"Path",
"(",
"self",
".",
"db_path",
"/",
"'.lock'",
")",
".",
"is_file",
"(",
")"
] | Checks whether the lock on the localpdb db path is present. | [
"Checks",
"whether",
"the",
"lock",
"on",
"the",
"localpdb",
"db",
"path",
"is",
"present",
"."
] | [
"\"\"\"\n Checks whether the lock on the localpdb db path is present.\n @return: True or False for lock presence\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "True or False for lock presence",
"docstring_tokens": [
"True",
"or",
"False",
"for",
"lock",
"presence"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": n... |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | remove_lock | null | def remove_lock(self):
"""
Removes the lock allowing for the further download sessions in the db path.
"""
if self.check_lock():
Path(self.db_path / '.lock').unlink() |
Removes the lock allowing for the further download sessions in the db path.
| Removes the lock allowing for the further download sessions in the db path. | [
"Removes",
"the",
"lock",
"allowing",
"for",
"the",
"further",
"download",
"sessions",
"in",
"the",
"db",
"path",
"."
] | def remove_lock(self):
if self.check_lock():
Path(self.db_path / '.lock').unlink() | [
"def",
"remove_lock",
"(",
"self",
")",
":",
"if",
"self",
".",
"check_lock",
"(",
")",
":",
"Path",
"(",
"self",
".",
"db_path",
"/",
"'.lock'",
")",
".",
"unlink",
"(",
")"
] | Removes the lock allowing for the further download sessions in the db path. | [
"Removes",
"the",
"lock",
"allowing",
"for",
"the",
"further",
"download",
"sessions",
"in",
"the",
"db",
"path",
"."
] | [
"\"\"\"\n Removes the lock allowing for the further download sessions in the db path.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2b48db232e8b6a66a5b653f5c55babe3b6687d16 | labstructbioinf/localpdb | localpdb/PDBDownloader.py | [
"MIT"
] | Python | clean_unsuccessful | null | def clean_unsuccessful(self):
"""
Cleans the files downloaded during the session.
This function is run when some part of the download session has failed.
"""
if self.remove_unsuccessful:
rm_strings = [f'{self.db_path}/data/{self.version}', f'{self.db_path}/clustering{... |
Cleans the files downloaded during the session.
This function is run when some part of the download session has failed.
| Cleans the files downloaded during the session.
This function is run when some part of the download session has failed. | [
"Cleans",
"the",
"files",
"downloaded",
"during",
"the",
"session",
".",
"This",
"function",
"is",
"run",
"when",
"some",
"part",
"of",
"the",
"download",
"session",
"has",
"failed",
"."
] | def clean_unsuccessful(self):
if self.remove_unsuccessful:
rm_strings = [f'{self.db_path}/data/{self.version}', f'{self.db_path}/clustering{self.version}']
try:
shutil.move(f'{self.db_path}/data/.versioning.log.bk', f'{self.db_path}/data/versioning.log')
excep... | [
"def",
"clean_unsuccessful",
"(",
"self",
")",
":",
"if",
"self",
".",
"remove_unsuccessful",
":",
"rm_strings",
"=",
"[",
"f'{self.db_path}/data/{self.version}'",
",",
"f'{self.db_path}/clustering{self.version}'",
"]",
"try",
":",
"shutil",
".",
"move",
"(",
"f'{self... | Cleans the files downloaded during the session. | [
"Cleans",
"the",
"files",
"downloaded",
"during",
"the",
"session",
"."
] | [
"\"\"\"\n Cleans the files downloaded during the session.\n This function is run when some part of the download session has failed.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8923f98e1d2da92c5c75682e1c62ade0445c8f8c | labstructbioinf/localpdb | localpdb/utils/os.py | [
"MIT"
] | Python | create_directory | <not_specific> | def create_directory(path):
"""
Creates directory with additional verbosity and checks
@param path: path to the created directory
@return: True if created properly
"""
path = Path(path)
if path.is_dir():
return True
else:
try:
path.mkdir()
except Permi... |
Creates directory with additional verbosity and checks
@param path: path to the created directory
@return: True if created properly
| Creates directory with additional verbosity and checks | [
"Creates",
"directory",
"with",
"additional",
"verbosity",
"and",
"checks"
] | def create_directory(path):
path = Path(path)
if path.is_dir():
return True
else:
try:
path.mkdir()
except PermissionError:
logger.error(f'No write permission in directory: \'{path}\'.')
sys.exit(1)
except FileExistsError:
logge... | [
"def",
"create_directory",
"(",
"path",
")",
":",
"path",
"=",
"Path",
"(",
"path",
")",
"if",
"path",
".",
"is_dir",
"(",
")",
":",
"return",
"True",
"else",
":",
"try",
":",
"path",
".",
"mkdir",
"(",
")",
"except",
"PermissionError",
":",
"logger"... | Creates directory with additional verbosity and checks | [
"Creates",
"directory",
"with",
"additional",
"verbosity",
"and",
"checks"
] | [
"\"\"\"\n Creates directory with additional verbosity and checks\n @param path: path to the created directory\n @return: True if created properly\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "True if created properly",
"docstring_tokens": [
"True",
"if",
"created",
"properly"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "path to the... |
8923f98e1d2da92c5c75682e1c62ade0445c8f8c | labstructbioinf/localpdb | localpdb/utils/os.py | [
"MIT"
] | Python | clean_exit | null | def clean_exit(callback=None, append=False):
"""A context manager which properly handles SIGTERM and SIGINT
Modified version of the handle_exit function
Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
"""
killed = False
old_handler = signal.signal(signal.SIGTERM, _sigterm_hand... | A context manager which properly handles SIGTERM and SIGINT
Modified version of the handle_exit function
Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
| A context manager which properly handles SIGTERM and SIGINT
Modified version of the handle_exit function
Giampaolo Rodola'
License: MIT | [
"A",
"context",
"manager",
"which",
"properly",
"handles",
"SIGTERM",
"and",
"SIGINT",
"Modified",
"version",
"of",
"the",
"handle_exit",
"function",
"Giampaolo",
"Rodola",
"'",
"License",
":",
"MIT"
] | def clean_exit(callback=None, append=False):
killed = False
old_handler = signal.signal(signal.SIGTERM, _sigterm_handler)
if (old_handler != signal.SIG_DFL) and (old_handler != _sigterm_handler):
if not append:
raise RuntimeError("there is already a handler registered for "
... | [
"def",
"clean_exit",
"(",
"callback",
"=",
"None",
",",
"append",
"=",
"False",
")",
":",
"killed",
"=",
"False",
"old_handler",
"=",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGTERM",
",",
"_sigterm_handler",
")",
"if",
"(",
"old_handler",
"!=",
"s... | A context manager which properly handles SIGTERM and SIGINT
Modified version of the handle_exit function
Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT | [
"A",
"context",
"manager",
"which",
"properly",
"handles",
"SIGTERM",
"and",
"SIGINT",
"Modified",
"version",
"of",
"the",
"handle_exit",
"function",
"Giampaolo",
"Rodola",
"'",
"<g",
".",
"rodola",
"[",
"AT",
"]",
"gmail",
"[",
"DOT",
"]",
"com",
">",
"Li... | [
"\"\"\"A context manager which properly handles SIGTERM and SIGINT\n Modified version of the handle_exit function\n Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>\n License: MIT\n \"\"\"",
"# code != 0 refers to an application error (e.g. explicit",
"# sys.exit('some error') call).",
"# We don'... | [
{
"param": "callback",
"type": null
},
{
"param": "append",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "callback",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "append",
"type": null,
"docstring": null,
"docstring_toke... |
8923f98e1d2da92c5c75682e1c62ade0445c8f8c | labstructbioinf/localpdb | localpdb/utils/os.py | [
"MIT"
] | Python | parse_simple | <not_specific> | def parse_simple(fn):
"""
Parses simple txt files containing single PDB id in each line.
@param fn: Name of the file to parse
@returns: set with parse PDB ids
"""
with open(fn) as f:
entries = {line.rstrip() for line in f}
return entries |
Parses simple txt files containing single PDB id in each line.
@param fn: Name of the file to parse
@returns: set with parse PDB ids
| Parses simple txt files containing single PDB id in each line. | [
"Parses",
"simple",
"txt",
"files",
"containing",
"single",
"PDB",
"id",
"in",
"each",
"line",
"."
] | def parse_simple(fn):
with open(fn) as f:
entries = {line.rstrip() for line in f}
return entries | [
"def",
"parse_simple",
"(",
"fn",
")",
":",
"with",
"open",
"(",
"fn",
")",
"as",
"f",
":",
"entries",
"=",
"{",
"line",
".",
"rstrip",
"(",
")",
"for",
"line",
"in",
"f",
"}",
"return",
"entries"
] | Parses simple txt files containing single PDB id in each line. | [
"Parses",
"simple",
"txt",
"files",
"containing",
"single",
"PDB",
"id",
"in",
"each",
"line",
"."
] | [
"\"\"\"\n Parses simple txt files containing single PDB id in each line.\n @param fn: Name of the file to parse\n @returns: set with parse PDB ids\n \"\"\""
] | [
{
"param": "fn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fn",
"type": null,
"docstring": "Name of the file to parse",
"docstring_tokens": [
"Name",
"of",
"the",
"file",
"to",
"parse"
],
"default": null,
"is_optional":... |
5385c6df0d564521e18ce47119fc60d5abb1d0eb | park-sungjoon/topological-phase-diagram | qwz/qwz_utils.py | [
"MIT"
] | Python | qwz_hamiltonian | <not_specific> | def qwz_hamiltonian(kx, ky, mu, b):
""" Returns the QWZ Hamiltonian at kx,ky.
Args:
kx, ky (float): point in momentum space.
mu, b (float): parameters in Hamiltonian.
Returns:
np.array: the QWZ Hamiltonian.
"""
j = complex(0, 1)
hamiltonian = np.zeros((2, 2), dtype=np.c... | Returns the QWZ Hamiltonian at kx,ky.
Args:
kx, ky (float): point in momentum space.
mu, b (float): parameters in Hamiltonian.
Returns:
np.array: the QWZ Hamiltonian.
| Returns the QWZ Hamiltonian at kx,ky. | [
"Returns",
"the",
"QWZ",
"Hamiltonian",
"at",
"kx",
"ky",
"."
] | def qwz_hamiltonian(kx, ky, mu, b):
j = complex(0, 1)
hamiltonian = np.zeros((2, 2), dtype=np.cdouble)
hamiltonian[0, 0] = mu - 2. * b * (2. - np.cos(kx) - np.cos(ky))
hamiltonian[1, 1] = -mu + 2. * b * (2. - np.cos(kx) - np.cos(ky))
hamiltonian[0, 1] = np.sin(kx) - j * np.sin(ky)
hamiltonian[1,... | [
"def",
"qwz_hamiltonian",
"(",
"kx",
",",
"ky",
",",
"mu",
",",
"b",
")",
":",
"j",
"=",
"complex",
"(",
"0",
",",
"1",
")",
"hamiltonian",
"=",
"np",
".",
"zeros",
"(",
"(",
"2",
",",
"2",
")",
",",
"dtype",
"=",
"np",
".",
"cdouble",
")",
... | Returns the QWZ Hamiltonian at kx,ky. | [
"Returns",
"the",
"QWZ",
"Hamiltonian",
"at",
"kx",
"ky",
"."
] | [
"\"\"\" Returns the QWZ Hamiltonian at kx,ky.\n\n Args:\n kx, ky (float): point in momentum space.\n mu, b (float): parameters in Hamiltonian.\n\n Returns:\n np.array: the QWZ Hamiltonian.\n \"\"\""
] | [
{
"param": "kx",
"type": null
},
{
"param": "ky",
"type": null
},
{
"param": "mu",
"type": null
},
{
"param": "b",
"type": null
}
] | {
"returns": [
{
"docstring": "the QWZ Hamiltonian.",
"docstring_tokens": [
"the",
"QWZ",
"Hamiltonian",
"."
],
"type": "np.array"
}
],
"raises": [],
"params": [
{
"identifier": "kx",
"type": null,
"docstring": null,
"do... |
5385c6df0d564521e18ce47119fc60d5abb1d0eb | park-sungjoon/topological-phase-diagram | qwz/qwz_utils.py | [
"MIT"
] | Python | distance | <not_specific> | def distance(state1, state2):
"""Return the quantum distance between state1 and state2.
Args:
state1 (np.array): a quantum state
state2 (np.array): a quantum state
Returns:
float: quantum distance between state1 and state2, sqrt(1-abs(<state1|state2>)**2)
"""
return np.sqrt(... | Return the quantum distance between state1 and state2.
Args:
state1 (np.array): a quantum state
state2 (np.array): a quantum state
Returns:
float: quantum distance between state1 and state2, sqrt(1-abs(<state1|state2>)**2)
| Return the quantum distance between state1 and state2. | [
"Return",
"the",
"quantum",
"distance",
"between",
"state1",
"and",
"state2",
"."
] | def distance(state1, state2):
return np.sqrt(abs(1.0 - abs(state1.conjugate().transpose() @ state2).item()**2)) | [
"def",
"distance",
"(",
"state1",
",",
"state2",
")",
":",
"return",
"np",
".",
"sqrt",
"(",
"abs",
"(",
"1.0",
"-",
"abs",
"(",
"state1",
".",
"conjugate",
"(",
")",
".",
"transpose",
"(",
")",
"@",
"state2",
")",
".",
"item",
"(",
")",
"**",
... | Return the quantum distance between state1 and state2. | [
"Return",
"the",
"quantum",
"distance",
"between",
"state1",
"and",
"state2",
"."
] | [
"\"\"\"Return the quantum distance between state1 and state2.\n\n Args:\n state1 (np.array): a quantum state\n state2 (np.array): a quantum state\n Returns:\n float: quantum distance between state1 and state2, sqrt(1-abs(<state1|state2>)**2)\n \"\"\""
] | [
{
"param": "state1",
"type": null
},
{
"param": "state2",
"type": null
}
] | {
"returns": [
{
"docstring": "quantum distance between state1 and state2, sqrt(1-abs()**2)",
"docstring_tokens": [
"quantum",
"distance",
"between",
"state1",
"and",
"state2",
"sqrt",
"(",
"1",
"-",
"abs",
... |
afc97bad18400f7f62101e8f6b4d27bade9cb700 | park-sungjoon/topological-phase-diagram | ssh/ssh_utils.py | [
"MIT"
] | Python | ssh_hamiltonian | <not_specific> | def ssh_hamiltonian(k, t1, t2, real_basis=True):
""" Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.
Args:
k (float): point in momentum space.
t1 (float): hopping parameter.
t2 (float): hopping paramter.
real_basis (bool): if True, returns Hamiltonian in real... | Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.
Args:
k (float): point in momentum space.
t1 (float): hopping parameter.
t2 (float): hopping paramter.
real_basis (bool): if True, returns Hamiltonian in real basis. Else, use complex basis.
Returns:
n... | Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2. | [
"Returns",
"the",
"SSH",
"Hamiltonian",
"at",
"k",
"with",
"hopping",
"amplitudes",
"t1",
"and",
"t2",
"."
] | def ssh_hamiltonian(k, t1, t2, real_basis=True):
if real_basis:
hamiltonian = np.zeros((2, 2), dtype=np.double)
hamiltonian[0, 0] = t2 * np.sin(k)
hamiltonian[1, 1] = -t2 * np.sin(k)
hamiltonian[0, 1] = t1 + t2 * np.cos(k)
hamiltonian[1, 0] = t1 + t2 * np.cos(k)
retur... | [
"def",
"ssh_hamiltonian",
"(",
"k",
",",
"t1",
",",
"t2",
",",
"real_basis",
"=",
"True",
")",
":",
"if",
"real_basis",
":",
"hamiltonian",
"=",
"np",
".",
"zeros",
"(",
"(",
"2",
",",
"2",
")",
",",
"dtype",
"=",
"np",
".",
"double",
")",
"hamil... | Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2. | [
"Returns",
"the",
"SSH",
"Hamiltonian",
"at",
"k",
"with",
"hopping",
"amplitudes",
"t1",
"and",
"t2",
"."
] | [
"\"\"\" Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.\n\n Args:\n k (float): point in momentum space.\n t1 (float): hopping parameter.\n t2 (float): hopping paramter.\n real_basis (bool): if True, returns Hamiltonian in real basis. Else, use complex basis.\n\n ... | [
{
"param": "k",
"type": null
},
{
"param": "t1",
"type": null
},
{
"param": "t2",
"type": null
},
{
"param": "real_basis",
"type": null
}
] | {
"returns": [
{
"docstring": "the SSH Hamiltonian.",
"docstring_tokens": [
"the",
"SSH",
"Hamiltonian",
"."
],
"type": "np.array"
}
],
"raises": [],
"params": [
{
"identifier": "k",
"type": null,
"docstring": "point in moment... |
27f014a3a6cb5ef2a5892d83ba7f95b0c7e1f28b | park-sungjoon/topological-phase-diagram | tb/tb_utils.py | [
"MIT"
] | Python | tb_H | <not_specific> | def tb_H(k, t3, t4):
""" Returns the Hamiltonian of three-bands model at k with hopping amplitudes t3, and t4.
Args:
k (float): point in momentum space.
t3, t4 (float): hopping parameter.
Returns:
np.array: the 3 by 3 Hamiltonian.
"""
hamiltonian = np.zeros((3, 3), dtype=n... | Returns the Hamiltonian of three-bands model at k with hopping amplitudes t3, and t4.
Args:
k (float): point in momentum space.
t3, t4 (float): hopping parameter.
Returns:
np.array: the 3 by 3 Hamiltonian.
| Returns the Hamiltonian of three-bands model at k with hopping amplitudes t3, and t4. | [
"Returns",
"the",
"Hamiltonian",
"of",
"three",
"-",
"bands",
"model",
"at",
"k",
"with",
"hopping",
"amplitudes",
"t3",
"and",
"t4",
"."
] | def tb_H(k, t3, t4):
hamiltonian = np.zeros((3, 3), dtype=np.double)
hamiltonian[0, 0] = 1.0 * np.sin(k)
hamiltonian[0, 1] = - 1.0 - 1.0 * np.cos(k)
hamiltonian[0, 2] = t3
hamiltonian[1, 0] = - 1.0 - 1.0 * np.cos(k)
hamiltonian[1, 1] = - 1.0 * np.sin(k)
hamiltonian[1, 2] = - t3
hamiltoni... | [
"def",
"tb_H",
"(",
"k",
",",
"t3",
",",
"t4",
")",
":",
"hamiltonian",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
",",
"3",
")",
",",
"dtype",
"=",
"np",
".",
"double",
")",
"hamiltonian",
"[",
"0",
",",
"0",
"]",
"=",
"1.0",
"*",
"np",
".",
... | Returns the Hamiltonian of three-bands model at k with hopping amplitudes t3, and t4. | [
"Returns",
"the",
"Hamiltonian",
"of",
"three",
"-",
"bands",
"model",
"at",
"k",
"with",
"hopping",
"amplitudes",
"t3",
"and",
"t4",
"."
] | [
"\"\"\" Returns the Hamiltonian of three-bands model at k with hopping amplitudes t3, and t4.\n\n Args:\n k (float): point in momentum space.\n t3, t4 (float): hopping parameter.\n\n Returns:\n np.array: the 3 by 3 Hamiltonian.\n \"\"\""
] | [
{
"param": "k",
"type": null
},
{
"param": "t3",
"type": null
},
{
"param": "t4",
"type": null
}
] | {
"returns": [
{
"docstring": "the 3 by 3 Hamiltonian.",
"docstring_tokens": [
"the",
"3",
"by",
"3",
"Hamiltonian",
"."
],
"type": "np.array"
}
],
"raises": [],
"params": [
{
"identifier": "k",
"type": null,
"... |
b403686d83d332dcbf103328425cdcbc2795ae91 | park-sungjoon/topological-phase-diagram | tb/tb_deformation_dirichlet.py | [
"MIT"
] | Python | loss_so3 | <not_specific> | def loss_so3(self, eulerangles_t, state_t, vol_loss):
""" note that eulerangles_t shorter than state_t by 1"""
deformed_state = self.deformation(eulerangles_t, state_t)
similarity = torch.zeros(self.mesh_size)
average_length = abs(vol_loss / self.mesh_size)
for i in range(self.m... | note that eulerangles_t shorter than state_t by 1 | note that eulerangles_t shorter than state_t by 1 | [
"note",
"that",
"eulerangles_t",
"shorter",
"than",
"state_t",
"by",
"1"
] | def loss_so3(self, eulerangles_t, state_t, vol_loss):
deformed_state = self.deformation(eulerangles_t, state_t)
similarity = torch.zeros(self.mesh_size)
average_length = abs(vol_loss / self.mesh_size)
for i in range(self.mesh_size - 1):
similarity[i] = torch.exp(-torch.sqrt(t... | [
"def",
"loss_so3",
"(",
"self",
",",
"eulerangles_t",
",",
"state_t",
",",
"vol_loss",
")",
":",
"deformed_state",
"=",
"self",
".",
"deformation",
"(",
"eulerangles_t",
",",
"state_t",
")",
"similarity",
"=",
"torch",
".",
"zeros",
"(",
"self",
".",
"mesh... | note that eulerangles_t shorter than state_t by 1 | [
"note",
"that",
"eulerangles_t",
"shorter",
"than",
"state_t",
"by",
"1"
] | [
"\"\"\" note that eulerangles_t shorter than state_t by 1\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "eulerangles_t",
"type": null
},
{
"param": "state_t",
"type": null
},
{
"param": "vol_loss",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "eulerangles_t",
"type": null,
"docstring": null,
"docstring_t... |
39344e85f19fd47f9099316071f060debb10b219 | park-sungjoon/topological-phase-diagram | ssh/ssh_deformation_dirichlet.py | [
"MIT"
] | Python | loss_so2 | <not_specific> | def loss_so2(self, theta_t, state_t, vol_loss):
""" note that theta_t shorter than state_t by 1"""
deformed_state = self.deformation(theta_t, state_t)
similarity = torch.zeros(self.mesh_size)
average_length = abs(vol_loss / self.mesh_size)
for i in range(self.mesh_size - 1):
... | note that theta_t shorter than state_t by 1 | note that theta_t shorter than state_t by 1 | [
"note",
"that",
"theta_t",
"shorter",
"than",
"state_t",
"by",
"1"
] | def loss_so2(self, theta_t, state_t, vol_loss):
deformed_state = self.deformation(theta_t, state_t)
similarity = torch.zeros(self.mesh_size)
average_length = abs(vol_loss / self.mesh_size)
for i in range(self.mesh_size - 1):
similarity[i] = torch.exp(-torch.sqrt(torch.abs(1. ... | [
"def",
"loss_so2",
"(",
"self",
",",
"theta_t",
",",
"state_t",
",",
"vol_loss",
")",
":",
"deformed_state",
"=",
"self",
".",
"deformation",
"(",
"theta_t",
",",
"state_t",
")",
"similarity",
"=",
"torch",
".",
"zeros",
"(",
"self",
".",
"mesh_size",
")... | note that theta_t shorter than state_t by 1 | [
"note",
"that",
"theta_t",
"shorter",
"than",
"state_t",
"by",
"1"
] | [
"\"\"\" note that theta_t shorter than state_t by 1\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "theta_t",
"type": null
},
{
"param": "state_t",
"type": null
},
{
"param": "vol_loss",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "theta_t",
"type": null,
"docstring": null,
"docstring_tokens"... |
d717f59fa8b728cc776d3874d13e2630e3dfa08c | park-sungjoon/topological-phase-diagram | ssh/ssh_phase_diagram_multiprocessing.py | [
"MIT"
] | Python | save_img | null | def save_img(eigenval, eigenvec, k_means_label, file_name):
""" Saves eigenvalue spectrum and distribution of persistence diagram in the space of eigenvectors of the random walk Laplacian.
Here, we explicitly indicate that only the first two eigenvectors will be used (using the knowledge that k means clusterin... | Saves eigenvalue spectrum and distribution of persistence diagram in the space of eigenvectors of the random walk Laplacian.
Here, we explicitly indicate that only the first two eigenvectors will be used (using the knowledge that k means clustering returns two clusters, see k_means).
Args:
eigenval, e... | Saves eigenvalue spectrum and distribution of persistence diagram in the space of eigenvectors of the random walk Laplacian.
Here, we explicitly indicate that only the first two eigenvectors will be used (using the knowledge that k means clustering returns two clusters, see k_means). | [
"Saves",
"eigenvalue",
"spectrum",
"and",
"distribution",
"of",
"persistence",
"diagram",
"in",
"the",
"space",
"of",
"eigenvectors",
"of",
"the",
"random",
"walk",
"Laplacian",
".",
"Here",
"we",
"explicitly",
"indicate",
"that",
"only",
"the",
"first",
"two",
... | def save_img(eigenval, eigenvec, k_means_label, file_name):
logger.info('saving image')
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(10, 5))
ax[0].tick_params(axis='x', labelsize=20)
ax[0].tick_params(axis='y', labelsize=20)
ax[1].tick_params(axis='x', labelsize=20)
ax[1].tick_params(axis='... | [
"def",
"save_img",
"(",
"eigenval",
",",
"eigenvec",
",",
"k_means_label",
",",
"file_name",
")",
":",
"logger",
".",
"info",
"(",
"'saving image'",
")",
"fig",
",",
"ax",
"=",
"plt",
".",
"subplots",
"(",
"nrows",
"=",
"1",
",",
"ncols",
"=",
"2",
"... | Saves eigenvalue spectrum and distribution of persistence diagram in the space of eigenvectors of the random walk Laplacian. | [
"Saves",
"eigenvalue",
"spectrum",
"and",
"distribution",
"of",
"persistence",
"diagram",
"in",
"the",
"space",
"of",
"eigenvectors",
"of",
"the",
"random",
"walk",
"Laplacian",
"."
] | [
"\"\"\" Saves eigenvalue spectrum and distribution of persistence diagram in the space of eigenvectors of the random walk Laplacian. \n Here, we explicitly indicate that only the first two eigenvectors will be used (using the knowledge that k means clustering returns two clusters, see k_means).\n Args:\n ... | [
{
"param": "eigenval",
"type": null
},
{
"param": "eigenvec",
"type": null
},
{
"param": "k_means_label",
"type": null
},
{
"param": "file_name",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "eigenval",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": nul... |
d717f59fa8b728cc776d3874d13e2630e3dfa08c | park-sungjoon/topological-phase-diagram | ssh/ssh_phase_diagram_multiprocessing.py | [
"MIT"
] | Python | k_means | <not_specific> | def k_means(eigenval, eigenvec, cutoff=0.2):
""" computes the clusters in eigenvector space using information in eigenvalues (last step in spectral clustering)
Args:
eigenval (np.array): eigenvalues of random walk laplacian
eigenvec (np.array): eigenvectors of random walk laplacian
cutof... | computes the clusters in eigenvector space using information in eigenvalues (last step in spectral clustering)
Args:
eigenval (np.array): eigenvalues of random walk laplacian
eigenvec (np.array): eigenvectors of random walk laplacian
cutoff (float): the number of eigenvalues below the cutof... | computes the clusters in eigenvector space using information in eigenvalues (last step in spectral clustering) | [
"computes",
"the",
"clusters",
"in",
"eigenvector",
"space",
"using",
"information",
"in",
"eigenvalues",
"(",
"last",
"step",
"in",
"spectral",
"clustering",
")"
] | def k_means(eigenval, eigenvec, cutoff=0.2):
n_clusters = np.sum(eigenval < cutoff)
k_means_clustered = cluster.k_means(eigenvec[:, :n_clusters], n_clusters=n_clusters)
return k_means_clustered | [
"def",
"k_means",
"(",
"eigenval",
",",
"eigenvec",
",",
"cutoff",
"=",
"0.2",
")",
":",
"n_clusters",
"=",
"np",
".",
"sum",
"(",
"eigenval",
"<",
"cutoff",
")",
"k_means_clustered",
"=",
"cluster",
".",
"k_means",
"(",
"eigenvec",
"[",
":",
",",
":",... | computes the clusters in eigenvector space using information in eigenvalues (last step in spectral clustering) | [
"computes",
"the",
"clusters",
"in",
"eigenvector",
"space",
"using",
"information",
"in",
"eigenvalues",
"(",
"last",
"step",
"in",
"spectral",
"clustering",
")"
] | [
"\"\"\" computes the clusters in eigenvector space using information in eigenvalues (last step in spectral clustering)\n Args:\n eigenval (np.array): eigenvalues of random walk laplacian\n eigenvec (np.array): eigenvectors of random walk laplacian\n cutoff (float): the number of eigenvalues ... | [
{
"param": "eigenval",
"type": null
},
{
"param": "eigenvec",
"type": null
},
{
"param": "cutoff",
"type": null
}
] | {
"returns": [
{
"docstring": "output of k means clustering (cluster centers, cluster label, inertia)",
"docstring_tokens": [
"output",
"of",
"k",
"means",
"clustering",
"(",
"cluster",
"centers",
"cluster",
"label",
... |
d717f59fa8b728cc776d3874d13e2630e3dfa08c | park-sungjoon/topological-phase-diagram | ssh/ssh_phase_diagram_multiprocessing.py | [
"MIT"
] | Python | plot_phase_diagram | null | def plot_phase_diagram(param_list, k_means_label, file_name, plot_boundary=True):
""" plots phase diagram for ssh model
Args:
param_list: list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).
k_means_label: output of k means clustering (k_mea... | plots phase diagram for ssh model
Args:
param_list: list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).
k_means_label: output of k means clustering (k_means) for the elements in param_list
file_name: name of the file to which we save t... | plots phase diagram for ssh model | [
"plots",
"phase",
"diagram",
"for",
"ssh",
"model"
] | def plot_phase_diagram(param_list, k_means_label, file_name, plot_boundary=True):
fig, ax = plt.subplots()
ax.tick_params(axis='x', labelsize=20)
ax.tick_params(axis='y', labelsize=20)
c_list = []
c_choice = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
num_clusters = np.max(k_means_label) + 1
assert ... | [
"def",
"plot_phase_diagram",
"(",
"param_list",
",",
"k_means_label",
",",
"file_name",
",",
"plot_boundary",
"=",
"True",
")",
":",
"fig",
",",
"ax",
"=",
"plt",
".",
"subplots",
"(",
")",
"ax",
".",
"tick_params",
"(",
"axis",
"=",
"'x'",
",",
"labelsi... | plots phase diagram for ssh model | [
"plots",
"phase",
"diagram",
"for",
"ssh",
"model"
] | [
"\"\"\" plots phase diagram for ssh model\n Args:\n param_list: list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).\n k_means_label: output of k means clustering (k_means) for the elements in param_list\n file_name: name of the file to ... | [
{
"param": "param_list",
"type": null
},
{
"param": "k_means_label",
"type": null
},
{
"param": "file_name",
"type": null
},
{
"param": "plot_boundary",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "param_list",
"type": null,
"docstring": "list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 ... |
2945fe84324b4d4e23e69d3d04fecb2829cb15f7 | Rfam/rfam-production | scripts/support/rfamseq2genseq.py | [
"Apache-2.0"
] | Python | convert_rfamseq_to_genseq | null | def convert_rfamseq_to_genseq(rfamseq_file, dest_dir=None):
"""
Converts an rfamseq file to genseq to map genome (upid) and sequence
accessions
:param rfamseq_file: A genome specific rfamseq file in the form of
upid.rfamseq, as generated from rfamseq table
returns: void
"""
# store ou... |
Converts an rfamseq file to genseq to map genome (upid) and sequence
accessions
:param rfamseq_file: A genome specific rfamseq file in the form of
upid.rfamseq, as generated from rfamseq table
returns: void
| Converts an rfamseq file to genseq to map genome (upid) and sequence
accessions | [
"Converts",
"an",
"rfamseq",
"file",
"to",
"genseq",
"to",
"map",
"genome",
"(",
"upid",
")",
"and",
"sequence",
"accessions"
] | def convert_rfamseq_to_genseq(rfamseq_file, dest_dir=None):
if dest_dir is None:
dest_dir = os.path.split(rfamseq_file)[0]
filename = os.path.basename(rfamseq_file).partition('.')[0]
genseq_file = open(os.path.join(dest_dir, filename+'.genseq'), 'w')
rfamseq_fp = open(rfamseq_file, 'r')
for ... | [
"def",
"convert_rfamseq_to_genseq",
"(",
"rfamseq_file",
",",
"dest_dir",
"=",
"None",
")",
":",
"if",
"dest_dir",
"is",
"None",
":",
"dest_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"rfamseq_file",
")",
"[",
"0",
"]",
"filename",
"=",
"os",
".",
... | Converts an rfamseq file to genseq to map genome (upid) and sequence
accessions | [
"Converts",
"an",
"rfamseq",
"file",
"to",
"genseq",
"to",
"map",
"genome",
"(",
"upid",
")",
"and",
"sequence",
"accessions"
] | [
"\"\"\"\n Converts an rfamseq file to genseq to map genome (upid) and sequence\n accessions\n\n :param rfamseq_file: A genome specific rfamseq file in the form of\n upid.rfamseq, as generated from rfamseq table\n\n returns: void\n \"\"\"",
"# store output in input file directory",
"# get the i... | [
{
"param": "rfamseq_file",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rfamseq_file",
"type": null,
"docstring": "A genome specific rfamseq file in the form of\nupid.rfamseq, as generated from rfamseq table\n\nvoid",
"docstring_tokens": [
"A",
"genome",
"specific",
... |
2945fe84324b4d4e23e69d3d04fecb2829cb15f7 | Rfam/rfam-production | scripts/support/rfamseq2genseq.py | [
"Apache-2.0"
] | Python | generate_genseq_files_from_project_directory | null | def generate_genseq_files_from_project_directory(project_dir, upid_input):
"""
Generates genseq files directly in the directory where a particular
genome is located
project_dir: The path to a project directory as generated by genome_downloader
upid_file: A file listing all upids for which to genera... |
Generates genseq files directly in the directory where a particular
genome is located
project_dir: The path to a project directory as generated by genome_downloader
upid_file: A file listing all upids for which to generate the genseq files
return: void
| Generates genseq files directly in the directory where a particular
genome is located
The path to a project directory as generated by genome_downloader
upid_file: A file listing all upids for which to generate the genseq files
void | [
"Generates",
"genseq",
"files",
"directly",
"in",
"the",
"directory",
"where",
"a",
"particular",
"genome",
"is",
"located",
"The",
"path",
"to",
"a",
"project",
"directory",
"as",
"generated",
"by",
"genome_downloader",
"upid_file",
":",
"A",
"file",
"listing",... | def generate_genseq_files_from_project_directory(project_dir, upid_input):
if os.path.isfile(upid_input):
fp = open(upid_input, 'r')
upids = [x.strip() for x in fp]
fp.close()
for upid in upids:
suffix = upid[-3:]
subdir = os.path.join(project_dir, suffix)
... | [
"def",
"generate_genseq_files_from_project_directory",
"(",
"project_dir",
",",
"upid_input",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"upid_input",
")",
":",
"fp",
"=",
"open",
"(",
"upid_input",
",",
"'r'",
")",
"upids",
"=",
"[",
"x",
".",... | Generates genseq files directly in the directory where a particular
genome is located | [
"Generates",
"genseq",
"files",
"directly",
"in",
"the",
"directory",
"where",
"a",
"particular",
"genome",
"is",
"located"
] | [
"\"\"\"\n Generates genseq files directly in the directory where a particular\n genome is located\n\n project_dir: The path to a project directory as generated by genome_downloader\n upid_file: A file listing all upids for which to generate the genseq files\n\n return: void\n \"\"\"",
"# loop ov... | [
{
"param": "project_dir",
"type": null
},
{
"param": "upid_input",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid_input",
"type": null,
"docstring": null,
"docstri... |
2945fe84324b4d4e23e69d3d04fecb2829cb15f7 | Rfam/rfam-production | scripts/support/rfamseq2genseq.py | [
"Apache-2.0"
] | Python | generate_genseq_files_from_common_directory | null | def generate_genseq_files_from_common_directory(rfamseq_input, dest_dir=None):
"""
Simple function to generate .genseq files from within the same directory
rfamseq_input: The path to a directory containing multiple .rfamseq files
or a single .rfamseq file
dest_dir: The path to destination directory... |
Simple function to generate .genseq files from within the same directory
rfamseq_input: The path to a directory containing multiple .rfamseq files
or a single .rfamseq file
dest_dir: The path to destination directory
return:
| Simple function to generate .genseq files from within the same directory
rfamseq_input: The path to a directory containing multiple .rfamseq files
or a single .rfamseq file
dest_dir: The path to destination directory
| [
"Simple",
"function",
"to",
"generate",
".",
"genseq",
"files",
"from",
"within",
"the",
"same",
"directory",
"rfamseq_input",
":",
"The",
"path",
"to",
"a",
"directory",
"containing",
"multiple",
".",
"rfamseq",
"files",
"or",
"a",
"single",
".",
"rfamseq",
... | def generate_genseq_files_from_common_directory(rfamseq_input, dest_dir=None):
if dest_dir is None:
if os.path.isdir(rfamseq_input):
dest_dir = rfamseq_input
else:
dest_dir = os.path.split(rfamseq_input)[0]
if os.path.isdir(rfamseq_input):
rfamseq_files = [x for x... | [
"def",
"generate_genseq_files_from_common_directory",
"(",
"rfamseq_input",
",",
"dest_dir",
"=",
"None",
")",
":",
"if",
"dest_dir",
"is",
"None",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"rfamseq_input",
")",
":",
"dest_dir",
"=",
"rfamseq_input",
"e... | Simple function to generate .genseq files from within the same directory
rfamseq_input: The path to a directory containing multiple .rfamseq files
or a single .rfamseq file
dest_dir: The path to destination directory | [
"Simple",
"function",
"to",
"generate",
".",
"genseq",
"files",
"from",
"within",
"the",
"same",
"directory",
"rfamseq_input",
":",
"The",
"path",
"to",
"a",
"directory",
"containing",
"multiple",
".",
"rfamseq",
"files",
"or",
"a",
"single",
".",
"rfamseq",
... | [
"\"\"\"\n Simple function to generate .genseq files from within the same directory\n\n rfamseq_input: The path to a directory containing multiple .rfamseq files\n or a single .rfamseq file\n dest_dir: The path to destination directory\n\n return:\n \"\"\"",
"# work on the destination directory"
... | [
{
"param": "rfamseq_input",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rfamseq_input",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstri... |
e44252784641fc7a945d007e4db76006d27753b7 | Rfam/rfam-production | scripts/support/update_go_terms.py | [
"Apache-2.0"
] | Python | parse_go_term_file | <not_specific> | def parse_go_term_file(go_term_file):
"""
Parses a tabular file of valid GO terms and returns a dictionary with all
available GO terms per family. An example of the file can be found in this
url(https://goo.gl/5PN5LT)
go_term_file: The path to a go term file. This should be a tab delimited
file... |
Parses a tabular file of valid GO terms and returns a dictionary with all
available GO terms per family. An example of the file can be found in this
url(https://goo.gl/5PN5LT)
go_term_file: The path to a go term file. This should be a tab delimited
file where multiple terms followed by their descr... | Parses a tabular file of valid GO terms and returns a dictionary with all
available GO terms per family. An example of the file can be found in this
url
The path to a go term file. This should be a tab delimited
file where multiple terms followed by their description, are
void | [
"Parses",
"a",
"tabular",
"file",
"of",
"valid",
"GO",
"terms",
"and",
"returns",
"a",
"dictionary",
"with",
"all",
"available",
"GO",
"terms",
"per",
"family",
".",
"An",
"example",
"of",
"the",
"file",
"can",
"be",
"found",
"in",
"this",
"url",
"The",
... | def parse_go_term_file(go_term_file):
go_terms_dict = {}
go_terms_fp = open(go_term_file, 'r')
for go_line in go_terms_fp:
go_line = go_line.strip().split('\t')
go_terms = go_line[1:]
rfam_acc = go_line[0].strip()
if rfam_acc not in go_terms_dict:
go_terms_dict[rf... | [
"def",
"parse_go_term_file",
"(",
"go_term_file",
")",
":",
"go_terms_dict",
"=",
"{",
"}",
"go_terms_fp",
"=",
"open",
"(",
"go_term_file",
",",
"'r'",
")",
"for",
"go_line",
"in",
"go_terms_fp",
":",
"go_line",
"=",
"go_line",
".",
"strip",
"(",
")",
"."... | Parses a tabular file of valid GO terms and returns a dictionary with all
available GO terms per family. | [
"Parses",
"a",
"tabular",
"file",
"of",
"valid",
"GO",
"terms",
"and",
"returns",
"a",
"dictionary",
"with",
"all",
"available",
"GO",
"terms",
"per",
"family",
"."
] | [
"\"\"\"\n Parses a tabular file of valid GO terms and returns a dictionary with all\n available GO terms per family. An example of the file can be found in this\n url(https://goo.gl/5PN5LT)\n\n go_term_file: The path to a go term file. This should be a tab delimited\n file where multiple terms follow... | [
{
"param": "go_term_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "go_term_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e44252784641fc7a945d007e4db76006d27753b7 | Rfam/rfam-production | scripts/support/update_go_terms.py | [
"Apache-2.0"
] | Python | update_desc_go_terms | null | def update_desc_go_terms(go_term_list, desc_file_path):
"""
Modifies a valid family DESC file, by adding GO terms listed in go_term_list
go_term_list: A list of GO term/description tuples to include in the DESC file
desc_file_path: The path to a valid Rfam DESC file
return: void
"""
desc_... |
Modifies a valid family DESC file, by adding GO terms listed in go_term_list
go_term_list: A list of GO term/description tuples to include in the DESC file
desc_file_path: The path to a valid Rfam DESC file
return: void
| Modifies a valid family DESC file, by adding GO terms listed in go_term_list
go_term_list: A list of GO term/description tuples to include in the DESC file
desc_file_path: The path to a valid Rfam DESC file
void | [
"Modifies",
"a",
"valid",
"family",
"DESC",
"file",
"by",
"adding",
"GO",
"terms",
"listed",
"in",
"go_term_list",
"go_term_list",
":",
"A",
"list",
"of",
"GO",
"term",
"/",
"description",
"tuples",
"to",
"include",
"in",
"the",
"DESC",
"file",
"desc_file_pa... | def update_desc_go_terms(go_term_list, desc_file_path):
desc_fp = open(desc_file_path, 'r')
desc_lines = desc_fp.readlines()
desc_fp.close()
new_desc_fp = open(os.path.join(os.path.split(desc_file_path)[0], "DESC_new"), 'w')
idx = 0
while idx < len(desc_lines):
if desc_lines[idx][0:2] ==... | [
"def",
"update_desc_go_terms",
"(",
"go_term_list",
",",
"desc_file_path",
")",
":",
"desc_fp",
"=",
"open",
"(",
"desc_file_path",
",",
"'r'",
")",
"desc_lines",
"=",
"desc_fp",
".",
"readlines",
"(",
")",
"desc_fp",
".",
"close",
"(",
")",
"new_desc_fp",
"... | Modifies a valid family DESC file, by adding GO terms listed in go_term_list
go_term_list: A list of GO term/description tuples to include in the DESC file
desc_file_path: The path to a valid Rfam DESC file | [
"Modifies",
"a",
"valid",
"family",
"DESC",
"file",
"by",
"adding",
"GO",
"terms",
"listed",
"in",
"go_term_list",
"go_term_list",
":",
"A",
"list",
"of",
"GO",
"term",
"/",
"description",
"tuples",
"to",
"include",
"in",
"the",
"DESC",
"file",
"desc_file_pa... | [
"\"\"\"\n Modifies a valid family DESC file, by adding GO terms listed in go_term_list\n\n go_term_list: A list of GO term/description tuples to include in the DESC file\n desc_file_path: The path to a valid Rfam DESC file\n\n return: void\n \"\"\"",
"# loop once until we reach DR lines",
"# brea... | [
{
"param": "go_term_list",
"type": null
},
{
"param": "desc_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "go_term_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desc_file_path",
"type": null,
"docstring": null,
"do... |
e44252784641fc7a945d007e4db76006d27753b7 | Rfam/rfam-production | scripts/support/update_go_terms.py | [
"Apache-2.0"
] | Python | modify_desc_go_terms | null | def modify_desc_go_terms(go_term_dict, desc_file_path):
"""
List of GO term modifications for a specific family parse_go_term_validation_file
The function reads the
go_term_list: Family GO term list as generated by
desc_file_path:
:return:
"""
# need to do the check for an empty list o... |
List of GO term modifications for a specific family parse_go_term_validation_file
The function reads the
go_term_list: Family GO term list as generated by
desc_file_path:
:return:
| List of GO term modifications for a specific family parse_go_term_validation_file
The function reads the
Family GO term list as generated by
desc_file_path. | [
"List",
"of",
"GO",
"term",
"modifications",
"for",
"a",
"specific",
"family",
"parse_go_term_validation_file",
"The",
"function",
"reads",
"the",
"Family",
"GO",
"term",
"list",
"as",
"generated",
"by",
"desc_file_path",
"."
] | def modify_desc_go_terms(go_term_dict, desc_file_path):
desc_fp = open(desc_file_path, 'r')
desc_lines = desc_fp.readlines()
desc_fp.close()
os.remove(desc_file_path)
new_desc_fp = open(desc_file_path, 'w')
for desc_line in desc_lines:
if desc_line[0:2] != "DR":
new_desc_fp.w... | [
"def",
"modify_desc_go_terms",
"(",
"go_term_dict",
",",
"desc_file_path",
")",
":",
"desc_fp",
"=",
"open",
"(",
"desc_file_path",
",",
"'r'",
")",
"desc_lines",
"=",
"desc_fp",
".",
"readlines",
"(",
")",
"desc_fp",
".",
"close",
"(",
")",
"os",
".",
"re... | List of GO term modifications for a specific family parse_go_term_validation_file
The function reads the | [
"List",
"of",
"GO",
"term",
"modifications",
"for",
"a",
"specific",
"family",
"parse_go_term_validation_file",
"The",
"function",
"reads",
"the"
] | [
"\"\"\"\n List of GO term modifications for a specific family parse_go_term_validation_file\n The function reads the\n\n go_term_list: Family GO term list as generated by\n desc_file_path:\n :return:\n \"\"\"",
"# need to do the check for an empty list outside this function",
"# get destinatio... | [
{
"param": "go_term_dict",
"type": null
},
{
"param": "desc_file_path",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "go_term_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional":... |
e44252784641fc7a945d007e4db76006d27753b7 | Rfam/rfam-production | scripts/support/update_go_terms.py | [
"Apache-2.0"
] | Python | main | null | def main(go_term_file, option ,checkout_dir):
"""
This function will check out a family from the SVN repository, modify the
desc file to add the GO terms and then check family back to the SVN repository
go_term_file: The path to a go term file. This should be a tab delimited
file where multiple ter... |
This function will check out a family from the SVN repository, modify the
desc file to add the GO terms and then check family back to the SVN repository
go_term_file: The path to a go term file. This should be a tab delimited
file where multiple terms followed by their description, are
checkout_di... | This function will check out a family from the SVN repository, modify the
desc file to add the GO terms and then check family back to the SVN repository
The path to a go term file. This should be a tab delimited
file where multiple terms followed by their description, are
checkout_dir: A destination directory where to... | [
"This",
"function",
"will",
"check",
"out",
"a",
"family",
"from",
"the",
"SVN",
"repository",
"modify",
"the",
"desc",
"file",
"to",
"add",
"the",
"GO",
"terms",
"and",
"then",
"check",
"family",
"back",
"to",
"the",
"SVN",
"repository",
"The",
"path",
... | def main(go_term_file, option ,checkout_dir):
checkout_cmd = "rfco.pl %s"
checkin_cmd = "rfci.pl -onlydesc -m \'GO terms added\' %s"
if not os.path.exists(checkout_dir):
os.mkdir(checkout_dir)
os.chdir(checkout_dir)
go_term_dict = None
if option == "--curation":
go_term_dict = pa... | [
"def",
"main",
"(",
"go_term_file",
",",
"option",
",",
"checkout_dir",
")",
":",
"checkout_cmd",
"=",
"\"rfco.pl %s\"",
"checkin_cmd",
"=",
"\"rfci.pl -onlydesc -m \\'GO terms added\\' %s\"",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"checkout_dir",
")",
... | This function will check out a family from the SVN repository, modify the
desc file to add the GO terms and then check family back to the SVN repository | [
"This",
"function",
"will",
"check",
"out",
"a",
"family",
"from",
"the",
"SVN",
"repository",
"modify",
"the",
"desc",
"file",
"to",
"add",
"the",
"GO",
"terms",
"and",
"then",
"check",
"family",
"back",
"to",
"the",
"SVN",
"repository"
] | [
"\"\"\"\n This function will check out a family from the SVN repository, modify the\n desc file to add the GO terms and then check family back to the SVN repository\n\n go_term_file: The path to a go term file. This should be a tab delimited\n file where multiple terms followed by their description, are... | [
{
"param": "go_term_file",
"type": null
},
{
"param": "option",
"type": null
},
{
"param": "checkout_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "go_term_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "option",
"type": null,
"docstring": null,
"docstring_... |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | wiki_redirects_parser | <not_specific> | def wiki_redirects_parser(redirects):
"""
Parses wiki redirects and reports rfam accessions and changes to WK tags
Returns a dictionary with changes per family accession
redirects: redirects.txt file from wiki
"""
wk_edits = {}
fp = open(redirects, 'r')
rfam_lines = [x.strip() for x i... |
Parses wiki redirects and reports rfam accessions and changes to WK tags
Returns a dictionary with changes per family accession
redirects: redirects.txt file from wiki
| Parses wiki redirects and reports rfam accessions and changes to WK tags
Returns a dictionary with changes per family accession
| [
"Parses",
"wiki",
"redirects",
"and",
"reports",
"rfam",
"accessions",
"and",
"changes",
"to",
"WK",
"tags",
"Returns",
"a",
"dictionary",
"with",
"changes",
"per",
"family",
"accession"
] | def wiki_redirects_parser(redirects):
wk_edits = {}
fp = open(redirects, 'r')
rfam_lines = [x.strip() for x in fp if x.find('Rfam') != -1]
fp.close()
c = '"'
for line in rfam_lines:
rfam_acc = line[len(line) - 7:len(line)]
positions = [pos for pos, char in enumerate(line) if char... | [
"def",
"wiki_redirects_parser",
"(",
"redirects",
")",
":",
"wk_edits",
"=",
"{",
"}",
"fp",
"=",
"open",
"(",
"redirects",
",",
"'r'",
")",
"rfam_lines",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"fp",
"if",
"x",
".",
"find",
"(",
... | Parses wiki redirects and reports rfam accessions and changes to WK tags
Returns a dictionary with changes per family accession | [
"Parses",
"wiki",
"redirects",
"and",
"reports",
"rfam",
"accessions",
"and",
"changes",
"to",
"WK",
"tags",
"Returns",
"a",
"dictionary",
"with",
"changes",
"per",
"family",
"accession"
] | [
"\"\"\"\n Parses wiki redirects and reports rfam accessions and changes to WK tags\n Returns a dictionary with changes per family accession\n\n redirects: redirects.txt file from wiki\n \"\"\"",
"# return a dictionary with the new redirects per family"
] | [
{
"param": "redirects",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "redirects",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | update_desc_file | null | def update_desc_file(desc_file, tag, updates):
"""
Function to update changes in desc files automatically
desc_file: Path to a desc file
tag: A valid DESC file tag to be modified e.g. 'WK'
updates: A tuple with the desc changes (old, new)
"""
family_dir = os.path.split(desc_file)[0]
new... |
Function to update changes in desc files automatically
desc_file: Path to a desc file
tag: A valid DESC file tag to be modified e.g. 'WK'
updates: A tuple with the desc changes (old, new)
| Function to update changes in desc files automatically
desc_file: Path to a desc file
tag: A valid DESC file tag to be modified e.g. 'WK'
updates: A tuple with the desc changes (old, new) | [
"Function",
"to",
"update",
"changes",
"in",
"desc",
"files",
"automatically",
"desc_file",
":",
"Path",
"to",
"a",
"desc",
"file",
"tag",
":",
"A",
"valid",
"DESC",
"file",
"tag",
"to",
"be",
"modified",
"e",
".",
"g",
".",
"'",
"WK",
"'",
"updates",
... | def update_desc_file(desc_file, tag, updates):
family_dir = os.path.split(desc_file)[0]
new_desc_path = os.path.join(family_dir, "DESC_NEW")
fp = open(desc_file, 'r')
new_desc = open(new_desc_path, 'w')
desc_lines = fp.readlines()
fp.close()
for line in desc_lines:
if line.find(tag) ... | [
"def",
"update_desc_file",
"(",
"desc_file",
",",
"tag",
",",
"updates",
")",
":",
"family_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"desc_file",
")",
"[",
"0",
"]",
"new_desc_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"family_dir",
",",
... | Function to update changes in desc files automatically
desc_file: Path to a desc file
tag: A valid DESC file tag to be modified e.g. | [
"Function",
"to",
"update",
"changes",
"in",
"desc",
"files",
"automatically",
"desc_file",
":",
"Path",
"to",
"a",
"desc",
"file",
"tag",
":",
"A",
"valid",
"DESC",
"file",
"tag",
"to",
"be",
"modified",
"e",
".",
"g",
"."
] | [
"\"\"\"\n Function to update changes in desc files automatically\n\n desc_file: Path to a desc file\n tag: A valid DESC file tag to be modified e.g. 'WK'\n updates: A tuple with the desc changes (old, new)\n \"\"\"",
"# remove old desc and rename new one to DESC"
] | [
{
"param": "desc_file",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "updates",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "desc_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": null,
"docstring": null,
"docstring_tokens... |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | checkout_family_from_svn | <not_specific> | def checkout_family_from_svn(rfam_acc, dest_dir):
"""
Checks out a family from the svn by calling rfco
rfam_acc: A valid Rfam family accession
dest_dir: Destination directory where to check out family
"""
os.chdir(dest_dir)
cmd = "rfco %s" % (rfam_acc)
subprocess.call(cmd, shell=True)
... |
Checks out a family from the svn by calling rfco
rfam_acc: A valid Rfam family accession
dest_dir: Destination directory where to check out family
| Checks out a family from the svn by calling rfco
rfam_acc: A valid Rfam family accession
dest_dir: Destination directory where to check out family | [
"Checks",
"out",
"a",
"family",
"from",
"the",
"svn",
"by",
"calling",
"rfco",
"rfam_acc",
":",
"A",
"valid",
"Rfam",
"family",
"accession",
"dest_dir",
":",
"Destination",
"directory",
"where",
"to",
"check",
"out",
"family"
] | def checkout_family_from_svn(rfam_acc, dest_dir):
os.chdir(dest_dir)
cmd = "rfco %s" % (rfam_acc)
subprocess.call(cmd, shell=True)
if not os.path.exists(os.path.join(dest_dir, rfam_acc)):
return -1
return 0 | [
"def",
"checkout_family_from_svn",
"(",
"rfam_acc",
",",
"dest_dir",
")",
":",
"os",
".",
"chdir",
"(",
"dest_dir",
")",
"cmd",
"=",
"\"rfco %s\"",
"%",
"(",
"rfam_acc",
")",
"subprocess",
".",
"call",
"(",
"cmd",
",",
"shell",
"=",
"True",
")",
"if",
... | Checks out a family from the svn by calling rfco
rfam_acc: A valid Rfam family accession
dest_dir: Destination directory where to check out family | [
"Checks",
"out",
"a",
"family",
"from",
"the",
"svn",
"by",
"calling",
"rfco",
"rfam_acc",
":",
"A",
"valid",
"Rfam",
"family",
"accession",
"dest_dir",
":",
"Destination",
"directory",
"where",
"to",
"check",
"out",
"family"
] | [
"\"\"\"\n Checks out a family from the svn by calling rfco\n\n rfam_acc: A valid Rfam family accession\n dest_dir: Destination directory where to check out family\n \"\"\""
] | [
{
"param": "rfam_acc",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rfam_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_to... |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | check_family_into_svn | null | def check_family_into_svn(dest_dir, onlydesc=None):
"""
Check family back to SVN repo using rfci
:param dest_dir:
:return: void
"""
os.chdir(dest_dir)
# list all family directories
family_dirs = [x for x in os.listdir(dest_dir) if x.find('RF') != -1]
for family in family_dirs:
... |
Check family back to SVN repo using rfci
:param dest_dir:
:return: void
| Check family back to SVN repo using rfci | [
"Check",
"family",
"back",
"to",
"SVN",
"repo",
"using",
"rfci"
] | def check_family_into_svn(dest_dir, onlydesc=None):
os.chdir(dest_dir)
family_dirs = [x for x in os.listdir(dest_dir) if x.find('RF') != -1]
for family in family_dirs:
if onlydesc is None:
cmd = "rfci -m /'Updated WK in DESC/' %s" % family
else:
cmd = "rfci -onlydesc ... | [
"def",
"check_family_into_svn",
"(",
"dest_dir",
",",
"onlydesc",
"=",
"None",
")",
":",
"os",
".",
"chdir",
"(",
"dest_dir",
")",
"family_dirs",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"listdir",
"(",
"dest_dir",
")",
"if",
"x",
".",
"find",
"("... | Check family back to SVN repo using rfci | [
"Check",
"family",
"back",
"to",
"SVN",
"repo",
"using",
"rfci"
] | [
"\"\"\"\n Check family back to SVN repo using rfci\n\n :param dest_dir:\n :return: void\n \"\"\"",
"# list all family directories"
] | [
{
"param": "dest_dir",
"type": null
},
{
"param": "onlydesc",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | create_wiki_markdown_links | null | def create_wiki_markdown_links(dest_dir):
"""
Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory
"""
fp_out = open(os.path.join(dest_dir, "family_links.md"), 'w')
families = [x for x in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, x))]
... |
Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory
| Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory | [
"Create",
"a",
"list",
"of",
"Rfam",
"accessions",
"and",
"links",
"in",
"markdown",
"dest_dir",
":",
"The",
"check",
"out",
"directory"
] | def create_wiki_markdown_links(dest_dir):
fp_out = open(os.path.join(dest_dir, "family_links.md"), 'w')
families = [x for x in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, x))]
for rfam_acc in families:
fam_dir = os.path.join(dest_dir, rfam_acc)
desc_fp = open(os.path.join(fa... | [
"def",
"create_wiki_markdown_links",
"(",
"dest_dir",
")",
":",
"fp_out",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"\"family_links.md\"",
")",
",",
"'w'",
")",
"families",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"list... | Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory | [
"Create",
"a",
"list",
"of",
"Rfam",
"accessions",
"and",
"links",
"in",
"markdown",
"dest_dir",
":",
"The",
"check",
"out",
"directory"
] | [
"\"\"\"\n Create a list of Rfam accessions and links in markdown\n\n dest_dir: The check out directory\n \"\"\"",
"# get tags"
] | [
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | create_rfam_markdown_links | null | def create_rfam_markdown_links(dest_dir):
"""
Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory
"""
fp_out = open(os.path.join(dest_dir, "family_links.md"), 'w')
families = [x for x in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, x))]
... |
Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory
| Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory | [
"Create",
"a",
"list",
"of",
"Rfam",
"accessions",
"and",
"links",
"in",
"markdown",
"dest_dir",
":",
"The",
"check",
"out",
"directory"
] | def create_rfam_markdown_links(dest_dir):
fp_out = open(os.path.join(dest_dir, "family_links.md"), 'w')
families = [x for x in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, x))]
for rfam_acc in families:
fam_dir = os.path.join(dest_dir, rfam_acc)
desc_fp = open(os.path.join(fa... | [
"def",
"create_rfam_markdown_links",
"(",
"dest_dir",
")",
":",
"fp_out",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"\"family_links.md\"",
")",
",",
"'w'",
")",
"families",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"list... | Create a list of Rfam accessions and links in markdown
dest_dir: The check out directory | [
"Create",
"a",
"list",
"of",
"Rfam",
"accessions",
"and",
"links",
"in",
"markdown",
"dest_dir",
":",
"The",
"check",
"out",
"directory"
] | [
"\"\"\"\n Create a list of Rfam accessions and links in markdown\n\n dest_dir: The check out directory\n \"\"\"",
"# get tags"
] | [
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | main | null | def main(redirects, dest_dir):
"""
This function puts all the pieces together parameters are provided through
command line
redirects: Wiki redirects output file
dest_dir: Family check out directory
"""
# create a log file
logging.basicConfig(filename=os.path.join(dest_dir, 'wk_desc_upd... |
This function puts all the pieces together parameters are provided through
command line
redirects: Wiki redirects output file
dest_dir: Family check out directory
| This function puts all the pieces together parameters are provided through
command line
Wiki redirects output file
dest_dir: Family check out directory | [
"This",
"function",
"puts",
"all",
"the",
"pieces",
"together",
"parameters",
"are",
"provided",
"through",
"command",
"line",
"Wiki",
"redirects",
"output",
"file",
"dest_dir",
":",
"Family",
"check",
"out",
"directory"
] | def main(redirects, dest_dir):
logging.basicConfig(filename=os.path.join(dest_dir, 'wk_desc_updates.log'), level=logging.ERROR)
wk_edits = wiki_redirects_parser(redirects)
for rfam_acc in wk_edits.keys():
status = checkout_family_from_svn(rfam_acc, dest_dir)
if status == 0:
famil... | [
"def",
"main",
"(",
"redirects",
",",
"dest_dir",
")",
":",
"logging",
".",
"basicConfig",
"(",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"'wk_desc_updates.log'",
")",
",",
"level",
"=",
"logging",
".",
"ERROR",
")",
"wk_edit... | This function puts all the pieces together parameters are provided through
command line | [
"This",
"function",
"puts",
"all",
"the",
"pieces",
"together",
"parameters",
"are",
"provided",
"through",
"command",
"line"
] | [
"\"\"\"\n This function puts all the pieces together parameters are provided through\n command line\n\n redirects: Wiki redirects output file\n dest_dir: Family check out directory\n \"\"\"",
"# create a log file",
"# parse wiki redirects file and changes per rfam_acc in a dictionary",
"# check... | [
{
"param": "redirects",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "redirects",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_t... |
055de6bcd154391e13ba5062f2c9d8cfaa8b817e | Rfam/rfam-production | scripts/support/update_wiki_redirects.py | [
"Apache-2.0"
] | Python | commit_family_to_svn | null | def commit_family_to_svn(dest_dir):
"""
Commits a list of families to the svn using rfci -onlydesc
dest_dir: A destination directory with all
"""
os.chdir(dest_dir)
# create a log file
logging.basicConfig(filename=os.path.join(dest_dir, 'auto_rfci_errors.log'), level=logging.DEBUG)
f... |
Commits a list of families to the svn using rfci -onlydesc
dest_dir: A destination directory with all
| Commits a list of families to the svn using rfci -onlydesc
dest_dir: A destination directory with all | [
"Commits",
"a",
"list",
"of",
"families",
"to",
"the",
"svn",
"using",
"rfci",
"-",
"onlydesc",
"dest_dir",
":",
"A",
"destination",
"directory",
"with",
"all"
] | def commit_family_to_svn(dest_dir):
os.chdir(dest_dir)
logging.basicConfig(filename=os.path.join(dest_dir, 'auto_rfci_errors.log'), level=logging.DEBUG)
family_dirs = [x for x in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, x))]
rfci_cmd = "rfci -onlydesc -m \'Wiki Updates\' %s"
for ... | [
"def",
"commit_family_to_svn",
"(",
"dest_dir",
")",
":",
"os",
".",
"chdir",
"(",
"dest_dir",
")",
"logging",
".",
"basicConfig",
"(",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"'auto_rfci_errors.log'",
")",
",",
"level",
"=",... | Commits a list of families to the svn using rfci -onlydesc
dest_dir: A destination directory with all | [
"Commits",
"a",
"list",
"of",
"families",
"to",
"the",
"svn",
"using",
"rfci",
"-",
"onlydesc",
"dest_dir",
":",
"A",
"destination",
"directory",
"with",
"all"
] | [
"\"\"\"\n Commits a list of families to the svn using rfci -onlydesc\n\n dest_dir: A destination directory with all\n \"\"\"",
"# create a log file"
] | [
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e79584f35cbe3544cc1046174c82df3d4e907fae | Rfam/rfam-production | scripts/export/fasta_gen_handler.py | [
"Apache-2.0"
] | Python | fasta_gen_handler | null | def fasta_gen_handler(seq_file, out_dir, rfam_accessions=None):
"""
The purpose of this script is to handle the fasta generation process,
generate individual shell scripts for each available family and submit
them to the cluster
seq_file: Path to the input sequence file (e.g. rfamseq11.fa)
ou... |
The purpose of this script is to handle the fasta generation process,
generate individual shell scripts for each available family and submit
them to the cluster
seq_file: Path to the input sequence file (e.g. rfamseq11.fa)
out_dir: The output directory where the fasta files will be generated
... | The purpose of this script is to handle the fasta generation process,
generate individual shell scripts for each available family and submit
them to the cluster
Path to the input sequence file
out_dir: The output directory where the fasta files will be generated | [
"The",
"purpose",
"of",
"this",
"script",
"is",
"to",
"handle",
"the",
"fasta",
"generation",
"process",
"generate",
"individual",
"shell",
"scripts",
"for",
"each",
"available",
"family",
"and",
"submit",
"them",
"to",
"the",
"cluster",
"Path",
"to",
"the",
... | def fasta_gen_handler(seq_file, out_dir, rfam_accessions=None):
families = []
if rfam_accessions is None:
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = ("SELECT rfam_acc FROM family")
cursor.execute(query)
entries = cursor.fetchall()
cursor.clo... | [
"def",
"fasta_gen_handler",
"(",
"seq_file",
",",
"out_dir",
",",
"rfam_accessions",
"=",
"None",
")",
":",
"families",
"=",
"[",
"]",
"if",
"rfam_accessions",
"is",
"None",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
... | The purpose of this script is to handle the fasta generation process,
generate individual shell scripts for each available family and submit
them to the cluster | [
"The",
"purpose",
"of",
"this",
"script",
"is",
"to",
"handle",
"the",
"fasta",
"generation",
"process",
"generate",
"individual",
"shell",
"scripts",
"for",
"each",
"available",
"family",
"and",
"submit",
"them",
"to",
"the",
"cluster"
] | [
"\"\"\"\n The purpose of this script is to handle the fasta generation process,\n generate individual shell scripts for each available family and submit\n them to the cluster\n\n seq_file: Path to the input sequence file (e.g. rfamseq11.fa)\n out_dir: The output directory where the fasta files w... | [
{
"param": "seq_file",
"type": null
},
{
"param": "out_dir",
"type": null
},
{
"param": "rfam_accessions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out_dir",
"type": null,
"docstring": null,
"docstring_tok... |
e79584f35cbe3544cc1046174c82df3d4e907fae | Rfam/rfam-production | scripts/export/fasta_gen_handler.py | [
"Apache-2.0"
] | Python | shell_script_generator | <not_specific> | def shell_script_generator(seq_file, rfam_acc, fa_outdir, out_dir=None):
"""
Generates family specific shell scripts to split fasta generation into
individual jobs
seq_file: The path to sequence file (e.g. )
rfam_acc: A valid Rfam family accession
fa_outdir: A path to where fasta files wil... |
Generates family specific shell scripts to split fasta generation into
individual jobs
seq_file: The path to sequence file (e.g. )
rfam_acc: A valid Rfam family accession
fa_outdir: A path to where fasta files will be generated
out_dir: A path to an output directory where the shell scr... | Generates family specific shell scripts to split fasta generation into
individual jobs
The path to sequence file
rfam_acc: A valid Rfam family accession
fa_outdir: A path to where fasta files will be generated
out_dir: A path to an output directory where the shell scripts will be
generated. If None, fa_outdir is... | [
"Generates",
"family",
"specific",
"shell",
"scripts",
"to",
"split",
"fasta",
"generation",
"into",
"individual",
"jobs",
"The",
"path",
"to",
"sequence",
"file",
"rfam_acc",
":",
"A",
"valid",
"Rfam",
"family",
"accession",
"fa_outdir",
":",
"A",
"path",
"to... | def shell_script_generator(seq_file, rfam_acc, fa_outdir, out_dir=None):
file_path = ''
if out_dir is None:
file_path = os.path.join(fa_outdir, rfam_acc + ".sh")
else:
file_path = os.path.join(out_dir, rfam_acc + ".sh")
log_dir = os.path.join(fa_outdir, "log")
output_fp = open(file_p... | [
"def",
"shell_script_generator",
"(",
"seq_file",
",",
"rfam_acc",
",",
"fa_outdir",
",",
"out_dir",
"=",
"None",
")",
":",
"file_path",
"=",
"''",
"if",
"out_dir",
"is",
"None",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"fa_outdir",
",... | Generates family specific shell scripts to split fasta generation into
individual jobs | [
"Generates",
"family",
"specific",
"shell",
"scripts",
"to",
"split",
"fasta",
"generation",
"into",
"individual",
"jobs"
] | [
"\"\"\"\n Generates family specific shell scripts to split fasta generation into\n individual jobs\n\n seq_file: The path to sequence file (e.g. )\n rfam_acc: A valid Rfam family accession\n fa_outdir: A path to where fasta files will be generated\n out_dir: A path to an output directory w... | [
{
"param": "seq_file",
"type": null
},
{
"param": "rfam_acc",
"type": null
},
{
"param": "fa_outdir",
"type": null
},
{
"param": "out_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rfam_acc",
"type": null,
"docstring": null,
"docstring_to... |
e79584f35cbe3544cc1046174c82df3d4e907fae | Rfam/rfam-production | scripts/export/fasta_gen_handler.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Basic argument parsing using python's argparse
return: Argparse parser object
"""
parser = argparse.ArgumentParser("Rfam fasta file generation handler")
parser.add_argument('--seq-db', help="Sequence database in fasta format",
action="store",... |
Basic argument parsing using python's argparse
return: Argparse parser object
| Basic argument parsing using python's argparse
return: Argparse parser object | [
"Basic",
"argument",
"parsing",
"using",
"python",
"'",
"s",
"argparse",
"return",
":",
"Argparse",
"parser",
"object"
] | def parse_arguments():
parser = argparse.ArgumentParser("Rfam fasta file generation handler")
parser.add_argument('--seq-db', help="Sequence database in fasta format",
action="store", default=None)
parser.add_argument('--outdir', help="Output directory", action="store")
parser.ad... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"\"Rfam fasta file generation handler\"",
")",
"parser",
".",
"add_argument",
"(",
"'--seq-db'",
",",
"help",
"=",
"\"Sequence database in fasta format\"",
",",
"action",
"... | Basic argument parsing using python's argparse
return: Argparse parser object | [
"Basic",
"argument",
"parsing",
"using",
"python",
"'",
"s",
"argparse",
"return",
":",
"Argparse",
"parser",
"object"
] | [
"\"\"\"\n Basic argument parsing using python's argparse\n\n return: Argparse parser object\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | run | null | def run(self):
"""
Main function that organises genome search directories based on
genome size
"""
# get updir location
upid_fasta = os.path.join(self.updir, self.upid + '.fa')
seq_chunks_dir = os.path.join(self.updir, "search_chunks")
if not os.path.exis... |
Main function that organises genome search directories based on
genome size
| Main function that organises genome search directories based on
genome size | [
"Main",
"function",
"that",
"organises",
"genome",
"search",
"directories",
"based",
"on",
"genome",
"size"
] | def run(self):
upid_fasta = os.path.join(self.updir, self.upid + '.fa')
seq_chunks_dir = os.path.join(self.updir, "search_chunks")
if not os.path.exists(seq_chunks_dir):
os.mkdir(seq_chunks_dir)
os.chmod(seq_chunks_dir, 0777)
if gsu.count_nucleotides_in_fasta(... | [
"def",
"run",
"(",
"self",
")",
":",
"upid_fasta",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",
"self",
".",
"upid",
"+",
"'.fa'",
")",
"seq_chunks_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",... | Main function that organises genome search directories based on
genome size | [
"Main",
"function",
"that",
"organises",
"genome",
"search",
"directories",
"based",
"on",
"genome",
"size"
] | [
"\"\"\"\n Main function that organises genome search directories based on\n genome size\n \"\"\"",
"# get updir location",
"# check if we need to split the seq_file",
"# split sequence file into smalled chunks",
"# now index the fasta files",
"# for input consistency if the sequence f... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | run | null | def run(self):
"""
Merge all fasta files in updir
"""
mf.merge_genome_files(self.updir) |
Merge all fasta files in updir
| Merge all fasta files in updir | [
"Merge",
"all",
"fasta",
"files",
"in",
"updir"
] | def run(self):
mf.merge_genome_files(self.updir) | [
"def",
"run",
"(",
"self",
")",
":",
"mf",
".",
"merge_genome_files",
"(",
"self",
".",
"updir",
")"
] | Merge all fasta files in updir | [
"Merge",
"all",
"fasta",
"files",
"in",
"updir"
] | [
"\"\"\"\n Merge all fasta files in updir\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | output | <not_specific> | def output(self):
"""
Check genome fasta file has been generated
"""
upid = os.path.split(self.updir)[1]
genome_fasta = os.path.join(self.updir, upid + '.fa')
return luigi.LocalTarget(genome_fasta) |
Check genome fasta file has been generated
| Check genome fasta file has been generated | [
"Check",
"genome",
"fasta",
"file",
"has",
"been",
"generated"
] | def output(self):
upid = os.path.split(self.updir)[1]
genome_fasta = os.path.join(self.updir, upid + '.fa')
return luigi.LocalTarget(genome_fasta) | [
"def",
"output",
"(",
"self",
")",
":",
"upid",
"=",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"updir",
")",
"[",
"1",
"]",
"genome_fasta",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",
"upid",
"+",
"'.fa'",
")",... | Check genome fasta file has been generated | [
"Check",
"genome",
"fasta",
"file",
"has",
"been",
"generated"
] | [
"\"\"\"\n Check genome fasta file has been generated\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | run | null | def run(self):
"""
Merge all tbl files in updir
"""
upid = os.path.basename(self.updir)
results_dir = os.path.join(self.updir, "search_output")
res_files = [x for x in os.listdir(results_dir) if x.endswith('.tbl')]
up_tbl = open(os.path.join(self.updir, self.upi... |
Merge all tbl files in updir
| Merge all tbl files in updir | [
"Merge",
"all",
"tbl",
"files",
"in",
"updir"
] | def run(self):
upid = os.path.basename(self.updir)
results_dir = os.path.join(self.updir, "search_output")
res_files = [x for x in os.listdir(results_dir) if x.endswith('.tbl')]
up_tbl = open(os.path.join(self.updir, self.upid +'.tbl'), 'w')
for res_file in res_files:
... | [
"def",
"run",
"(",
"self",
")",
":",
"upid",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"self",
".",
"updir",
")",
"results_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",
"\"search_output\"",
")",
"res_files",
"=",
"[... | Merge all tbl files in updir | [
"Merge",
"all",
"tbl",
"files",
"in",
"updir"
] | [
"\"\"\"\n Merge all tbl files in updir\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | output | <not_specific> | def output(self):
"""
Check genome tbl file has been generated
"""
genome_tbl = os.path.join(self.updir, self.upid + '.tbl')
return luigi.LocalTarget(genome_tbl) |
Check genome tbl file has been generated
| Check genome tbl file has been generated | [
"Check",
"genome",
"tbl",
"file",
"has",
"been",
"generated"
] | def output(self):
genome_tbl = os.path.join(self.updir, self.upid + '.tbl')
return luigi.LocalTarget(genome_tbl) | [
"def",
"output",
"(",
"self",
")",
":",
"genome_tbl",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",
"self",
".",
"upid",
"+",
"'.tbl'",
")",
"return",
"luigi",
".",
"LocalTarget",
"(",
"genome_tbl",
")"
] | Check genome tbl file has been generated | [
"Check",
"genome",
"tbl",
"file",
"has",
"been",
"generated"
] | [
"\"\"\"\n Check genome tbl file has been generated\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | run | null | def run(self):
"""
Merge all fasta files in updir
"""
up_fasta = os.path.join(self.updir, self.upid)
gsu.cleanup_illegal_lines_from_fasta(up_fasta, dest_dir=self.updir) |
Merge all fasta files in updir
| Merge all fasta files in updir | [
"Merge",
"all",
"fasta",
"files",
"in",
"updir"
] | def run(self):
up_fasta = os.path.join(self.updir, self.upid)
gsu.cleanup_illegal_lines_from_fasta(up_fasta, dest_dir=self.updir) | [
"def",
"run",
"(",
"self",
")",
":",
"up_fasta",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",
"self",
".",
"upid",
")",
"gsu",
".",
"cleanup_illegal_lines_from_fasta",
"(",
"up_fasta",
",",
"dest_dir",
"=",
"self",
".",
"updir",... | Merge all fasta files in updir | [
"Merge",
"all",
"fasta",
"files",
"in",
"updir"
] | [
"\"\"\"\n Merge all fasta files in updir\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | output | <not_specific> | def output(self):
"""
Check that a clean fasta file has been generated
"""
upid = os.path.split(self.updir)[1]
clean_fasta = os.path.join(self.updir, upid + '_cleaned.fa')
return luigi.LocalTarget(clean_fasta) |
Check that a clean fasta file has been generated
| Check that a clean fasta file has been generated | [
"Check",
"that",
"a",
"clean",
"fasta",
"file",
"has",
"been",
"generated"
] | def output(self):
upid = os.path.split(self.updir)[1]
clean_fasta = os.path.join(self.updir, upid + '_cleaned.fa')
return luigi.LocalTarget(clean_fasta) | [
"def",
"output",
"(",
"self",
")",
":",
"upid",
"=",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"updir",
")",
"[",
"1",
"]",
"clean_fasta",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"updir",
",",
"upid",
"+",
"'_cleaned.fa'",... | Check that a clean fasta file has been generated | [
"Check",
"that",
"a",
"clean",
"fasta",
"file",
"has",
"been",
"generated"
] | [
"\"\"\"\n Check that a clean fasta file has been generated\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bd9e8567b2ee0b433b6b0fe0c7cab8a5a270ab | Rfam/rfam-production | pipelines/genome_search_utils.py | [
"Apache-2.0"
] | Python | run | null | def run(self):
"""
Call load_upid_gca_file to export all upid_gca accession pairs in
json format.
"""
id_pairs = None
upids = []
if self.genome_list is None:
upid_gca_file_loc = os.path.join(self.project_dir, "upid_gca_dict.json")
upid_gca... |
Call load_upid_gca_file to export all upid_gca accession pairs in
json format.
| Call load_upid_gca_file to export all upid_gca accession pairs in
json format. | [
"Call",
"load_upid_gca_file",
"to",
"export",
"all",
"upid_gca",
"accession",
"pairs",
"in",
"json",
"format",
"."
] | def run(self):
id_pairs = None
upids = []
if self.genome_list is None:
upid_gca_file_loc = os.path.join(self.project_dir, "upid_gca_dict.json")
upid_gca_fp = open(upid_gca_file_loc, 'r')
accessions = json.load(upid_gca_fp)
upid_gca_fp.close()
... | [
"def",
"run",
"(",
"self",
")",
":",
"id_pairs",
"=",
"None",
"upids",
"=",
"[",
"]",
"if",
"self",
".",
"genome_list",
"is",
"None",
":",
"upid_gca_file_loc",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"project_dir",
",",
"\"upid_gca_dict.... | Call load_upid_gca_file to export all upid_gca accession pairs in
json format. | [
"Call",
"load_upid_gca_file",
"to",
"export",
"all",
"upid_gca",
"accession",
"pairs",
"in",
"json",
"format",
"."
] | [
"\"\"\"\n Call load_upid_gca_file to export all upid_gca accession pairs in\n json format.\n \"\"\"",
"# Merge Genomes"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46bf849a547642296689d51d0912988f6b8eb32d | Rfam/rfam-production | utils/RfamDB.py | [
"Apache-2.0"
] | Python | connect | <not_specific> | def connect(db_config=None):
"""
Connects to a specific database and returns a mysql connection object.
:param db_config: database config values
:type db_config: dict
:return: db connection
"""
db_config = db_conf if db_config is None else db_config
cnx = None
try:
cnx = mysq... |
Connects to a specific database and returns a mysql connection object.
:param db_config: database config values
:type db_config: dict
:return: db connection
| Connects to a specific database and returns a mysql connection object. | [
"Connects",
"to",
"a",
"specific",
"database",
"and",
"returns",
"a",
"mysql",
"connection",
"object",
"."
] | def connect(db_config=None):
db_config = db_conf if db_config is None else db_config
cnx = None
try:
cnx = mysql.connector.connect(user=db_config["user"],
password=db_config["pwd"],
host=db_config["host"],
... | [
"def",
"connect",
"(",
"db_config",
"=",
"None",
")",
":",
"db_config",
"=",
"db_conf",
"if",
"db_config",
"is",
"None",
"else",
"db_config",
"cnx",
"=",
"None",
"try",
":",
"cnx",
"=",
"mysql",
".",
"connector",
".",
"connect",
"(",
"user",
"=",
"db_c... | Connects to a specific database and returns a mysql connection object. | [
"Connects",
"to",
"a",
"specific",
"database",
"and",
"returns",
"a",
"mysql",
"connection",
"object",
"."
] | [
"\"\"\"\n Connects to a specific database and returns a mysql connection object.\n :param db_config: database config values\n :type db_config: dict\n :return: db connection\n \"\"\""
] | [
{
"param": "db_config",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "db_config",
"type": null,
"docstring": "database config values",
"docstring_tokens": [
"database",
... |
46bf849a547642296689d51d0912988f6b8eb32d | Rfam/rfam-production | utils/RfamDB.py | [
"Apache-2.0"
] | Python | disconnect | null | def disconnect(cnx):
"""
Closes a database connection
cnx: MySQL connection object
"""
try:
cnx.close()
except Exception as e:
print("Error closing database connection: {0}".format(e))
logging.debug("Error closing database connection: {0}".format(e)) |
Closes a database connection
cnx: MySQL connection object
| Closes a database connection
cnx: MySQL connection object | [
"Closes",
"a",
"database",
"connection",
"cnx",
":",
"MySQL",
"connection",
"object"
] | def disconnect(cnx):
try:
cnx.close()
except Exception as e:
print("Error closing database connection: {0}".format(e))
logging.debug("Error closing database connection: {0}".format(e)) | [
"def",
"disconnect",
"(",
"cnx",
")",
":",
"try",
":",
"cnx",
".",
"close",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"\"Error closing database connection: {0}\"",
".",
"format",
"(",
"e",
")",
")",
"logging",
".",
"debug",
"(",
"\"E... | Closes a database connection
cnx: MySQL connection object | [
"Closes",
"a",
"database",
"connection",
"cnx",
":",
"MySQL",
"connection",
"object"
] | [
"\"\"\"\n Closes a database connection\n\n cnx: MySQL connection object\n \"\"\""
] | [
{
"param": "cnx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cnx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | load_clan_seqs_from_db | <not_specific> | def load_clan_seqs_from_db(clan_acc): # tested
"""
Loads specific clan family sequences from full_region table and returns
a dictionary structure as {Rfam_acc:{Rfseq_acc:[start, end, evalue]}}
for clan competition.
This has been modified to accommodate sequence duplicates
clan_acc: Clan acces... |
Loads specific clan family sequences from full_region table and returns
a dictionary structure as {Rfam_acc:{Rfseq_acc:[start, end, evalue]}}
for clan competition.
This has been modified to accommodate sequence duplicates
clan_acc: Clan accession as in Rfam
| Loads specific clan family sequences from full_region table and returns
a dictionary structure as {Rfam_acc:{Rfseq_acc:[start, end, evalue]}}
for clan competition.
This has been modified to accommodate sequence duplicates
Clan accession as in Rfam | [
"Loads",
"specific",
"clan",
"family",
"sequences",
"from",
"full_region",
"table",
"and",
"returns",
"a",
"dictionary",
"structure",
"as",
"{",
"Rfam_acc",
":",
"{",
"Rfseq_acc",
":",
"[",
"start",
"end",
"evalue",
"]",
"}}",
"for",
"clan",
"competition",
"... | def load_clan_seqs_from_db(clan_acc):
fam_seqs = {}
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
query = ("SELECT full_region.rfam_acc, full_region.rfamseq_acc, \
full_region.seq_start, full_region.seq_end, full_region.evalue_score\n"
"FROM full_region\n"
"JOIN (SELECT rfam_a... | [
"def",
"load_clan_seqs_from_db",
"(",
"clan_acc",
")",
":",
"fam_seqs",
"=",
"{",
"}",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"raw",
"=",
"True",
")",
"query",
"=",
"(",
"\"SELECT full_region.rfam_acc, ful... | Loads specific clan family sequences from full_region table and returns
a dictionary structure as {Rfam_acc:{Rfseq_acc:[start, end, evalue]}}
for clan competition. | [
"Loads",
"specific",
"clan",
"family",
"sequences",
"from",
"full_region",
"table",
"and",
"returns",
"a",
"dictionary",
"structure",
"as",
"{",
"Rfam_acc",
":",
"{",
"Rfseq_acc",
":",
"[",
"start",
"end",
"evalue",
"]",
"}}",
"for",
"clan",
"competition",
"... | [
"# tested",
"\"\"\"\n Loads specific clan family sequences from full_region table and returns\n a dictionary structure as {Rfam_acc:{Rfseq_acc:[start, end, evalue]}}\n for clan competition.\n\n This has been modified to accommodate sequence duplicates\n\n clan_acc: Clan accession as in Rfam\n \"... | [
{
"param": "clan_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clan_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | load_clan_members_from_db | <not_specific> | def load_clan_members_from_db(clan_acc):
"""
Retrieves all clan family members from DB and returns a list of the family
accessions.
clan_acc: Clan accession as in Rfam
"""
clan_members = []
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
query = ("SELECT rfam_acc FROM clan_m... |
Retrieves all clan family members from DB and returns a list of the family
accessions.
clan_acc: Clan accession as in Rfam
| Retrieves all clan family members from DB and returns a list of the family
accessions.
Clan accession as in Rfam | [
"Retrieves",
"all",
"clan",
"family",
"members",
"from",
"DB",
"and",
"returns",
"a",
"list",
"of",
"the",
"family",
"accessions",
".",
"Clan",
"accession",
"as",
"in",
"Rfam"
] | def load_clan_members_from_db(clan_acc):
clan_members = []
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
query = ("SELECT rfam_acc FROM clan_membership "
"WHERE clan_acc=\'%s\'") % (clan_acc)
cursor.execute(query)
rows = cursor.fetchall()
cursor.close()
RfamDB.disconnect(cn... | [
"def",
"load_clan_members_from_db",
"(",
"clan_acc",
")",
":",
"clan_members",
"=",
"[",
"]",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"raw",
"=",
"True",
")",
"query",
"=",
"(",
"\"SELECT rfam_acc FROM clan... | Retrieves all clan family members from DB and returns a list of the family
accessions. | [
"Retrieves",
"all",
"clan",
"family",
"members",
"from",
"DB",
"and",
"returns",
"a",
"list",
"of",
"the",
"family",
"accessions",
"."
] | [
"\"\"\"\n Retrieves all clan family members from DB and returns a list of the family\n accessions.\n\n clan_acc: Clan accession as in Rfam\n \"\"\""
] | [
{
"param": "clan_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clan_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | reset_is_significant | null | def reset_is_significant(clan_comp_type='FULL'):
"""
This function resets full_region's is_singificant field's back to 1.
This should be able to update all or part of the table for clan
competition initialization and restoration.
"""
seq_regs = []
cnx = RfamDB.connect()
# cursor to fet... |
This function resets full_region's is_singificant field's back to 1.
This should be able to update all or part of the table for clan
competition initialization and restoration.
| This function resets full_region's is_singificant field's back to 1.
This should be able to update all or part of the table for clan
competition initialization and restoration. | [
"This",
"function",
"resets",
"full_region",
"'",
"s",
"is_singificant",
"field",
"'",
"s",
"back",
"to",
"1",
".",
"This",
"should",
"be",
"able",
"to",
"update",
"all",
"or",
"part",
"of",
"the",
"table",
"for",
"clan",
"competition",
"initialization",
"... | def reset_is_significant(clan_comp_type='FULL'):
seq_regs = []
cnx = RfamDB.connect()
d_cursor = cnx.cursor(buffered=True)
if clan_comp_type.upper() == 'FULL':
select_query = ("SELECT rfam_acc, rfamseq_acc, seq_start FROM full_region "
"WHERE is_significant=0")
up... | [
"def",
"reset_is_significant",
"(",
"clan_comp_type",
"=",
"'FULL'",
")",
":",
"seq_regs",
"=",
"[",
"]",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"d_cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"if",
"clan_comp_type",
".... | This function resets full_region's is_singificant field's back to 1. | [
"This",
"function",
"resets",
"full_region",
"'",
"s",
"is_singificant",
"field",
"'",
"s",
"back",
"to",
"1",
"."
] | [
"\"\"\"\n This function resets full_region's is_singificant field's back to 1.\n This should be able to update all or part of the table for clan\n competition initialization and restoration.\n \"\"\"",
"# cursor to fetch data",
"# query to fetch all non significant sequences",
"# query to update 0... | [
{
"param": "clan_comp_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clan_comp_type",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | update_post_process | null | def update_post_process(jobs_file):
"""
Updates _post_process table with the job_ids per family assigned by lsf
jobs_file: This is a tab separated txt file generated from running the
job_dequeuer.py script that submits the rfam_view_process for each
family.
(rfam_acc uuid job_id ...)
"""
... |
Updates _post_process table with the job_ids per family assigned by lsf
jobs_file: This is a tab separated txt file generated from running the
job_dequeuer.py script that submits the rfam_view_process for each
family.
(rfam_acc uuid job_id ...)
| Updates _post_process table with the job_ids per family assigned by lsf
jobs_file: This is a tab separated txt file generated from running the
job_dequeuer.py script that submits the rfam_view_process for each
family. | [
"Updates",
"_post_process",
"table",
"with",
"the",
"job_ids",
"per",
"family",
"assigned",
"by",
"lsf",
"jobs_file",
":",
"This",
"is",
"a",
"tab",
"separated",
"txt",
"file",
"generated",
"from",
"running",
"the",
"job_dequeuer",
".",
"py",
"script",
"that",... | def update_post_process(jobs_file):
job_ids = []
jobs_file_fp = open(jobs_file, 'r')
query = ("UPDATE _post_process SET lsf_id=%s "
"WHERE rfam_acc=%s AND uuid=%s")
for line in jobs_file_fp:
line = line.strip()
line = string.split(line, '\t')
job_ids.append((line[2], line[0], li... | [
"def",
"update_post_process",
"(",
"jobs_file",
")",
":",
"job_ids",
"=",
"[",
"]",
"jobs_file_fp",
"=",
"open",
"(",
"jobs_file",
",",
"'r'",
")",
"query",
"=",
"(",
"\"UPDATE _post_process SET lsf_id=%s \"",
"\"WHERE rfam_acc=%s AND uuid=%s\"",
")",
"for",
"line",... | Updates _post_process table with the job_ids per family assigned by lsf
jobs_file: This is a tab separated txt file generated from running the
job_dequeuer.py script that submits the rfam_view_process for each
family. | [
"Updates",
"_post_process",
"table",
"with",
"the",
"job_ids",
"per",
"family",
"assigned",
"by",
"lsf",
"jobs_file",
":",
"This",
"is",
"a",
"tab",
"separated",
"txt",
"file",
"generated",
"from",
"running",
"the",
"job_dequeuer",
".",
"py",
"script",
"that",... | [
"\"\"\"\n Updates _post_process table with the job_ids per family assigned by lsf\n\n jobs_file: This is a tab separated txt file generated from running the\n job_dequeuer.py script that submits the rfam_view_process for each\n family.\n (rfam_acc uuid job_id ...)\n \"\"\"",
"# get lsf ids from ... | [
{
"param": "jobs_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "jobs_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | update_family_ncbi | null | def update_family_ncbi():
"""
Updates table family_ncbi by adding all distinct taxonomic ids per family.
:return: void
"""
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
c_cursor = cnx.cursor(buffered=True)
cursor.execute("select rfam_acc from family")
rfam_accs = curs... |
Updates table family_ncbi by adding all distinct taxonomic ids per family.
:return: void
| Updates table family_ncbi by adding all distinct taxonomic ids per family. | [
"Updates",
"table",
"family_ncbi",
"by",
"adding",
"all",
"distinct",
"taxonomic",
"ids",
"per",
"family",
"."
] | def update_family_ncbi():
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
c_cursor = cnx.cursor(buffered=True)
cursor.execute("select rfam_acc from family")
rfam_accs = cursor.fetchall()
cursor.close()
get_ncbi_ids = ("select distinct rs.ncbi_id, f.rfam_id, "
"f... | [
"def",
"update_family_ncbi",
"(",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"c_cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"cursor",
".... | Updates table family_ncbi by adding all distinct taxonomic ids per family. | [
"Updates",
"table",
"family_ncbi",
"by",
"adding",
"all",
"distinct",
"taxonomic",
"ids",
"per",
"family",
"."
] | [
"\"\"\"\n Updates table family_ncbi by adding all distinct taxonomic ids per family.\n\n :return: void\n \"\"\"",
"# family_ncbi query"
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_clanin_data | <not_specific> | def fetch_clanin_data():
"""
Fetches all rfam_ids per clan. To be used for clanin file generation
:return: void
"""
clan_members = {}
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
cursor.execute("select cm.clan_acc, f.rfam_id from clan_membership cm, family f "
"wh... |
Fetches all rfam_ids per clan. To be used for clanin file generation
:return: void
| Fetches all rfam_ids per clan. To be used for clanin file generation | [
"Fetches",
"all",
"rfam_ids",
"per",
"clan",
".",
"To",
"be",
"used",
"for",
"clanin",
"file",
"generation"
] | def fetch_clanin_data():
clan_members = {}
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
cursor.execute("select cm.clan_acc, f.rfam_id from clan_membership cm, family f "
"where f.rfam_acc=cm.rfam_acc "
"order by cm.clan_acc")
clan_pairs = cursor.fetchall()
cursor.close... | [
"def",
"fetch_clanin_data",
"(",
")",
":",
"clan_members",
"=",
"{",
"}",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"cursor",
".",
"execute",
"(",
"\"select cm.clan_acc, f.rfam_i... | Fetches all rfam_ids per clan. | [
"Fetches",
"all",
"rfam_ids",
"per",
"clan",
"."
] | [
"\"\"\"\n Fetches all rfam_ids per clan. To be used for clanin file generation\n\n :return: void\n \"\"\"",
"# build clan membership dictionary"
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_clan_accessions | <not_specific> | def fetch_clan_accessions():
"""
Fetches all clan accessions from the database and returns then in the
form of a list
returns: A list of all clan accessions
"""
cnx = RfamDB.connect()
clan_cursor = cnx.cursor(buffered=True)
clan_query = "SELECT clan_acc FROM clan"
# fetch clans
... |
Fetches all clan accessions from the database and returns then in the
form of a list
returns: A list of all clan accessions
| Fetches all clan accessions from the database and returns then in the
form of a list
A list of all clan accessions | [
"Fetches",
"all",
"clan",
"accessions",
"from",
"the",
"database",
"and",
"returns",
"then",
"in",
"the",
"form",
"of",
"a",
"list",
"A",
"list",
"of",
"all",
"clan",
"accessions"
] | def fetch_clan_accessions():
cnx = RfamDB.connect()
clan_cursor = cnx.cursor(buffered=True)
clan_query = "SELECT clan_acc FROM clan"
clan_cursor.execute(clan_query)
clans = [str(x[0]) for x in clan_cursor.fetchall()]
clan_cursor.close()
RfamDB.disconnect(cnx)
return clans | [
"def",
"fetch_clan_accessions",
"(",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"clan_cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"clan_query",
"=",
"\"SELECT clan_acc FROM clan\"",
"clan_cursor",
".",
"execute",
"(",
... | Fetches all clan accessions from the database and returns then in the
form of a list | [
"Fetches",
"all",
"clan",
"accessions",
"from",
"the",
"database",
"and",
"returns",
"then",
"in",
"the",
"form",
"of",
"a",
"list"
] | [
"\"\"\"\n Fetches all clan accessions from the database and returns then in the\n form of a list\n\n returns: A list of all clan accessions\n \"\"\"",
"# fetch clans"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_clan_full_region_records | <not_specific> | def fetch_clan_full_region_records(clan_acc):
"""
Fetches all regions per clan
param clan_acc: A valid Rfam clan accession
returns: A list with all regions from full_region table for a specific clan
"""
cnx = RfamDB.connect()
clan_cursor = cnx.cursor(buffered=True)
clan_region_query... |
Fetches all regions per clan
param clan_acc: A valid Rfam clan accession
returns: A list with all regions from full_region table for a specific clan
| Fetches all regions per clan
param clan_acc: A valid Rfam clan accession
A list with all regions from full_region table for a specific clan | [
"Fetches",
"all",
"regions",
"per",
"clan",
"param",
"clan_acc",
":",
"A",
"valid",
"Rfam",
"clan",
"accession",
"A",
"list",
"with",
"all",
"regions",
"from",
"full_region",
"table",
"for",
"a",
"specific",
"clan"
] | def fetch_clan_full_region_records(clan_acc):
cnx = RfamDB.connect()
clan_cursor = cnx.cursor(buffered=True)
clan_region_query = ("SELECT * FROM full_region\n"
"JOIN (SELECT rfam_acc FROM clan_membership WHERE clan_acc=\'%s\') as CLAN_FAMS\n"
"ON CLAN_FAMS.rfam_acc=full_regio... | [
"def",
"fetch_clan_full_region_records",
"(",
"clan_acc",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"clan_cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"clan_region_query",
"=",
"(",
"\"SELECT * FROM full_region\\n\"",
"\... | Fetches all regions per clan
param clan_acc: A valid Rfam clan accession | [
"Fetches",
"all",
"regions",
"per",
"clan",
"param",
"clan_acc",
":",
"A",
"valid",
"Rfam",
"clan",
"accession"
] | [
"\"\"\"\n Fetches all regions per clan\n\n param clan_acc: A valid Rfam clan accession\n\n returns: A list with all regions from full_region table for a specific clan\n \"\"\"",
"# % (clan_acc)"
] | [
{
"param": "clan_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clan_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_clan_pdb_full_region_records | <not_specific> | def fetch_clan_pdb_full_region_records(clan_acc):
"""
Fetches all regions per clan
param clan_acc: A valid Rfam clan accession
returns: A list with all pdb regions per clan
"""
cnx = RfamDB.connect()
clan_cursor = cnx.cursor(buffered=True)
clan_pdb_region_query = ("select pfr.rfam_ac... |
Fetches all regions per clan
param clan_acc: A valid Rfam clan accession
returns: A list with all pdb regions per clan
| Fetches all regions per clan
param clan_acc: A valid Rfam clan accession
A list with all pdb regions per clan | [
"Fetches",
"all",
"regions",
"per",
"clan",
"param",
"clan_acc",
":",
"A",
"valid",
"Rfam",
"clan",
"accession",
"A",
"list",
"with",
"all",
"pdb",
"regions",
"per",
"clan"
] | def fetch_clan_pdb_full_region_records(clan_acc):
cnx = RfamDB.connect()
clan_cursor = cnx.cursor(buffered=True)
clan_pdb_region_query = ("select pfr.rfam_acc, concat(pfr.pdb_id,'_',pfr.chain) as seq_acc, "
"pfr.pdb_start, pfr.pdb_end, pfr.bit_score, pfr.evalue_score "
"from pdb_full_region pf... | [
"def",
"fetch_clan_pdb_full_region_records",
"(",
"clan_acc",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"clan_cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"clan_pdb_region_query",
"=",
"(",
"\"select pfr.rfam_acc, concat(p... | Fetches all regions per clan
param clan_acc: A valid Rfam clan accession | [
"Fetches",
"all",
"regions",
"per",
"clan",
"param",
"clan_acc",
":",
"A",
"valid",
"Rfam",
"clan",
"accession"
] | [
"\"\"\"\n Fetches all regions per clan\n\n param clan_acc: A valid Rfam clan accession\n\n returns: A list with all pdb regions per clan\n \"\"\""
] | [
{
"param": "clan_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clan_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_rfam_accs_sorted | <not_specific> | def fetch_rfam_accs_sorted(order='DESC'):
"""
Fetch all available Rfam accs and sort by specified order. DESC by default
order: The order in which to sort the records (ASC, DESC)
returns: void
"""
# connect to db
cnx = RfamDB.connect()
# get a new buffered cursor
cursor = cnx.curs... |
Fetch all available Rfam accs and sort by specified order. DESC by default
order: The order in which to sort the records (ASC, DESC)
returns: void
| Fetch all available Rfam accs and sort by specified order. DESC by default
order: The order in which to sort the records (ASC, DESC)
returns: void | [
"Fetch",
"all",
"available",
"Rfam",
"accs",
"and",
"sort",
"by",
"specified",
"order",
".",
"DESC",
"by",
"default",
"order",
":",
"The",
"order",
"in",
"which",
"to",
"sort",
"the",
"records",
"(",
"ASC",
"DESC",
")",
"returns",
":",
"void"
] | def fetch_rfam_accs_sorted(order='DESC'):
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = ("select rfam_acc from seed_region\n"
"group by rfam_acc\n"
"order by count(*) %s" % order)
cursor.execute(query)
rfam_accs = [str(x[0]) for x in cursor.fetchall()]
cursor.cl... | [
"def",
"fetch_rfam_accs_sorted",
"(",
"order",
"=",
"'DESC'",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"query",
"=",
"(",
"\"select rfam_acc from seed_region\\n\"",
"\"g... | Fetch all available Rfam accs and sort by specified order. | [
"Fetch",
"all",
"available",
"Rfam",
"accs",
"and",
"sort",
"by",
"specified",
"order",
"."
] | [
"\"\"\"\n Fetch all available Rfam accs and sort by specified order. DESC by default\n\n order: The order in which to sort the records (ASC, DESC)\n returns: void\n \"\"\"",
"# connect to db",
"# get a new buffered cursor",
"# update is_significant field to 0"
] | [
{
"param": "order",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "order",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_all_upids | <not_specific> | def fetch_all_upids():
"""
Fetch all available genome accessions from genome table
return: A list of UP/RG ids as stored in genome
"""
# connect to db
cnx = RfamDB.connect()
# get a new buffered cursor
cursor = cnx.cursor(buffered=True)
# update is_significant field to 0
quer... |
Fetch all available genome accessions from genome table
return: A list of UP/RG ids as stored in genome
| Fetch all available genome accessions from genome table
return: A list of UP/RG ids as stored in genome | [
"Fetch",
"all",
"available",
"genome",
"accessions",
"from",
"genome",
"table",
"return",
":",
"A",
"list",
"of",
"UP",
"/",
"RG",
"ids",
"as",
"stored",
"in",
"genome"
] | def fetch_all_upids():
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = "select upid from genome"
cursor.execute(query)
genome_accs = [str(x[0]) for x in cursor.fetchall()]
cursor.close()
RfamDB.disconnect(cnx)
return genome_accs | [
"def",
"fetch_all_upids",
"(",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"query",
"=",
"\"select upid from genome\"",
"cursor",
".",
"execute",
"(",
"query",
")",
"ge... | Fetch all available genome accessions from genome table
return: A list of UP/RG ids as stored in genome | [
"Fetch",
"all",
"available",
"genome",
"accessions",
"from",
"genome",
"table",
"return",
":",
"A",
"list",
"of",
"UP",
"/",
"RG",
"ids",
"as",
"stored",
"in",
"genome"
] | [
"\"\"\"\n Fetch all available genome accessions from genome table\n\n return: A list of UP/RG ids as stored in genome\n \"\"\"",
"# connect to db",
"# get a new buffered cursor",
"# update is_significant field to 0"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_author_orcid | <not_specific> | def fetch_author_orcid(author_name):
"""
Searches for author by name and
:param author_name:
:return:
"""
orcid = None
cnx = RfamDB.connect()
# Get a new buffered cursor
cursor = cnx.cursor(buffered=True)
query = """
Select orcid from author
where name like '%s%s%s' or... |
Searches for author by name and
:param author_name:
:return:
| Searches for author by name and | [
"Searches",
"for",
"author",
"by",
"name",
"and"
] | def fetch_author_orcid(author_name):
orcid = None
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = """
Select orcid from author
where name like '%s%s%s' or synonyms like '%s%s%s'
"""
cursor.execute(query % (chr(37), author_name, chr(37),
chr(37), author_name, chr(3... | [
"def",
"fetch_author_orcid",
"(",
"author_name",
")",
":",
"orcid",
"=",
"None",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"query",
"=",
"\"\"\"\n Select orcid from author\n wh... | Searches for author by name and | [
"Searches",
"for",
"author",
"by",
"name",
"and"
] | [
"\"\"\"\n Searches for author by name and\n :param author_name:\n :return:\n \"\"\"",
"# Get a new buffered cursor",
"# This will return none if there's no ORCiD available"
] | [
{
"param": "author_name",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "author_name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,... |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | update_assembly_names | null | def update_assembly_names(upid_gca_file):
"""
Loads the upid_gca json files and parses the corresponding assembly xml files
from ENA to fetch the assembly names and update the fields in genome table
param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }
return: void
"""
... |
Loads the upid_gca json files and parses the corresponding assembly xml files
from ENA to fetch the assembly names and update the fields in genome table
param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }
return: void
| Loads the upid_gca json files and parses the corresponding assembly xml files
from ENA to fetch the assembly names and update the fields in genome table
param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }
void | [
"Loads",
"the",
"upid_gca",
"json",
"files",
"and",
"parses",
"the",
"corresponding",
"assembly",
"xml",
"files",
"from",
"ENA",
"to",
"fetch",
"the",
"assembly",
"names",
"and",
"update",
"the",
"fields",
"in",
"genome",
"table",
"param",
"upid_gca_file",
":"... | def update_assembly_names(upid_gca_file):
fp = open(upid_gca_file, 'r')
acc_pairs = json.load(fp)
fp.close()
assembly_names = []
for upid in acc_pairs.keys():
data = fgm.fetch_gca_data(upid, acc_pairs[upid]["GCA"], acc_pairs[upid]["DOM"])
if "fields" in data:
if data["fie... | [
"def",
"update_assembly_names",
"(",
"upid_gca_file",
")",
":",
"fp",
"=",
"open",
"(",
"upid_gca_file",
",",
"'r'",
")",
"acc_pairs",
"=",
"json",
".",
"load",
"(",
"fp",
")",
"fp",
".",
"close",
"(",
")",
"assembly_names",
"=",
"[",
"]",
"for",
"upid... | Loads the upid_gca json files and parses the corresponding assembly xml files
from ENA to fetch the assembly names and update the fields in genome table | [
"Loads",
"the",
"upid_gca",
"json",
"files",
"and",
"parses",
"the",
"corresponding",
"assembly",
"xml",
"files",
"from",
"ENA",
"to",
"fetch",
"the",
"assembly",
"names",
"and",
"update",
"the",
"fields",
"in",
"genome",
"table"
] | [
"\"\"\"\n Loads the upid_gca json files and parses the corresponding assembly xml files\n from ENA to fetch the assembly names and update the fields in genome table\n\n param upid_gca_file: A json file with upid: {\"GCA\" : GCAxxx, \"DOM\": domain }\n\n return: void\n \"\"\"",
"# a list of tuples t... | [
{
"param": "upid_gca_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "upid_gca_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_metagenomic_regions | <not_specific> | def fetch_metagenomic_regions():
"""
Fetches all seed_region entries
return: A list of tuples with all seed_region entries
"""
# connect to db
cnx = RfamDB.connect()
# get a new buffered cursor
cursor = cnx.cursor(buffered=True)
# update is_significant field to 0
query = ("Se... |
Fetches all seed_region entries
return: A list of tuples with all seed_region entries
| Fetches all seed_region entries
return: A list of tuples with all seed_region entries | [
"Fetches",
"all",
"seed_region",
"entries",
"return",
":",
"A",
"list",
"of",
"tuples",
"with",
"all",
"seed_region",
"entries"
] | def fetch_metagenomic_regions():
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = ("Select rfam_acc, umgseq_acc, seq_start, seq_end "
"from meta_full_region")
cursor.execute(query)
region_rows = cursor.fetchall()
cursor.close()
RfamDB.disconnect(cnx)
return ... | [
"def",
"fetch_metagenomic_regions",
"(",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"query",
"=",
"(",
"\"Select rfam_acc, umgseq_acc, seq_start, seq_end \"",
"\"from meta_full_... | Fetches all seed_region entries
return: A list of tuples with all seed_region entries | [
"Fetches",
"all",
"seed_region",
"entries",
"return",
":",
"A",
"list",
"of",
"tuples",
"with",
"all",
"seed_region",
"entries"
] | [
"\"\"\"\n Fetches all seed_region entries\n\n return: A list of tuples with all seed_region entries\n \"\"\"",
"# connect to db",
"# get a new buffered cursor",
"# update is_significant field to 0"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_type_specific_rfam_accessions | <not_specific> | def fetch_type_specific_rfam_accessions(rna_type, return_type = "list"):
"""
Fetches all Rfam family accessions from the database matching the
rna_type parameter
rna_type: A string specifying a valid type of ncRNAs to extract
from the database
return_type: The python type the data will be retur... |
Fetches all Rfam family accessions from the database matching the
rna_type parameter
rna_type: A string specifying a valid type of ncRNAs to extract
from the database
return_type: The python type the data will be return
| Fetches all Rfam family accessions from the database matching the
rna_type parameter
A string specifying a valid type of ncRNAs to extract
from the database
return_type: The python type the data will be return | [
"Fetches",
"all",
"Rfam",
"family",
"accessions",
"from",
"the",
"database",
"matching",
"the",
"rna_type",
"parameter",
"A",
"string",
"specifying",
"a",
"valid",
"type",
"of",
"ncRNAs",
"to",
"extract",
"from",
"the",
"database",
"return_type",
":",
"The",
"... | def fetch_type_specific_rfam_accessions(rna_type, return_type = "list"):
query = """
select rfam_acc from family
where type like '%s%s%s'
"""
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
cursor.execute(query % (chr(37), rna_type, chr(37)))
rfam_accs = {}
if return_type =... | [
"def",
"fetch_type_specific_rfam_accessions",
"(",
"rna_type",
",",
"return_type",
"=",
"\"list\"",
")",
":",
"query",
"=",
"\"\"\"\n select rfam_acc from family\n where type like '%s%s%s'\n \"\"\"",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
... | Fetches all Rfam family accessions from the database matching the
rna_type parameter | [
"Fetches",
"all",
"Rfam",
"family",
"accessions",
"from",
"the",
"database",
"matching",
"the",
"rna_type",
"parameter"
] | [
"\"\"\"\n Fetches all Rfam family accessions from the database matching the\n rna_type parameter\n\n rna_type: A string specifying a valid type of ncRNAs to extract\n from the database\n return_type: The python type the data will be return\n \"\"\"",
"# process accessions"
] | [
{
"param": "rna_type",
"type": null
},
{
"param": "return_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rna_type",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "return_type",
"type": null,
"docstring": null,
"docstring... |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_taxonomy_fields | <not_specific> | def fetch_taxonomy_fields(tax_id):
"""
Fetches all fields from RfamLive taxonomy table based on
the tax id provided
tax_id: A valid tax id
return: A dictionary with all taxonomy fields
"""
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
query = "Select * from taxonomy... |
Fetches all fields from RfamLive taxonomy table based on
the tax id provided
tax_id: A valid tax id
return: A dictionary with all taxonomy fields
| Fetches all fields from RfamLive taxonomy table based on
the tax id provided
A valid tax id
A dictionary with all taxonomy fields | [
"Fetches",
"all",
"fields",
"from",
"RfamLive",
"taxonomy",
"table",
"based",
"on",
"the",
"tax",
"id",
"provided",
"A",
"valid",
"tax",
"id",
"A",
"dictionary",
"with",
"all",
"taxonomy",
"fields"
] | def fetch_taxonomy_fields(tax_id):
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
query = "Select * from taxonomy where ncbi_id=%s"
cursor.execute(query % tax_id)
fields = cursor.fetchall()[0]
return fields | [
"def",
"fetch_taxonomy_fields",
"(",
"tax_id",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"dictionary",
"=",
"True",
")",
"query",
"=",
"\"Select * from taxonomy where ncbi_id=%s\"",
"cursor",
".",
"exec... | Fetches all fields from RfamLive taxonomy table based on
the tax id provided | [
"Fetches",
"all",
"fields",
"from",
"RfamLive",
"taxonomy",
"table",
"based",
"on",
"the",
"tax",
"id",
"provided"
] | [
"\"\"\"\n Fetches all fields from RfamLive taxonomy table based on\n the tax id provided\n\n tax_id: A valid tax id\n\n return: A dictionary with all taxonomy fields\n \"\"\""
] | [
{
"param": "tax_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tax_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_max_RG_accession_from_genome | <not_specific> | def fetch_max_RG_accession_from_genome():
"""
Fetches the maximum RFXXXXXXXXX accession from the RfamLive
genome table. To be used for assigning accessions to genomes
not found in Uniprot proteomes.
return: Returns the maximum RGXXXXXXXXX id found in the genome
table
"""
cnx = RfamDB.c... |
Fetches the maximum RFXXXXXXXXX accession from the RfamLive
genome table. To be used for assigning accessions to genomes
not found in Uniprot proteomes.
return: Returns the maximum RGXXXXXXXXX id found in the genome
table
| Fetches the maximum RFXXXXXXXXX accession from the RfamLive
genome table. To be used for assigning accessions to genomes
not found in Uniprot proteomes.
Returns the maximum RGXXXXXXXXX id found in the genome
table | [
"Fetches",
"the",
"maximum",
"RFXXXXXXXXX",
"accession",
"from",
"the",
"RfamLive",
"genome",
"table",
".",
"To",
"be",
"used",
"for",
"assigning",
"accessions",
"to",
"genomes",
"not",
"found",
"in",
"Uniprot",
"proteomes",
".",
"Returns",
"the",
"maximum",
"... | def fetch_max_RG_accession_from_genome():
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = "Select max(upid) from genome where upid like \'RG%\'"
cursor.execute(query)
rfam_genome_id = cursor.fetchone()[0]
return rfam_genome_id | [
"def",
"fetch_max_RG_accession_from_genome",
"(",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"query",
"=",
"\"Select max(upid) from genome where upid like \\'RG%\\'\"",
"cursor",
... | Fetches the maximum RFXXXXXXXXX accession from the RfamLive
genome table. | [
"Fetches",
"the",
"maximum",
"RFXXXXXXXXX",
"accession",
"from",
"the",
"RfamLive",
"genome",
"table",
"."
] | [
"\"\"\"\n Fetches the maximum RFXXXXXXXXX accession from the RfamLive\n genome table. To be used for assigning accessions to genomes\n not found in Uniprot proteomes.\n\n return: Returns the maximum RGXXXXXXXXX id found in the genome\n table\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | populate_genome_table | null | def populate_genome_table(data):
"""
Populates the RfamLive genome table with the data provided as input
data: A list of tuples with the new genome table entries
return: Void
"""
# connect to db
cnx = RfamDB.connect()
# get a new buffered cursor
cursor = cnx.cursor(raw=True)
... |
Populates the RfamLive genome table with the data provided as input
data: A list of tuples with the new genome table entries
return: Void
| Populates the RfamLive genome table with the data provided as input
data: A list of tuples with the new genome table entries
Void | [
"Populates",
"the",
"RfamLive",
"genome",
"table",
"with",
"the",
"data",
"provided",
"as",
"input",
"data",
":",
"A",
"list",
"of",
"tuples",
"with",
"the",
"new",
"genome",
"table",
"entries",
"Void"
] | def populate_genome_table(data):
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
query = ("INSERT INTO genome (upid, assembly_acc, assembly_version, wgs_acc,"
"wgs_version, assembly_name, assembly_level, study_ref, description,"
"total_length, ungapped_length, circular, ncbi_i... | [
"def",
"populate_genome_table",
"(",
"data",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"raw",
"=",
"True",
")",
"query",
"=",
"(",
"\"INSERT INTO genome (upid, assembly_acc, assembly_version, wgs_acc,\"",
... | Populates the RfamLive genome table with the data provided as input
data: A list of tuples with the new genome table entries | [
"Populates",
"the",
"RfamLive",
"genome",
"table",
"with",
"the",
"data",
"provided",
"as",
"input",
"data",
":",
"A",
"list",
"of",
"tuples",
"with",
"the",
"new",
"genome",
"table",
"entries"
] | [
"\"\"\"\n Populates the RfamLive genome table with the data provided as input\n\n data: A list of tuples with the new genome table entries\n\n return: Void\n \"\"\"",
"# connect to db",
"# get a new buffered cursor",
"# query to update is_significant field to 0",
"# execute query batched"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | update_metagenomic_region_md5s | null | def update_metagenomic_region_md5s(data):
"""
Updates md5 fields of the seed region table
data: A list of tuples specifying the entries to populate
return: void
"""
# connect to db
cnx = RfamDB.connect()
# get a new buffered cursor
cursor = cnx.cursor(buffered=True)
# updat... |
Updates md5 fields of the seed region table
data: A list of tuples specifying the entries to populate
return: void
| Updates md5 fields of the seed region table
data: A list of tuples specifying the entries to populate
void | [
"Updates",
"md5",
"fields",
"of",
"the",
"seed",
"region",
"table",
"data",
":",
"A",
"list",
"of",
"tuples",
"specifying",
"the",
"entries",
"to",
"populate",
"void"
] | def update_metagenomic_region_md5s(data):
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
query = ("UPDATE meta_full_region SET md5=%s WHERE rfam_acc=%s "
"AND rfamseq_acc=%s AND seq_start=%s AND seq_end=%s")
cursor.executemany(query, data)
cnx.commit()
cursor.close()
... | [
"def",
"update_metagenomic_region_md5s",
"(",
"data",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"query",
"=",
"(",
"\"UPDATE meta_full_region SET md5=%s WHERE rfam_acc=%s \"",
... | Updates md5 fields of the seed region table
data: A list of tuples specifying the entries to populate | [
"Updates",
"md5",
"fields",
"of",
"the",
"seed",
"region",
"table",
"data",
":",
"A",
"list",
"of",
"tuples",
"specifying",
"the",
"entries",
"to",
"populate"
] | [
"\"\"\"\n Updates md5 fields of the seed region table\n\n data: A list of tuples specifying the entries to populate\n\n return: void\n \"\"\"",
"# connect to db",
"# get a new buffered cursor",
"# update is_significant field to 0"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_family_tax_ids | <not_specific> | def fetch_family_tax_ids(rfam_acc):
"""
Queries RfamLive and extracts all family taxonomy ids
rfam_acc: A valid Rfam family accession
return: A list of taxonomic ids associated with a specific Rfam family
"""
query = """select distinct ncbi_id
from family_ncbi
where rfam_acc=\'%s\'"""... |
Queries RfamLive and extracts all family taxonomy ids
rfam_acc: A valid Rfam family accession
return: A list of taxonomic ids associated with a specific Rfam family
| Queries RfamLive and extracts all family taxonomy ids
rfam_acc: A valid Rfam family accession
A list of taxonomic ids associated with a specific Rfam family | [
"Queries",
"RfamLive",
"and",
"extracts",
"all",
"family",
"taxonomy",
"ids",
"rfam_acc",
":",
"A",
"valid",
"Rfam",
"family",
"accession",
"A",
"list",
"of",
"taxonomic",
"ids",
"associated",
"with",
"a",
"specific",
"Rfam",
"family"
] | def fetch_family_tax_ids(rfam_acc):
query = """select distinct ncbi_id
from family_ncbi
where rfam_acc=\'%s\'"""
cnx = RfamDB.connect()
cursor = cnx.cursor(buffered=True)
cursor.execute(query % rfam_acc)
tax_ids = [x[0] for x in cursor.fetchall()]
cursor.close()
cnx.close()
retur... | [
"def",
"fetch_family_tax_ids",
"(",
"rfam_acc",
")",
":",
"query",
"=",
"\"\"\"select distinct ncbi_id\n from family_ncbi\n where rfam_acc=\\'%s\\'\"\"\"",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"buffered",
"=",
... | Queries RfamLive and extracts all family taxonomy ids
rfam_acc: A valid Rfam family accession | [
"Queries",
"RfamLive",
"and",
"extracts",
"all",
"family",
"taxonomy",
"ids",
"rfam_acc",
":",
"A",
"valid",
"Rfam",
"family",
"accession"
] | [
"\"\"\"\n Queries RfamLive and extracts all family taxonomy ids\n\n rfam_acc: A valid Rfam family accession\n\n return: A list of taxonomic ids associated with a specific Rfam family\n \"\"\""
] | [
{
"param": "rfam_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rfam_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_family_full_regions | <not_specific> | def fetch_family_full_regions(rfam_acc, sort=True):
"""
Fetches family regions from full_region table
:param rfam_acc:
:return: A dictionary with all FULL regions per accession belonging to a specific
family
"""
query = """select rfamseq_acc, seq_start, seq_end
from full_region
... |
Fetches family regions from full_region table
:param rfam_acc:
:return: A dictionary with all FULL regions per accession belonging to a specific
family
| Fetches family regions from full_region table | [
"Fetches",
"family",
"regions",
"from",
"full_region",
"table"
] | def fetch_family_full_regions(rfam_acc, sort=True):
query = """select rfamseq_acc, seq_start, seq_end
from full_region
where rfam_acc=\'%s\'
and is_significant=1
and type=\'full\'"""
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
cursor.execute(query % rfam_a... | [
"def",
"fetch_family_full_regions",
"(",
"rfam_acc",
",",
"sort",
"=",
"True",
")",
":",
"query",
"=",
"\"\"\"select rfamseq_acc, seq_start, seq_end\n from full_region\n where rfam_acc=\\'%s\\'\n and is_significant=1\n and type=\\'full\\'\"\"\"",
"cnx",
"=",
... | Fetches family regions from full_region table | [
"Fetches",
"family",
"regions",
"from",
"full_region",
"table"
] | [
"\"\"\"\n Fetches family regions from full_region table\n :param rfam_acc:\n\n :return: A dictionary with all FULL regions per accession belonging to a specific\n family\n \"\"\"",
"# sorts hits by start points"
] | [
{
"param": "rfam_acc",
"type": null
},
{
"param": "sort",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary with all FULL regions per accession belonging to a specific\nfamily",
"docstring_tokens": [
"A",
"dictionary",
"with",
"all",
"FULL",
"regions",
"per",
"accession",
"belonging",
... |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_family_seed_regions | <not_specific> | def fetch_family_seed_regions(rfam_acc):
"""
Fetches family regions from full_region table
:param rfam_acc:
:return: A dictionary with all SEED regions per accession belonging to a specific
family
"""
query = """select rfamseq_acc, seq_start, seq_end
from seed_region
where ... |
Fetches family regions from full_region table
:param rfam_acc:
:return: A dictionary with all SEED regions per accession belonging to a specific
family
| Fetches family regions from full_region table | [
"Fetches",
"family",
"regions",
"from",
"full_region",
"table"
] | def fetch_family_seed_regions(rfam_acc):
query = """select rfamseq_acc, seq_start, seq_end
from seed_region
where rfam_acc=\'%s\'"""
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
cursor.execute(query % rfam_acc)
regions = cursor.fetchall()
cursor.close()
cnx.clo... | [
"def",
"fetch_family_seed_regions",
"(",
"rfam_acc",
")",
":",
"query",
"=",
"\"\"\"select rfamseq_acc, seq_start, seq_end\n from seed_region\n where rfam_acc=\\'%s\\'\"\"\"",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
... | Fetches family regions from full_region table | [
"Fetches",
"family",
"regions",
"from",
"full_region",
"table"
] | [
"\"\"\"\n Fetches family regions from full_region table\n :param rfam_acc:\n\n :return: A dictionary with all SEED regions per accession belonging to a specific\n family\n \"\"\""
] | [
{
"param": "rfam_acc",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary with all SEED regions per accession belonging to a specific\nfamily",
"docstring_tokens": [
"A",
"dictionary",
"with",
"all",
"SEED",
"regions",
"per",
"accession",
"belonging",
... |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_family_metadata | <not_specific> | def fetch_family_metadata(rfam_acc):
"""
Fetches family metadata from family table
:param rfam_acc:
:return: A dictionary with metadata describing an Rfam family family
"""
query = """select rfam_id, description, type
from family
where rfam_acc=\'%s\'"""
cnx = RfamDB.conne... |
Fetches family metadata from family table
:param rfam_acc:
:return: A dictionary with metadata describing an Rfam family family
| Fetches family metadata from family table | [
"Fetches",
"family",
"metadata",
"from",
"family",
"table"
] | def fetch_family_metadata(rfam_acc):
query = """select rfam_id, description, type
from family
where rfam_acc=\'%s\'"""
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
cursor.execute(query % rfam_acc)
metadata = cursor.fetchone()
cursor.close()
cnx.close()
retu... | [
"def",
"fetch_family_metadata",
"(",
"rfam_acc",
")",
":",
"query",
"=",
"\"\"\"select rfam_id, description, type\n from family\n where rfam_acc=\\'%s\\'\"\"\"",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"dicti... | Fetches family metadata from family table | [
"Fetches",
"family",
"metadata",
"from",
"family",
"table"
] | [
"\"\"\"\n Fetches family metadata from family table\n :param rfam_acc:\n\n :return: A dictionary with metadata describing an Rfam family family\n \"\"\""
] | [
{
"param": "rfam_acc",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary with metadata describing an Rfam family family",
"docstring_tokens": [
"A",
"dictionary",
"with",
"metadata",
"describing",
"an",
"Rfam",
"family",
"family"
],
"type": null
... |
3bac52456a1ade4f2777e9b9865975b7630dcb42 | Rfam/rfam-production | utils/db_utils.py | [
"Apache-2.0"
] | Python | fetch_mirna_families | <not_specific> | def fetch_mirna_families():
"""
Fetches a list of all microRNA families from family table
:return: A dictionary with metadata describing Rfam microRNA families
"""
query = """select rfam_acc, rfam_id, description, gathering_cutoff
from family
where type like '%mirna%'"""
cnx =... |
Fetches a list of all microRNA families from family table
:return: A dictionary with metadata describing Rfam microRNA families
| Fetches a list of all microRNA families from family table | [
"Fetches",
"a",
"list",
"of",
"all",
"microRNA",
"families",
"from",
"family",
"table"
] | def fetch_mirna_families():
query = """select rfam_acc, rfam_id, description, gathering_cutoff
from family
where type like '%mirna%'"""
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
cursor.execute(query)
data = cursor.fetchall()
cursor.close()
cnx.close()
re... | [
"def",
"fetch_mirna_families",
"(",
")",
":",
"query",
"=",
"\"\"\"select rfam_acc, rfam_id, description, gathering_cutoff\n from family\n where type like '%mirna%'\"\"\"",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",... | Fetches a list of all microRNA families from family table | [
"Fetches",
"a",
"list",
"of",
"all",
"microRNA",
"families",
"from",
"family",
"table"
] | [
"\"\"\"\n Fetches a list of all microRNA families from family table\n\n :return: A dictionary with metadata describing Rfam microRNA families\n \"\"\""
] | [] | {
"returns": [
{
"docstring": "A dictionary with metadata describing Rfam microRNA families",
"docstring_tokens": [
"A",
"dictionary",
"with",
"metadata",
"describing",
"Rfam",
"microRNA",
"families"
],
"type": null
}
],... |
2f0b918b7b71d5e747dbfc97feb344e25fa0ae88 | Rfam/rfam-production | scripts/validation/fam_view_validator.py | [
"Apache-2.0"
] | Python | check_ss_images | null | def check_ss_images(cnx_obj, no_fams):
'''
Checks that secondary structure images have been generated for all
new families and returns True or False accordingly.
'''
query = ("SELECT ss.type,count(*)\n"
"FROM secondary_structure_image ss, family f\n"
"WHERE f.rfam_... |
Checks that secondary structure images have been generated for all
new families and returns True or False accordingly.
| Checks that secondary structure images have been generated for all
new families and returns True or False accordingly. | [
"Checks",
"that",
"secondary",
"structure",
"images",
"have",
"been",
"generated",
"for",
"all",
"new",
"families",
"and",
"returns",
"True",
"or",
"False",
"accordingly",
"."
] | def check_ss_images(cnx_obj, no_fams):
query = ("SELECT ss.type,count(*)\n"
"FROM secondary_structure_image ss, family f\n"
"WHERE f.rfam_acc=ss.rfam_acc\n"
"AND ss.image is not NULL\n"
"AND f.author like \'%Arga%\'\n"
"GROUP BY ss.type")
cursor =... | [
"def",
"check_ss_images",
"(",
"cnx_obj",
",",
"no_fams",
")",
":",
"query",
"=",
"(",
"\"SELECT ss.type,count(*)\\n\"",
"\"FROM secondary_structure_image ss, family f\\n\"",
"\"WHERE f.rfam_acc=ss.rfam_acc\\n\"",
"\"AND ss.image is not NULL\\n\"",
"\"AND f.author like \\'%Arga%\\'\\n\... | Checks that secondary structure images have been generated for all
new families and returns True or False accordingly. | [
"Checks",
"that",
"secondary",
"structure",
"images",
"have",
"been",
"generated",
"for",
"all",
"new",
"families",
"and",
"returns",
"True",
"or",
"False",
"accordingly",
"."
] | [
"'''\n Checks that secondary structure images have been generated for all\n new families and returns True or False accordingly.\n '''"
] | [
{
"param": "cnx_obj",
"type": null
},
{
"param": "no_fams",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cnx_obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "no_fams",
"type": null,
"docstring": null,
"docstring_toke... |
2f0b918b7b71d5e747dbfc97feb344e25fa0ae88 | Rfam/rfam-production | scripts/validation/fam_view_validator.py | [
"Apache-2.0"
] | Python | check_sunburst | null | def check_sunburst(cnx_obj):
'''
Looks up sunburst table and checks that there're entries for all
families in the view process.
'''
# families number or get that dynamically
query = ("SELECT s.type,count(*)\n"
"FROM sunburst s, family f\n"
"WHERE f.rfam_acc=s.r... |
Looks up sunburst table and checks that there're entries for all
families in the view process.
| Looks up sunburst table and checks that there're entries for all
families in the view process. | [
"Looks",
"up",
"sunburst",
"table",
"and",
"checks",
"that",
"there",
"'",
"re",
"entries",
"for",
"all",
"families",
"in",
"the",
"view",
"process",
"."
] | def check_sunburst(cnx_obj):
query = ("SELECT s.type,count(*)\n"
"FROM sunburst s, family f\n"
"WHERE f.rfam_acc=s.rfam_acc\n"
"AND s.data is not NULL\n"
"AND f.author like \'%Arga%\'\n"
"GROUP BY s.type") | [
"def",
"check_sunburst",
"(",
"cnx_obj",
")",
":",
"query",
"=",
"(",
"\"SELECT s.type,count(*)\\n\"",
"\"FROM sunburst s, family f\\n\"",
"\"WHERE f.rfam_acc=s.rfam_acc\\n\"",
"\"AND s.data is not NULL\\n\"",
"\"AND f.author like \\'%Arga%\\'\\n\"",
"\"GROUP BY s.type\"",
")"
] | Looks up sunburst table and checks that there're entries for all
families in the view process. | [
"Looks",
"up",
"sunburst",
"table",
"and",
"checks",
"that",
"there",
"'",
"re",
"entries",
"for",
"all",
"families",
"in",
"the",
"view",
"process",
"."
] | [
"'''\n Looks up sunburst table and checks that there're entries for all\n families in the view process.\n '''",
"# families number or get that dynamically",
"# TO BE IMPLEMENTED"
] | [
{
"param": "cnx_obj",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cnx_obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2f0b918b7b71d5e747dbfc97feb344e25fa0ae88 | Rfam/rfam-production | scripts/validation/fam_view_validator.py | [
"Apache-2.0"
] | Python | count_rchie_diagrams | null | def count_rchie_diagrams(cnx_obj, no_fams):
'''
Counts the number of rchie diagrams generated
'''
query = ("SELECT count(*) from secondary_structure_image\n"
"WHERE type=\'rchie\' and image is not NULL\n")
# TO BE IMPLEMENTED |
Counts the number of rchie diagrams generated
| Counts the number of rchie diagrams generated | [
"Counts",
"the",
"number",
"of",
"rchie",
"diagrams",
"generated"
] | def count_rchie_diagrams(cnx_obj, no_fams):
query = ("SELECT count(*) from secondary_structure_image\n"
"WHERE type=\'rchie\' and image is not NULL\n") | [
"def",
"count_rchie_diagrams",
"(",
"cnx_obj",
",",
"no_fams",
")",
":",
"query",
"=",
"(",
"\"SELECT count(*) from secondary_structure_image\\n\"",
"\"WHERE type=\\'rchie\\' and image is not NULL\\n\"",
")"
] | Counts the number of rchie diagrams generated | [
"Counts",
"the",
"number",
"of",
"rchie",
"diagrams",
"generated"
] | [
"'''\n Counts the number of rchie diagrams generated\n '''",
"# TO BE IMPLEMENTED"
] | [
{
"param": "cnx_obj",
"type": null
},
{
"param": "no_fams",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cnx_obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "no_fams",
"type": null,
"docstring": null,
"docstring_toke... |
2f0b918b7b71d5e747dbfc97feb344e25fa0ae88 | Rfam/rfam-production | scripts/validation/fam_view_validator.py | [
"Apache-2.0"
] | Python | check_alignment_and_tree | null | def check_alignment_and_tree(cnx_obj, no_fams):
'''
Checks all types of files for the new families in alignment_and_tree
table.
'''
query = ("SELECT ant.type, count(*)\n"
"FROM alignment_and_tree ant, family f\n"
"WHERE f.rfam_acc=ant.rfam_acc\n"
"AND ... |
Checks all types of files for the new families in alignment_and_tree
table.
| Checks all types of files for the new families in alignment_and_tree
table. | [
"Checks",
"all",
"types",
"of",
"files",
"for",
"the",
"new",
"families",
"in",
"alignment_and_tree",
"table",
"."
] | def check_alignment_and_tree(cnx_obj, no_fams):
query = ("SELECT ant.type, count(*)\n"
"FROM alignment_and_tree ant, family f\n"
"WHERE f.rfam_acc=ant.rfam_acc\n"
"AND f.author like \'%Arga%\'\n"
"GROUP BY ant.type") | [
"def",
"check_alignment_and_tree",
"(",
"cnx_obj",
",",
"no_fams",
")",
":",
"query",
"=",
"(",
"\"SELECT ant.type, count(*)\\n\"",
"\"FROM alignment_and_tree ant, family f\\n\"",
"\"WHERE f.rfam_acc=ant.rfam_acc\\n\"",
"\"AND f.author like \\'%Arga%\\'\\n\"",
"\"GROUP BY ant.type\"",
... | Checks all types of files for the new families in alignment_and_tree
table. | [
"Checks",
"all",
"types",
"of",
"files",
"for",
"the",
"new",
"families",
"in",
"alignment_and_tree",
"table",
"."
] | [
"'''\n Checks all types of files for the new families in alignment_and_tree\n table.\n '''",
"# TO BE IMPLEMENTED"
] | [
{
"param": "cnx_obj",
"type": null
},
{
"param": "no_fams",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cnx_obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "no_fams",
"type": null,
"docstring": null,
"docstring_toke... |
2f0b918b7b71d5e747dbfc97feb344e25fa0ae88 | Rfam/rfam-production | scripts/validation/fam_view_validator.py | [
"Apache-2.0"
] | Python | check_html_alignment | null | def check_html_alignment(cnx_obj, no_fams):
'''
Checks if there're entries in the html_alignment for all new families
'''
query = ("SELECT ha.type, count(*)\n"
"FROM html_alignment ha, family f\n"
"WHERE f.rfam_acc=ha.rfam_acc\n"
"AND f.author like \'%Arga%\'\... |
Checks if there're entries in the html_alignment for all new families
| Checks if there're entries in the html_alignment for all new families | [
"Checks",
"if",
"there",
"'",
"re",
"entries",
"in",
"the",
"html_alignment",
"for",
"all",
"new",
"families"
] | def check_html_alignment(cnx_obj, no_fams):
query = ("SELECT ha.type, count(*)\n"
"FROM html_alignment ha, family f\n"
"WHERE f.rfam_acc=ha.rfam_acc\n"
"AND f.author like \'%Arga%\'\n"
"GROUP BY ha.type") | [
"def",
"check_html_alignment",
"(",
"cnx_obj",
",",
"no_fams",
")",
":",
"query",
"=",
"(",
"\"SELECT ha.type, count(*)\\n\"",
"\"FROM html_alignment ha, family f\\n\"",
"\"WHERE f.rfam_acc=ha.rfam_acc\\n\"",
"\"AND f.author like \\'%Arga%\\'\\n\"",
"\"GROUP BY ha.type\"",
")"
] | Checks if there're entries in the html_alignment for all new families | [
"Checks",
"if",
"there",
"'",
"re",
"entries",
"in",
"the",
"html_alignment",
"for",
"all",
"new",
"families"
] | [
"'''\n Checks if there're entries in the html_alignment for all new families\n '''",
"# TO BE IMPLEMENTED"
] | [
{
"param": "cnx_obj",
"type": null
},
{
"param": "no_fams",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cnx_obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "no_fams",
"type": null,
"docstring": null,
"docstring_toke... |
2f0b918b7b71d5e747dbfc97feb344e25fa0ae88 | Rfam/rfam-production | scripts/validation/fam_view_validator.py | [
"Apache-2.0"
] | Python | print_report | null | def print_report(no_fams):
'''
Calls all functions and displays the results on screen
'''
cnx = RfamDB.connect()
check_ss_images(cnx, no_fams)
check_sunburst(cnx)
count_rchie_diagrams(cnx, no_fams)
check_alignment_and_tree(cnx, no_fams)
check_html_alignment(cnx, no_fams)
R... |
Calls all functions and displays the results on screen
| Calls all functions and displays the results on screen | [
"Calls",
"all",
"functions",
"and",
"displays",
"the",
"results",
"on",
"screen"
] | def print_report(no_fams):
cnx = RfamDB.connect()
check_ss_images(cnx, no_fams)
check_sunburst(cnx)
count_rchie_diagrams(cnx, no_fams)
check_alignment_and_tree(cnx, no_fams)
check_html_alignment(cnx, no_fams)
RfamDB.disconnect(cnx) | [
"def",
"print_report",
"(",
"no_fams",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"check_ss_images",
"(",
"cnx",
",",
"no_fams",
")",
"check_sunburst",
"(",
"cnx",
")",
"count_rchie_diagrams",
"(",
"cnx",
",",
"no_fams",
")",
"check_alignment_... | Calls all functions and displays the results on screen | [
"Calls",
"all",
"functions",
"and",
"displays",
"the",
"results",
"on",
"screen"
] | [
"'''\n Calls all functions and displays the results on screen\n '''"
] | [
{
"param": "no_fams",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "no_fams",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
536d5ed69ce52f0e880f378b90c46dbb58f09edf | Rfam/rfam-production | utils/infernal_utils.py | [
"Apache-2.0"
] | Python | generate_bed_detail_file_with_ss | null | def generate_bed_detail_file_with_ss(inf_output_file, dest_dir, ss_notation="wuss"):
"""
Parses Infernal's detailed output and generates a bed file in detailed format
with the last column containing the secondary structure string in the specified
notation.
inf_output_file: Infernal's output file (-... |
Parses Infernal's detailed output and generates a bed file in detailed format
with the last column containing the secondary structure string in the specified
notation.
inf_output_file: Infernal's output file (-o option)
dest_dir: The path to the output directory
ss_notation: A string indicatin... | Parses Infernal's detailed output and generates a bed file in detailed format
with the last column containing the secondary structure string in the specified
notation.
Infernal's output file (-o option)
dest_dir: The path to the output directory
ss_notation: A string indicating the the notation in which to output the
... | [
"Parses",
"Infernal",
"'",
"s",
"detailed",
"output",
"and",
"generates",
"a",
"bed",
"file",
"in",
"detailed",
"format",
"with",
"the",
"last",
"column",
"containing",
"the",
"secondary",
"structure",
"string",
"in",
"the",
"specified",
"notation",
".",
"Infe... | def generate_bed_detail_file_with_ss(inf_output_file, dest_dir, ss_notation="wuss"):
scores = infernal_output_parser(inf_output_file, ss_notation=ss_notation)
filename = os.path.basename(inf_output_file).partition('.')[0]
fp_out = open(os.path.join(dest_dir, filename + '.bed'), 'w')
for score in scores:... | [
"def",
"generate_bed_detail_file_with_ss",
"(",
"inf_output_file",
",",
"dest_dir",
",",
"ss_notation",
"=",
"\"wuss\"",
")",
":",
"scores",
"=",
"infernal_output_parser",
"(",
"inf_output_file",
",",
"ss_notation",
"=",
"ss_notation",
")",
"filename",
"=",
"os",
".... | Parses Infernal's detailed output and generates a bed file in detailed format
with the last column containing the secondary structure string in the specified
notation. | [
"Parses",
"Infernal",
"'",
"s",
"detailed",
"output",
"and",
"generates",
"a",
"bed",
"file",
"in",
"detailed",
"format",
"with",
"the",
"last",
"column",
"containing",
"the",
"secondary",
"structure",
"string",
"in",
"the",
"specified",
"notation",
"."
] | [
"\"\"\"\n Parses Infernal's detailed output and generates a bed file in detailed format\n with the last column containing the secondary structure string in the specified\n notation.\n\n inf_output_file: Infernal's output file (-o option)\n dest_dir: The path to the output directory\n ss_notation: ... | [
{
"param": "inf_output_file",
"type": null
},
{
"param": "dest_dir",
"type": null
},
{
"param": "ss_notation",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inf_output_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docst... |
536d5ed69ce52f0e880f378b90c46dbb58f09edf | Rfam/rfam-production | utils/infernal_utils.py | [
"Apache-2.0"
] | Python | infernal_output_parser | <not_specific> | def infernal_output_parser(inf_output_file, ss_notation="wuss"):
"""
Parses Infernal's detailed output file (-o) and returns a list of dictionaries
for each hit found in the file
inf_output_file: Infernal's output file (-o)
dest_dir: The path to the output directory
ss_notation: A string indica... |
Parses Infernal's detailed output file (-o) and returns a list of dictionaries
for each hit found in the file
inf_output_file: Infernal's output file (-o)
dest_dir: The path to the output directory
ss_notation: A string indicating the the notation in which to output the
secondary structure str... | Parses Infernal's detailed output file (-o) and returns a list of dictionaries
for each hit found in the file
Infernal's output file (-o)
dest_dir: The path to the output directory
ss_notation: A string indicating the the notation in which to output the
secondary structure string (wuss or dbn)
A list of dictionaries | [
"Parses",
"Infernal",
"'",
"s",
"detailed",
"output",
"file",
"(",
"-",
"o",
")",
"and",
"returns",
"a",
"list",
"of",
"dictionaries",
"for",
"each",
"hit",
"found",
"in",
"the",
"file",
"Infernal",
"'",
"s",
"output",
"file",
"(",
"-",
"o",
")",
"de... | def infernal_output_parser(inf_output_file, ss_notation="wuss"):
rna_type = ''
ss_str_list = []
scores = []
fp_in = open(inf_output_file, 'r')
line = fp_in.readline()
rfam_acc = ''
while line != '':
if line.find("Accession:") != -1:
rfam_acc = [x for x in line.strip().spl... | [
"def",
"infernal_output_parser",
"(",
"inf_output_file",
",",
"ss_notation",
"=",
"\"wuss\"",
")",
":",
"rna_type",
"=",
"''",
"ss_str_list",
"=",
"[",
"]",
"scores",
"=",
"[",
"]",
"fp_in",
"=",
"open",
"(",
"inf_output_file",
",",
"'r'",
")",
"line",
"="... | Parses Infernal's detailed output file (-o) and returns a list of dictionaries
for each hit found in the file | [
"Parses",
"Infernal",
"'",
"s",
"detailed",
"output",
"file",
"(",
"-",
"o",
")",
"and",
"returns",
"a",
"list",
"of",
"dictionaries",
"for",
"each",
"hit",
"found",
"in",
"the",
"file"
] | [
"\"\"\"\n Parses Infernal's detailed output file (-o) and returns a list of dictionaries\n for each hit found in the file\n\n inf_output_file: Infernal's output file (-o)\n dest_dir: The path to the output directory\n ss_notation: A string indicating the the notation in which to output the\n secon... | [
{
"param": "inf_output_file",
"type": null
},
{
"param": "ss_notation",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inf_output_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ss_notation",
"type": null,
"docstring": null,
"do... |
536d5ed69ce52f0e880f378b90c46dbb58f09edf | Rfam/rfam-production | utils/infernal_utils.py | [
"Apache-2.0"
] | Python | infernal_to_rfam | null | def infernal_to_rfam(inf_tblout_file, dest_dir, file_format='tsv'):
"""
Parses Infernal's output file and exports results in Rfam's genome full region format
(tsv option is used by default)
inf_tblout_file: Infernal's output file in tabular format
format: This is an option whether to output results... |
Parses Infernal's output file and exports results in Rfam's genome full region format
(tsv option is used by default)
inf_tblout_file: Infernal's output file in tabular format
format: This is an option whether to output results in tabular format or create a json file
| Parses Infernal's output file and exports results in Rfam's genome full region format
(tsv option is used by default)
Infernal's output file in tabular format
format: This is an option whether to output results in tabular format or create a json file | [
"Parses",
"Infernal",
"'",
"s",
"output",
"file",
"and",
"exports",
"results",
"in",
"Rfam",
"'",
"s",
"genome",
"full",
"region",
"format",
"(",
"tsv",
"option",
"is",
"used",
"by",
"default",
")",
"Infernal",
"'",
"s",
"output",
"file",
"in",
"tabular"... | def infernal_to_rfam(inf_tblout_file, dest_dir, file_format='tsv'):
in_file = open(inf_tblout_file, 'r')
filename = os.path.basename(inf_tblout_file).partition('.')[0]
out_file = None
if file_format == "tsv":
out_file = open(os.path.join(dest_dir, filename + ".tsv"), 'w')
else:
out_f... | [
"def",
"infernal_to_rfam",
"(",
"inf_tblout_file",
",",
"dest_dir",
",",
"file_format",
"=",
"'tsv'",
")",
":",
"in_file",
"=",
"open",
"(",
"inf_tblout_file",
",",
"'r'",
")",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"inf_tblout_file",
")",... | Parses Infernal's output file and exports results in Rfam's genome full region format
(tsv option is used by default) | [
"Parses",
"Infernal",
"'",
"s",
"output",
"file",
"and",
"exports",
"results",
"in",
"Rfam",
"'",
"s",
"genome",
"full",
"region",
"format",
"(",
"tsv",
"option",
"is",
"used",
"by",
"default",
")"
] | [
"\"\"\"\n Parses Infernal's output file and exports results in Rfam's genome full region format\n (tsv option is used by default)\n\n inf_tblout_file: Infernal's output file in tabular format\n format: This is an option whether to output results in tabular format or create a json file\n \"\"\"",
"... | [
{
"param": "inf_tblout_file",
"type": null
},
{
"param": "dest_dir",
"type": null
},
{
"param": "file_format",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inf_tblout_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docst... |
536d5ed69ce52f0e880f378b90c46dbb58f09edf | Rfam/rfam-production | utils/infernal_utils.py | [
"Apache-2.0"
] | Python | tblout_to_full_region | null | def tblout_to_full_region(tblout_file, dest_dir=None):
"""
Parses Infernal's tblout file and generates a .txt file that is compatible with full_region
table.
tblout_file: A valid Infernal's output file in .tblout format
dest_dir: The path to the output directory
return: True if successful, Fal... |
Parses Infernal's tblout file and generates a .txt file that is compatible with full_region
table.
tblout_file: A valid Infernal's output file in .tblout format
dest_dir: The path to the output directory
return: True if successful, False otherwise
| Parses Infernal's tblout file and generates a .txt file that is compatible with full_region
table.
A valid Infernal's output file in .tblout format
dest_dir: The path to the output directory
True if successful, False otherwise | [
"Parses",
"Infernal",
"'",
"s",
"tblout",
"file",
"and",
"generates",
"a",
".",
"txt",
"file",
"that",
"is",
"compatible",
"with",
"full_region",
"table",
".",
"A",
"valid",
"Infernal",
"'",
"s",
"output",
"file",
"in",
".",
"tblout",
"format",
"dest_dir",... | def tblout_to_full_region(tblout_file, dest_dir=None):
tblout_fp = open(tblout_file, 'r')
filename = os.path.split(tblout_file)[1].partition('.')[0]
if dest_dir is None:
dest_dir = os.path.split(tblout_file)[0]
full_region_fp = open(os.path.join(dest_dir, filename+'.txt'), 'w')
is_significan... | [
"def",
"tblout_to_full_region",
"(",
"tblout_file",
",",
"dest_dir",
"=",
"None",
")",
":",
"tblout_fp",
"=",
"open",
"(",
"tblout_file",
",",
"'r'",
")",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"tblout_file",
")",
"[",
"1",
"]",
".",
"p... | Parses Infernal's tblout file and generates a .txt file that is compatible with full_region
table. | [
"Parses",
"Infernal",
"'",
"s",
"tblout",
"file",
"and",
"generates",
"a",
".",
"txt",
"file",
"that",
"is",
"compatible",
"with",
"full_region",
"table",
"."
] | [
"\"\"\"\n Parses Infernal's tblout file and generates a .txt file that is compatible with full_region\n table.\n\n tblout_file: A valid Infernal's output file in .tblout format\n dest_dir: The path to the output directory\n\n return: True if successful, False otherwise\n \"\"\"",
"#filename = os... | [
{
"param": "tblout_file",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tblout_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring... |
536d5ed69ce52f0e880f378b90c46dbb58f09edf | Rfam/rfam-production | utils/infernal_utils.py | [
"Apache-2.0"
] | Python | infernal_to_full_region | null | def infernal_to_full_region(inf_output_file, dest_dir, filename=None):
"""
Parses Inferna's detailed output (-o option) and generates a file in tabular format, which is
compatible with the full_region table
inf_output_file: Infernal's output file (-o option)
dest_dir: The path to the output directo... |
Parses Inferna's detailed output (-o option) and generates a file in tabular format, which is
compatible with the full_region table
inf_output_file: Infernal's output file (-o option)
dest_dir: The path to the output directory
filename: A filename for the output
returns: Void
| Parses Inferna's detailed output (-o option) and generates a file in tabular format, which is
compatible with the full_region table
Infernal's output file (-o option)
dest_dir: The path to the output directory
filename: A filename for the output
Void | [
"Parses",
"Inferna",
"'",
"s",
"detailed",
"output",
"(",
"-",
"o",
"option",
")",
"and",
"generates",
"a",
"file",
"in",
"tabular",
"format",
"which",
"is",
"compatible",
"with",
"the",
"full_region",
"table",
"Infernal",
"'",
"s",
"output",
"file",
"(",
... | def infernal_to_full_region(inf_output_file, dest_dir, filename=None):
scores = infernal_output_parser(inf_output_file, ss_notation="wuss")
if dest_dir is None:
dest_dir = os.path.split(inf_output_file)[0]
if filename is None:
filename = os.path.basename(inf_output_file).partition('.')[0]
... | [
"def",
"infernal_to_full_region",
"(",
"inf_output_file",
",",
"dest_dir",
",",
"filename",
"=",
"None",
")",
":",
"scores",
"=",
"infernal_output_parser",
"(",
"inf_output_file",
",",
"ss_notation",
"=",
"\"wuss\"",
")",
"if",
"dest_dir",
"is",
"None",
":",
"de... | Parses Inferna's detailed output (-o option) and generates a file in tabular format, which is
compatible with the full_region table | [
"Parses",
"Inferna",
"'",
"s",
"detailed",
"output",
"(",
"-",
"o",
"option",
")",
"and",
"generates",
"a",
"file",
"in",
"tabular",
"format",
"which",
"is",
"compatible",
"with",
"the",
"full_region",
"table"
] | [
"\"\"\"\n Parses Inferna's detailed output (-o option) and generates a file in tabular format, which is\n compatible with the full_region table\n\n inf_output_file: Infernal's output file (-o option)\n dest_dir: The path to the output directory\n filename: A filename for the output\n\n returns: Vo... | [
{
"param": "inf_output_file",
"type": null
},
{
"param": "dest_dir",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inf_output_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docst... |
536d5ed69ce52f0e880f378b90c46dbb58f09edf | Rfam/rfam-production | utils/infernal_utils.py | [
"Apache-2.0"
] | Python | convert_short_wuss_to_dbn | <not_specific> | def convert_short_wuss_to_dbn(ss_string):
"""
Converts RNA structure string from shorthand WUSS notation to dot-bracket notation
ss_string: Secondary structure string
"""
for regex in DBN_REGEX.keys():
ss_string = re.sub(regex, DBN_REGEX[regex], ss_string)
return ss_string |
Converts RNA structure string from shorthand WUSS notation to dot-bracket notation
ss_string: Secondary structure string
| Converts RNA structure string from shorthand WUSS notation to dot-bracket notation
ss_string: Secondary structure string | [
"Converts",
"RNA",
"structure",
"string",
"from",
"shorthand",
"WUSS",
"notation",
"to",
"dot",
"-",
"bracket",
"notation",
"ss_string",
":",
"Secondary",
"structure",
"string"
] | def convert_short_wuss_to_dbn(ss_string):
for regex in DBN_REGEX.keys():
ss_string = re.sub(regex, DBN_REGEX[regex], ss_string)
return ss_string | [
"def",
"convert_short_wuss_to_dbn",
"(",
"ss_string",
")",
":",
"for",
"regex",
"in",
"DBN_REGEX",
".",
"keys",
"(",
")",
":",
"ss_string",
"=",
"re",
".",
"sub",
"(",
"regex",
",",
"DBN_REGEX",
"[",
"regex",
"]",
",",
"ss_string",
")",
"return",
"ss_str... | Converts RNA structure string from shorthand WUSS notation to dot-bracket notation
ss_string: Secondary structure string | [
"Converts",
"RNA",
"structure",
"string",
"from",
"shorthand",
"WUSS",
"notation",
"to",
"dot",
"-",
"bracket",
"notation",
"ss_string",
":",
"Secondary",
"structure",
"string"
] | [
"\"\"\"\n Converts RNA structure string from shorthand WUSS notation to dot-bracket notation\n\n ss_string: Secondary structure string\n \"\"\""
] | [
{
"param": "ss_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ss_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.py | [
"Apache-2.0"
] | Python | calc_seq_overlap | <not_specific> | def calc_seq_overlap(s1, e1, s2, e2):
"""
Calculate sequence overlaps
s1: SEQ1 start coordinate
e1: SEQ1 end coordinate
s2: SEQ2 start coordinate
e2: SEQ2 end coordinate
"""
len1 = abs(e1 - s1)
len2 = abs(e2 - s2)
overlap = None
# get strand
strand = get_strand(s1, e1... |
Calculate sequence overlaps
s1: SEQ1 start coordinate
e1: SEQ1 end coordinate
s2: SEQ2 start coordinate
e2: SEQ2 end coordinate
| Calculate sequence overlaps
s1: SEQ1 start coordinate
e1: SEQ1 end coordinate
s2: SEQ2 start coordinate
e2: SEQ2 end coordinate | [
"Calculate",
"sequence",
"overlaps",
"s1",
":",
"SEQ1",
"start",
"coordinate",
"e1",
":",
"SEQ1",
"end",
"coordinate",
"s2",
":",
"SEQ2",
"start",
"coordinate",
"e2",
":",
"SEQ2",
"end",
"coordinate"
] | def calc_seq_overlap(s1, e1, s2, e2):
len1 = abs(e1 - s1)
len2 = abs(e2 - s2)
overlap = None
strand = get_strand(s1, e1)
if s1 == s2 and len1 == len2:
return float(len1) / float(len2)
elif strand == 1:
overlap = cal_overlap_pos_strand(s1, e1, s2, e2)
elif strand == -1:
... | [
"def",
"calc_seq_overlap",
"(",
"s1",
",",
"e1",
",",
"s2",
",",
"e2",
")",
":",
"len1",
"=",
"abs",
"(",
"e1",
"-",
"s1",
")",
"len2",
"=",
"abs",
"(",
"e2",
"-",
"s2",
")",
"overlap",
"=",
"None",
"strand",
"=",
"get_strand",
"(",
"s1",
",",
... | Calculate sequence overlaps
s1: SEQ1 start coordinate
e1: SEQ1 end coordinate
s2: SEQ2 start coordinate
e2: SEQ2 end coordinate | [
"Calculate",
"sequence",
"overlaps",
"s1",
":",
"SEQ1",
"start",
"coordinate",
"e1",
":",
"SEQ1",
"end",
"coordinate",
"s2",
":",
"SEQ2",
"start",
"coordinate",
"e2",
":",
"SEQ2",
"end",
"coordinate"
] | [
"\"\"\"\n Calculate sequence overlaps\n\n s1: SEQ1 start coordinate\n e1: SEQ1 end coordinate\n s2: SEQ2 start coordinate\n e2: SEQ2 end coordinate\n \"\"\"",
"# get strand",
"# full overlap",
"# check5'",
"# check 3'",
"# will return None in a case that we didn't capture"
] | [
{
"param": "s1",
"type": null
},
{
"param": "e1",
"type": null
},
{
"param": "s2",
"type": null
},
{
"param": "e2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e1",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.