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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.py | [
"Apache-2.0"
] | Python | cal_overlap_pos_strand | <not_specific> | def cal_overlap_pos_strand(s1, e1, s2, e2):
"""
Calculates the region overlap between two regions on the 5' strand and
returns the degree of overlap
s1: Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates
"""
overlap = None
len1 ... |
Calculates the region overlap between two regions on the 5' strand and
returns the degree of overlap
s1: Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates
| Calculates the region overlap between two regions on the 5' strand and
returns the degree of overlap
Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates | [
"Calculates",
"the",
"region",
"overlap",
"between",
"two",
"regions",
"on",
"the",
"5",
"'",
"strand",
"and",
"returns",
"the",
"degree",
"of",
"overlap",
"Seq1",
"start",
"coordinates",
"e1",
":",
"Seq1",
"end",
"coordinates",
"s2",
":",
"Seq2",
"start",
... | def cal_overlap_pos_strand(s1, e1, s2, e2):
overlap = None
len1 = abs(e1 - s1)
len2 = abs(e2 - s2)
min_len = min(len1, len2)
if s1 < s2 and e2 < e1:
overlap = COMP_OVL
elif s1 <= s2 and s2 < e1 and e1 <= e2:
overlap = float(e1 - s2 + 1) / float(min_len)
elif s1 < s2 and e1 <=... | [
"def",
"cal_overlap_pos_strand",
"(",
"s1",
",",
"e1",
",",
"s2",
",",
"e2",
")",
":",
"overlap",
"=",
"None",
"len1",
"=",
"abs",
"(",
"e1",
"-",
"s1",
")",
"len2",
"=",
"abs",
"(",
"e2",
"-",
"s2",
")",
"min_len",
"=",
"min",
"(",
"len1",
","... | Calculates the region overlap between two regions on the 5' strand and
returns the degree of overlap | [
"Calculates",
"the",
"region",
"overlap",
"between",
"two",
"regions",
"on",
"the",
"5",
"'",
"strand",
"and",
"returns",
"the",
"degree",
"of",
"overlap"
] | [
"\"\"\"\n Calculates the region overlap between two regions on the 5' strand and\n returns the degree of overlap\n\n s1: Seq1 start coordinates\n e1: Seq1 end coordinates\n s2: Seq2 start coordinates\n e2: Seq2 end coordinates\n \"\"\"",
"# seq2 within seq1",
"# partial overlap, seq1 before... | [
{
"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": [],
... |
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.py | [
"Apache-2.0"
] | Python | cal_overlap_neg_strand | <not_specific> | def cal_overlap_neg_strand(s1, e1, s2, e2):
"""
Calculates the region overlap between two regions on the 3' strand and
returns the degree of overlap
s1: Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates
"""
overlap = None
len1... |
Calculates the region overlap between two regions on the 3' strand and
returns the degree of overlap
s1: Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates
| Calculates the region overlap between two regions on the 3' strand and
returns the degree of overlap
Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates | [
"Calculates",
"the",
"region",
"overlap",
"between",
"two",
"regions",
"on",
"the",
"3",
"'",
"strand",
"and",
"returns",
"the",
"degree",
"of",
"overlap",
"Seq1",
"start",
"coordinates",
"e1",
":",
"Seq1",
"end",
"coordinates",
"s2",
":",
"Seq2",
"start",
... | def cal_overlap_neg_strand(s1, e1, s2, e2):
overlap = None
len1 = abs(e1 - s1)
len2 = abs(e2 - s2)
min_len = min(len1, len2)
if s1 > s2 and e1 < e2:
overlap = COMP_OVL
elif s1 > s2 and e1 >= s2:
overlap = NO_OVL
elif s1 >= s2 and s2 > e1 and e1 >= e2:
overlap = float(... | [
"def",
"cal_overlap_neg_strand",
"(",
"s1",
",",
"e1",
",",
"s2",
",",
"e2",
")",
":",
"overlap",
"=",
"None",
"len1",
"=",
"abs",
"(",
"e1",
"-",
"s1",
")",
"len2",
"=",
"abs",
"(",
"e2",
"-",
"s2",
")",
"min_len",
"=",
"min",
"(",
"len1",
","... | Calculates the region overlap between two regions on the 3' strand and
returns the degree of overlap | [
"Calculates",
"the",
"region",
"overlap",
"between",
"two",
"regions",
"on",
"the",
"3",
"'",
"strand",
"and",
"returns",
"the",
"degree",
"of",
"overlap"
] | [
"\"\"\"\n Calculates the region overlap between two regions on the 3' strand and\n returns the degree of overlap\n\n s1: Seq1 start coordinates\n e1: Seq1 end coordinates\n s2: Seq2 start coordinates\n e2: Seq2 end coordinates\n\n \"\"\"",
"# seq2 within seq1 region - this may match the parti... | [
{
"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": [],
... |
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.py | [
"Apache-2.0"
] | Python | compete_seq_regions | <not_specific> | def compete_seq_regions(regions, log):
"""
regions: A list of duplicate regions for seq_acc
log: log file pointer for tracking regions we haven't captured
"""
index = 0
non_sig_regs = []
while index <= len(regions) - 2:
reg1 = regions[index]
comp_regs = regions[index + 1:]... |
regions: A list of duplicate regions for seq_acc
log: log file pointer for tracking regions we haven't captured
| A list of duplicate regions for seq_acc
log: log file pointer for tracking regions we haven't captured | [
"A",
"list",
"of",
"duplicate",
"regions",
"for",
"seq_acc",
"log",
":",
"log",
"file",
"pointer",
"for",
"tracking",
"regions",
"we",
"haven",
"'",
"t",
"captured"
] | def compete_seq_regions(regions, log):
index = 0
non_sig_regs = []
while index <= len(regions) - 2:
reg1 = regions[index]
comp_regs = regions[index + 1:]
for reg2 in comp_regs:
strand1 = get_strand(int(reg1[START]), int(reg1[END]))
strand2 = get_strand(int(reg... | [
"def",
"compete_seq_regions",
"(",
"regions",
",",
"log",
")",
":",
"index",
"=",
"0",
"non_sig_regs",
"=",
"[",
"]",
"while",
"index",
"<=",
"len",
"(",
"regions",
")",
"-",
"2",
":",
"reg1",
"=",
"regions",
"[",
"index",
"]",
"comp_regs",
"=",
"reg... | regions: A list of duplicate regions for seq_acc
log: log file pointer for tracking regions we haven't captured | [
"regions",
":",
"A",
"list",
"of",
"duplicate",
"regions",
"for",
"seq_acc",
"log",
":",
"log",
"file",
"pointer",
"for",
"tracking",
"regions",
"we",
"haven",
"'",
"t",
"captured"
] | [
"\"\"\"\n regions: A list of duplicate regions for seq_acc\n log: log file pointer for tracking regions we haven't captured\n \"\"\"",
"# check if the sequences come from the same strand",
"# calculate overlap",
"# check for a an overlap",
"# at this point check the evalues and build the list for",... | [
{
"param": "regions",
"type": null
},
{
"param": "log",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regions",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "log",
"type": null,
"docstring": null,
"docstring_tokens":... |
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.py | [
"Apache-2.0"
] | Python | complete_clan_seqs | <not_specific> | def complete_clan_seqs(sorted_clan, clan_comp_type='FULL'):
"""
Parses a sorted clan file and generates a list of regions per rfam_acc,
which are then competed by compete_seq_regions
sorted_clan: A valid path to a sorted clan file
"""
fp = open(sorted_clan, 'r')
# log regions in which cal... |
Parses a sorted clan file and generates a list of regions per rfam_acc,
which are then competed by compete_seq_regions
sorted_clan: A valid path to a sorted clan file
| Parses a sorted clan file and generates a list of regions per rfam_acc,
which are then competed by compete_seq_regions
A valid path to a sorted clan file | [
"Parses",
"a",
"sorted",
"clan",
"file",
"and",
"generates",
"a",
"list",
"of",
"regions",
"per",
"rfam_acc",
"which",
"are",
"then",
"competed",
"by",
"compete_seq_regions",
"A",
"valid",
"path",
"to",
"a",
"sorted",
"clan",
"file"
] | def complete_clan_seqs(sorted_clan, clan_comp_type='FULL'):
fp = open(sorted_clan, 'r')
logging.basicConfig(
filename="missed_overlaps.log", filemode='w', level=logging.DEBUG)
non_sig_regs = []
regions = []
seq_prev = fp.readline().strip().split('\t')
seq_next = fp.readline().strip().spl... | [
"def",
"complete_clan_seqs",
"(",
"sorted_clan",
",",
"clan_comp_type",
"=",
"'FULL'",
")",
":",
"fp",
"=",
"open",
"(",
"sorted_clan",
",",
"'r'",
")",
"logging",
".",
"basicConfig",
"(",
"filename",
"=",
"\"missed_overlaps.log\"",
",",
"filemode",
"=",
"'w'"... | Parses a sorted clan file and generates a list of regions per rfam_acc,
which are then competed by compete_seq_regions | [
"Parses",
"a",
"sorted",
"clan",
"file",
"and",
"generates",
"a",
"list",
"of",
"regions",
"per",
"rfam_acc",
"which",
"are",
"then",
"competed",
"by",
"compete_seq_regions"
] | [
"\"\"\"\n Parses a sorted clan file and generates a list of regions per rfam_acc,\n which are then competed by compete_seq_regions\n\n sorted_clan: A valid path to a sorted clan file\n \"\"\"",
"# log regions in which calculate overlap returns None",
"# read first 2 regions",
"# read while there a... | [
{
"param": "sorted_clan",
"type": null
},
{
"param": "clan_comp_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sorted_clan",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clan_comp_type",
"type": null,
"docstring": null,
"doc... |
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.py | [
"Apache-2.0"
] | Python | usage | null | def usage():
"""
Displays information on how to run clan competition
"""
print "\nUsage:\n------"
print "\nclan_competition.py [clan_file|clan_dir] [-r] [PDB|FULL]"
print "\nclan_dir: A directory of sorted clan region files"
print "clan_file: The path to a sorted clan region file"
pri... |
Displays information on how to run clan competition
| Displays information on how to run clan competition | [
"Displays",
"information",
"on",
"how",
"to",
"run",
"clan",
"competition"
] | def usage():
print "\nUsage:\n------"
print "\nclan_competition.py [clan_file|clan_dir] [-r] [PDB|FULL]"
print "\nclan_dir: A directory of sorted clan region files"
print "clan_file: The path to a sorted clan region file"
print "\n-r option to reset is_significant field"
print "\nPDB option for ... | [
"def",
"usage",
"(",
")",
":",
"print",
"\"\\nUsage:\\n------\"",
"print",
"\"\\nclan_competition.py [clan_file|clan_dir] [-r] [PDB|FULL]\"",
"print",
"\"\\nclan_dir: A directory of sorted clan region files\"",
"print",
"\"clan_file: The path to a sorted clan region file\"",
"print",
"\"... | Displays information on how to run clan competition | [
"Displays",
"information",
"on",
"how",
"to",
"run",
"clan",
"competition"
] | [
"\"\"\"\n Displays information on how to run clan competition\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f826008ce1f1e6f378607db8f72381ff3ae22171 | Rfam/rfam-production | scripts/processing/clan_competition.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(prog="clan_competition.py")
parser.add_argument("--input", help="A directory of with clan files to compete")
parser.add_argument("-r", help="Reset ... |
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(prog="clan_competition.py")
parser.add_argument("--input", help="A directory of with clan files to compete")
parser.add_argument("-r", help="Reset is_significant field", action="store_true",
default=False)
mutualy_exclusive ... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"clan_competition.py\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--input\"",
",",
"help",
"=",
"\"A directory of with clan files to compete\"",
")",
"p... | 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": []
} |
31d28f0a18a49210403dfe5e9c6e2f85a568f207 | Rfam/rfam-production | scripts/release/generate_tax_data.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Basic argument parsing with Python's argparse
return: Argparse parser object
"""
parser = argparse.ArgumentParser("Script to generate taxonomy data for genome import")
parser.add_argument("-f", help="A file containing a list of valid taxids", action="store")
re... |
Basic argument parsing with Python's argparse
return: Argparse parser object
| Basic argument parsing with Python's argparse
return: Argparse parser object | [
"Basic",
"argument",
"parsing",
"with",
"Python",
"'",
"s",
"argparse",
"return",
":",
"Argparse",
"parser",
"object"
] | def parse_arguments():
parser = argparse.ArgumentParser("Script to generate taxonomy data for genome import")
parser.add_argument("-f", help="A file containing a list of valid taxids", action="store")
return parser | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"\"Script to generate taxonomy data for genome import\"",
")",
"parser",
".",
"add_argument",
"(",
"\"-f\"",
",",
"help",
"=",
"\"A file containing a list of valid taxids\"",
"... | Basic argument parsing with Python's argparse
return: Argparse parser object | [
"Basic",
"argument",
"parsing",
"with",
"Python",
"'",
"s",
"argparse",
"return",
":",
"Argparse",
"parser",
"object"
] | [
"\"\"\"\n Basic argument parsing with Python's argparse\n\n return: Argparse parser object\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0ca82d5b8d421b9ac0f980362d251e5205a7f785 | Rfam/rfam-production | cwl/tools/rfamseq2genseq/rfamseq2genseq_single.py | [
"Apache-2.0"
] | Python | convert_rfamseq_to_genseq | null | def convert_rfamseq_to_genseq(rfamseq_file):
"""
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 output in input fi... |
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 = os.path.split(rfamseq_file)[0]
filename = os.path.basename(rfamseq_file).partition('.')[0]
genseq_file = open(filename + '.genseq', 'w')
rfamseq_fp = open(rfamseq_file, 'r')
for line in rfamseq_fp:
line = line.strip().split('\t')
... | [
"def",
"convert_rfamseq_to_genseq",
"(",
"rfamseq_file",
")",
":",
"dest_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"rfamseq_file",
")",
"[",
"0",
"]",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"rfamseq_file",
")",
".",
"partition",
... | 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
}
] | {
"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",
... |
a4f19f92369cada2178458e69b3e40391227ed0a | Rfam/rfam-production | scripts/support/rfam_queue_watcher.py | [
"Apache-2.0"
] | Python | check_queue_status | <not_specific> | def check_queue_status(queue_name):
"""
Checks the queue status specified by queue_name
queue_name: The name of the queue to check
returns: True if running, False if Not Running
"""
cmd_args = ["/etc/init.d/%s" % queue_name, "status"]
process = sp.Popen(cmd_args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.P... |
Checks the queue status specified by queue_name
queue_name: The name of the queue to check
returns: True if running, False if Not Running
| Checks the queue status specified by queue_name
queue_name: The name of the queue to check
True if running, False if Not Running | [
"Checks",
"the",
"queue",
"status",
"specified",
"by",
"queue_name",
"queue_name",
":",
"The",
"name",
"of",
"the",
"queue",
"to",
"check",
"True",
"if",
"running",
"False",
"if",
"Not",
"Running"
] | def check_queue_status(queue_name):
cmd_args = ["/etc/init.d/%s" % queue_name, "status"]
process = sp.Popen(cmd_args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
response, err = process.communicate()
response_str = response.strip().split(' ')[-1]
status = False
if response_str.find("[Running]") != -1:
status... | [
"def",
"check_queue_status",
"(",
"queue_name",
")",
":",
"cmd_args",
"=",
"[",
"\"/etc/init.d/%s\"",
"%",
"queue_name",
",",
"\"status\"",
"]",
"process",
"=",
"sp",
".",
"Popen",
"(",
"cmd_args",
",",
"stdin",
"=",
"sp",
".",
"PIPE",
",",
"stdout",
"=",
... | Checks the queue status specified by queue_name
queue_name: The name of the queue to check | [
"Checks",
"the",
"queue",
"status",
"specified",
"by",
"queue_name",
"queue_name",
":",
"The",
"name",
"of",
"the",
"queue",
"to",
"check"
] | [
"\"\"\"\n\tChecks the queue status specified by queue_name\n\t\n\tqueue_name: The name of the queue to check\n\t\n\treturns: True if running, False if Not Running\n\t\"\"\"",
"# fetch the last element from the list",
"# status initialization"
] | [
{
"param": "queue_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "queue_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4f19f92369cada2178458e69b3e40391227ed0a | Rfam/rfam-production | scripts/support/rfam_queue_watcher.py | [
"Apache-2.0"
] | Python | start_queue | <not_specific> | def start_queue(queue_name, attempts = 6):
"""
Starts the queue specified by queue_name
queue_name: The name of the queue to start
attempts: The number of attempts to try and start the
queue
returns: True on success, False on failure
"""
cmd_args = ["/etc/init.d/%s" % queue_name, "start"]
queue_status =... |
Starts the queue specified by queue_name
queue_name: The name of the queue to start
attempts: The number of attempts to try and start the
queue
returns: True on success, False on failure
| Starts the queue specified by queue_name
queue_name: The name of the queue to start
attempts: The number of attempts to try and start the
queue
True on success, False on failure | [
"Starts",
"the",
"queue",
"specified",
"by",
"queue_name",
"queue_name",
":",
"The",
"name",
"of",
"the",
"queue",
"to",
"start",
"attempts",
":",
"The",
"number",
"of",
"attempts",
"to",
"try",
"and",
"start",
"the",
"queue",
"True",
"on",
"success",
"Fal... | def start_queue(queue_name, attempts = 6):
cmd_args = ["/etc/init.d/%s" % queue_name, "start"]
queue_status = check_queue_status(queue_name)
while not queue_status:
process = sp.Popen(cmd_args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
response, err = process.communicate()
response_str = response.s... | [
"def",
"start_queue",
"(",
"queue_name",
",",
"attempts",
"=",
"6",
")",
":",
"cmd_args",
"=",
"[",
"\"/etc/init.d/%s\"",
"%",
"queue_name",
",",
"\"start\"",
"]",
"queue_status",
"=",
"check_queue_status",
"(",
"queue_name",
")",
"while",
"not",
"queue_status",... | Starts the queue specified by queue_name
queue_name: The name of the queue to start
attempts: The number of attempts to try and start the
queue | [
"Starts",
"the",
"queue",
"specified",
"by",
"queue_name",
"queue_name",
":",
"The",
"name",
"of",
"the",
"queue",
"to",
"start",
"attempts",
":",
"The",
"number",
"of",
"attempts",
"to",
"try",
"and",
"start",
"the",
"queue"
] | [
"\"\"\"\n\tStarts the queue specified by queue_name\n\t\n\tqueue_name: The name of the queue to start\n\tattempts: The number of attempts to try and start the\n\tqueue \n\n\treturns: True on success, False on failure\n\t\"\"\"",
"# fetch the last element from the list",
"# exit loop if status was successful",
... | [
{
"param": "queue_name",
"type": null
},
{
"param": "attempts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "queue_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "attempts",
"type": null,
"docstring": null,
"docstring_... |
a4f19f92369cada2178458e69b3e40391227ed0a | Rfam/rfam-production | scripts/support/rfam_queue_watcher.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Uses python's argparse to parse the command line arguments
return: Argparse parser object
"""
# create a new argument parser object
parser = argparse.ArgumentParser(description='Update scores for new release')
# group required arguments together
req_args = parser.add_a... |
Uses python's argparse to parse the command line arguments
return: Argparse parser object
| Uses python's argparse to parse the command line arguments
return: Argparse parser object | [
"Uses",
"python",
"'",
"s",
"argparse",
"to",
"parse",
"the",
"command",
"line",
"arguments",
"return",
":",
"Argparse",
"parser",
"object"
] | def parse_arguments():
parser = argparse.ArgumentParser(description='Update scores for new release')
req_args = parser.add_argument_group("required arguments")
req_args.add_argument('-q', help='A comma separated list of queues to watch',
type=list, required=True)
req_args.add_arg... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Update scores for new release'",
")",
"req_args",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"required arguments\"",
")",
"req_args",
".",
"ad... | Uses python's argparse to parse the command line arguments
return: Argparse parser object | [
"Uses",
"python",
"'",
"s",
"argparse",
"to",
"parse",
"the",
"command",
"line",
"arguments",
"return",
":",
"Argparse",
"parser",
"object"
] | [
"\"\"\"\n\tUses python's argparse to parse the command line arguments\n\t\n\treturn: Argparse parser object\n\t\"\"\"",
"# create a new argument parser object",
"# group required arguments together"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
24a502459a99b2e379e49ced954dd649a269fc22 | Rfam/rfam-production | scripts/export/genomes/ena_genome_downloader.py | [
"Apache-2.0"
] | Python | fetch_genome_from_ENA | null | def fetch_genome_from_ENA(genome_accession, dest_dir):
"""
Uses ENAs enaBrowserTools to download a specific directory
genome_accession: A valid ENA accession to Download
dest_dir: Destination directory where genome will be downloaded
return: void
"""
exec_path = os.path.join(gc.ENA_TOOLKI... |
Uses ENAs enaBrowserTools to download a specific directory
genome_accession: A valid ENA accession to Download
dest_dir: Destination directory where genome will be downloaded
return: void
| Uses ENAs enaBrowserTools to download a specific directory
genome_accession: A valid ENA accession to Download
dest_dir: Destination directory where genome will be downloaded
void | [
"Uses",
"ENAs",
"enaBrowserTools",
"to",
"download",
"a",
"specific",
"directory",
"genome_accession",
":",
"A",
"valid",
"ENA",
"accession",
"to",
"Download",
"dest_dir",
":",
"Destination",
"directory",
"where",
"genome",
"will",
"be",
"downloaded",
"void"
] | def fetch_genome_from_ENA(genome_accession, dest_dir):
exec_path = os.path.join(gc.ENA_TOOLKIT, 'enaDataGet')
cmd = "%s -f fasta -m -d %s %s" % (exec_path, dest_dir, genome_accession)
subprocess.call(cmd, shell=True) | [
"def",
"fetch_genome_from_ENA",
"(",
"genome_accession",
",",
"dest_dir",
")",
":",
"exec_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"gc",
".",
"ENA_TOOLKIT",
",",
"'enaDataGet'",
")",
"cmd",
"=",
"\"%s -f fasta -m -d %s %s\"",
"%",
"(",
"exec_path",
","... | Uses ENAs enaBrowserTools to download a specific directory
genome_accession: A valid ENA accession to Download
dest_dir: Destination directory where genome will be downloaded | [
"Uses",
"ENAs",
"enaBrowserTools",
"to",
"download",
"a",
"specific",
"directory",
"genome_accession",
":",
"A",
"valid",
"ENA",
"accession",
"to",
"Download",
"dest_dir",
":",
"Destination",
"directory",
"where",
"genome",
"will",
"be",
"downloaded"
] | [
"\"\"\"\n Uses ENAs enaBrowserTools to download a specific directory\n\n genome_accession: A valid ENA accession to Download\n dest_dir: Destination directory where genome will be downloaded\n\n return: void\n \"\"\""
] | [
{
"param": "genome_accession",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "genome_accession",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docs... |
24a502459a99b2e379e49ced954dd649a269fc22 | Rfam/rfam-production | scripts/export/genomes/ena_genome_downloader.py | [
"Apache-2.0"
] | Python | main | null | def main(genome_accession_file, project_dir, lsf=True):
"""
Parses a file of genome accessions and downloads genomes from ENA. Genomes
are downloaded in fasta format. It is a requirement that genome_accession
file containes a GCA or WGS accession per genome
genome_accession_file: A file with a lis... |
Parses a file of genome accessions and downloads genomes from ENA. Genomes
are downloaded in fasta format. It is a requirement that genome_accession
file containes a GCA or WGS accession per genome
genome_accession_file: A file with a list of upid\tGCA\tdomain or
upid\tWGS\tdomain pairs
projec... | Parses a file of genome accessions and downloads genomes from ENA. Genomes
are downloaded in fasta format. It is a requirement that genome_accession
file containes a GCA or WGS accession per genome
A file with a list of upid\tGCA\tdomain or
upid\tWGS\tdomain pairs
project_dir: The path to the directory where all genom... | [
"Parses",
"a",
"file",
"of",
"genome",
"accessions",
"and",
"downloads",
"genomes",
"from",
"ENA",
".",
"Genomes",
"are",
"downloaded",
"in",
"fasta",
"format",
".",
"It",
"is",
"a",
"requirement",
"that",
"genome_accession",
"file",
"containes",
"a",
"GCA",
... | def main(genome_accession_file, project_dir, lsf=True):
if not os.path.exists(project_dir):
os.mkdir(project_dir)
input_fp = open(genome_accession_file, 'r')
for genome in input_fp:
genome_data = genome.strip().split('\t')
upid = genome_data[0]
domain = genome_data[2]
... | [
"def",
"main",
"(",
"genome_accession_file",
",",
"project_dir",
",",
"lsf",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"project_dir",
")",
":",
"os",
".",
"mkdir",
"(",
"project_dir",
")",
"input_fp",
"=",
"open",
"(",
... | Parses a file of genome accessions and downloads genomes from ENA. | [
"Parses",
"a",
"file",
"of",
"genome",
"accessions",
"and",
"downloads",
"genomes",
"from",
"ENA",
"."
] | [
"\"\"\"\n Parses a file of genome accessions and downloads genomes from ENA. Genomes\n are downloaded in fasta format. It is a requirement that genome_accession\n file containes a GCA or WGS accession per genome\n\n genome_accession_file: A file with a list of upid\\tGCA\\tdomain or\n upid\\tWGS\\tdo... | [
{
"param": "genome_accession_file",
"type": null
},
{
"param": "project_dir",
"type": null
},
{
"param": "lsf",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "genome_accession_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "project_dir",
"type": null,
"docstring": null,
... |
61734c3615f80e0e6a024906a603aa5dbe0a0db0 | Rfam/rfam-production | scripts/support/merge_all_tbl_files.py | [
"Apache-2.0"
] | Python | merge_project_files | null | def merge_project_files(project_dir, upid_list, file_type):
"""
The purpose of this function is to merge genome files (rfamseq, genseq, tblout)
to release ready files for the database import
project_dir: The path to the project directory. Project directory should be
in the same structure as the one... |
The purpose of this function is to merge genome files (rfamseq, genseq, tblout)
to release ready files for the database import
project_dir: The path to the project directory. Project directory should be
in the same structure as the one generated by genome_download pipeline
upid_list: A list of upi... | The purpose of this function is to merge genome files (rfamseq, genseq, tblout)
to release ready files for the database import
The path to the project directory. Project directory should be
in the same structure as the one generated by genome_download pipeline
upid_list: A list of upids to include in the merge
file_ty... | [
"The",
"purpose",
"of",
"this",
"function",
"is",
"to",
"merge",
"genome",
"files",
"(",
"rfamseq",
"genseq",
"tblout",
")",
"to",
"release",
"ready",
"files",
"for",
"the",
"database",
"import",
"The",
"path",
"to",
"the",
"project",
"directory",
".",
"Pr... | def merge_project_files(project_dir, upid_list, file_type):
fp = open(upid_list, 'r')
upids = [x.strip() for x in fp]
fp.close()
for upid in upids:
subdir_loc = os.path.join(project_dir, upid[-3:])
updir = os.path.join(subdir_loc, upid)
source_dir = ''
if file_type.lower(... | [
"def",
"merge_project_files",
"(",
"project_dir",
",",
"upid_list",
",",
"file_type",
")",
":",
"fp",
"=",
"open",
"(",
"upid_list",
",",
"'r'",
")",
"upids",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"fp",
"]",
"fp",
".",
"close",
"... | The purpose of this function is to merge genome files (rfamseq, genseq, tblout)
to release ready files for the database import | [
"The",
"purpose",
"of",
"this",
"function",
"is",
"to",
"merge",
"genome",
"files",
"(",
"rfamseq",
"genseq",
"tblout",
")",
"to",
"release",
"ready",
"files",
"for",
"the",
"database",
"import"
] | [
"\"\"\"\n The purpose of this function is to merge genome files (rfamseq, genseq, tblout)\n to release ready files for the database import\n\n project_dir: The path to the project directory. Project directory should be\n in the same structure as the one generated by genome_download pipeline\n upid_li... | [
{
"param": "project_dir",
"type": null
},
{
"param": "upid_list",
"type": null
},
{
"param": "file_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid_list",
"type": null,
"docstring": null,
"docstrin... |
61734c3615f80e0e6a024906a603aa5dbe0a0db0 | Rfam/rfam-production | scripts/support/merge_all_tbl_files.py | [
"Apache-2.0"
] | Python | merge_batch_search_tbls | null | def merge_batch_search_tbls(result_dir, filename = None):
"""
Merges all infernal tbl files produced by a genome_scanner batch search
result_dir: The path to the result directory
return: void
"""
fp_out = open(os.path.join(result_dir, "full_region.tbl"), 'w')
subdirs = [x for x in os.lis... |
Merges all infernal tbl files produced by a genome_scanner batch search
result_dir: The path to the result directory
return: void
| Merges all infernal tbl files produced by a genome_scanner batch search
result_dir: The path to the result directory
void | [
"Merges",
"all",
"infernal",
"tbl",
"files",
"produced",
"by",
"a",
"genome_scanner",
"batch",
"search",
"result_dir",
":",
"The",
"path",
"to",
"the",
"result",
"directory",
"void"
] | def merge_batch_search_tbls(result_dir, filename = None):
fp_out = open(os.path.join(result_dir, "full_region.tbl"), 'w')
subdirs = [x for x in os.listdir(result_dir) if
os.path.isdir(os.path.join(result_dir, x))]
for subdir in subdirs:
subdir_loc = os.path.join(result_dir, subdir)
... | [
"def",
"merge_batch_search_tbls",
"(",
"result_dir",
",",
"filename",
"=",
"None",
")",
":",
"fp_out",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"result_dir",
",",
"\"full_region.tbl\"",
")",
",",
"'w'",
")",
"subdirs",
"=",
"[",
"x",
"for",... | Merges all infernal tbl files produced by a genome_scanner batch search
result_dir: The path to the result directory | [
"Merges",
"all",
"infernal",
"tbl",
"files",
"produced",
"by",
"a",
"genome_scanner",
"batch",
"search",
"result_dir",
":",
"The",
"path",
"to",
"the",
"result",
"directory"
] | [
"\"\"\"\n Merges all infernal tbl files produced by a genome_scanner batch search\n\n result_dir: The path to the result directory\n\n return: void\n \"\"\"",
"# list 24 support subdirs",
"# list umgs dirs",
"# list all tbl files"
] | [
{
"param": "result_dir",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "result_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_... |
b0cc8d212b5bf1ad360ad9b01fcf57d851d67eec | Rfam/rfam-production | scripts/validation/validate_genomes.py | [
"Apache-2.0"
] | Python | check_genome_download_status | <not_specific> | def check_genome_download_status(lsf_out_file):
"""
Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0
"""
infile_fp = open(lsf_out_file, 'r')
st... |
Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0
| Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0 | [
"Opens",
"LSF",
"output",
"file",
"and",
"checks",
"whether",
"the",
"job",
"'",
"s",
"status",
"is",
"success",
"lsf_out_file",
":",
"LSF",
"platform",
"'",
"s",
"output",
"file",
"generated",
"by",
"-",
"o",
"option",
"returns",
":",
"status",
"1",
"if... | def check_genome_download_status(lsf_out_file):
infile_fp = open(lsf_out_file, 'r')
status = False
for line in infile_fp:
if line.find("Success") != -1:
status = True
infile_fp.close()
return status | [
"def",
"check_genome_download_status",
"(",
"lsf_out_file",
")",
":",
"infile_fp",
"=",
"open",
"(",
"lsf_out_file",
",",
"'r'",
")",
"status",
"=",
"False",
"for",
"line",
"in",
"infile_fp",
":",
"if",
"line",
".",
"find",
"(",
"\"Success\"",
")",
"!=",
"... | Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0 | [
"Opens",
"LSF",
"output",
"file",
"and",
"checks",
"whether",
"the",
"job",
"'",
"s",
"status",
"is",
"success",
"lsf_out_file",
":",
"LSF",
"platform",
"'",
"s",
"output",
"file",
"generated",
"by",
"-",
"o",
"option",
"returns",
":",
"status",
"1",
"if... | [
"\"\"\"\n Opens LSF output file and checks whether the job's status is success\n\n lsf_out_file: LSF platform's output file generated by -o option\n returns: status 1 if the download was successful, otherwise 0\n \"\"\""
] | [
{
"param": "lsf_out_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lsf_out_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b0cc8d212b5bf1ad360ad9b01fcf57d851d67eec | Rfam/rfam-production | scripts/validation/validate_genomes.py | [
"Apache-2.0"
] | Python | check_compressed_file | <not_specific> | def check_compressed_file(filename):
"""
Checks if the provided file is in one of the compressed formats
filename: The path to input file
returns: Boolean - True if the file is compressed, False otherwise
"""
magic_dict = {
"\x1f\x8b\x08": "gz",
"\x42\x5a\x68": "bz2",
"... |
Checks if the provided file is in one of the compressed formats
filename: The path to input file
returns: Boolean - True if the file is compressed, False otherwise
| Checks if the provided file is in one of the compressed formats
filename: The path to input file
returns: Boolean - True if the file is compressed, False otherwise | [
"Checks",
"if",
"the",
"provided",
"file",
"is",
"in",
"one",
"of",
"the",
"compressed",
"formats",
"filename",
":",
"The",
"path",
"to",
"input",
"file",
"returns",
":",
"Boolean",
"-",
"True",
"if",
"the",
"file",
"is",
"compressed",
"False",
"otherwise"... | def check_compressed_file(filename):
magic_dict = {
"\x1f\x8b\x08": "gz",
"\x42\x5a\x68": "bz2",
"\x50\x4b\x03\x04": "zip"
}
max_len = max(len(x) for x in magic_dict)
with open(filename) as fp_in:
file_start = fp_in.read(max_len)
for magic, filetype in magic_dict.item... | [
"def",
"check_compressed_file",
"(",
"filename",
")",
":",
"magic_dict",
"=",
"{",
"\"\\x1f\\x8b\\x08\"",
":",
"\"gz\"",
",",
"\"\\x42\\x5a\\x68\"",
":",
"\"bz2\"",
",",
"\"\\x50\\x4b\\x03\\x04\"",
":",
"\"zip\"",
"}",
"max_len",
"=",
"max",
"(",
"len",
"(",
"x"... | Checks if the provided file is in one of the compressed formats
filename: The path to input file
returns: Boolean - True if the file is compressed, False otherwise | [
"Checks",
"if",
"the",
"provided",
"file",
"is",
"in",
"one",
"of",
"the",
"compressed",
"formats",
"filename",
":",
"The",
"path",
"to",
"input",
"file",
"returns",
":",
"Boolean",
"-",
"True",
"if",
"the",
"file",
"is",
"compressed",
"False",
"otherwise"... | [
"\"\"\"\n Checks if the provided file is in one of the compressed formats\n\n filename: The path to input file\n returns: Boolean - True if the file is compressed, False otherwise\n \"\"\"",
"# can also return filetype"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b0cc8d212b5bf1ad360ad9b01fcf57d851d67eec | Rfam/rfam-production | scripts/validation/validate_genomes.py | [
"Apache-2.0"
] | Python | check_wgs_file_exists | <not_specific> | def check_wgs_file_exists(wgs_accession, dest_dir):
"""
Check if a WGS sequence file was copied in the correct location
param wgs_accession: A valid Whole Genome Shotgun accession
return: True if the file exists, False otherwise. Defaults to True
"""
wgs_prefix = wgs_accession[0:6]
wgs_f... |
Check if a WGS sequence file was copied in the correct location
param wgs_accession: A valid Whole Genome Shotgun accession
return: True if the file exists, False otherwise. Defaults to True
| Check if a WGS sequence file was copied in the correct location
param wgs_accession: A valid Whole Genome Shotgun accession
True if the file exists, False otherwise. Defaults to True | [
"Check",
"if",
"a",
"WGS",
"sequence",
"file",
"was",
"copied",
"in",
"the",
"correct",
"location",
"param",
"wgs_accession",
":",
"A",
"valid",
"Whole",
"Genome",
"Shotgun",
"accession",
"True",
"if",
"the",
"file",
"exists",
"False",
"otherwise",
".",
"Def... | def check_wgs_file_exists(wgs_accession, dest_dir):
wgs_prefix = wgs_accession[0:6]
wgs_file_loc = os.path.join(dest_dir,
wgs_prefix + ".fasta.gz")
if not os.path.exists(wgs_file_loc):
return False
return True | [
"def",
"check_wgs_file_exists",
"(",
"wgs_accession",
",",
"dest_dir",
")",
":",
"wgs_prefix",
"=",
"wgs_accession",
"[",
"0",
":",
"6",
"]",
"wgs_file_loc",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"wgs_prefix",
"+",
"\".fasta.gz\"",
")",
... | Check if a WGS sequence file was copied in the correct location
param wgs_accession: A valid Whole Genome Shotgun accession | [
"Check",
"if",
"a",
"WGS",
"sequence",
"file",
"was",
"copied",
"in",
"the",
"correct",
"location",
"param",
"wgs_accession",
":",
"A",
"valid",
"Whole",
"Genome",
"Shotgun",
"accession"
] | [
"\"\"\"\n Check if a WGS sequence file was copied in the correct location\n\n param wgs_accession: A valid Whole Genome Shotgun accession\n\n return: True if the file exists, False otherwise. Defaults to True\n \"\"\""
] | [
{
"param": "wgs_accession",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wgs_accession",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstri... |
b0cc8d212b5bf1ad360ad9b01fcf57d851d67eec | Rfam/rfam-production | scripts/validation/validate_genomes.py | [
"Apache-2.0"
] | Python | check_file_format | <not_specific> | def check_file_format(seq_file):
"""
Performs some sanity checks on the sequence file. Checks if file is
compressed and if not validates the format using esl-seqstat. It will also
check if the sequence file provided is empty or not
seq_file: The path to a valid sequence file
returns: True if fi... |
Performs some sanity checks on the sequence file. Checks if file is
compressed and if not validates the format using esl-seqstat. It will also
check if the sequence file provided is empty or not
seq_file: The path to a valid sequence file
returns: True if file passed validation checks, False other... | Performs some sanity checks on the sequence file. Checks if file is
compressed and if not validates the format using esl-seqstat. It will also
check if the sequence file provided is empty or not
The path to a valid sequence file
returns: True if file passed validation checks, False otherwise | [
"Performs",
"some",
"sanity",
"checks",
"on",
"the",
"sequence",
"file",
".",
"Checks",
"if",
"file",
"is",
"compressed",
"and",
"if",
"not",
"validates",
"the",
"format",
"using",
"esl",
"-",
"seqstat",
".",
"It",
"will",
"also",
"check",
"if",
"the",
"... | def check_file_format(seq_file):
status = True
if seq_file.endswith(".gz"):
if not os.path.exists(seq_file):
return False
else:
return check_compressed_file(seq_file)
elif seq_file.endswith(".fa"):
if not os.path.exists(seq_file):
return False
... | [
"def",
"check_file_format",
"(",
"seq_file",
")",
":",
"status",
"=",
"True",
"if",
"seq_file",
".",
"endswith",
"(",
"\".gz\"",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"seq_file",
")",
":",
"return",
"False",
"else",
":",
"return... | Performs some sanity checks on the sequence file. | [
"Performs",
"some",
"sanity",
"checks",
"on",
"the",
"sequence",
"file",
"."
] | [
"\"\"\"\n Performs some sanity checks on the sequence file. Checks if file is\n compressed and if not validates the format using esl-seqstat. It will also\n check if the sequence file provided is empty or not\n\n seq_file: The path to a valid sequence file\n returns: True if file passed validation ch... | [
{
"param": "seq_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6c7b2d337f9b3a677e6beeea00d377c3c0551bb4 | Rfam/rfam-production | scripts/support/fasta2rfamseq_old.py | [
"Apache-2.0"
] | Python | generate_rfamseq_metadata_from_fasta | null | def generate_rfamseq_metadata_from_fasta(fasta_file, taxid, source, filename=None, to_file=True):
"""
Parses a fasta file and generates rfamseq like matadata using esl-seqstat. The output is in
rfamseq table format.
fasta_file: A valid merged genome fasta (UPXXXXXXXXX.fa)
taxid: A valid genome taxo... |
Parses a fasta file and generates rfamseq like matadata using esl-seqstat. The output is in
rfamseq table format.
fasta_file: A valid merged genome fasta (UPXXXXXXXXX.fa)
taxid: A valid genome taxonomy id
source: The database where the genome was downloaded from
filename: A filename to be used... | Parses a fasta file and generates rfamseq like matadata using esl-seqstat. The output is in
rfamseq table format.
A valid merged genome fasta (UPXXXXXXXXX.fa)
taxid: A valid genome taxonomy id
source: The database where the genome was downloaded from
filename: A filename to be used for the output file. If None, uses f... | [
"Parses",
"a",
"fasta",
"file",
"and",
"generates",
"rfamseq",
"like",
"matadata",
"using",
"esl",
"-",
"seqstat",
".",
"The",
"output",
"is",
"in",
"rfamseq",
"table",
"format",
".",
"A",
"valid",
"merged",
"genome",
"fasta",
"(",
"UPXXXXXXXXX",
".",
"fa"... | def generate_rfamseq_metadata_from_fasta(fasta_file, taxid, source, filename=None, to_file=True):
mol_type = "genomic DNA"
previous_acc = ''
output_fp = None
if to_file is True:
if filename is None:
filename = os.path.basename(fasta_file).partition('.')[0]
destination = os.pa... | [
"def",
"generate_rfamseq_metadata_from_fasta",
"(",
"fasta_file",
",",
"taxid",
",",
"source",
",",
"filename",
"=",
"None",
",",
"to_file",
"=",
"True",
")",
":",
"mol_type",
"=",
"\"genomic DNA\"",
"previous_acc",
"=",
"''",
"output_fp",
"=",
"None",
"if",
"... | Parses a fasta file and generates rfamseq like matadata using esl-seqstat. | [
"Parses",
"a",
"fasta",
"file",
"and",
"generates",
"rfamseq",
"like",
"matadata",
"using",
"esl",
"-",
"seqstat",
"."
] | [
"\"\"\"\n Parses a fasta file and generates rfamseq like matadata using esl-seqstat. The output is in\n rfamseq table format.\n\n fasta_file: A valid merged genome fasta (UPXXXXXXXXX.fa)\n taxid: A valid genome taxonomy id\n source: The database where the genome was downloaded from\n filename: A f... | [
{
"param": "fasta_file",
"type": null
},
{
"param": "taxid",
"type": null
},
{
"param": "source",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "to_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "taxid",
"type": null,
"docstring": null,
"docstring_tok... |
6c7b2d337f9b3a677e6beeea00d377c3c0551bb4 | Rfam/rfam-production | scripts/support/fasta2rfamseq_old.py | [
"Apache-2.0"
] | Python | main | null | def main(project_dir, upid_list, upid_gca_tax_file):
"""
Main function that does some input parsing and calls
generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table
project_dir: The path to a project directory where the genomes are initially
downloaded
upid_list: A file ... |
Main function that does some input parsing and calls
generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table
project_dir: The path to a project directory where the genomes are initially
downloaded
upid_list: A file containing a list of upids for which to generate the .rfamse... | Main function that does some input parsing and calls
generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table
The path to a project directory where the genomes are initially
downloaded
upid_list: A file containing a list of upids for which to generate the .rfamseq
files
upid_gca_tax_file: A json ... | [
"Main",
"function",
"that",
"does",
"some",
"input",
"parsing",
"and",
"calls",
"generate_rfamseq_metadata_from_fasta",
"to",
"generate",
"new",
"entries",
"for",
"rfamseq",
"table",
"The",
"path",
"to",
"a",
"project",
"directory",
"where",
"the",
"genomes",
"are... | def main(project_dir, upid_list, upid_gca_tax_file):
fp = open(upid_gca_tax_file, 'r')
upid_gca_tax_dict = json.load(fp)
fp.close()
fp = open(upid_list, 'r')
upids = [x.strip() for x in fp]
fp.close()
for upid in upids:
subdir = os.path.join(project_dir, upid[-3:])
updir = os... | [
"def",
"main",
"(",
"project_dir",
",",
"upid_list",
",",
"upid_gca_tax_file",
")",
":",
"fp",
"=",
"open",
"(",
"upid_gca_tax_file",
",",
"'r'",
")",
"upid_gca_tax_dict",
"=",
"json",
".",
"load",
"(",
"fp",
")",
"fp",
".",
"close",
"(",
")",
"fp",
"=... | Main function that does some input parsing and calls
generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table | [
"Main",
"function",
"that",
"does",
"some",
"input",
"parsing",
"and",
"calls",
"generate_rfamseq_metadata_from_fasta",
"to",
"generate",
"new",
"entries",
"for",
"rfamseq",
"table"
] | [
"\"\"\"\n Main function that does some input parsing and calls\n generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table\n\n project_dir: The path to a project directory where the genomes are initially\n downloaded\n upid_list: A file containing a list of upids for which to gen... | [
{
"param": "project_dir",
"type": null
},
{
"param": "upid_list",
"type": null
},
{
"param": "upid_gca_tax_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid_list",
"type": null,
"docstring": null,
"docstrin... |
e5986647ce453a04e0b4e4d0ced37f2b122eb642 | Rfam/rfam-production | scripts/export/clanin_file_generator.py | [
"Apache-2.0"
] | Python | generate_clanin_file | null | def generate_clanin_file(dest_dir=None):
"""
Creates a clanin file to be used for clan competition during cmscan
dest_dir: The path to destination directory. Using currect if no
directory provided
returns: void
"""
# create destination directory or use current if not provided
if dest_... |
Creates a clanin file to be used for clan competition during cmscan
dest_dir: The path to destination directory. Using currect if no
directory provided
returns: void
| Creates a clanin file to be used for clan competition during cmscan
dest_dir: The path to destination directory. Using currect if no
directory provided
void | [
"Creates",
"a",
"clanin",
"file",
"to",
"be",
"used",
"for",
"clan",
"competition",
"during",
"cmscan",
"dest_dir",
":",
"The",
"path",
"to",
"destination",
"directory",
".",
"Using",
"currect",
"if",
"no",
"directory",
"provided",
"void"
] | def generate_clanin_file(dest_dir=None):
if dest_dir is None:
dest_dir = os.getcwd()
else:
if not os.path.exists(dest_dir):
os.mkdir(dest_dir)
clan_members = db.fetch_clanin_data()
fp = open(os.path.join(dest_dir, 'Rfam.clanin'), 'w')
for clan in clan_members.keys():
... | [
"def",
"generate_clanin_file",
"(",
"dest_dir",
"=",
"None",
")",
":",
"if",
"dest_dir",
"is",
"None",
":",
"dest_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
"else",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest_dir",
")",
":",
"os",
... | Creates a clanin file to be used for clan competition during cmscan
dest_dir: The path to destination directory. | [
"Creates",
"a",
"clanin",
"file",
"to",
"be",
"used",
"for",
"clan",
"competition",
"during",
"cmscan",
"dest_dir",
":",
"The",
"path",
"to",
"destination",
"directory",
"."
] | [
"\"\"\"\n Creates a clanin file to be used for clan competition during cmscan\n\n dest_dir: The path to destination directory. Using currect if no\n directory provided\n\n returns: void\n \"\"\"",
"# create destination directory or use current if not provided",
"# fetch clan members from the data... | [
{
"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": []
} |
e5986647ce453a04e0b4e4d0ced37f2b122eb642 | Rfam/rfam-production | scripts/export/clanin_file_generator.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(prog="clanin_file_generator.py")
parser.add_argument("--dest-dir", help="Destination directory to store output to")
return parser |
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(prog="clanin_file_generator.py")
parser.add_argument("--dest-dir", help="Destination directory to store output to")
return parser | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"clanin_file_generator.py\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--dest-dir\"",
",",
"help",
"=",
"\"Destination directory to store output to\"",
")... | 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": []
} |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | split_seq_file | null | def split_seq_file(seq_file, size, dest_dir=None):
"""
Splits a fasta sequence file of size X into chunks of specified size using
Bio-Easel's esl-ssplit.pl
seq_file (string): A string representing the path to the sequence file
size (int): An integer specifying the size of the file chunks
dest_d... |
Splits a fasta sequence file of size X into chunks of specified size using
Bio-Easel's esl-ssplit.pl
seq_file (string): A string representing the path to the sequence file
size (int): An integer specifying the size of the file chunks
dest_dir (string): A string representing the path to the output ... | Splits a fasta sequence file of size X into chunks of specified size using
Bio-Easel's esl-ssplit.pl
seq_file (string): A string representing the path to the sequence file
size (int): An integer specifying the size of the file chunks
dest_dir (string): A string representing the path to the output directory | [
"Splits",
"a",
"fasta",
"sequence",
"file",
"of",
"size",
"X",
"into",
"chunks",
"of",
"specified",
"size",
"using",
"Bio",
"-",
"Easel",
"'",
"s",
"esl",
"-",
"ssplit",
".",
"pl",
"seq_file",
"(",
"string",
")",
":",
"A",
"string",
"representing",
"th... | def split_seq_file(seq_file, size, dest_dir=None):
seq_file_size = os.path.getsize(seq_file)
chunks_no = int(math.ceil(seq_file_size / size))
try:
cmd = ''
filename = os.path.basename(seq_file).partition('.')[0]
if dest_dir is None:
cmd = "esl-ssplit.pl -n -r %s %s" % (se... | [
"def",
"split_seq_file",
"(",
"seq_file",
",",
"size",
",",
"dest_dir",
"=",
"None",
")",
":",
"seq_file_size",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"seq_file",
")",
"chunks_no",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"seq_file_size",
"/",
... | Splits a fasta sequence file of size X into chunks of specified size using
Bio-Easel's esl-ssplit.pl | [
"Splits",
"a",
"fasta",
"sequence",
"file",
"of",
"size",
"X",
"into",
"chunks",
"of",
"specified",
"size",
"using",
"Bio",
"-",
"Easel",
"'",
"s",
"esl",
"-",
"ssplit",
".",
"pl"
] | [
"\"\"\"\n Splits a fasta sequence file of size X into chunks of specified size using\n Bio-Easel's esl-ssplit.pl\n\n seq_file (string): A string representing the path to the sequence file\n size (int): An integer specifying the size of the file chunks\n dest_dir (string): A string representing the pa... | [
{
"param": "seq_file",
"type": null
},
{
"param": "size",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": null,
"docstring": null,
"docstring_tokens... |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | extract_job_stats | <not_specific> | def extract_job_stats(lsf_output_file):
"""
Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc.
out_dir: A directory where job .out files have been stored
"""
gen_exec_stats = {}
# op... |
Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc.
out_dir: A directory where job .out files have been stored
| Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc.
A directory where job .out files have been stored | [
"Loops",
"over",
"the",
"out_dir",
"which",
"contains",
"all",
".",
"out",
"LSF",
"job",
"files",
"parses",
"the",
"files",
"and",
"returns",
"job",
"details",
"such",
"as",
"start",
"and",
"end",
"dates",
"max",
"required",
"memory",
"etc",
".",
"A",
"d... | def extract_job_stats(lsf_output_file):
gen_exec_stats = {}
fp = open(os.path.join(input, file), 'r')
content = fp.readlines()
fp.close()
upid = file.partition('.')[0]
stats = {}
for line in content:
if line.find("Started") != -1:
line = line.strip().split(' ')
... | [
"def",
"extract_job_stats",
"(",
"lsf_output_file",
")",
":",
"gen_exec_stats",
"=",
"{",
"}",
"fp",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"input",
",",
"file",
")",
",",
"'r'",
")",
"content",
"=",
"fp",
".",
"readlines",
"(",
")",
... | Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc. | [
"Loops",
"over",
"the",
"out_dir",
"which",
"contains",
"all",
".",
"out",
"LSF",
"job",
"files",
"parses",
"the",
"files",
"and",
"returns",
"job",
"details",
"such",
"as",
"start",
"and",
"end",
"dates",
"max",
"required",
"memory",
"etc",
"."
] | [
"\"\"\"\n Loops over the out_dir which contains all .out LSF job files, parses the files and returns job\n details such as, start and end dates, max required memory etc.\n\n out_dir: A directory where job .out files have been stored\n \"\"\"",
"# open lsf output file and read contents",
"# get refer... | [
{
"param": "lsf_output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lsf_output_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | extract_project_stats | <not_specific> | def extract_project_stats(lsf_output_dir):
"""
Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc.
lsf_output_dir: A directory where job .out files have been stored
"""
all_stats = {}
... |
Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc.
lsf_output_dir: A directory where job .out files have been stored
| Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc.
A directory where job .out files have been stored | [
"Loops",
"over",
"the",
"out_dir",
"which",
"contains",
"all",
".",
"out",
"LSF",
"job",
"files",
"parses",
"the",
"files",
"and",
"returns",
"job",
"details",
"such",
"as",
"start",
"and",
"end",
"dates",
"max",
"required",
"memory",
"etc",
".",
"A",
"d... | def extract_project_stats(lsf_output_dir):
all_stats = {}
output_files = os.listdir(lsf_output_dir)
total_exec_time = 0.0
for output_file in output_files:
job_stats = extract_job_stats(output_file)
upid = job_stats.keys()
total_exec_time = total_exec_time + float(job_stats[upid][... | [
"def",
"extract_project_stats",
"(",
"lsf_output_dir",
")",
":",
"all_stats",
"=",
"{",
"}",
"output_files",
"=",
"os",
".",
"listdir",
"(",
"lsf_output_dir",
")",
"total_exec_time",
"=",
"0.0",
"for",
"output_file",
"in",
"output_files",
":",
"job_stats",
"=",
... | Loops over the out_dir which contains all .out LSF job files, parses the files and returns job
details such as, start and end dates, max required memory etc. | [
"Loops",
"over",
"the",
"out_dir",
"which",
"contains",
"all",
".",
"out",
"LSF",
"job",
"files",
"parses",
"the",
"files",
"and",
"returns",
"job",
"details",
"such",
"as",
"start",
"and",
"end",
"dates",
"max",
"required",
"memory",
"etc",
"."
] | [
"\"\"\"\n Loops over the out_dir which contains all .out LSF job files, parses the files and returns job\n details such as, start and end dates, max required memory etc.\n\n lsf_output_dir: A directory where job .out files have been stored\n \"\"\"",
"# move all files in a single dir and get from ther... | [
{
"param": "lsf_output_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lsf_output_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | index_sequence_file | null | def index_sequence_file(seq_file):
"""
Uses esl-sfetch to index a sequence file. The sequence file must be in
fasta format
seq_file (string): A string representing the path to the sequence file
output: An indexed file X.fa.ssi
returns: void
"""
esl_sfetch = ""
# call command to in... |
Uses esl-sfetch to index a sequence file. The sequence file must be in
fasta format
seq_file (string): A string representing the path to the sequence file
output: An indexed file X.fa.ssi
returns: void
| Uses esl-sfetch to index a sequence file. The sequence file must be in
fasta format
seq_file (string): A string representing the path to the sequence file
An indexed file X.fa.ssi
returns: void | [
"Uses",
"esl",
"-",
"sfetch",
"to",
"index",
"a",
"sequence",
"file",
".",
"The",
"sequence",
"file",
"must",
"be",
"in",
"fasta",
"format",
"seq_file",
"(",
"string",
")",
":",
"A",
"string",
"representing",
"the",
"path",
"to",
"the",
"sequence",
"file... | def index_sequence_file(seq_file):
esl_sfetch = ""
cmd = "esl-sfetch --index %s" % seq_file
subprocess.call(cmd, shell=True) | [
"def",
"index_sequence_file",
"(",
"seq_file",
")",
":",
"esl_sfetch",
"=",
"\"\"",
"cmd",
"=",
"\"esl-sfetch --index %s\"",
"%",
"seq_file",
"subprocess",
".",
"call",
"(",
"cmd",
",",
"shell",
"=",
"True",
")"
] | Uses esl-sfetch to index a sequence file. | [
"Uses",
"esl",
"-",
"sfetch",
"to",
"index",
"a",
"sequence",
"file",
"."
] | [
"\"\"\"\n Uses esl-sfetch to index a sequence file. The sequence file must be in\n fasta format\n\n seq_file (string): A string representing the path to the sequence file\n\n output: An indexed file X.fa.ssi\n returns: void\n \"\"\"",
"# call command to index sequence file"
] | [
{
"param": "seq_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | calculate_genome_size | null | def calculate_genome_size(genome):
"""
Uses Infernal's esl-seqstat to calculate the size of a genome
genome: This can be either a directory containing multiple fasta files or
a single fasta file
returns: The size of the genome as a number of nt
"""
# call count_nucleotides
pass |
Uses Infernal's esl-seqstat to calculate the size of a genome
genome: This can be either a directory containing multiple fasta files or
a single fasta file
returns: The size of the genome as a number of nt
| Uses Infernal's esl-seqstat to calculate the size of a genome
genome: This can be either a directory containing multiple fasta files or
a single fasta file
returns: The size of the genome as a number of nt | [
"Uses",
"Infernal",
"'",
"s",
"esl",
"-",
"seqstat",
"to",
"calculate",
"the",
"size",
"of",
"a",
"genome",
"genome",
":",
"This",
"can",
"be",
"either",
"a",
"directory",
"containing",
"multiple",
"fasta",
"files",
"or",
"a",
"single",
"fasta",
"file",
... | def calculate_genome_size(genome):
pass | [
"def",
"calculate_genome_size",
"(",
"genome",
")",
":",
"pass"
] | Uses Infernal's esl-seqstat to calculate the size of a genome
genome: This can be either a directory containing multiple fasta files or
a single fasta file
returns: The size of the genome as a number of nt | [
"Uses",
"Infernal",
"'",
"s",
"esl",
"-",
"seqstat",
"to",
"calculate",
"the",
"size",
"of",
"a",
"genome",
"genome",
":",
"This",
"can",
"be",
"either",
"a",
"directory",
"containing",
"multiple",
"fasta",
"files",
"or",
"a",
"single",
"fasta",
"file",
... | [
"\"\"\"\n Uses Infernal's esl-seqstat to calculate the size of a genome\n\n genome: This can be either a directory containing multiple fasta files or\n a single fasta file\n returns: The size of the genome as a number of nt\n \"\"\"",
"# call count_nucleotides"
] | [
{
"param": "genome",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "genome",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | count_nucleotides_in_fasta | <not_specific> | def count_nucleotides_in_fasta(fasta_file):
"""
Uses Infernal's esl-seqstat to get the number of nucleotides in a fasta a
given fasta file
param fasta_file (string): A string representing the path to a valid fasta
file
returns (int): The number of nucleotides in the given fasta file
"""
... |
Uses Infernal's esl-seqstat to get the number of nucleotides in a fasta a
given fasta file
param fasta_file (string): A string representing the path to a valid fasta
file
returns (int): The number of nucleotides in the given fasta file
| Uses Infernal's esl-seqstat to get the number of nucleotides in a fasta a
given fasta file
param fasta_file (string): A string representing the path to a valid fasta
file
returns (int): The number of nucleotides in the given fasta file | [
"Uses",
"Infernal",
"'",
"s",
"esl",
"-",
"seqstat",
"to",
"get",
"the",
"number",
"of",
"nucleotides",
"in",
"a",
"fasta",
"a",
"given",
"fasta",
"file",
"param",
"fasta_file",
"(",
"string",
")",
":",
"A",
"string",
"representing",
"the",
"path",
"to",... | def count_nucleotides_in_fasta(fasta_file):
if os.path.exists(fasta_file):
fasta_file_dir = os.path.split(fasta_file)[0]
if fasta_file.endswith(".gz"):
filename = fasta_file.partition('.')[0]
with gzip.open(fasta_file, 'r') as fasta_in, open(os.path.join(fasta_file_dir,
... | [
"def",
"count_nucleotides_in_fasta",
"(",
"fasta_file",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fasta_file",
")",
":",
"fasta_file_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"fasta_file",
")",
"[",
"0",
"]",
"if",
"fasta_file",
".",... | Uses Infernal's esl-seqstat to get the number of nucleotides in a fasta a
given fasta file | [
"Uses",
"Infernal",
"'",
"s",
"esl",
"-",
"seqstat",
"to",
"get",
"the",
"number",
"of",
"nucleotides",
"in",
"a",
"fasta",
"a",
"given",
"fasta",
"file"
] | [
"\"\"\"\n Uses Infernal's esl-seqstat to get the number of nucleotides in a fasta a\n given fasta file\n\n param fasta_file (string): A string representing the path to a valid fasta\n file\n returns (int): The number of nucleotides in the given fasta file\n \"\"\"",
"# some sanity checks",
"# ... | [
{
"param": "fasta_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | calculate_seqdb_size | <not_specific> | def calculate_seqdb_size(project_dir, mb=True):
"""
Loops over all genome directories in the project dir, as organized by
genome_downloader.py and calculates the size of the new seqdb
project_dir (path): The path to the project_dir (result of genome_downloader.py)
mb (boolean): If True convert nucl... |
Loops over all genome directories in the project dir, as organized by
genome_downloader.py and calculates the size of the new seqdb
project_dir (path): The path to the project_dir (result of genome_downloader.py)
mb (boolean): If True convert nucleotides to megabases. Default True
return: The siz... | Loops over all genome directories in the project dir, as organized by
genome_downloader.py and calculates the size of the new seqdb
project_dir (path): The path to the project_dir (result of genome_downloader.py)
mb (boolean): If True convert nucleotides to megabases. Default True
The size of the seqdb (nt) | [
"Loops",
"over",
"all",
"genome",
"directories",
"in",
"the",
"project",
"dir",
"as",
"organized",
"by",
"genome_downloader",
".",
"py",
"and",
"calculates",
"the",
"size",
"of",
"the",
"new",
"seqdb",
"project_dir",
"(",
"path",
")",
":",
"The",
"path",
"... | def calculate_seqdb_size(project_dir, mb=True):
seqdb_size = 0
domain_dirs = [x for x in os.listdir(project_dir)
if os.path.isdir(os.path.join(project_dir, x))]
for domain_dir in domain_dirs:
domain_dir_loc = os.path.join(project_dir, domain_dir)
genome_dirs = os.listdir(d... | [
"def",
"calculate_seqdb_size",
"(",
"project_dir",
",",
"mb",
"=",
"True",
")",
":",
"seqdb_size",
"=",
"0",
"domain_dirs",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"listdir",
"(",
"project_dir",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"o... | Loops over all genome directories in the project dir, as organized by
genome_downloader.py and calculates the size of the new seqdb | [
"Loops",
"over",
"all",
"genome",
"directories",
"in",
"the",
"project",
"dir",
"as",
"organized",
"by",
"genome_downloader",
".",
"py",
"and",
"calculates",
"the",
"size",
"of",
"the",
"new",
"seqdb"
] | [
"\"\"\"\n Loops over all genome directories in the project dir, as organized by\n genome_downloader.py and calculates the size of the new seqdb\n\n project_dir (path): The path to the project_dir (result of genome_downloader.py)\n mb (boolean): If True convert nucleotides to megabases. Default True\n\n ... | [
{
"param": "project_dir",
"type": null
},
{
"param": "mb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mb",
"type": null,
"docstring": null,
"docstring_token... |
0a68a0c9efa943f3169d02ad8c89e5cf76555eea | Rfam/rfam-production | utils/genome_search_utils.py | [
"Apache-2.0"
] | Python | cleanup_illegal_lines_from_fasta | null | def cleanup_illegal_lines_from_fasta(fasta_file, dest_dir=None):
"""
The purpose of this function is to cleanup any illegal lines
from merged genome fasta files. Looks for any illegal characters
in a sequence line and skips those while re-writting the fasta file.
Prints any illegal lines found
... |
The purpose of this function is to cleanup any illegal lines
from merged genome fasta files. Looks for any illegal characters
in a sequence line and skips those while re-writting the fasta file.
Prints any illegal lines found
fasta_file: The path to a fasta file
dest_dir: The path to a directo... | The purpose of this function is to cleanup any illegal lines
from merged genome fasta files. Looks for any illegal characters
in a sequence line and skips those while re-writting the fasta file.
Prints any illegal lines found
The path to a fasta file
dest_dir: The path to a directory where the new fasta will
be create... | [
"The",
"purpose",
"of",
"this",
"function",
"is",
"to",
"cleanup",
"any",
"illegal",
"lines",
"from",
"merged",
"genome",
"fasta",
"files",
".",
"Looks",
"for",
"any",
"illegal",
"characters",
"in",
"a",
"sequence",
"line",
"and",
"skips",
"those",
"while",
... | def cleanup_illegal_lines_from_fasta(fasta_file, dest_dir=None):
regex = re.compile("[^ATKMBVCNSWD-GUYRHatkbbvcnswdguyrh]")
filename = os.path.basename(fasta_file).partition('.')[0]
if dest_dir is None:
dest_dir = os.path.split(fasta_file)[0]
if not os.path.exists(dest_dir):
os.mkdir(des... | [
"def",
"cleanup_illegal_lines_from_fasta",
"(",
"fasta_file",
",",
"dest_dir",
"=",
"None",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"\"[^ATKMBVCNSWD-GUYRHatkbbvcnswdguyrh]\"",
")",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"fasta_file",
... | The purpose of this function is to cleanup any illegal lines
from merged genome fasta files. | [
"The",
"purpose",
"of",
"this",
"function",
"is",
"to",
"cleanup",
"any",
"illegal",
"lines",
"from",
"merged",
"genome",
"fasta",
"files",
"."
] | [
"\"\"\"\n The purpose of this function is to cleanup any illegal lines\n from merged genome fasta files. Looks for any illegal characters\n in a sequence line and skips those while re-writting the fasta file.\n Prints any illegal lines found\n\n fasta_file: The path to a fasta file\n dest_dir: The... | [
{
"param": "fasta_file",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | clan_xml_builder | null | def clan_xml_builder(entries, clan_acc=None):
"""
Expands the Xml4dbDumper object by adding a new clan entry
entries: The xml entries node to be expanded
clan_acc: An Rfam associated clan accession
"""
entry_type = "Clan"
cross_ref_dict = {}
# fetch clan fields
clan_fields =... |
Expands the Xml4dbDumper object by adding a new clan entry
entries: The xml entries node to be expanded
clan_acc: An Rfam associated clan accession
| Expands the Xml4dbDumper object by adding a new clan entry
entries: The xml entries node to be expanded
clan_acc: An Rfam associated clan accession | [
"Expands",
"the",
"Xml4dbDumper",
"object",
"by",
"adding",
"a",
"new",
"clan",
"entry",
"entries",
":",
"The",
"xml",
"entries",
"node",
"to",
"be",
"expanded",
"clan_acc",
":",
"An",
"Rfam",
"associated",
"clan",
"accession"
] | def clan_xml_builder(entries, clan_acc=None):
entry_type = "Clan"
cross_ref_dict = {}
clan_fields = fetch_entry_fields(clan_acc, rs.CLAN)
entry = ET.SubElement(entries, "entry", id=clan_acc)
ET.SubElement(entry, "name").text = clan_fields["name"]
ET.SubElement(entry, "description").text = clan_f... | [
"def",
"clan_xml_builder",
"(",
"entries",
",",
"clan_acc",
"=",
"None",
")",
":",
"entry_type",
"=",
"\"Clan\"",
"cross_ref_dict",
"=",
"{",
"}",
"clan_fields",
"=",
"fetch_entry_fields",
"(",
"clan_acc",
",",
"rs",
".",
"CLAN",
")",
"entry",
"=",
"ET",
"... | Expands the Xml4dbDumper object by adding a new clan entry
entries: The xml entries node to be expanded
clan_acc: An Rfam associated clan accession | [
"Expands",
"the",
"Xml4dbDumper",
"object",
"by",
"adding",
"a",
"new",
"clan",
"entry",
"entries",
":",
"The",
"xml",
"entries",
"node",
"to",
"be",
"expanded",
"clan_acc",
":",
"An",
"Rfam",
"associated",
"clan",
"accession"
] | [
"\"\"\"\n Expands the Xml4dbDumper object by adding a new clan entry\n\n entries: The xml entries node to be expanded\n clan_acc: An Rfam associated clan accession\n \"\"\"",
"# fetch clan fields",
"# add a new clan entry to the xml tree",
"# entry dates - common to motifs and clans",
"# cl... | [
{
"param": "entries",
"type": null
},
{
"param": "clan_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clan_acc",
"type": null,
"docstring": null,
"docstring_tok... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | motif_xml_builder | null | def motif_xml_builder(entries, motif_acc=None):
"""
Expands the Xml4dbDump with a Motif entry
entries: Entries node on xml tree
motif_acc: An Rfam associated motif accession
"""
entry_type = "Motif"
cross_ref_dict = {}
# fetch clan fields
motif_fields = fetch_entry_fields(mot... |
Expands the Xml4dbDump with a Motif entry
entries: Entries node on xml tree
motif_acc: An Rfam associated motif accession
| Expands the Xml4dbDump with a Motif entry
entries: Entries node on xml tree
motif_acc: An Rfam associated motif accession | [
"Expands",
"the",
"Xml4dbDump",
"with",
"a",
"Motif",
"entry",
"entries",
":",
"Entries",
"node",
"on",
"xml",
"tree",
"motif_acc",
":",
"An",
"Rfam",
"associated",
"motif",
"accession"
] | def motif_xml_builder(entries, motif_acc=None):
entry_type = "Motif"
cross_ref_dict = {}
motif_fields = fetch_entry_fields(motif_acc, rs.MOTIF)
entry = ET.SubElement(entries, "entry", id=motif_acc)
ET.SubElement(entry, "name").text = motif_fields["name"]
ET.SubElement(entry, "description").text ... | [
"def",
"motif_xml_builder",
"(",
"entries",
",",
"motif_acc",
"=",
"None",
")",
":",
"entry_type",
"=",
"\"Motif\"",
"cross_ref_dict",
"=",
"{",
"}",
"motif_fields",
"=",
"fetch_entry_fields",
"(",
"motif_acc",
",",
"rs",
".",
"MOTIF",
")",
"entry",
"=",
"ET... | Expands the Xml4dbDump with a Motif entry
entries: Entries node on xml tree
motif_acc: An Rfam associated motif accession | [
"Expands",
"the",
"Xml4dbDump",
"with",
"a",
"Motif",
"entry",
"entries",
":",
"Entries",
"node",
"on",
"xml",
"tree",
"motif_acc",
":",
"An",
"Rfam",
"associated",
"motif",
"accession"
] | [
"\"\"\"\n Expands the Xml4dbDump with a Motif entry\n\n entries: Entries node on xml tree\n motif_acc: An Rfam associated motif accession\n \"\"\"",
"# fetch clan fields",
"# add a new clan entry to the xml tree",
"# entry dates - common to motifs and clans",
"# adding cross references"
] | [
{
"param": "entries",
"type": null
},
{
"param": "motif_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "motif_acc",
"type": null,
"docstring": null,
"docstring_to... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | genome_xml_builder | null | def genome_xml_builder(entries, gen_acc=None):
"""
Expands the Xml4dbDump with a Genome entry
entries: Entries node on xml tree
gen_acc: An Rfam associated motif accession
"""
entry_type = "Genome"
cross_ref_dict = {}
# fetch genome fields
genome_fields = fetch_entry_fields(g... |
Expands the Xml4dbDump with a Genome entry
entries: Entries node on xml tree
gen_acc: An Rfam associated motif accession
| Expands the Xml4dbDump with a Genome entry
entries: Entries node on xml tree
gen_acc: An Rfam associated motif accession | [
"Expands",
"the",
"Xml4dbDump",
"with",
"a",
"Genome",
"entry",
"entries",
":",
"Entries",
"node",
"on",
"xml",
"tree",
"gen_acc",
":",
"An",
"Rfam",
"associated",
"motif",
"accession"
] | def genome_xml_builder(entries, gen_acc=None):
entry_type = "Genome"
cross_ref_dict = {}
genome_fields = fetch_entry_fields(gen_acc, rs.GENOME)
entry = ET.SubElement(entries, "entry", id=gen_acc)
if genome_fields["name"] is not None:
ET.SubElement(entry, "name").text = genome_fields["name"]
... | [
"def",
"genome_xml_builder",
"(",
"entries",
",",
"gen_acc",
"=",
"None",
")",
":",
"entry_type",
"=",
"\"Genome\"",
"cross_ref_dict",
"=",
"{",
"}",
"genome_fields",
"=",
"fetch_entry_fields",
"(",
"gen_acc",
",",
"rs",
".",
"GENOME",
")",
"entry",
"=",
"ET... | Expands the Xml4dbDump with a Genome entry
entries: Entries node on xml tree
gen_acc: An Rfam associated motif accession | [
"Expands",
"the",
"Xml4dbDump",
"with",
"a",
"Genome",
"entry",
"entries",
":",
"Entries",
"node",
"on",
"xml",
"tree",
"gen_acc",
":",
"An",
"Rfam",
"associated",
"motif",
"accession"
] | [
"\"\"\"\n Expands the Xml4dbDump with a Genome entry\n\n entries: Entries node on xml tree\n gen_acc: An Rfam associated motif accession\n \"\"\"",
"# fetch genome fields",
"# add a new genome entry to the xml tree",
"# entry dates - common to motifs and clans",
"# build genome cross referen... | [
{
"param": "entries",
"type": null
},
{
"param": "gen_acc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gen_acc",
"type": null,
"docstring": null,
"docstring_toke... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | result_iterator | null | def result_iterator(cursor, arraysize=1000):
"""
An iterator that uses fetchmany to keep memory usage down
"""
while True:
results = cursor.fetchmany(arraysize)
if not results:
break
for result in results:
yield result |
An iterator that uses fetchmany to keep memory usage down
| An iterator that uses fetchmany to keep memory usage down | [
"An",
"iterator",
"that",
"uses",
"fetchmany",
"to",
"keep",
"memory",
"usage",
"down"
] | def result_iterator(cursor, arraysize=1000):
while True:
results = cursor.fetchmany(arraysize)
if not results:
break
for result in results:
yield result | [
"def",
"result_iterator",
"(",
"cursor",
",",
"arraysize",
"=",
"1000",
")",
":",
"while",
"True",
":",
"results",
"=",
"cursor",
".",
"fetchmany",
"(",
"arraysize",
")",
"if",
"not",
"results",
":",
"break",
"for",
"result",
"in",
"results",
":",
"yield... | An iterator that uses fetchmany to keep memory usage down | [
"An",
"iterator",
"that",
"uses",
"fetchmany",
"to",
"keep",
"memory",
"usage",
"down"
] | [
"\"\"\"\n An iterator that uses fetchmany to keep memory usage down\n \"\"\""
] | [
{
"param": "cursor",
"type": null
},
{
"param": "arraysize",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cursor",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arraysize",
"type": null,
"docstring": null,
"docstring_tok... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | format_full_region | null | def format_full_region(entries, region, genome, chromosome, rnacentral_ids):
"""
Format full regions for a genome. Genome metadata is retrieved only once.
"""
timestamp = datetime.datetime.now().strftime("%d %b %Y")
name = '%s/%s:%s' % (region["rfamseq_acc"], region["seq_start"], region["seq_end"])
... |
Format full regions for a genome. Genome metadata is retrieved only once.
| Format full regions for a genome. Genome metadata is retrieved only once. | [
"Format",
"full",
"regions",
"for",
"a",
"genome",
".",
"Genome",
"metadata",
"is",
"retrieved",
"only",
"once",
"."
] | def format_full_region(entries, region, genome, chromosome, rnacentral_ids):
timestamp = datetime.datetime.now().strftime("%d %b %Y")
name = '%s/%s:%s' % (region["rfamseq_acc"], region["seq_start"], region["seq_end"])
scientific_name = None
if genome is not None:
scientific_name = genome.scienti... | [
"def",
"format_full_region",
"(",
"entries",
",",
"region",
",",
"genome",
",",
"chromosome",
",",
"rnacentral_ids",
")",
":",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
"(",
"\"%d %b %Y\"",
")",
"name",
"=",
"'%s... | Format full regions for a genome. | [
"Format",
"full",
"regions",
"for",
"a",
"genome",
"."
] | [
"\"\"\"\n Format full regions for a genome. Genome metadata is retrieved only once.\n \"\"\"",
"# add a new family entry to the xml tree",
"# additional fields",
"# adding cross references",
"# create cross references dictionary"
] | [
{
"param": "entries",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "genome",
"type": null
},
{
"param": "chromosome",
"type": null
},
{
"param": "rnacentral_ids",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_token... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | full_region_xml_builder | null | def full_region_xml_builder(entries, upid):
"""
Export full region entries for a genome.
entries: Entries node on xml tree
upid: Genome identifier.
"""
tax_id_duplicates = {'562': 1, '1280': 1, '7209': 1, '10679': 1, '10717': 1,
'11021': 1, '11036': 1, '11072': 1, ... |
Export full region entries for a genome.
entries: Entries node on xml tree
upid: Genome identifier.
| Export full region entries for a genome.
entries: Entries node on xml tree
upid: Genome identifier. | [
"Export",
"full",
"region",
"entries",
"for",
"a",
"genome",
".",
"entries",
":",
"Entries",
"node",
"on",
"xml",
"tree",
"upid",
":",
"Genome",
"identifier",
"."
] | def full_region_xml_builder(entries, upid):
tax_id_duplicates = {'562': 1, '1280': 1, '7209': 1, '10679': 1, '10717': 1,
'11021': 1, '11036': 1, '11072': 1, '11082': 1, '11228': 1,
'11636': 1, '11963': 1, '31649': 1, '84589': 1, '90370': 1,
... | [
"def",
"full_region_xml_builder",
"(",
"entries",
",",
"upid",
")",
":",
"tax_id_duplicates",
"=",
"{",
"'562'",
":",
"1",
",",
"'1280'",
":",
"1",
",",
"'7209'",
":",
"1",
",",
"'10679'",
":",
"1",
",",
"'10717'",
":",
"1",
",",
"'11021'",
":",
"1",... | Export full region entries for a genome. | [
"Export",
"full",
"region",
"entries",
"for",
"a",
"genome",
"."
] | [
"\"\"\"\n Export full region entries for a genome.\n\n entries: Entries node on xml tree\n upid: Genome identifier.\n \"\"\"",
"# work on 'full' refions",
"# work on 'seed' regions if not already exported",
"# cursor.execute(rs.FULL_REGION_SEEDS % upid)",
"\"\"\"\n # if one of the cases o... | [
{
"param": "entries",
"type": null
},
{
"param": "upid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid",
"type": null,
"docstring": null,
"docstring_tokens"... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | add_hierarchical_fields | null | def add_hierarchical_fields(xml_tree_node, tax_tree_dict, name_dict):
"""
Expands the cross references xml tree by adding hierarchical references
for the ncbi ids in valid_ncbi_ids
xml_tree_node: An existing xml tree node to expand with hierarchical
fields
tax_tree_dict: Speci... |
Expands the cross references xml tree by adding hierarchical references
for the ncbi ids in valid_ncbi_ids
xml_tree_node: An existing xml tree node to expand with hierarchical
fields
tax_tree_dict: Species taxonomy tree dictionary as generated by
get_family_ta... | Expands the cross references xml tree by adding hierarchical references
for the ncbi ids in valid_ncbi_ids
An existing xml tree node to expand with hierarchical
fields
tax_tree_dict: Species taxonomy tree dictionary as generated by
get_family_tax_tree
name_dict: NCBI's name dictionary as returned by read_ncbi_names_... | [
"Expands",
"the",
"cross",
"references",
"xml",
"tree",
"by",
"adding",
"hierarchical",
"references",
"for",
"the",
"ncbi",
"ids",
"in",
"valid_ncbi_ids",
"An",
"existing",
"xml",
"tree",
"node",
"to",
"expand",
"with",
"hierarchical",
"fields",
"tax_tree_dict",
... | def add_hierarchical_fields(xml_tree_node, tax_tree_dict, name_dict):
for tax_id in tax_tree_dict.keys():
hfields = ET.SubElement(xml_tree_node, "hierarchical_field",
name="taxonomy_lineage")
lineage = tax_tree_dict[tax_id]
tax_tree = lineage[::-1]
for... | [
"def",
"add_hierarchical_fields",
"(",
"xml_tree_node",
",",
"tax_tree_dict",
",",
"name_dict",
")",
":",
"for",
"tax_id",
"in",
"tax_tree_dict",
".",
"keys",
"(",
")",
":",
"hfields",
"=",
"ET",
".",
"SubElement",
"(",
"xml_tree_node",
",",
"\"hierarchical_fiel... | Expands the cross references xml tree by adding hierarchical references
for the ncbi ids in valid_ncbi_ids | [
"Expands",
"the",
"cross",
"references",
"xml",
"tree",
"by",
"adding",
"hierarchical",
"references",
"for",
"the",
"ncbi",
"ids",
"in",
"valid_ncbi_ids"
] | [
"\"\"\"\n Expands the cross references xml tree by adding hierarchical references\n for the ncbi ids in valid_ncbi_ids\n\n xml_tree_node: An existing xml tree node to expand with hierarchical\n fields\n tax_tree_dict: Species taxonomy tree dictionary as generated by\n ... | [
{
"param": "xml_tree_node",
"type": null
},
{
"param": "tax_tree_dict",
"type": null
},
{
"param": "name_dict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "xml_tree_node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tax_tree_dict",
"type": null,
"docstring": null,
"do... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | build_additional_fields | <not_specific> | def build_additional_fields(entry, fields, num_3d_structures, fam_ncbi_ids, entry_type, tax_strings=None):
"""
This function expands the entry xml field with the additional fields
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry wit... |
This function expands the entry xml field with the additional fields
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
| This function expands the entry xml field with the additional fields
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with | [
"This",
"function",
"expands",
"the",
"entry",
"xml",
"field",
"with",
"the",
"additional",
"fields",
"entry",
":",
"This",
"is",
"the",
"xml",
".",
"etree",
".",
"ElementTree",
"at",
"the",
"point",
"of",
"entry",
"fields",
":",
"A",
"list",
"of",
"addi... | def build_additional_fields(entry, fields, num_3d_structures, fam_ncbi_ids, entry_type, tax_strings=None):
add_fields = ET.SubElement(entry, "additional_fields")
ET.SubElement(add_fields, "field", name="entry_type").text = entry_type
authors = fields["author"]
authors = authors.replace(';', ',')
aut... | [
"def",
"build_additional_fields",
"(",
"entry",
",",
"fields",
",",
"num_3d_structures",
",",
"fam_ncbi_ids",
",",
"entry_type",
",",
"tax_strings",
"=",
"None",
")",
":",
"add_fields",
"=",
"ET",
".",
"SubElement",
"(",
"entry",
",",
"\"additional_fields\"",
")... | This function expands the entry xml field with the additional fields
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with | [
"This",
"function",
"expands",
"the",
"entry",
"xml",
"field",
"with",
"the",
"additional",
"fields",
"entry",
":",
"This",
"is",
"the",
"xml",
".",
"etree",
".",
"ElementTree",
"at",
"the",
"point",
"of",
"entry",
"fields",
":",
"A",
"list",
"of",
"addi... | [
"\"\"\"\n This function expands the entry xml field with the additional fields\n\n entry: This is the xml.etree.ElementTree at the point of entry\n fields: A list of additional fields to expand the entry with\n \"\"\"",
"# adding entry type",
"# adding authors",
"# number of species",
"# number... | [
{
"param": "entry",
"type": null
},
{
"param": "fields",
"type": null
},
{
"param": "num_3d_structures",
"type": null
},
{
"param": "fam_ncbi_ids",
"type": null
},
{
"param": "entry_type",
"type": null
},
{
"param": "tax_strings",
"type": null
}
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fields",
"type": null,
"docstring": null,
"docstring_tokens"... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | build_genome_additional_fields | <not_specific> | def build_genome_additional_fields(entry, fields):
"""
Builds additional field nodes for a Genome
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
return: void
"""
# TO DO - Generalize this one by executing a quer... |
Builds additional field nodes for a Genome
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
return: void
| Builds additional field nodes for a Genome
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
void | [
"Builds",
"additional",
"field",
"nodes",
"for",
"a",
"Genome",
"entry",
":",
"This",
"is",
"the",
"xml",
".",
"etree",
".",
"ElementTree",
"at",
"the",
"point",
"of",
"entry",
"fields",
":",
"A",
"list",
"of",
"additional",
"fields",
"to",
"expand",
"th... | def build_genome_additional_fields(entry, fields):
add_fields = ET.SubElement(entry, "additional_fields")
ET.SubElement(add_fields, "field", name="entry_type").text = "Genome"
if fields["assembly_acc"] is None:
ET.SubElement(add_fields, "field", name="gca_accession").text = ''
else:
ET.S... | [
"def",
"build_genome_additional_fields",
"(",
"entry",
",",
"fields",
")",
":",
"add_fields",
"=",
"ET",
".",
"SubElement",
"(",
"entry",
",",
"\"additional_fields\"",
")",
"ET",
".",
"SubElement",
"(",
"add_fields",
",",
"\"field\"",
",",
"name",
"=",
"\"entr... | Builds additional field nodes for a Genome
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with | [
"Builds",
"additional",
"field",
"nodes",
"for",
"a",
"Genome",
"entry",
":",
"This",
"is",
"the",
"xml",
".",
"etree",
".",
"ElementTree",
"at",
"the",
"point",
"of",
"entry",
"fields",
":",
"A",
"list",
"of",
"additional",
"fields",
"to",
"expand",
"th... | [
"\"\"\"\n Builds additional field nodes for a Genome\n\n entry: This is the xml.etree.ElementTree at the point of entry\n fields: A list of additional fields to expand the entry with\n\n return: void\n \"\"\"",
"# TO DO - Generalize this one by executing a query to fetch additional",
"# fields h... | [
{
"param": "entry",
"type": null
},
{
"param": "fields",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fields",
"type": null,
"docstring": null,
"docstring_tokens"... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | build_full_region_additional_fields | <not_specific> | def build_full_region_additional_fields(entry, fields, genome, chromosomes):
"""
Builds additional field nodes for a the full_region xml dump
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
return: void
"""
# TO ... |
Builds additional field nodes for a the full_region xml dump
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
return: void
| Builds additional field nodes for a the full_region xml dump
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
void | [
"Builds",
"additional",
"field",
"nodes",
"for",
"a",
"the",
"full_region",
"xml",
"dump",
"entry",
":",
"This",
"is",
"the",
"xml",
".",
"etree",
".",
"ElementTree",
"at",
"the",
"point",
"of",
"entry",
"fields",
":",
"A",
"list",
"of",
"additional",
"f... | def build_full_region_additional_fields(entry, fields, genome, chromosomes):
add_fields = ET.SubElement(entry, "additional_fields")
tax_string = ''
species = ''
common_name = ''
scientific_name = ''
if genome is not None:
tax_string = genome.ncbi.tax_string
species = genome.ncbi_... | [
"def",
"build_full_region_additional_fields",
"(",
"entry",
",",
"fields",
",",
"genome",
",",
"chromosomes",
")",
":",
"add_fields",
"=",
"ET",
".",
"SubElement",
"(",
"entry",
",",
"\"additional_fields\"",
")",
"tax_string",
"=",
"''",
"species",
"=",
"''",
... | Builds additional field nodes for a the full_region xml dump
entry: This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with | [
"Builds",
"additional",
"field",
"nodes",
"for",
"a",
"the",
"full_region",
"xml",
"dump",
"entry",
":",
"This",
"is",
"the",
"xml",
".",
"etree",
".",
"ElementTree",
"at",
"the",
"point",
"of",
"entry",
"fields",
":",
"A",
"list",
"of",
"additional",
"f... | [
"\"\"\"\n Builds additional field nodes for a the full_region xml dump\n\n entry: This is the xml.etree.ElementTree at the point of entry\n fields: A list of additional fields to expand the entry with\n\n return: void\n \"\"\"",
"# TO DO - Generalize this one by executing a query to fetch addition... | [
{
"param": "entry",
"type": null
},
{
"param": "fields",
"type": null
},
{
"param": "genome",
"type": null
},
{
"param": "chromosomes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fields",
"type": null,
"docstring": null,
"docstring_tokens"... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | fetch_value_list | <not_specific> | def fetch_value_list(rfam_acc, query):
"""
Retrieves and returns a list of all rfam_acc related values, returned
by executing the query. Values in list are converted to string format.
If rfam_acc is None then query is executed without an rfam_acc
rfam_acc: A family specific accession
query: ... |
Retrieves and returns a list of all rfam_acc related values, returned
by executing the query. Values in list are converted to string format.
If rfam_acc is None then query is executed without an rfam_acc
rfam_acc: A family specific accession
query: A string with the MySQL query to be executed
... | Retrieves and returns a list of all rfam_acc related values, returned
by executing the query. Values in list are converted to string format.
If rfam_acc is None then query is executed without an rfam_acc
A family specific accession
query: A string with the MySQL query to be executed | [
"Retrieves",
"and",
"returns",
"a",
"list",
"of",
"all",
"rfam_acc",
"related",
"values",
"returned",
"by",
"executing",
"the",
"query",
".",
"Values",
"in",
"list",
"are",
"converted",
"to",
"string",
"format",
".",
"If",
"rfam_acc",
"is",
"None",
"then",
... | def fetch_value_list(rfam_acc, query):
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
if rfam_acc is None:
cursor.execute(query)
else:
cursor.execute(query % rfam_acc)
values = cursor.fetchall()
cursor.close()
cnx.disconnect()
if len(values) > 0:
if isinstan... | [
"def",
"fetch_value_list",
"(",
"rfam_acc",
",",
"query",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"raw",
"=",
"True",
")",
"if",
"rfam_acc",
"is",
"None",
":",
"cursor",
".",
"execute",
"(",... | Retrieves and returns a list of all rfam_acc related values, returned
by executing the query. | [
"Retrieves",
"and",
"returns",
"a",
"list",
"of",
"all",
"rfam_acc",
"related",
"values",
"returned",
"by",
"executing",
"the",
"query",
"."
] | [
"\"\"\"\n Retrieves and returns a list of all rfam_acc related values, returned\n by executing the query. Values in list are converted to string format.\n If rfam_acc is None then query is executed without an rfam_acc\n\n rfam_acc: A family specific accession\n query: A string with the MySQL query... | [
{
"param": "rfam_acc",
"type": null
},
{
"param": "query",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rfam_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "query",
"type": null,
"docstring": null,
"docstring_token... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | fetch_entry_fields | <not_specific> | def fetch_entry_fields(entry_acc, entry_type):
"""
Returns a dictionary with the entry's fields
entry_acc: An Rfam associated accession (Motif, Clan, Family)
entry_type: The type of the entry accession
"""
# maybe the entry type not required... use rfam_acc[0:2]
cnx = RfamDB.connect()
... |
Returns a dictionary with the entry's fields
entry_acc: An Rfam associated accession (Motif, Clan, Family)
entry_type: The type of the entry accession
| Returns a dictionary with the entry's fields
entry_acc: An Rfam associated accession (Motif, Clan, Family)
entry_type: The type of the entry accession | [
"Returns",
"a",
"dictionary",
"with",
"the",
"entry",
"'",
"s",
"fields",
"entry_acc",
":",
"An",
"Rfam",
"associated",
"accession",
"(",
"Motif",
"Clan",
"Family",
")",
"entry_type",
":",
"The",
"type",
"of",
"the",
"entry",
"accession"
] | def fetch_entry_fields(entry_acc, entry_type):
cnx = RfamDB.connect()
cursor = cnx.cursor(dictionary=True)
entry_type = entry_type[0].capitalize()
fields = None
try:
if entry_type == rs.FAMILY:
cursor.execute(rs.FAM_FIELDS % entry_acc)
elif entry_type == rs.CLAN:
... | [
"def",
"fetch_entry_fields",
"(",
"entry_acc",
",",
"entry_type",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"dictionary",
"=",
"True",
")",
"entry_type",
"=",
"entry_type",
"[",
"0",
"]",
".",
"... | Returns a dictionary with the entry's fields
entry_acc: An Rfam associated accession (Motif, Clan, Family)
entry_type: The type of the entry accession | [
"Returns",
"a",
"dictionary",
"with",
"the",
"entry",
"'",
"s",
"fields",
"entry_acc",
":",
"An",
"Rfam",
"associated",
"accession",
"(",
"Motif",
"Clan",
"Family",
")",
"entry_type",
":",
"The",
"type",
"of",
"the",
"entry",
"accession"
] | [
"\"\"\"\n Returns a dictionary with the entry's fields\n\n entry_acc: An Rfam associated accession (Motif, Clan, Family)\n entry_type: The type of the entry accession\n \"\"\"",
"# maybe the entry type not required... use rfam_acc[0:2]"
] | [
{
"param": "entry_acc",
"type": null
},
{
"param": "entry_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry_acc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry_type",
"type": null,
"docstring": null,
"docstring... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | fetch_value | <not_specific> | def fetch_value(query, accession):
"""
Retrieves and returns a value from the database depending to the query
executed. The query should return a single value
query: The query to be executed in the form of string.
accession: Rfam specific accession (family, clan, motif)
to execute... |
Retrieves and returns a value from the database depending to the query
executed. The query should return a single value
query: The query to be executed in the form of string.
accession: Rfam specific accession (family, clan, motif)
to execute the query on
| Retrieves and returns a value from the database depending to the query
executed. The query should return a single value
The query to be executed in the form of string.
accession: Rfam specific accession (family, clan, motif)
to execute the query on | [
"Retrieves",
"and",
"returns",
"a",
"value",
"from",
"the",
"database",
"depending",
"to",
"the",
"query",
"executed",
".",
"The",
"query",
"should",
"return",
"a",
"single",
"value",
"The",
"query",
"to",
"be",
"executed",
"in",
"the",
"form",
"of",
"stri... | def fetch_value(query, accession):
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
if accession is not None:
cursor.execute(query % accession)
else:
cursor.execute(query)
value = cursor.fetchall()
cursor.close()
cnx.disconnect()
if len(value) > 0:
return valu... | [
"def",
"fetch_value",
"(",
"query",
",",
"accession",
")",
":",
"cnx",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"cnx",
".",
"cursor",
"(",
"raw",
"=",
"True",
")",
"if",
"accession",
"is",
"not",
"None",
":",
"cursor",
".",
"execute",
... | Retrieves and returns a value from the database depending to the query
executed. | [
"Retrieves",
"and",
"returns",
"a",
"value",
"from",
"the",
"database",
"depending",
"to",
"the",
"query",
"executed",
"."
] | [
"\"\"\"\n Retrieves and returns a value from the database depending to the query\n executed. The query should return a single value\n\n query: The query to be executed in the form of string.\n accession: Rfam specific accession (family, clan, motif)\n to execute the query on\n \"\"\"... | [
{
"param": "query",
"type": null
},
{
"param": "accession",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "accession",
"type": null,
"docstring": null,
"docstring_toke... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | main | <not_specific> | def main(entry_type, rfam_acc, outdir, hfields=False):
"""
This function puts everything together
entry_type: One of the three entry types in Rfam (Motif, Clan, Family)
rfam_acc: An Rfam associated accession (RF*,CL*,RM*). If rfam_acc is set
to None, then all data related to the entry typ... |
This function puts everything together
entry_type: One of the three entry types in Rfam (Motif, Clan, Family)
rfam_acc: An Rfam associated accession (RF*,CL*,RM*). If rfam_acc is set
to None, then all data related to the entry type will be
exported
hfields: A flag (True/Fal... | This function puts everything together
entry_type: One of the three entry types in Rfam (Motif, Clan, Family)
rfam_acc: An Rfam associated accession (RF*,CL*,RM*). If rfam_acc is set
to None, then all data related to the entry type will be
exported
hfields: A flag (True/False) indicating whether to add hierarchical
fie... | [
"This",
"function",
"puts",
"everything",
"together",
"entry_type",
":",
"One",
"of",
"the",
"three",
"entry",
"types",
"in",
"Rfam",
"(",
"Motif",
"Clan",
"Family",
")",
"rfam_acc",
":",
"An",
"Rfam",
"associated",
"accession",
"(",
"RF",
"*",
"CL",
"*",
... | def main(entry_type, rfam_acc, outdir, hfields=False):
rfam_accs = None
entry = ""
name_object = {}
name_dict = {}
try:
if not os.path.exists(outdir):
try:
os.mkdir(outdir)
except:
print "Error creating output directory at: ", outdir
... | [
"def",
"main",
"(",
"entry_type",
",",
"rfam_acc",
",",
"outdir",
",",
"hfields",
"=",
"False",
")",
":",
"rfam_accs",
"=",
"None",
"entry",
"=",
"\"\"",
"name_object",
"=",
"{",
"}",
"name_dict",
"=",
"{",
"}",
"try",
":",
"if",
"not",
"os",
".",
... | This function puts everything together
entry_type: One of the three entry types in Rfam (Motif, Clan, Family)
rfam_acc: An Rfam associated accession (RF*,CL*,RM*). | [
"This",
"function",
"puts",
"everything",
"together",
"entry_type",
":",
"One",
"of",
"the",
"three",
"entry",
"types",
"in",
"Rfam",
"(",
"Motif",
"Clan",
"Family",
")",
"rfam_acc",
":",
"An",
"Rfam",
"associated",
"accession",
"(",
"RF",
"*",
"CL",
"*",
... | [
"\"\"\"\n This function puts everything together\n\n entry_type: One of the three entry types in Rfam (Motif, Clan, Family)\n rfam_acc: An Rfam associated accession (RF*,CL*,RM*). If rfam_acc is set\n to None, then all data related to the entry type will be\n exported\n hfields... | [
{
"param": "entry_type",
"type": null
},
{
"param": "rfam_acc",
"type": null
},
{
"param": "outdir",
"type": null
},
{
"param": "hfields",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry_type",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rfam_acc",
"type": null,
"docstring": null,
"docstring_... |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | xmllint | null | def xmllint(filepath):
"""
Validate xml files against EBI Search schema.
Run xmllint on the output file and print the resulting report.
"""
schema_url = 'http://www.ebi.ac.uk/ebisearch/XML4dbDumps.xsd'
cmd = ('xmllint {filepath} --schema {schema_url} --noout --stream') \
.format(filepath... |
Validate xml files against EBI Search schema.
Run xmllint on the output file and print the resulting report.
| Validate xml files against EBI Search schema.
Run xmllint on the output file and print the resulting report. | [
"Validate",
"xml",
"files",
"against",
"EBI",
"Search",
"schema",
".",
"Run",
"xmllint",
"on",
"the",
"output",
"file",
"and",
"print",
"the",
"resulting",
"report",
"."
] | def xmllint(filepath):
schema_url = 'http://www.ebi.ac.uk/ebisearch/XML4dbDumps.xsd'
cmd = ('xmllint {filepath} --schema {schema_url} --noout --stream') \
.format(filepath=filepath, schema_url=schema_url)
try:
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
ex... | [
"def",
"xmllint",
"(",
"filepath",
")",
":",
"schema_url",
"=",
"'http://www.ebi.ac.uk/ebisearch/XML4dbDumps.xsd'",
"cmd",
"=",
"(",
"'xmllint {filepath} --schema {schema_url} --noout --stream'",
")",
".",
"format",
"(",
"filepath",
"=",
"filepath",
",",
"schema_url",
"="... | Validate xml files against EBI Search schema. | [
"Validate",
"xml",
"files",
"against",
"EBI",
"Search",
"schema",
"."
] | [
"\"\"\"\n Validate xml files against EBI Search schema.\n Run xmllint on the output file and print the resulting report.\n \"\"\""
] | [
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
194c74bad52de4108058b9b8f936ff55ad06b802 | Rfam/rfam-production | scripts/export/rfam_xml_dumper.py | [
"Apache-2.0"
] | Python | usage | <not_specific> | def usage():
"""
Parses arguments and displays usage information on screen
"""
parser = argparse.ArgumentParser(
description="Rfam Search Xml4db Dumper.", epilog='')
# group required arguments together
req_args = parser.add_argument_group("required arguments")
req_args.add_argumen... |
Parses arguments and displays usage information on screen
| Parses arguments and displays usage information on screen | [
"Parses",
"arguments",
"and",
"displays",
"usage",
"information",
"on",
"screen"
] | def usage():
parser = argparse.ArgumentParser(
description="Rfam Search Xml4db Dumper.", epilog='')
req_args = parser.add_argument_group("required arguments")
req_args.add_argument("--type", help="rfam entry type (F: Family, M: Motif, C: Clan, G: Genome, R: Regions)",
type=... | [
"def",
"usage",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Rfam Search Xml4db Dumper.\"",
",",
"epilog",
"=",
"''",
")",
"req_args",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"required arguments\"",
")",
"... | Parses arguments and displays usage information on screen | [
"Parses",
"arguments",
"and",
"displays",
"usage",
"information",
"on",
"screen"
] | [
"\"\"\"\n Parses arguments and displays usage information on screen\n \"\"\"",
"# group required arguments together"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7e9e0e6977455f7e968b93a753fb73a847fe4bac | Rfam/rfam-production | scripts/export/fasta_file_generator.py | [
"Apache-2.0"
] | Python | generate_fasta | null | def generate_fasta(seq_file, out_dir):
"""
Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source (e.g. rfamseq11.fa). It will generate fasta
files for all families by default
seq_file: The path to rfamseq input file in fasta format, for
... |
Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source (e.g. rfamseq11.fa). It will generate fasta
files for all families by default
seq_file: The path to rfamseq input file in fasta format, for
generating the fasta files
out_dir: ... | Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source . It will generate fasta
files for all families by default
The path to rfamseq input file in fasta format, for
generating the fasta files
Destination directory where the files will be
generated | [
"Uses",
"esl",
"-",
"sfetch",
"to",
"generate",
"family",
"specific",
"fasta",
"files",
"out",
"of",
"seq_file",
"which",
"is",
"provided",
"as",
"source",
".",
"It",
"will",
"generate",
"fasta",
"files",
"for",
"all",
"families",
"by",
"default",
"The",
"... | def generate_fasta(seq_file, out_dir):
sequence = ''
fp_out = None
seq_bits = None
log_file = os.path.join(out_dir, "missing_seqs.log")
logging.basicConfig(
filename=log_file, filemode='w', level=logging.INFO)
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
query = ("SELECT ... | [
"def",
"generate_fasta",
"(",
"seq_file",
",",
"out_dir",
")",
":",
"sequence",
"=",
"''",
"fp_out",
"=",
"None",
"seq_bits",
"=",
"None",
"log_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"missing_seqs.log\"",
")",
"logging",
".",
... | Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source (e.g. | [
"Uses",
"esl",
"-",
"sfetch",
"to",
"generate",
"family",
"specific",
"fasta",
"files",
"out",
"of",
"seq_file",
"which",
"is",
"provided",
"as",
"source",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"\n Uses esl-sfetch to generate family specific fasta files out of seq_file\n which is provided as source (e.g. rfamseq11.fa). It will generate fasta\n files for all families by default\n\n seq_file: The path to rfamseq input file in fasta format, for\n generating the fasta files\... | [
{
"param": "seq_file",
"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": "out_dir",
"type": null,
"docstring": null,
"docstring_tok... |
7e9e0e6977455f7e968b93a753fb73a847fe4bac | Rfam/rfam-production | scripts/export/fasta_file_generator.py | [
"Apache-2.0"
] | Python | generate_fasta_single | null | def generate_fasta_single(seq_file, rfam_acc, out_dir):
"""
Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source. Works on single family based on rfam_acc.
Files are generated in a compressed .fa.gz format
seq_file: This is the the path to rfamseq in... |
Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source. Works on single family based on rfam_acc.
Files are generated in a compressed .fa.gz format
seq_file: This is the the path to rfamseq input file in fasta format,
for generating the fa... | Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source. Works on single family based on rfam_acc.
Files are generated in a compressed .fa.gz format
This is the the path to rfamseq input file in fasta format,
for generating the fasta files
The rfam_acc of a specific family
... | [
"Uses",
"esl",
"-",
"sfetch",
"to",
"generate",
"family",
"specific",
"fasta",
"files",
"out",
"of",
"seq_file",
"which",
"is",
"provided",
"as",
"source",
".",
"Works",
"on",
"single",
"family",
"based",
"on",
"rfam_acc",
".",
"Files",
"are",
"generated",
... | def generate_fasta_single(seq_file, rfam_acc, out_dir):
sequence = ''
fp_out = None
seq_bits = None
log_file = os.path.join(out_dir, rfam_acc + ".log")
logging.basicConfig(
filename=log_file, filemode='w', level=logging.INFO)
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
q... | [
"def",
"generate_fasta_single",
"(",
"seq_file",
",",
"rfam_acc",
",",
"out_dir",
")",
":",
"sequence",
"=",
"''",
"fp_out",
"=",
"None",
"seq_bits",
"=",
"None",
"log_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"rfam_acc",
"+",
"\".... | Uses esl-sfetch to generate family specific fasta files out of seq_file
which is provided as source. | [
"Uses",
"esl",
"-",
"sfetch",
"to",
"generate",
"family",
"specific",
"fasta",
"files",
"out",
"of",
"seq_file",
"which",
"is",
"provided",
"as",
"source",
"."
] | [
"\"\"\"\n Uses esl-sfetch to generate family specific fasta files out of seq_file\n which is provided as source. Works on single family based on rfam_acc.\n Files are generated in a compressed .fa.gz format\n\n seq_file: This is the the path to rfamseq input file in fasta format,\n for ... | [
{
"param": "seq_file",
"type": null
},
{
"param": "rfam_acc",
"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... |
7e9e0e6977455f7e968b93a753fb73a847fe4bac | Rfam/rfam-production | scripts/export/fasta_file_generator.py | [
"Apache-2.0"
] | Python | seq_validator | <not_specific> | def seq_validator(sequence):
"""
Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False.
sequence: A string for validation
"""
# checks for ascii characters that should not appear in a fasta sequence
seq_val = re.compile(r"[.... |
Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False.
sequence: A string for validation
| Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False.
A string for validation | [
"Checks",
"if",
"the",
"sequence",
"provided",
"is",
"valid",
"fasta",
"sequence",
".",
"Returns",
"True",
"if",
"the",
"sequence",
"is",
"valid",
"otherwise",
"returns",
"False",
".",
"A",
"string",
"for",
"validation"
] | def seq_validator(sequence):
seq_val = re.compile(r"[.-@|\s| -)|z-~|Z-`|EFIJLOPQX|efijlopqx+,]+")
if seq_val.search(sequence) is None:
return True
return False | [
"def",
"seq_validator",
"(",
"sequence",
")",
":",
"seq_val",
"=",
"re",
".",
"compile",
"(",
"r\"[.-@|\\s| -)|z-~|Z-`|EFIJLOPQX|efijlopqx+,]+\"",
")",
"if",
"seq_val",
".",
"search",
"(",
"sequence",
")",
"is",
"None",
":",
"return",
"True",
"return",
"False"
] | Checks if the sequence provided is valid fasta sequence. | [
"Checks",
"if",
"the",
"sequence",
"provided",
"is",
"valid",
"fasta",
"sequence",
"."
] | [
"\"\"\"\n Checks if the sequence provided is valid fasta sequence. Returns True\n if the sequence is valid, otherwise returns False.\n\n sequence: A string for validation\n \"\"\"",
"# checks for ascii characters that should not appear in a fasta sequence"
] | [
{
"param": "sequence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
baf075924c1e9c89cc1e4dca06b231d8d6b1fa13 | Rfam/rfam-production | pdb_mapping/pdb_families.py | [
"Apache-2.0"
] | Python | list_new_families | null | def list_new_families():
"""
List new families with 3D structures
"""
conn = RfamDB.connect()
cursor = conn.cursor()
new_families_query = ("SELECT DISTINCT rfam_acc, pdb_id "
"FROM pdb_full_region "
"WHERE is_significant = 1 "
... |
List new families with 3D structures
| List new families with 3D structures | [
"List",
"new",
"families",
"with",
"3D",
"structures"
] | def list_new_families():
conn = RfamDB.connect()
cursor = conn.cursor()
new_families_query = ("SELECT DISTINCT rfam_acc, pdb_id "
"FROM pdb_full_region "
"WHERE is_significant = 1 "
"AND rfam_acc NOT IN "
... | [
"def",
"list_new_families",
"(",
")",
":",
"conn",
"=",
"RfamDB",
".",
"connect",
"(",
")",
"cursor",
"=",
"conn",
".",
"cursor",
"(",
")",
"new_families_query",
"=",
"(",
"\"SELECT DISTINCT rfam_acc, pdb_id \"",
"\"FROM pdb_full_region \"",
"\"WHERE is_significant = ... | List new families with 3D structures | [
"List",
"new",
"families",
"with",
"3D",
"structures"
] | [
"\"\"\"\n List new families with 3D structures\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6fb50cd8b66d6ad9a019ccc42dc3222eb6dbeee8 | Rfam/rfam-production | scripts/validation/genome_download_validator.py | [
"Apache-2.0"
] | Python | domain_download_validator | <not_specific> | def domain_download_validator(domain_dir, filename=None):
"""
Lists all proteome directories in dest_dir and creates a list
of the genomes that were not downloaded successfully. If filename
is provided then the Upids will be listed in filename.list
domain_dir: Destination directory, could be one of... |
Lists all proteome directories in dest_dir and creates a list
of the genomes that were not downloaded successfully. If filename
is provided then the Upids will be listed in filename.list
domain_dir: Destination directory, could be one of the four domains
filename: A filename for the UPID list/ val... | Lists all proteome directories in dest_dir and creates a list
of the genomes that were not downloaded successfully. If filename
is provided then the Upids will be listed in filename.list
Destination directory, could be one of the four domains
filename: A filename for the UPID list/ validation report
returns: None if f... | [
"Lists",
"all",
"proteome",
"directories",
"in",
"dest_dir",
"and",
"creates",
"a",
"list",
"of",
"the",
"genomes",
"that",
"were",
"not",
"downloaded",
"successfully",
".",
"If",
"filename",
"is",
"provided",
"then",
"the",
"Upids",
"will",
"be",
"listed",
... | def domain_download_validator(domain_dir, filename=None):
recovery_list = []
updirs = os.listdir(domain_dir)
for updir in updirs:
lsf_output_file = os.path.join(domain_dir, os.path.join(updir, "download.out"))
status = check_genome_download_status(lsf_output_file)
if status == 0:
... | [
"def",
"domain_download_validator",
"(",
"domain_dir",
",",
"filename",
"=",
"None",
")",
":",
"recovery_list",
"=",
"[",
"]",
"updirs",
"=",
"os",
".",
"listdir",
"(",
"domain_dir",
")",
"for",
"updir",
"in",
"updirs",
":",
"lsf_output_file",
"=",
"os",
"... | Lists all proteome directories in dest_dir and creates a list
of the genomes that were not downloaded successfully. | [
"Lists",
"all",
"proteome",
"directories",
"in",
"dest_dir",
"and",
"creates",
"a",
"list",
"of",
"the",
"genomes",
"that",
"were",
"not",
"downloaded",
"successfully",
"."
] | [
"\"\"\"\n Lists all proteome directories in dest_dir and creates a list\n of the genomes that were not downloaded successfully. If filename\n is provided then the Upids will be listed in filename.list\n\n domain_dir: Destination directory, could be one of the four domains\n filename: A filename for t... | [
{
"param": "domain_dir",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "domain_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_... |
6fb50cd8b66d6ad9a019ccc42dc3222eb6dbeee8 | Rfam/rfam-production | scripts/validation/genome_download_validator.py | [
"Apache-2.0"
] | Python | check_genome_download_status | <not_specific> | def check_genome_download_status(lsf_out_file, keyword):
"""
Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
keyword: A string to look for in the file (e.g. Success)
returns: status 1 if the keyword was found, oth... |
Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
keyword: A string to look for in the file (e.g. Success)
returns: status 1 if the keyword was found, otherwise 0
| Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
keyword: A string to look for in the file
status 1 if the keyword was found, otherwise 0 | [
"Opens",
"LSF",
"output",
"file",
"and",
"checks",
"whether",
"the",
"job",
"'",
"s",
"status",
"is",
"success",
"lsf_out_file",
":",
"LSF",
"platform",
"'",
"s",
"output",
"file",
"generated",
"by",
"-",
"o",
"option",
"keyword",
":",
"A",
"string",
"to... | def check_genome_download_status(lsf_out_file, keyword):
infile_fp = open(lsf_out_file, 'r')
status = False
for line in infile_fp:
if line.find(keyword) != -1:
status = True
infile_fp.close()
return status | [
"def",
"check_genome_download_status",
"(",
"lsf_out_file",
",",
"keyword",
")",
":",
"infile_fp",
"=",
"open",
"(",
"lsf_out_file",
",",
"'r'",
")",
"status",
"=",
"False",
"for",
"line",
"in",
"infile_fp",
":",
"if",
"line",
".",
"find",
"(",
"keyword",
... | Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
keyword: A string to look for in the file (e.g. | [
"Opens",
"LSF",
"output",
"file",
"and",
"checks",
"whether",
"the",
"job",
"'",
"s",
"status",
"is",
"success",
"lsf_out_file",
":",
"LSF",
"platform",
"'",
"s",
"output",
"file",
"generated",
"by",
"-",
"o",
"option",
"keyword",
":",
"A",
"string",
"to... | [
"\"\"\"\n Opens LSF output file and checks whether the job's status is success\n\n lsf_out_file: LSF platform's output file generated by -o option\n keyword: A string to look for in the file (e.g. Success)\n\n returns: status 1 if the keyword was found, otherwise 0\n \"\"\""
] | [
{
"param": "lsf_out_file",
"type": null
},
{
"param": "keyword",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lsf_out_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keyword",
"type": null,
"docstring": null,
"docstring... |
6fb50cd8b66d6ad9a019ccc42dc3222eb6dbeee8 | Rfam/rfam-production | scripts/validation/genome_download_validator.py | [
"Apache-2.0"
] | Python | project_download_validator | null | def project_download_validator(project_dir, id_pairs_file=None, filename=None):
"""
Loops over a genome download project directory and reports all the upids
that need to be recovered
project_dir: Destination directory of genome download pipeline
id_pairs_file: A json file with all the UPids of the ... |
Loops over a genome download project directory and reports all the upids
that need to be recovered
project_dir: Destination directory of genome download pipeline
id_pairs_file: A json file with all the UPids of the corresponding
Uniprot's release. If None simply reports a list of UPIds
filenam... | Loops over a genome download project directory and reports all the upids
that need to be recovered
Destination directory of genome download pipeline
id_pairs_file: A json file with all the UPids of the corresponding
Uniprot's release. If None simply reports a list of UPIds
filename: A name for the output file. "recove... | [
"Loops",
"over",
"a",
"genome",
"download",
"project",
"directory",
"and",
"reports",
"all",
"the",
"upids",
"that",
"need",
"to",
"be",
"recovered",
"Destination",
"directory",
"of",
"genome",
"download",
"pipeline",
"id_pairs_file",
":",
"A",
"json",
"file",
... | def project_download_validator(project_dir, id_pairs_file=None, filename=None):
upids_to_recover = []
sub_dirs = [x for x in os.listdir(project_dir) if x in gc.DOMAINS]
for sub_dir in sub_dirs:
domain_dir_path = os.path.join(project_dir, sub_dir)
upids_to_recover.extend(domain_download_valid... | [
"def",
"project_download_validator",
"(",
"project_dir",
",",
"id_pairs_file",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"upids_to_recover",
"=",
"[",
"]",
"sub_dirs",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"listdir",
"(",
"project_dir",
")... | Loops over a genome download project directory and reports all the upids
that need to be recovered | [
"Loops",
"over",
"a",
"genome",
"download",
"project",
"directory",
"and",
"reports",
"all",
"the",
"upids",
"that",
"need",
"to",
"be",
"recovered"
] | [
"\"\"\"\n Loops over a genome download project directory and reports all the upids\n that need to be recovered\n\n project_dir: Destination directory of genome download pipeline\n id_pairs_file: A json file with all the UPids of the corresponding\n Uniprot's release. If None simply reports a list of ... | [
{
"param": "project_dir",
"type": null
},
{
"param": "id_pairs_file",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id_pairs_file",
"type": null,
"docstring": null,
"docs... |
6fb50cd8b66d6ad9a019ccc42dc3222eb6dbeee8 | Rfam/rfam-production | scripts/validation/genome_download_validator.py | [
"Apache-2.0"
] | Python | check_all_genome_files_exist | null | def check_all_genome_files_exist(project_dir, upid_gca_file=None):
"""
This function will extract all accessions per genome and check that all files
exist. A json file will be generated with all missing accessions so that they
can be downloaded using restore_gen_download. It reports download status for
... |
This function will extract all accessions per genome and check that all files
exist. A json file will be generated with all missing accessions so that they
can be downloaded using restore_gen_download. It reports download status for
all domain subdirectories and mark it as "Success" or "Failure". In ca... | This function will extract all accessions per genome and check that all files
exist. A json file will be generated with all missing accessions so that they
can be downloaded using restore_gen_download. It reports download status for
all domain subdirectories and mark it as "Success" or "Failure". In case of
failure it ... | [
"This",
"function",
"will",
"extract",
"all",
"accessions",
"per",
"genome",
"and",
"check",
"that",
"all",
"files",
"exist",
".",
"A",
"json",
"file",
"will",
"be",
"generated",
"with",
"all",
"missing",
"accessions",
"so",
"that",
"they",
"can",
"be",
"d... | def check_all_genome_files_exist(project_dir, upid_gca_file=None):
domain_dirs = [x for x in os.listdir(project_dir) if x in gc.DOMAINS]
upid_gca_pairs = None
if upid_gca_file is None:
upid_gca_fp = open(os.path.join(project_dir, "upid_gca_dict.json"), 'r')
upid_gca_pairs = json.load(upid_gc... | [
"def",
"check_all_genome_files_exist",
"(",
"project_dir",
",",
"upid_gca_file",
"=",
"None",
")",
":",
"domain_dirs",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"listdir",
"(",
"project_dir",
")",
"if",
"x",
"in",
"gc",
".",
"DOMAINS",
"]",
"upid_gca_pai... | This function will extract all accessions per genome and check that all files
exist. | [
"This",
"function",
"will",
"extract",
"all",
"accessions",
"per",
"genome",
"and",
"check",
"that",
"all",
"files",
"exist",
"."
] | [
"\"\"\"\n This function will extract all accessions per genome and check that all files\n exist. A json file will be generated with all missing accessions so that they\n can be downloaded using restore_gen_download. It reports download status for\n all domain subdirectories and mark it as \"Success\" or... | [
{
"param": "project_dir",
"type": null
},
{
"param": "upid_gca_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid_gca_file",
"type": null,
"docstring": null,
"docs... |
6fb50cd8b66d6ad9a019ccc42dc3222eb6dbeee8 | Rfam/rfam-production | scripts/validation/genome_download_validator.py | [
"Apache-2.0"
] | Python | validate_domain_dir | <not_specific> | def validate_domain_dir(domain_dir, out_file=True):
"""
Validate sequence files downloaded in domain directory
domain_dir: The path to a domain directory
out_file: If True this one will generate an json file with all erroneous
files per upid that we need to download again.
return: A dict with ... |
Validate sequence files downloaded in domain directory
domain_dir: The path to a domain directory
out_file: If True this one will generate an json file with all erroneous
files per upid that we need to download again.
return: A dict with all erroneous accessions in the format {upid: [acc1,...]}
... | Validate sequence files downloaded in domain directory
domain_dir: The path to a domain directory
out_file: If True this one will generate an json file with all erroneous
files per upid that we need to download again.
A dict with all erroneous accessions in the format {upid: [acc1,...]} | [
"Validate",
"sequence",
"files",
"downloaded",
"in",
"domain",
"directory",
"domain_dir",
":",
"The",
"path",
"to",
"a",
"domain",
"directory",
"out_file",
":",
"If",
"True",
"this",
"one",
"will",
"generate",
"an",
"json",
"file",
"with",
"all",
"erroneous",
... | def validate_domain_dir(domain_dir, out_file=True):
domain_err_accs = {}
upids = [x for x in os.listdir(domain_dir)
if os.path.isdir(os.path.join(domain_dir, x))]
for upid in upids:
upid_err_accs = []
upid_dir = os.path.join(domain_dir, upid)
seq_files = [x for x in os.l... | [
"def",
"validate_domain_dir",
"(",
"domain_dir",
",",
"out_file",
"=",
"True",
")",
":",
"domain_err_accs",
"=",
"{",
"}",
"upids",
"=",
"[",
"x",
"for",
"x",
"in",
"os",
".",
"listdir",
"(",
"domain_dir",
")",
"if",
"os",
".",
"path",
".",
"isdir",
... | Validate sequence files downloaded in domain directory
domain_dir: The path to a domain directory
out_file: If True this one will generate an json file with all erroneous
files per upid that we need to download again. | [
"Validate",
"sequence",
"files",
"downloaded",
"in",
"domain",
"directory",
"domain_dir",
":",
"The",
"path",
"to",
"a",
"domain",
"directory",
"out_file",
":",
"If",
"True",
"this",
"one",
"will",
"generate",
"an",
"json",
"file",
"with",
"all",
"erroneous",
... | [
"\"\"\"\n Validate sequence files downloaded in domain directory\n\n domain_dir: The path to a domain directory\n out_file: If True this one will generate an json file with all erroneous\n files per upid that we need to download again.\n\n return: A dict with all erroneous accessions in the format {u... | [
{
"param": "domain_dir",
"type": null
},
{
"param": "out_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "domain_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out_file",
"type": null,
"docstring": null,
"docstring_... |
6fb50cd8b66d6ad9a019ccc42dc3222eb6dbeee8 | Rfam/rfam-production | scripts/validation/genome_download_validator.py | [
"Apache-2.0"
] | Python | check_luigi_worker_status | <not_specific> | def check_luigi_worker_status(err_file):
"""
Parse the lsf err file and look for a report of failed tasks
lsf_err_file: The path to a valid lsf err file
return: True if success, False otherwise
"""
err_file_fp = open(err_file, 'r')
for line in err_file:
if line.find("failed tasks... |
Parse the lsf err file and look for a report of failed tasks
lsf_err_file: The path to a valid lsf err file
return: True if success, False otherwise
| Parse the lsf err file and look for a report of failed tasks
lsf_err_file: The path to a valid lsf err file
True if success, False otherwise | [
"Parse",
"the",
"lsf",
"err",
"file",
"and",
"look",
"for",
"a",
"report",
"of",
"failed",
"tasks",
"lsf_err_file",
":",
"The",
"path",
"to",
"a",
"valid",
"lsf",
"err",
"file",
"True",
"if",
"success",
"False",
"otherwise"
] | def check_luigi_worker_status(err_file):
err_file_fp = open(err_file, 'r')
for line in err_file:
if line.find("failed tasks") != -1:
err_file_fp.close()
return False
err_file_fp.close()
return True | [
"def",
"check_luigi_worker_status",
"(",
"err_file",
")",
":",
"err_file_fp",
"=",
"open",
"(",
"err_file",
",",
"'r'",
")",
"for",
"line",
"in",
"err_file",
":",
"if",
"line",
".",
"find",
"(",
"\"failed tasks\"",
")",
"!=",
"-",
"1",
":",
"err_file_fp",
... | Parse the lsf err file and look for a report of failed tasks
lsf_err_file: The path to a valid lsf err file | [
"Parse",
"the",
"lsf",
"err",
"file",
"and",
"look",
"for",
"a",
"report",
"of",
"failed",
"tasks",
"lsf_err_file",
":",
"The",
"path",
"to",
"a",
"valid",
"lsf",
"err",
"file"
] | [
"\"\"\"\n Parse the lsf err file and look for a report of failed tasks\n\n lsf_err_file: The path to a valid lsf err file\n\n return: True if success, False otherwise\n \"\"\""
] | [
{
"param": "err_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "err_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af5db7e2698c2bd69fe6c745f42d35b4fadc48d2 | Rfam/rfam-production | scripts/support/restore_genome.py | [
"Apache-2.0"
] | Python | redownload_genome_from_gca_report | null | def redownload_genome_from_gca_report(updir, gca_report_file):
"""
Re-downloads a genome using the GCA report file located in
the upid directory
return:
"""
if not os.path.exists(updir):
os.mkdir(updir)
fp = open(gca_report_file, 'r')
# parse and store accessions in a list
... |
Re-downloads a genome using the GCA report file located in
the upid directory
return:
| Re-downloads a genome using the GCA report file located in
the upid directory
| [
"Re",
"-",
"downloads",
"a",
"genome",
"using",
"the",
"GCA",
"report",
"file",
"located",
"in",
"the",
"upid",
"directory"
] | def redownload_genome_from_gca_report(updir, gca_report_file):
if not os.path.exists(updir):
os.mkdir(updir)
fp = open(gca_report_file, 'r')
accessions = [x.strip().split('\t')[0] for x in fp]
fp.close()
accessions.pop(0)
seq_dir = os.path.join(updir, "sequences")
if not os.path.exis... | [
"def",
"redownload_genome_from_gca_report",
"(",
"updir",
",",
"gca_report_file",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"updir",
")",
":",
"os",
".",
"mkdir",
"(",
"updir",
")",
"fp",
"=",
"open",
"(",
"gca_report_file",
",",
"'r'... | Re-downloads a genome using the GCA report file located in
the upid directory | [
"Re",
"-",
"downloads",
"a",
"genome",
"using",
"the",
"GCA",
"report",
"file",
"located",
"in",
"the",
"upid",
"directory"
] | [
"\"\"\"\n Re-downloads a genome using the GCA report file located in\n the upid directory\n\n return:\n \"\"\"",
"# parse and store accessions in a list",
"# remove GCA report header",
"# create directory or clean up old download"
] | [
{
"param": "updir",
"type": null
},
{
"param": "gca_report_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "updir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gca_report_file",
"type": null,
"docstring": null,
"docstrin... |
af5db7e2698c2bd69fe6c745f42d35b4fadc48d2 | Rfam/rfam-production | scripts/support/restore_genome.py | [
"Apache-2.0"
] | Python | redownload_genome_from_uniprot_json | null | def redownload_genome_from_uniprot_json(updir, upid_accession_file):
"""
Re-downloads a genome using the upid_accessions.json file
located in the upid directory
return:
"""
if not os.path.exists(updir):
os.mkdir(updir)
fp = open(upid_accession_file, 'r')
acc_dict = json.load(f... |
Re-downloads a genome using the upid_accessions.json file
located in the upid directory
return:
| Re-downloads a genome using the upid_accessions.json file
located in the upid directory
| [
"Re",
"-",
"downloads",
"a",
"genome",
"using",
"the",
"upid_accessions",
".",
"json",
"file",
"located",
"in",
"the",
"upid",
"directory"
] | def redownload_genome_from_uniprot_json(updir, upid_accession_file):
if not os.path.exists(updir):
os.mkdir(updir)
fp = open(upid_accession_file, 'r')
acc_dict = json.load(fp)
fp.close()
accessions = acc_dict["OTHER"].values()
seq_dir = os.path.join(updir, "sequences")
if not os.pat... | [
"def",
"redownload_genome_from_uniprot_json",
"(",
"updir",
",",
"upid_accession_file",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"updir",
")",
":",
"os",
".",
"mkdir",
"(",
"updir",
")",
"fp",
"=",
"open",
"(",
"upid_accession_file",
"... | Re-downloads a genome using the upid_accessions.json file
located in the upid directory | [
"Re",
"-",
"downloads",
"a",
"genome",
"using",
"the",
"upid_accessions",
".",
"json",
"file",
"located",
"in",
"the",
"upid",
"directory"
] | [
"\"\"\"\n Re-downloads a genome using the upid_accessions.json file\n located in the upid directory\n\n return:\n \"\"\"",
"# parse and store accessions in a list",
"# create directory or clean up old download"
] | [
{
"param": "updir",
"type": null
},
{
"param": "upid_accession_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "updir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid_accession_file",
"type": null,
"docstring": null,
"docs... |
240915a3d1efc66948af17dbbe71897539c13853 | Rfam/rfam-production | scripts/support/mirnas/precompute.py | [
"Apache-2.0"
] | Python | launch_new_rfsearch | null | def launch_new_rfsearch(family_dir, cpu=4):
"""
Launches a new LSF job
family_dir: The location of a valid family directory
cpus: Number of CPUs to use per thread
return: void
"""
lsf_err_file = os.path.join(family_dir, "auto_rfsearch.err")
lsf_out_file = os.path.join(family_dir, "aut... |
Launches a new LSF job
family_dir: The location of a valid family directory
cpus: Number of CPUs to use per thread
return: void
| Launches a new LSF job
family_dir: The location of a valid family directory
cpus: Number of CPUs to use per thread
void | [
"Launches",
"a",
"new",
"LSF",
"job",
"family_dir",
":",
"The",
"location",
"of",
"a",
"valid",
"family",
"directory",
"cpus",
":",
"Number",
"of",
"CPUs",
"to",
"use",
"per",
"thread",
"void"
] | def launch_new_rfsearch(family_dir, cpu=4):
lsf_err_file = os.path.join(family_dir, "auto_rfsearch.err")
lsf_out_file = os.path.join(family_dir, "auto_rfsearch.out")
job_name = os.path.basename(family_dir)
cmd = ''
if os.path.exists(os.path.join(family_dir, "DESC")) is False:
cmd = ("bsub -M... | [
"def",
"launch_new_rfsearch",
"(",
"family_dir",
",",
"cpu",
"=",
"4",
")",
":",
"lsf_err_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"family_dir",
",",
"\"auto_rfsearch.err\"",
")",
"lsf_out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"family_di... | Launches a new LSF job
family_dir: The location of a valid family directory
cpus: Number of CPUs to use per thread | [
"Launches",
"a",
"new",
"LSF",
"job",
"family_dir",
":",
"The",
"location",
"of",
"a",
"valid",
"family",
"directory",
"cpus",
":",
"Number",
"of",
"CPUs",
"to",
"use",
"per",
"thread"
] | [
"\"\"\"\n Launches a new LSF job\n\n family_dir: The location of a valid family directory\n cpus: Number of CPUs to use per thread\n\n return: void\n \"\"\"",
"# LSF command to be executed",
"# call command",
"#print (cmd % (MEMORY, lsf_out_file, lsf_err_file, cpu, LSF_GROUP, job_name, family_d... | [
{
"param": "family_dir",
"type": null
},
{
"param": "cpu",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "family_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cpu",
"type": null,
"docstring": null,
"docstring_token... |
d1397c678dd66c00c83d9a0d460a94fe5e5f9d2b | Rfam/rfam-production | scripts/support/populate_region_md5s.py | [
"Apache-2.0"
] | Python | fetch_sequence | <not_specific> | def fetch_sequence(seq_file, seq_acc, seq_start, seq_end, type='seed'):
"""
Extracts a sequence from sequence file seq_file using rfamseq_acc
and sequence start-end positions (seq_start, seq_end)
rfam_seed_file: A sequence file in fasta format to extract a sequence from
seq_acc: The accession of the... |
Extracts a sequence from sequence file seq_file using rfamseq_acc
and sequence start-end positions (seq_start, seq_end)
rfam_seed_file: A sequence file in fasta format to extract a sequence from
seq_acc: The accession of the sequence to extract
seq_start: The starting position of the sequence/subse... | Extracts a sequence from sequence file seq_file using rfamseq_acc
and sequence start-end positions (seq_start, seq_end)
rfam_seed_file: A sequence file in fasta format to extract a sequence from
seq_acc: The accession of the sequence to extract
seq_start: The starting position of the sequence/subsequence
seq_end: The e... | [
"Extracts",
"a",
"sequence",
"from",
"sequence",
"file",
"seq_file",
"using",
"rfamseq_acc",
"and",
"sequence",
"start",
"-",
"end",
"positions",
"(",
"seq_start",
"seq_end",
")",
"rfam_seed_file",
":",
"A",
"sequence",
"file",
"in",
"fasta",
"format",
"to",
"... | def fetch_sequence(seq_file, seq_acc, seq_start, seq_end, type='seed'):
cmd = ''
if type == 'seed':
cmd = "esl-sfetch %s %s/%s-%s" % (seq_file, str(seq_acc),
str(seq_start), str(seq_end))
elif type == 'full':
cmd = "esl-sfetch -c %s..%s %s %s" % (str(seq_start), str(se... | [
"def",
"fetch_sequence",
"(",
"seq_file",
",",
"seq_acc",
",",
"seq_start",
",",
"seq_end",
",",
"type",
"=",
"'seed'",
")",
":",
"cmd",
"=",
"''",
"if",
"type",
"==",
"'seed'",
":",
"cmd",
"=",
"\"esl-sfetch %s %s/%s-%s\"",
"%",
"(",
"seq_file",
",",
"s... | Extracts a sequence from sequence file seq_file using rfamseq_acc
and sequence start-end positions (seq_start, seq_end)
rfam_seed_file: A sequence file in fasta format to extract a sequence from
seq_acc: The accession of the sequence to extract
seq_start: The starting position of the sequence/subsequence
seq_end: The e... | [
"Extracts",
"a",
"sequence",
"from",
"sequence",
"file",
"seq_file",
"using",
"rfamseq_acc",
"and",
"sequence",
"start",
"-",
"end",
"positions",
"(",
"seq_start",
"seq_end",
")",
"rfam_seed_file",
":",
"A",
"sequence",
"file",
"in",
"fasta",
"format",
"to",
"... | [
"\"\"\"\n Extracts a sequence from sequence file seq_file using rfamseq_acc\n and sequence start-end positions (seq_start, seq_end)\n rfam_seed_file: A sequence file in fasta format to extract a sequence from\n seq_acc: The accession of the sequence to extract\n seq_start: The starting position of th... | [
{
"param": "seq_file",
"type": null
},
{
"param": "seq_acc",
"type": null
},
{
"param": "seq_start",
"type": null
},
{
"param": "seq_end",
"type": null
},
{
"param": "type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq_acc",
"type": null,
"docstring": null,
"docstring_tok... |
d1397c678dd66c00c83d9a0d460a94fe5e5f9d2b | Rfam/rfam-production | scripts/support/populate_region_md5s.py | [
"Apache-2.0"
] | Python | generate_md5s_and_populate_table | null | def generate_md5s_and_populate_table(seq_file, type = "seed", dest_dir = None):
"""
Fetches seed of full regions from the database and populates/updates the
appropriate table with the md5s of the corresponding ncRNA sequences.
seq_file: This can be the Rfam.seed file (seed) or an Rfamseq file (full)
... |
Fetches seed of full regions from the database and populates/updates the
appropriate table with the md5s of the corresponding ncRNA sequences.
seq_file: This can be the Rfam.seed file (seed) or an Rfamseq file (full)
type: one of seed/full
return: void
| Fetches seed of full regions from the database and populates/updates the
appropriate table with the md5s of the corresponding ncRNA sequences.
This can be the Rfam.seed file or an Rfamseq file (full)
type: one of seed/full
void | [
"Fetches",
"seed",
"of",
"full",
"regions",
"from",
"the",
"database",
"and",
"populates",
"/",
"updates",
"the",
"appropriate",
"table",
"with",
"the",
"md5s",
"of",
"the",
"corresponding",
"ncRNA",
"sequences",
".",
"This",
"can",
"be",
"the",
"Rfam",
".",... | def generate_md5s_and_populate_table(seq_file, type = "seed", dest_dir = None):
if dest_dir is None:
dest_dir = os.path.split(seq_file)[0]
region_rows = None
if type == "seed":
region_rows = sr.fetch_seed_regions()
elif type == "full":
region_rows = db.fetch_metagenomic_regions()... | [
"def",
"generate_md5s_and_populate_table",
"(",
"seq_file",
",",
"type",
"=",
"\"seed\"",
",",
"dest_dir",
"=",
"None",
")",
":",
"if",
"dest_dir",
"is",
"None",
":",
"dest_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"seq_file",
")",
"[",
"0",
"]",
... | Fetches seed of full regions from the database and populates/updates the
appropriate table with the md5s of the corresponding ncRNA sequences. | [
"Fetches",
"seed",
"of",
"full",
"regions",
"from",
"the",
"database",
"and",
"populates",
"/",
"updates",
"the",
"appropriate",
"table",
"with",
"the",
"md5s",
"of",
"the",
"corresponding",
"ncRNA",
"sequences",
"."
] | [
"\"\"\"\n Fetches seed of full regions from the database and populates/updates the\n appropriate table with the md5s of the corresponding ncRNA sequences.\n\n seq_file: This can be the Rfam.seed file (seed) or an Rfamseq file (full)\n type: one of seed/full\n\n return: void\n \"\"\"",
"# extract... | [
{
"param": "seq_file",
"type": null
},
{
"param": "type",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": null,
"docstring": null,
"docstring_tokens... |
2a8f29eecaa67b5e46ab3803074560ae224d2682 | Rfam/rfam-production | scripts/support/genseq_to_rfamseq.py | [
"Apache-2.0"
] | Python | convert_genseq_to_rfamseq | null | def convert_genseq_to_rfamseq(genseq_dump):
"""
Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: This can be a directory or a genseq .json file
return: void
"""
if os.path.isfile(genseq_dump):
rfamseq_entries = genseq_file_to_rfamseq(genseq_dump)
... |
Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: This can be a directory or a genseq .json file
return: void
| Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: This can be a directory or a genseq .json file
void | [
"Loads",
"genseq",
"json",
"object",
"and",
"generates",
"a",
"rfamseq",
"dump",
"in",
"txt",
"format",
"genseq_dump",
":",
"This",
"can",
"be",
"a",
"directory",
"or",
"a",
"genseq",
".",
"json",
"file",
"void"
] | def convert_genseq_to_rfamseq(genseq_dump):
if os.path.isfile(genseq_dump):
rfamseq_entries = genseq_file_to_rfamseq(genseq_dump)
for entry in rfamseq_entries:
print '\t'.join(entry)
elif os.path.isdir(genseq_dump):
json_files = os.listdir(genseq_dump)
for json_file i... | [
"def",
"convert_genseq_to_rfamseq",
"(",
"genseq_dump",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"genseq_dump",
")",
":",
"rfamseq_entries",
"=",
"genseq_file_to_rfamseq",
"(",
"genseq_dump",
")",
"for",
"entry",
"in",
"rfamseq_entries",
":",
"prin... | Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: This can be a directory or a genseq .json file | [
"Loads",
"genseq",
"json",
"object",
"and",
"generates",
"a",
"rfamseq",
"dump",
"in",
"txt",
"format",
"genseq_dump",
":",
"This",
"can",
"be",
"a",
"directory",
"or",
"a",
"genseq",
".",
"json",
"file"
] | [
"\"\"\"\n Loads genseq json object and generates a rfamseq dump in txt format\n\n genseq_dump: This can be a directory or a genseq .json file\n\n return: void\n \"\"\""
] | [
{
"param": "genseq_dump",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "genseq_dump",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2a8f29eecaa67b5e46ab3803074560ae224d2682 | Rfam/rfam-production | scripts/support/genseq_to_rfamseq.py | [
"Apache-2.0"
] | Python | genseq_file_to_rfamseq | <not_specific> | def genseq_file_to_rfamseq(genseq_json_dump):
"""
Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: A genseq .json file generated from metadata export
return: void
"""
genseq_fp = open(genseq_json_dump, 'r')
genseq_entries = json.load(genseq_fp)
rfamseq... |
Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: A genseq .json file generated from metadata export
return: void
| Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: A genseq .json file generated from metadata export
void | [
"Loads",
"genseq",
"json",
"object",
"and",
"generates",
"a",
"rfamseq",
"dump",
"in",
"txt",
"format",
"genseq_dump",
":",
"A",
"genseq",
".",
"json",
"file",
"generated",
"from",
"metadata",
"export",
"void"
] | def genseq_file_to_rfamseq(genseq_json_dump):
genseq_fp = open(genseq_json_dump, 'r')
genseq_entries = json.load(genseq_fp)
rfamseq_entries = []
for genseq_dict in genseq_entries:
fields = genseq_dict["fields"]
genseq_fp.close()
rfamseq_acc = genseq_dict["pk"]
rfamseq_att... | [
"def",
"genseq_file_to_rfamseq",
"(",
"genseq_json_dump",
")",
":",
"genseq_fp",
"=",
"open",
"(",
"genseq_json_dump",
",",
"'r'",
")",
"genseq_entries",
"=",
"json",
".",
"load",
"(",
"genseq_fp",
")",
"rfamseq_entries",
"=",
"[",
"]",
"for",
"genseq_dict",
"... | Loads genseq json object and generates a rfamseq dump in txt format
genseq_dump: A genseq .json file generated from metadata export | [
"Loads",
"genseq",
"json",
"object",
"and",
"generates",
"a",
"rfamseq",
"dump",
"in",
"txt",
"format",
"genseq_dump",
":",
"A",
"genseq",
".",
"json",
"file",
"generated",
"from",
"metadata",
"export"
] | [
"\"\"\"\n Loads genseq json object and generates a rfamseq dump in txt format\n\n genseq_dump: A genseq .json file generated from metadata export\n\n return: void\n \"\"\"",
"# get fields",
"# initializing list with pk",
"# ncbi_id",
"# setting mol_type to other RNA for all new sequneces",
"#... | [
{
"param": "genseq_json_dump",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "genseq_json_dump",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44ef2fdcefc8c1eb2b7d005b961c1e82757f32da | Rfam/rfam-production | scripts/export/fasta_export.py | [
"Apache-2.0"
] | Python | export_sequences | null | def export_sequences(seq_db, sql, filename=None, out_dir=None):
"""
Exporting sequences from rfam_live and generating a fasta file
by fetching the corresponding regions from seq_db provided as param
seq_db: A fasta sequence database to extract sequence regions from.
Default seq_db i... |
Exporting sequences from rfam_live and generating a fasta file
by fetching the corresponding regions from seq_db provided as param
seq_db: A fasta sequence database to extract sequence regions from.
Default seq_db is rfamseq11.fa
sql: The query to execute (string or valid .s... | Exporting sequences from rfam_live and generating a fasta file
by fetching the corresponding regions from seq_db provided as param
A fasta sequence database to extract sequence regions from.
Default seq_db is rfamseq11.fa
sql: The query to execute (string or valid .sql file)
filename: Ouput filename
out_dir: ... | [
"Exporting",
"sequences",
"from",
"rfam_live",
"and",
"generating",
"a",
"fasta",
"file",
"by",
"fetching",
"the",
"corresponding",
"regions",
"from",
"seq_db",
"provided",
"as",
"param",
"A",
"fasta",
"sequence",
"database",
"to",
"extract",
"sequence",
"regions"... | def export_sequences(seq_db, sql, filename=None, out_dir=None):
log_file = os.path.join(out_dir, "missing_seqs.log")
logging.basicConfig(
filename=log_file, filemode='w', level=logging.INFO)
cnx = RfamDB.connect()
cursor = cnx.cursor(raw=True)
query = ''
if os.path.isfile(sql):
f... | [
"def",
"export_sequences",
"(",
"seq_db",
",",
"sql",
",",
"filename",
"=",
"None",
",",
"out_dir",
"=",
"None",
")",
":",
"log_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"missing_seqs.log\"",
")",
"logging",
".",
"basicConfig",
"... | Exporting sequences from rfam_live and generating a fasta file
by fetching the corresponding regions from seq_db provided as param | [
"Exporting",
"sequences",
"from",
"rfam_live",
"and",
"generating",
"a",
"fasta",
"file",
"by",
"fetching",
"the",
"corresponding",
"regions",
"from",
"seq_db",
"provided",
"as",
"param"
] | [
"\"\"\"\n Exporting sequences from rfam_live and generating a fasta file\n by fetching the corresponding regions from seq_db provided as param\n\n seq_db: A fasta sequence database to extract sequence regions from.\n Default seq_db is rfamseq11.fa\n sql: The query to execute (s... | [
{
"param": "seq_db",
"type": null
},
{
"param": "sql",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "out_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_db",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sql",
"type": null,
"docstring": null,
"docstring_tokens": ... |
44ef2fdcefc8c1eb2b7d005b961c1e82757f32da | Rfam/rfam-production | scripts/export/fasta_export.py | [
"Apache-2.0"
] | Python | seq_validator | <not_specific> | def seq_validator(sequence):
"""
Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False
sequence: A string for validation
"""
# checks for ascii characters that should not appear in a fasta sequence
seq_val = re.compile(r"[... |
Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False
sequence: A string for validation
| Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False
A string for validation | [
"Checks",
"if",
"the",
"sequence",
"provided",
"is",
"valid",
"fasta",
"sequence",
".",
"Returns",
"True",
"if",
"the",
"sequence",
"is",
"valid",
"otherwise",
"returns",
"False",
"A",
"string",
"for",
"validation"
] | def seq_validator(sequence):
seq_val = re.compile(r"[.-@|\s| -)|z-~|Z-`|EFIJLOPQX|efijlopqx+,]+")
if(seq_val.search(sequence) is None):
return True
return False | [
"def",
"seq_validator",
"(",
"sequence",
")",
":",
"seq_val",
"=",
"re",
".",
"compile",
"(",
"r\"[.-@|\\s| -)|z-~|Z-`|EFIJLOPQX|efijlopqx+,]+\"",
")",
"if",
"(",
"seq_val",
".",
"search",
"(",
"sequence",
")",
"is",
"None",
")",
":",
"return",
"True",
"return... | Checks if the sequence provided is valid fasta sequence. | [
"Checks",
"if",
"the",
"sequence",
"provided",
"is",
"valid",
"fasta",
"sequence",
"."
] | [
"\"\"\"\n Checks if the sequence provided is valid fasta sequence. Returns True\n if the sequence is valid, otherwise returns False\n\n sequence: A string for validation\n \"\"\"",
"# checks for ascii characters that should not appear in a fasta sequence"
] | [
{
"param": "sequence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44ef2fdcefc8c1eb2b7d005b961c1e82757f32da | Rfam/rfam-production | scripts/export/fasta_export.py | [
"Apache-2.0"
] | Python | usage | <not_specific> | def usage():
"""
Parses arguments and displays usage information on screen
"""
parser = argparse.ArgumentParser(
description="Rfam fasta export tool", epilog='')
# group required arguments together
req_args = parser.add_argument_group("required arguments")
req_args.add_argument("-... |
Parses arguments and displays usage information on screen
| Parses arguments and displays usage information on screen | [
"Parses",
"arguments",
"and",
"displays",
"usage",
"information",
"on",
"screen"
] | def usage():
parser = argparse.ArgumentParser(
description="Rfam fasta export tool", epilog='')
req_args = parser.add_argument_group("required arguments")
req_args.add_argument("--sql", help="query to execute (string or .sql file)",
type=str, required=True)
parser.add_a... | [
"def",
"usage",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Rfam fasta export tool\"",
",",
"epilog",
"=",
"''",
")",
"req_args",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"required arguments\"",
")",
"req_... | Parses arguments and displays usage information on screen | [
"Parses",
"arguments",
"and",
"displays",
"usage",
"information",
"on",
"screen"
] | [
"\"\"\"\n Parses arguments and displays usage information on screen\n \"\"\"",
"# group required arguments together"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9bdd053838f196af7932d5177cee1b9ee548af83 | Rfam/rfam-production | scripts/emerge/precompute_emerge.py | [
"Apache-2.0"
] | Python | parse_input_file | null | def parse_input_file(filename):
"""
Read input data and standardise sequences and names.
Example input is provided in `example.tsv`.
"""
skipped = {
'length': 0,
'in_rfam': 0,
}
MIN_LENGTH = 50
with open(filename, 'r') as tsv:
reader = csv.DictReader(tsv, delimite... |
Read input data and standardise sequences and names.
Example input is provided in `example.tsv`.
| Read input data and standardise sequences and names.
Example input is provided in `example.tsv`. | [
"Read",
"input",
"data",
"and",
"standardise",
"sequences",
"and",
"names",
".",
"Example",
"input",
"is",
"provided",
"in",
"`",
"example",
".",
"tsv",
"`",
"."
] | def parse_input_file(filename):
skipped = {
'length': 0,
'in_rfam': 0,
}
MIN_LENGTH = 50
with open(filename, 'r') as tsv:
reader = csv.DictReader(tsv, delimiter='\t')
for row in reader:
sequence = row['Sequence (RNA or DNA)'].replace('-', '').replace('.','').u... | [
"def",
"parse_input_file",
"(",
"filename",
")",
":",
"skipped",
"=",
"{",
"'length'",
":",
"0",
",",
"'in_rfam'",
":",
"0",
",",
"}",
"MIN_LENGTH",
"=",
"50",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"tsv",
":",
"reader",
"=",
"csv",
... | Read input data and standardise sequences and names. | [
"Read",
"input",
"data",
"and",
"standardise",
"sequences",
"and",
"names",
"."
] | [
"\"\"\"\n Read input data and standardise sequences and names.\n Example input is provided in `example.tsv`.\n \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9bdd053838f196af7932d5177cee1b9ee548af83 | Rfam/rfam-production | scripts/emerge/precompute_emerge.py | [
"Apache-2.0"
] | Python | run | null | def run(args):
"""
* create FASTA file
* predict secondary structure
* make SEED
* launch rfsearch
"""
for rna in parse_input_file(args.inputfile):
folder = '%s_%s' % (rna['row_id'], rna['name'])
rna_dir = os.path.join(args.destination, folder)
if not os.path.exists(r... |
* create FASTA file
* predict secondary structure
* make SEED
* launch rfsearch
| create FASTA file
predict secondary structure
make SEED
launch rfsearch | [
"create",
"FASTA",
"file",
"predict",
"secondary",
"structure",
"make",
"SEED",
"launch",
"rfsearch"
] | def run(args):
for rna in parse_input_file(args.inputfile):
folder = '%s_%s' % (rna['row_id'], rna['name'])
rna_dir = os.path.join(args.destination, folder)
if not os.path.exists(rna_dir):
os.mkdir(rna_dir)
else:
overlap = os.path.join(rna_dir, 'overlap')
... | [
"def",
"run",
"(",
"args",
")",
":",
"for",
"rna",
"in",
"parse_input_file",
"(",
"args",
".",
"inputfile",
")",
":",
"folder",
"=",
"'%s_%s'",
"%",
"(",
"rna",
"[",
"'row_id'",
"]",
",",
"rna",
"[",
"'name'",
"]",
")",
"rna_dir",
"=",
"os",
".",
... | create FASTA file
predict secondary structure
make SEED
launch rfsearch | [
"create",
"FASTA",
"file",
"predict",
"secondary",
"structure",
"make",
"SEED",
"launch",
"rfsearch"
] | [
"\"\"\"\n * create FASTA file\n * predict secondary structure\n * make SEED\n * launch rfsearch\n \"\"\""
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c5965d529f4ca9d642a258b17d22f7f953c1b5 | Rfam/rfam-production | scripts/release/database_file_selector.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()
parser.add_argument("--source-dir", help="Source directory containing a mysqldump database dump",
action="store")
parser.... |
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()
parser.add_argument("--source-dir", help="Source directory containing a mysqldump database dump",
action="store")
parser.add_argument("--dest-dir", help="Destination directory to create ftp database_files",
... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"\"--source-dir\"",
",",
"help",
"=",
"\"Source directory containing a mysqldump database dump\"",
",",
"action",
"=",
"\"store\"",... | 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": []
} |
087f492431aadb46df1babcbc88abea674e88d64 | Rfam/rfam-production | scripts/support/fasta2rfamseq.py | [
"Apache-2.0"
] | Python | extract_metadata_from_fasta | null | def extract_metadata_from_fasta(fasta_file, taxid, source, filename=None, to_file=True):
"""
Parses a fasta file and generates rfamseq like matadata using esl-seqstat
fasta_file: A valid fasta file
taxid: A file with upid and taxid mappings.
database:
returns: void
"""
mol_type = "gen... |
Parses a fasta file and generates rfamseq like matadata using esl-seqstat
fasta_file: A valid fasta file
taxid: A file with upid and taxid mappings.
database:
returns: void
| Parses a fasta file and generates rfamseq like matadata using esl-seqstat
fasta_file: A valid fasta file
taxid: A file with upid and taxid mappings.
database.
void | [
"Parses",
"a",
"fasta",
"file",
"and",
"generates",
"rfamseq",
"like",
"matadata",
"using",
"esl",
"-",
"seqstat",
"fasta_file",
":",
"A",
"valid",
"fasta",
"file",
"taxid",
":",
"A",
"file",
"with",
"upid",
"and",
"taxid",
"mappings",
".",
"database",
"."... | def extract_metadata_from_fasta(fasta_file, taxid, source, filename=None, to_file=True):
mol_type = "genomic DNA"
previous_acc = ''
seq_acc_taxids = {}
is_taxid_str = True
if os.path.isfile(taxid):
is_taxid_str = False
fp = open(taxid, 'r')
for line in fp:
line = ... | [
"def",
"extract_metadata_from_fasta",
"(",
"fasta_file",
",",
"taxid",
",",
"source",
",",
"filename",
"=",
"None",
",",
"to_file",
"=",
"True",
")",
":",
"mol_type",
"=",
"\"genomic DNA\"",
"previous_acc",
"=",
"''",
"seq_acc_taxids",
"=",
"{",
"}",
"is_taxid... | Parses a fasta file and generates rfamseq like matadata using esl-seqstat
fasta_file: A valid fasta file
taxid: A file with upid and taxid mappings. | [
"Parses",
"a",
"fasta",
"file",
"and",
"generates",
"rfamseq",
"like",
"matadata",
"using",
"esl",
"-",
"seqstat",
"fasta_file",
":",
"A",
"valid",
"fasta",
"file",
"taxid",
":",
"A",
"file",
"with",
"upid",
"and",
"taxid",
"mappings",
"."
] | [
"\"\"\"\n Parses a fasta file and generates rfamseq like matadata using esl-seqstat\n\n fasta_file: A valid fasta file\n taxid: A file with upid and taxid mappings.\n database:\n\n returns: void\n \"\"\"",
"# default flag",
"# check if taxid is file ",
"# create an output file pointed",
"#... | [
{
"param": "fasta_file",
"type": null
},
{
"param": "taxid",
"type": null
},
{
"param": "source",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "to_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "taxid",
"type": null,
"docstring": null,
"docstring_tok... |
087f492431aadb46df1babcbc88abea674e88d64 | Rfam/rfam-production | scripts/support/fasta2rfamseq.py | [
"Apache-2.0"
] | Python | create_rfamseq_metadata_for_genome_project | null | def create_rfamseq_metadata_for_genome_project(fasta_input, upid_list, upid_gca_tax_file):
"""
This is the main function of the fasta2rfamseq script, which converts a
fasta file to rfamseq table dumps (e.g. filename.rfamseq) for easy import
to rfam_live upon release
fasta_input: This can be a singl... |
This is the main function of the fasta2rfamseq script, which converts a
fasta file to rfamseq table dumps (e.g. filename.rfamseq) for easy import
to rfam_live upon release
fasta_input: This can be a single fasta file or a genome project directory
as orgnised by the genome download pipeline
upi... | This is the main function of the fasta2rfamseq script, which converts a
fasta file to rfamseq table dumps for easy import
to rfam_live upon release
This can be a single fasta file or a genome project directory
as orgnised by the genome download pipeline
upid_list: This is a plain txt file listing all the upids in the... | [
"This",
"is",
"the",
"main",
"function",
"of",
"the",
"fasta2rfamseq",
"script",
"which",
"converts",
"a",
"fasta",
"file",
"to",
"rfamseq",
"table",
"dumps",
"for",
"easy",
"import",
"to",
"rfam_live",
"upon",
"release",
"This",
"can",
"be",
"a",
"single",
... | def create_rfamseq_metadata_for_genome_project(fasta_input, upid_list, upid_gca_tax_file):
fp = open(upid_gca_tax_file, 'r')
upid_gca_tax_dict = json.load(fp)
fp.close()
if os.path.isfile(upid_list):
project_dir = fasta_input
fp = open(upid_list, 'r')
upids = [x.strip() for x in ... | [
"def",
"create_rfamseq_metadata_for_genome_project",
"(",
"fasta_input",
",",
"upid_list",
",",
"upid_gca_tax_file",
")",
":",
"fp",
"=",
"open",
"(",
"upid_gca_tax_file",
",",
"'r'",
")",
"upid_gca_tax_dict",
"=",
"json",
".",
"load",
"(",
"fp",
")",
"fp",
".",... | This is the main function of the fasta2rfamseq script, which converts a
fasta file to rfamseq table dumps (e.g. | [
"This",
"is",
"the",
"main",
"function",
"of",
"the",
"fasta2rfamseq",
"script",
"which",
"converts",
"a",
"fasta",
"file",
"to",
"rfamseq",
"table",
"dumps",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"\n This is the main function of the fasta2rfamseq script, which converts a\n fasta file to rfamseq table dumps (e.g. filename.rfamseq) for easy import\n to rfam_live upon release\n\n fasta_input: This can be a single fasta file or a genome project directory\n as orgnised by the genome download... | [
{
"param": "fasta_input",
"type": null
},
{
"param": "upid_list",
"type": null
},
{
"param": "upid_gca_tax_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_input",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upid_list",
"type": null,
"docstring": null,
"docstrin... |
087f492431aadb46df1babcbc88abea674e88d64 | Rfam/rfam-production | scripts/support/fasta2rfamseq.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Basic argument parsing using Python's argparse
return: An argparse parser object
"""
parser = argparse.ArgumentParser(description='Rfam family Auro-Builder')
# group required arguments together
req_args = parser.add_argument_group("required arguments")
... |
Basic argument parsing using Python's argparse
return: An argparse parser object
| Basic argument parsing using Python's argparse
return: An argparse parser object | [
"Basic",
"argument",
"parsing",
"using",
"Python",
"'",
"s",
"argparse",
"return",
":",
"An",
"argparse",
"parser",
"object"
] | def parse_arguments():
parser = argparse.ArgumentParser(description='Rfam family Auro-Builder')
req_args = parser.add_argument_group("required arguments")
mutually_exclusive_args = parser.add_mutually_exclusive_group(required=False)
mutually_exclusive_args.add_argument('--dest-dir', help='destination di... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Rfam family Auro-Builder'",
")",
"req_args",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"required arguments\"",
")",
"mutually_exclusive_args",
... | Basic argument parsing using Python's argparse
return: An argparse parser object | [
"Basic",
"argument",
"parsing",
"using",
"Python",
"'",
"s",
"argparse",
"return",
":",
"An",
"argparse",
"parser",
"object"
] | [
"\"\"\"\n Basic argument parsing using Python's argparse\n\n return: An argparse parser object\n \"\"\"",
"# group required arguments together",
"# source"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
10755309ffd2abbf4b9247892cb293c617a69313 | Rfam/rfam-production | utils/genome_validation.py | [
"Apache-2.0"
] | Python | validate_sequence_file | <not_specific> | def validate_sequence_file(seq_file, seq_type='dna'):
"""
Validating sequence file file using esl-seqstat
seq_file: The sequence file to validate
seq_type: The type of the sequences in the file (e.g. dna, rna, amino)
return: True if valid, False if invalid
"""
# command string should look... |
Validating sequence file file using esl-seqstat
seq_file: The sequence file to validate
seq_type: The type of the sequences in the file (e.g. dna, rna, amino)
return: True if valid, False if invalid
| Validating sequence file file using esl-seqstat
seq_file: The sequence file to validate
seq_type: The type of the sequences in the file
True if valid, False if invalid | [
"Validating",
"sequence",
"file",
"file",
"using",
"esl",
"-",
"seqstat",
"seq_file",
":",
"The",
"sequence",
"file",
"to",
"validate",
"seq_type",
":",
"The",
"type",
"of",
"the",
"sequences",
"in",
"the",
"file",
"True",
"if",
"valid",
"False",
"if",
"in... | def validate_sequence_file(seq_file, seq_type='dna'):
cmd_args = []
esl_tool = os.path.join(gc.LSF_RFAM_BIN, 'esl-seqstat')
seq_type_arg = "--%s" % seq_type
cmd_args = [esl_tool, seq_type_arg, seq_file]
popen_obj = subprocess.Popen(cmd_args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
mess... | [
"def",
"validate_sequence_file",
"(",
"seq_file",
",",
"seq_type",
"=",
"'dna'",
")",
":",
"cmd_args",
"=",
"[",
"]",
"esl_tool",
"=",
"os",
".",
"path",
".",
"join",
"(",
"gc",
".",
"LSF_RFAM_BIN",
",",
"'esl-seqstat'",
")",
"seq_type_arg",
"=",
"\"--%s\"... | Validating sequence file file using esl-seqstat
seq_file: The sequence file to validate
seq_type: The type of the sequences in the file (e.g. | [
"Validating",
"sequence",
"file",
"file",
"using",
"esl",
"-",
"seqstat",
"seq_file",
":",
"The",
"sequence",
"file",
"to",
"validate",
"seq_type",
":",
"The",
"type",
"of",
"the",
"sequences",
"in",
"the",
"file",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"\n Validating sequence file file using esl-seqstat\n\n seq_file: The sequence file to validate\n seq_type: The type of the sequences in the file (e.g. dna, rna, amino)\n\n return: True if valid, False if invalid\n \"\"\"",
"# command string should look like esl-seqstat --seq_type seq_file"
] | [
{
"param": "seq_file",
"type": null
},
{
"param": "seq_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq_type",
"type": null,
"docstring": null,
"docstring_to... |
10755309ffd2abbf4b9247892cb293c617a69313 | Rfam/rfam-production | utils/genome_validation.py | [
"Apache-2.0"
] | Python | check_genome_download_status | <not_specific> | def check_genome_download_status(lsf_out_file):
"""
Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0
"""
infile_fp = open(lsf_out_file, 'r')
st... |
Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0
| Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0 | [
"Opens",
"LSF",
"output",
"file",
"and",
"checks",
"whether",
"the",
"job",
"'",
"s",
"status",
"is",
"success",
"lsf_out_file",
":",
"LSF",
"platform",
"'",
"s",
"output",
"file",
"generated",
"by",
"-",
"o",
"option",
"returns",
":",
"status",
"1",
"if... | def check_genome_download_status(lsf_out_file):
infile_fp = open(lsf_out_file, 'r')
status = 0
for line in infile_fp:
if line.find("Success") != -1:
status = 1
infile_fp.close()
return status | [
"def",
"check_genome_download_status",
"(",
"lsf_out_file",
")",
":",
"infile_fp",
"=",
"open",
"(",
"lsf_out_file",
",",
"'r'",
")",
"status",
"=",
"0",
"for",
"line",
"in",
"infile_fp",
":",
"if",
"line",
".",
"find",
"(",
"\"Success\"",
")",
"!=",
"-",
... | Opens LSF output file and checks whether the job's status is success
lsf_out_file: LSF platform's output file generated by -o option
returns: status 1 if the download was successful, otherwise 0 | [
"Opens",
"LSF",
"output",
"file",
"and",
"checks",
"whether",
"the",
"job",
"'",
"s",
"status",
"is",
"success",
"lsf_out_file",
":",
"LSF",
"platform",
"'",
"s",
"output",
"file",
"generated",
"by",
"-",
"o",
"option",
"returns",
":",
"status",
"1",
"if... | [
"\"\"\"\n Opens LSF output file and checks whether the job's status is success\n\n lsf_out_file: LSF platform's output file generated by -o option\n returns: status 1 if the download was successful, otherwise 0\n \"\"\""
] | [
{
"param": "lsf_out_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lsf_out_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
10755309ffd2abbf4b9247892cb293c617a69313 | Rfam/rfam-production | utils/genome_validation.py | [
"Apache-2.0"
] | Python | check_all_files_downloaded | <not_specific> | def check_all_files_downloaded(gca_report_file, genome_dir):
"""
Parse genome GCA file and check that all files have been downloaded and
report any missing files
gca_report_file: A genome assembly report file provided by ENA
genome_dir: The path to a specific genome directory
return: True if a... |
Parse genome GCA file and check that all files have been downloaded and
report any missing files
gca_report_file: A genome assembly report file provided by ENA
genome_dir: The path to a specific genome directory
return: True if all files were downloaded, alternatively a list of
the accessions... | Parse genome GCA file and check that all files have been downloaded and
report any missing files
A genome assembly report file provided by ENA
genome_dir: The path to a specific genome directory
True if all files were downloaded, alternatively a list of
the accessions of the missing files | [
"Parse",
"genome",
"GCA",
"file",
"and",
"check",
"that",
"all",
"files",
"have",
"been",
"downloaded",
"and",
"report",
"any",
"missing",
"files",
"A",
"genome",
"assembly",
"report",
"file",
"provided",
"by",
"ENA",
"genome_dir",
":",
"The",
"path",
"to",
... | def check_all_files_downloaded(gca_report_file, genome_dir):
missing_files = []
gca_accessions = gf.assembly_report_parser(gca_report_file)
downloaded_files = [x for x in os.listdir(genome_dir) if x.endswith(".fa")]
for accession in gca_accessions:
file_path = os.path.join(genome_dir, accession ... | [
"def",
"check_all_files_downloaded",
"(",
"gca_report_file",
",",
"genome_dir",
")",
":",
"missing_files",
"=",
"[",
"]",
"gca_accessions",
"=",
"gf",
".",
"assembly_report_parser",
"(",
"gca_report_file",
")",
"downloaded_files",
"=",
"[",
"x",
"for",
"x",
"in",
... | Parse genome GCA file and check that all files have been downloaded and
report any missing files | [
"Parse",
"genome",
"GCA",
"file",
"and",
"check",
"that",
"all",
"files",
"have",
"been",
"downloaded",
"and",
"report",
"any",
"missing",
"files"
] | [
"\"\"\"\n Parse genome GCA file and check that all files have been downloaded and\n report any missing files\n\n gca_report_file: A genome assembly report file provided by ENA\n genome_dir: The path to a specific genome directory\n\n return: True if all files were downloaded, alternatively a list of\... | [
{
"param": "gca_report_file",
"type": null
},
{
"param": "genome_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gca_report_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "genome_dir",
"type": null,
"docstring": null,
"doc... |
379c6c89714b8f178cd7d2adafe15aee8c566ef6 | Rfam/rfam-production | scripts/release/rfamseq_generator.py | [
"Apache-2.0"
] | Python | merge_all_genome_files | null | def merge_all_genome_files(project_dir, dest_dir, filename='rfamseq'):
"""
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file.... |
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq
return: Void
| Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq
Void | [
"Simple",
"script",
"to",
"merge",
"all",
"genomes",
"to",
"a",
"single",
"rfamseq",
"file",
"project_dir",
":",
"The",
"path",
"to",
"a",
"genome",
"download",
"project",
"directory",
"dest_dir",
":",
"The",
"directory",
"where",
"to",
"create",
"the",
"new... | def merge_all_genome_files(project_dir, dest_dir, filename='rfamseq'):
err_cases_fp = os.path.join(dest_dir, filename+'_err_cases.txt')
rfamseq_fp = open(os.path.join(dest_dir, filename + ".fa"), 'w')
subdirs = [x for x in os.listdir(project_dir)
if os.path.isdir(os.path.join(project_dir, x))... | [
"def",
"merge_all_genome_files",
"(",
"project_dir",
",",
"dest_dir",
",",
"filename",
"=",
"'rfamseq'",
")",
":",
"err_cases_fp",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"filename",
"+",
"'_err_cases.txt'",
")",
"rfamseq_fp",
"=",
"open",
... | Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. | [
"Simple",
"script",
"to",
"merge",
"all",
"genomes",
"to",
"a",
"single",
"rfamseq",
"file",
"project_dir",
":",
"The",
"path",
"to",
"a",
"genome",
"download",
"project",
"directory",
"dest_dir",
":",
"The",
"directory",
"where",
"to",
"create",
"the",
"new... | [
"\"\"\"\n Simple script to merge all genomes to a single rfamseq file\n\n project_dir: The path to a genome download project directory\n dest_dir: The directory where to create the new rfamseq file\n filename: A filename for the rfamseq file. Defaults to rfamseq\n\n return: Void\n \"\"\"",
"#if ... | [
{
"param": "project_dir",
"type": null
},
{
"param": "dest_dir",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring... |
379c6c89714b8f178cd7d2adafe15aee8c566ef6 | Rfam/rfam-production | scripts/release/rfamseq_generator.py | [
"Apache-2.0"
] | Python | merge_project_files | null | def merge_project_files(project_dir, dest_dir, file_type, filename='rfamseq'):
"""
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfams... |
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq
return: Void
| Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq
Void | [
"Simple",
"script",
"to",
"merge",
"all",
"genomes",
"to",
"a",
"single",
"rfamseq",
"file",
"project_dir",
":",
"The",
"path",
"to",
"a",
"genome",
"download",
"project",
"directory",
"dest_dir",
":",
"The",
"directory",
"where",
"to",
"create",
"the",
"new... | def merge_project_files(project_dir, dest_dir, file_type, filename='rfamseq'):
err_cases_fp = os.path.join(dest_dir, filename+'_err_cases.txt')
rfamseq_fp = open(os.path.join(dest_dir, filename + "." + file_type), 'w')
subdirs = [x for x in os.listdir(project_dir)
if os.path.isdir(os.path.joi... | [
"def",
"merge_project_files",
"(",
"project_dir",
",",
"dest_dir",
",",
"file_type",
",",
"filename",
"=",
"'rfamseq'",
")",
":",
"err_cases_fp",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"filename",
"+",
"'_err_cases.txt'",
")",
"rfamseq_fp",... | Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. | [
"Simple",
"script",
"to",
"merge",
"all",
"genomes",
"to",
"a",
"single",
"rfamseq",
"file",
"project_dir",
":",
"The",
"path",
"to",
"a",
"genome",
"download",
"project",
"directory",
"dest_dir",
":",
"The",
"directory",
"where",
"to",
"create",
"the",
"new... | [
"\"\"\"\n Simple script to merge all genomes to a single rfamseq file\n\n project_dir: The path to a genome download project directory\n dest_dir: The directory where to create the new rfamseq file\n filename: A filename for the rfamseq file. Defaults to rfamseq\n\n return: Void\n \"\"\"",
"#if ... | [
{
"param": "project_dir",
"type": null
},
{
"param": "dest_dir",
"type": null
},
{
"param": "file_type",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring... |
379c6c89714b8f178cd7d2adafe15aee8c566ef6 | Rfam/rfam-production | scripts/release/rfamseq_generator.py | [
"Apache-2.0"
] | Python | seq_validator | <not_specific> | def seq_validator(sequence):
"""
Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False.
sequence: A string for validation
"""
# checks for ascii characters that should not appear in a fasta sequence
seq_val = re.compile("[^A... |
Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False.
sequence: A string for validation
| Checks if the sequence provided is valid fasta sequence. Returns True
if the sequence is valid, otherwise returns False.
A string for validation | [
"Checks",
"if",
"the",
"sequence",
"provided",
"is",
"valid",
"fasta",
"sequence",
".",
"Returns",
"True",
"if",
"the",
"sequence",
"is",
"valid",
"otherwise",
"returns",
"False",
".",
"A",
"string",
"for",
"validation"
] | def seq_validator(sequence):
seq_val = re.compile("[^ATKMBVCNSWD-GUYRHatkbbvcnswdguyrh]")
if seq_val.search(sequence):
return False
return True | [
"def",
"seq_validator",
"(",
"sequence",
")",
":",
"seq_val",
"=",
"re",
".",
"compile",
"(",
"\"[^ATKMBVCNSWD-GUYRHatkbbvcnswdguyrh]\"",
")",
"if",
"seq_val",
".",
"search",
"(",
"sequence",
")",
":",
"return",
"False",
"return",
"True"
] | Checks if the sequence provided is valid fasta sequence. | [
"Checks",
"if",
"the",
"sequence",
"provided",
"is",
"valid",
"fasta",
"sequence",
"."
] | [
"\"\"\"\n Checks if the sequence provided is valid fasta sequence. Returns True\n if the sequence is valid, otherwise returns False.\n\n sequence: A string for validation\n \"\"\"",
"# checks for ascii characters that should not appear in a fasta sequence",
"# if any illegal characters found return ... | [
{
"param": "sequence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
379c6c89714b8f178cd7d2adafe15aee8c566ef6 | Rfam/rfam-production | scripts/release/rfamseq_generator.py | [
"Apache-2.0"
] | Python | merge_files_from_accession_list | null | def merge_files_from_accession_list(project_dir, acc_list_file, dest_dir, file_type, filename='rfamseq'):
"""
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filenam... |
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq
return: Void
| Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq
Void | [
"Simple",
"script",
"to",
"merge",
"all",
"genomes",
"to",
"a",
"single",
"rfamseq",
"file",
"project_dir",
":",
"The",
"path",
"to",
"a",
"genome",
"download",
"project",
"directory",
"dest_dir",
":",
"The",
"directory",
"where",
"to",
"create",
"the",
"new... | def merge_files_from_accession_list(project_dir, acc_list_file, dest_dir, file_type, filename='rfamseq'):
if file_type.lower() == 'fasta':
file_type = 'fa'
elif file_type.lower() == 'tblout':
file_type = 'tbl'
err_cases_fp = os.path.join(dest_dir, filename+'_err_cases.txt')
rfamseq_fp = open(os.path.j... | [
"def",
"merge_files_from_accession_list",
"(",
"project_dir",
",",
"acc_list_file",
",",
"dest_dir",
",",
"file_type",
",",
"filename",
"=",
"'rfamseq'",
")",
":",
"if",
"file_type",
".",
"lower",
"(",
")",
"==",
"'fasta'",
":",
"file_type",
"=",
"'fa'",
"elif... | Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. | [
"Simple",
"script",
"to",
"merge",
"all",
"genomes",
"to",
"a",
"single",
"rfamseq",
"file",
"project_dir",
":",
"The",
"path",
"to",
"a",
"genome",
"download",
"project",
"directory",
"dest_dir",
":",
"The",
"directory",
"where",
"to",
"create",
"the",
"new... | [
"\"\"\"\n Simple script to merge all genomes to a single rfamseq file\n\n project_dir: The path to a genome download project directory\n dest_dir: The directory where to create the new rfamseq file\n filename: A filename for the rfamseq file. Defaults to rfamseq\n\n return: Void\n \"\"\"",
"#sub... | [
{
"param": "project_dir",
"type": null
},
{
"param": "acc_list_file",
"type": null
},
{
"param": "dest_dir",
"type": null
},
{
"param": "file_type",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "acc_list_file",
"type": null,
"docstring": null,
"docs... |
379c6c89714b8f178cd7d2adafe15aee8c566ef6 | Rfam/rfam-production | scripts/release/rfamseq_generator.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Uses python's argparse to parse the command line arguments
return: Argparse parser object
"""
# create a new argument parser object
parser = argparse.ArgumentParser(description='Merges genomes into a unified fasta file (Rfamseq)')
# group required arguments together
re... |
Uses python's argparse to parse the command line arguments
return: Argparse parser object
| Uses python's argparse to parse the command line arguments
return: Argparse parser object | [
"Uses",
"python",
"'",
"s",
"argparse",
"to",
"parse",
"the",
"command",
"line",
"arguments",
"return",
":",
"Argparse",
"parser",
"object"
] | def parse_arguments():
parser = argparse.ArgumentParser(description='Merges genomes into a unified fasta file (Rfamseq)')
req_args = parser.add_argument_group("required arguments")
req_args.add_argument('--project_dir', help='a project directory where the genome directories reside',
... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Merges genomes into a unified fasta file (Rfamseq)'",
")",
"req_args",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"required arguments\"",
")",
"re... | Uses python's argparse to parse the command line arguments
return: Argparse parser object | [
"Uses",
"python",
"'",
"s",
"argparse",
"to",
"parse",
"the",
"command",
"line",
"arguments",
"return",
":",
"Argparse",
"parser",
"object"
] | [
"\"\"\"\n\tUses python's argparse to parse the command line arguments\n\t\n\treturn: Argparse parser object\n\t\"\"\"",
"# create a new argument parser object",
"# group required arguments together"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5cf1952c6a0b7d691c9d160f365a2a73b3efa654 | Rfam/rfam-production | pdb_mapping/pdb_full_region_table.py | [
"Apache-2.0"
] | Python | create_pdb_temp_table | null | def create_pdb_temp_table(pdb_file):
"""
Create the pdb_full_region_temp table and populate with data from the pdb text file.
:param pdb_file: Text file with data to import to pdb_full_region_temp
"""
conn = RfamDB.connect(db_config=DB_CONFIG)
cursor = conn.cursor()
try:
cursor.execu... |
Create the pdb_full_region_temp table and populate with data from the pdb text file.
:param pdb_file: Text file with data to import to pdb_full_region_temp
| Create the pdb_full_region_temp table and populate with data from the pdb text file. | [
"Create",
"the",
"pdb_full_region_temp",
"table",
"and",
"populate",
"with",
"data",
"from",
"the",
"pdb",
"text",
"file",
"."
] | def create_pdb_temp_table(pdb_file):
conn = RfamDB.connect(db_config=DB_CONFIG)
cursor = conn.cursor()
try:
cursor.execute("DROP TABLE IF EXISTS pdb_full_region_temp;")
cursor.execute("CREATE TABLE pdb_full_region_temp LIKE pdb_full_region;")
with open(pdb_file) as f:
rea... | [
"def",
"create_pdb_temp_table",
"(",
"pdb_file",
")",
":",
"conn",
"=",
"RfamDB",
".",
"connect",
"(",
"db_config",
"=",
"DB_CONFIG",
")",
"cursor",
"=",
"conn",
".",
"cursor",
"(",
")",
"try",
":",
"cursor",
".",
"execute",
"(",
"\"DROP TABLE IF EXISTS pdb_... | Create the pdb_full_region_temp table and populate with data from the pdb text file. | [
"Create",
"the",
"pdb_full_region_temp",
"table",
"and",
"populate",
"with",
"data",
"from",
"the",
"pdb",
"text",
"file",
"."
] | [
"\"\"\"\n Create the pdb_full_region_temp table and populate with data from the pdb text file.\n :param pdb_file: Text file with data to import to pdb_full_region_temp\n \"\"\""
] | [
{
"param": "pdb_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pdb_file",
"type": null,
"docstring": "Text file with data to import to pdb_full_region_temp",
"docstring_tokens": [
"Text",
"file",
"with",
"data",
"to",
"import",
"to",... |
5cf1952c6a0b7d691c9d160f365a2a73b3efa654 | Rfam/rfam-production | pdb_mapping/pdb_full_region_table.py | [
"Apache-2.0"
] | Python | qc_checks | null | def qc_checks():
"""
Execute quality control checks before we update the table
"""
conn = RfamDB.connect(db_config=DB_CONFIG)
cursor = conn.cursor()
try:
cursor.execute("SELECT COUNT(*) FROM pdb_full_region_temp;")
num_rows_pdb_temp = cursor.fetchone()[0]
cursor.execute("... |
Execute quality control checks before we update the table
| Execute quality control checks before we update the table | [
"Execute",
"quality",
"control",
"checks",
"before",
"we",
"update",
"the",
"table"
] | def qc_checks():
conn = RfamDB.connect(db_config=DB_CONFIG)
cursor = conn.cursor()
try:
cursor.execute("SELECT COUNT(*) FROM pdb_full_region_temp;")
num_rows_pdb_temp = cursor.fetchone()[0]
cursor.execute("SELECT COUNT(*) FROM pdb_full_region;")
num_rows_pdb = cursor.fetchone... | [
"def",
"qc_checks",
"(",
")",
":",
"conn",
"=",
"RfamDB",
".",
"connect",
"(",
"db_config",
"=",
"DB_CONFIG",
")",
"cursor",
"=",
"conn",
".",
"cursor",
"(",
")",
"try",
":",
"cursor",
".",
"execute",
"(",
"\"SELECT COUNT(*) FROM pdb_full_region_temp;\"",
")... | Execute quality control checks before we update the table | [
"Execute",
"quality",
"control",
"checks",
"before",
"we",
"update",
"the",
"table"
] | [
"\"\"\"\n Execute quality control checks before we update the table\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5cf1952c6a0b7d691c9d160f365a2a73b3efa654 | Rfam/rfam-production | pdb_mapping/pdb_full_region_table.py | [
"Apache-2.0"
] | Python | parse_args | <not_specific> | def parse_args():
"""
Parse the cli arguments when calling this script to insert a text file to the PDB table in the database.
"""
parser = argparse.ArgumentParser(description='Create PDB full region table and import new data')
parser.add_argument('-f', '--file', help='Text file with data to import ... |
Parse the cli arguments when calling this script to insert a text file to the PDB table in the database.
| Parse the cli arguments when calling this script to insert a text file to the PDB table in the database. | [
"Parse",
"the",
"cli",
"arguments",
"when",
"calling",
"this",
"script",
"to",
"insert",
"a",
"text",
"file",
"to",
"the",
"PDB",
"table",
"in",
"the",
"database",
"."
] | def parse_args():
parser = argparse.ArgumentParser(description='Create PDB full region table and import new data')
parser.add_argument('-f', '--file', help='Text file with data to import to pdb_full_region_temp', required=True)
parser.add_argument('-db', '--database', help='Specify which database config val... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Create PDB full region table and import new data'",
")",
"parser",
".",
"add_argument",
"(",
"'-f'",
",",
"'--file'",
",",
"help",
"=",
"'Text file with ... | Parse the cli arguments when calling this script to insert a text file to the PDB table in the database. | [
"Parse",
"the",
"cli",
"arguments",
"when",
"calling",
"this",
"script",
"to",
"insert",
"a",
"text",
"file",
"to",
"the",
"PDB",
"table",
"in",
"the",
"database",
"."
] | [
"\"\"\"\n Parse the cli arguments when calling this script to insert a text file to the PDB table in the database.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
61d946fb98f1f65df008a35e983c184186c470d7 | Rfam/rfam-production | scripts/validation/genome_search_validator.py | [
"Apache-2.0"
] | Python | check_genome_search_success | <not_specific> | def check_genome_search_success(error_file):
"""
Checks whether genome search was successful by checking lsf error file
size. If the file is empty return success, otherwise return 0
error_file (string): A string representing the path to LSF's job error
file (-e)
"""
success = 1
if os.p... |
Checks whether genome search was successful by checking lsf error file
size. If the file is empty return success, otherwise return 0
error_file (string): A string representing the path to LSF's job error
file (-e)
| Checks whether genome search was successful by checking lsf error file
size. If the file is empty return success, otherwise return 0
error_file (string): A string representing the path to LSF's job error
file (-e) | [
"Checks",
"whether",
"genome",
"search",
"was",
"successful",
"by",
"checking",
"lsf",
"error",
"file",
"size",
".",
"If",
"the",
"file",
"is",
"empty",
"return",
"success",
"otherwise",
"return",
"0",
"error_file",
"(",
"string",
")",
":",
"A",
"string",
... | def check_genome_search_success(error_file):
success = 1
if os.path.getsize(error_file) == 0:
return success
return 0 | [
"def",
"check_genome_search_success",
"(",
"error_file",
")",
":",
"success",
"=",
"1",
"if",
"os",
".",
"path",
".",
"getsize",
"(",
"error_file",
")",
"==",
"0",
":",
"return",
"success",
"return",
"0"
] | Checks whether genome search was successful by checking lsf error file
size. | [
"Checks",
"whether",
"genome",
"search",
"was",
"successful",
"by",
"checking",
"lsf",
"error",
"file",
"size",
"."
] | [
"\"\"\"\n Checks whether genome search was successful by checking lsf error file\n size. If the file is empty return success, otherwise return 0\n\n error_file (string): A string representing the path to LSF's job error\n file (-e)\n \"\"\""
] | [
{
"param": "error_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "error_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
61d946fb98f1f65df008a35e983c184186c470d7 | Rfam/rfam-production | scripts/validation/genome_search_validator.py | [
"Apache-2.0"
] | Python | check_search_err_files | <not_specific> | def check_search_err_files(search_output_dir):
"""
Lookup all output subdirectories and check for cases that .err files are
not empty
search_output_dir: search output directory as organised by genome_search
returns: A dictionary with all erroneous cases
"""
search_err_cases = {}
outp... |
Lookup all output subdirectories and check for cases that .err files are
not empty
search_output_dir: search output directory as organised by genome_search
returns: A dictionary with all erroneous cases
| Lookup all output subdirectories and check for cases that .err files are
not empty
search output directory as organised by genome_search
A dictionary with all erroneous cases | [
"Lookup",
"all",
"output",
"subdirectories",
"and",
"check",
"for",
"cases",
"that",
".",
"err",
"files",
"are",
"not",
"empty",
"search",
"output",
"directory",
"as",
"organised",
"by",
"genome_search",
"A",
"dictionary",
"with",
"all",
"erroneous",
"cases"
] | def check_search_err_files(search_output_dir):
search_err_cases = {}
output_subdirs = os.listdir(search_output_dir)
for subdir in output_subdirs:
subdir_loc = os.path.join(search_output_dir, subdir)
updirs = os.listdir(subdir_loc)
for updir in updirs:
updir_loc = os.path.... | [
"def",
"check_search_err_files",
"(",
"search_output_dir",
")",
":",
"search_err_cases",
"=",
"{",
"}",
"output_subdirs",
"=",
"os",
".",
"listdir",
"(",
"search_output_dir",
")",
"for",
"subdir",
"in",
"output_subdirs",
":",
"subdir_loc",
"=",
"os",
".",
"path"... | Lookup all output subdirectories and check for cases that .err files are
not empty | [
"Lookup",
"all",
"output",
"subdirectories",
"and",
"check",
"for",
"cases",
"that",
".",
"err",
"files",
"are",
"not",
"empty"
] | [
"\"\"\"\n Lookup all output subdirectories and check for cases that .err files are\n not empty\n\n search_output_dir: search output directory as organised by genome_search\n\n returns: A dictionary with all erroneous cases\n \"\"\""
] | [
{
"param": "search_output_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "search_output_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8ec02bd0c13a9e8e8de78b145bc471b2dd4ab0ed | Rfam/rfam-production | scripts/validation/fasta_gen_validator.py | [
"Apache-2.0"
] | Python | compare_seq_counts | <not_specific> | def compare_seq_counts(db_counts, fa_counts):
"""
Compares the number of sequences per family in full_region table with
the number of sequences written in the distinct fasta files
db_counts: A dictionary with the number of sequences per family as
found in full_region (e.g. {'RFXXXXX':N... |
Compares the number of sequences per family in full_region table with
the number of sequences written in the distinct fasta files
db_counts: A dictionary with the number of sequences per family as
found in full_region (e.g. {'RFXXXXX':N,...}). Output of
get_full_region_seq... | Compares the number of sequences per family in full_region table with
the number of sequences written in the distinct fasta files
A dictionary with the number of sequences per family as
found in full_region . Output of
get_full_region_seq_counts
fa_counts: A dictionary with the number of sequences per family fasta
fi... | [
"Compares",
"the",
"number",
"of",
"sequences",
"per",
"family",
"in",
"full_region",
"table",
"with",
"the",
"number",
"of",
"sequences",
"written",
"in",
"the",
"distinct",
"fasta",
"files",
"A",
"dictionary",
"with",
"the",
"number",
"of",
"sequences",
"per... | def compare_seq_counts(db_counts, fa_counts):
faulty_fams = []
for rfam_acc in db_counts.keys():
if (db_counts[rfam_acc] != fa_counts[rfam_acc]):
faulty_fams.append(rfam_acc)
return faulty_fams | [
"def",
"compare_seq_counts",
"(",
"db_counts",
",",
"fa_counts",
")",
":",
"faulty_fams",
"=",
"[",
"]",
"for",
"rfam_acc",
"in",
"db_counts",
".",
"keys",
"(",
")",
":",
"if",
"(",
"db_counts",
"[",
"rfam_acc",
"]",
"!=",
"fa_counts",
"[",
"rfam_acc",
"... | Compares the number of sequences per family in full_region table with
the number of sequences written in the distinct fasta files | [
"Compares",
"the",
"number",
"of",
"sequences",
"per",
"family",
"in",
"full_region",
"table",
"with",
"the",
"number",
"of",
"sequences",
"written",
"in",
"the",
"distinct",
"fasta",
"files"
] | [
"\"\"\"\n Compares the number of sequences per family in full_region table with\n the number of sequences written in the distinct fasta files\n\n db_counts: A dictionary with the number of sequences per family as\n found in full_region (e.g. {'RFXXXXX':N,...}). Output of\n ge... | [
{
"param": "db_counts",
"type": null
},
{
"param": "fa_counts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "db_counts",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fa_counts",
"type": null,
"docstring": null,
"docstring_... |
8ec02bd0c13a9e8e8de78b145bc471b2dd4ab0ed | Rfam/rfam-production | scripts/validation/fasta_gen_validator.py | [
"Apache-2.0"
] | Python | usage | null | def usage():
"""
Displays information on how to run fasta_gen_validator
"""
print "\nUsage:\n------"
print "\npython fasta_gen_validator.py /path/to/fasta_files"
print "\nfasta_files: The path to the fasta files directory\n" |
Displays information on how to run fasta_gen_validator
| Displays information on how to run fasta_gen_validator | [
"Displays",
"information",
"on",
"how",
"to",
"run",
"fasta_gen_validator"
] | def usage():
print "\nUsage:\n------"
print "\npython fasta_gen_validator.py /path/to/fasta_files"
print "\nfasta_files: The path to the fasta files directory\n" | [
"def",
"usage",
"(",
")",
":",
"print",
"\"\\nUsage:\\n------\"",
"print",
"\"\\npython fasta_gen_validator.py /path/to/fasta_files\"",
"print",
"\"\\nfasta_files: The path to the fasta files directory\\n\""
] | Displays information on how to run fasta_gen_validator | [
"Displays",
"information",
"on",
"how",
"to",
"run",
"fasta_gen_validator"
] | [
"\"\"\"\n Displays information on how to run fasta_gen_validator\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9e411bcef769dd947c2a11a2df54b90850a4f614 | Rfam/rfam-production | scripts/preprocessing/desc_generator.py | [
"Apache-2.0"
] | Python | extract_sequence_accessions_from_seed | <not_specific> | def extract_sequence_accessions_from_seed(seed_file):
"""
Parses a seed MSA and extracts all sequence
accessions in the form of a dictionary
seed_file: An Rfam seed alignment
return: A dictionary of seed accessions
"""
accessions = {}
fp = open(seed_file, 'r')
for line in fp:
... |
Parses a seed MSA and extracts all sequence
accessions in the form of a dictionary
seed_file: An Rfam seed alignment
return: A dictionary of seed accessions
| Parses a seed MSA and extracts all sequence
accessions in the form of a dictionary
An Rfam seed alignment
A dictionary of seed accessions | [
"Parses",
"a",
"seed",
"MSA",
"and",
"extracts",
"all",
"sequence",
"accessions",
"in",
"the",
"form",
"of",
"a",
"dictionary",
"An",
"Rfam",
"seed",
"alignment",
"A",
"dictionary",
"of",
"seed",
"accessions"
] | def extract_sequence_accessions_from_seed(seed_file):
accessions = {}
fp = open(seed_file, 'r')
for line in fp:
line = line.strip()
if len(line) > 1 and line[0] != '#' and line != '':
line = line.split(' ')
accession = line[0].partition('/')[0]
if accessio... | [
"def",
"extract_sequence_accessions_from_seed",
"(",
"seed_file",
")",
":",
"accessions",
"=",
"{",
"}",
"fp",
"=",
"open",
"(",
"seed_file",
",",
"'r'",
")",
"for",
"line",
"in",
"fp",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"len",
"("... | Parses a seed MSA and extracts all sequence
accessions in the form of a dictionary | [
"Parses",
"a",
"seed",
"MSA",
"and",
"extracts",
"all",
"sequence",
"accessions",
"in",
"the",
"form",
"of",
"a",
"dictionary"
] | [
"\"\"\"\n Parses a seed MSA and extracts all sequence\n accessions in the form of a dictionary\n\n seed_file: An Rfam seed alignment\n\n return: A dictionary of seed accessions\n \"\"\""
] | [
{
"param": "seed_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seed_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9e411bcef769dd947c2a11a2df54b90850a4f614 | Rfam/rfam-production | scripts/preprocessing/desc_generator.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("Generates a DESC template for a new family")
parser.add_argument("--input", help="miRBase directory with rfsearch results",
actio... |
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("Generates a DESC template for a new family")
parser.add_argument("--input", help="miRBase directory with rfsearch results",
action="store", default=None)
parser.add_argument("--outdir", help="Path to the output directory", action... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"\"Generates a DESC template for a new family\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--input\"",
",",
"help",
"=",
"\"miRBase directory with rfsearch results\"",
",",
... | 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": []
} |
9e49835af1b0bcc68886386baf6119f3fbebb612 | Rfam/rfam-production | scripts/export/rnac2json.py | [
"Apache-2.0"
] | Python | rnac_to_json | null | def rnac_to_json(rfam2rnac_file, fasta_dir, no_seqs=None, out_dir=None):
"""
This was initially developed for processing the entire Rfam2RNAcentral
export with the output split to multiple output files with the number
of sequences per file set by the parameter no_seqs.
rfam2rnac_file: Rfam2RNAcent... |
This was initially developed for processing the entire Rfam2RNAcentral
export with the output split to multiple output files with the number
of sequences per file set by the parameter no_seqs.
rfam2rnac_file: Rfam2RNAcentral db dump
fasta_dir: The path to the directory containing the fasta ... | This was initially developed for processing the entire Rfam2RNAcentral
export with the output split to multiple output files with the number
of sequences per file set by the parameter no_seqs.
Rfam2RNAcentral db dump
fasta_dir: The path to the directory containing the fasta files
of the current Rfam release
no_s... | [
"This",
"was",
"initially",
"developed",
"for",
"processing",
"the",
"entire",
"Rfam2RNAcentral",
"export",
"with",
"the",
"output",
"split",
"to",
"multiple",
"output",
"files",
"with",
"the",
"number",
"of",
"sequences",
"per",
"file",
"set",
"by",
"the",
"p... | def rnac_to_json(rfam2rnac_file, fasta_dir, no_seqs=None, out_dir=None):
json_obj_list = []
sequence = None
logging.basicConfig(
filename="empty_seqs.log", filemode='w', level=logging.DEBUG)
rnac_fp = open(rfam2rnac_file, 'r')
filename = os.path.basename(rfam2rnac_file).partition('.')[0]
... | [
"def",
"rnac_to_json",
"(",
"rfam2rnac_file",
",",
"fasta_dir",
",",
"no_seqs",
"=",
"None",
",",
"out_dir",
"=",
"None",
")",
":",
"json_obj_list",
"=",
"[",
"]",
"sequence",
"=",
"None",
"logging",
".",
"basicConfig",
"(",
"filename",
"=",
"\"empty_seqs.lo... | This was initially developed for processing the entire Rfam2RNAcentral
export with the output split to multiple output files with the number
of sequences per file set by the parameter no_seqs. | [
"This",
"was",
"initially",
"developed",
"for",
"processing",
"the",
"entire",
"Rfam2RNAcentral",
"export",
"with",
"the",
"output",
"split",
"to",
"multiple",
"output",
"files",
"with",
"the",
"number",
"of",
"sequences",
"per",
"file",
"set",
"by",
"the",
"p... | [
"\"\"\"\n This was initially developed for processing the entire Rfam2RNAcentral\n export with the output split to multiple output files with the number\n of sequences per file set by the parameter no_seqs.\n\n rfam2rnac_file: Rfam2RNAcentral db dump\n fasta_dir: The path to the directory cont... | [
{
"param": "rfam2rnac_file",
"type": null
},
{
"param": "fasta_dir",
"type": null
},
{
"param": "no_seqs",
"type": null
},
{
"param": "out_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rfam2rnac_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_dir",
"type": null,
"docstring": null,
"docst... |
9e49835af1b0bcc68886386baf6119f3fbebb612 | Rfam/rfam-production | scripts/export/rnac2json.py | [
"Apache-2.0"
] | Python | rnac_to_json_multi | null | def rnac_to_json_multi(seq_dir, fasta_dir, out_dir=None):
"""
This is an implementation of the rnac_to_json function with the
difference that input is split to smaller files prior to the json
generation. It exports the sequences out of the Rfam's currenct version
of fasta files.
seq_dir: The... |
This is an implementation of the rnac_to_json function with the
difference that input is split to smaller files prior to the json
generation. It exports the sequences out of the Rfam's currenct version
of fasta files.
seq_dir: The path to the directory containing multiple sequence
... | This is an implementation of the rnac_to_json function with the
difference that input is split to smaller files prior to the json
generation. It exports the sequences out of the Rfam's currenct version
of fasta files.
The path to the directory containing multiple sequence
files to be converted to json
fasta_dir: The ... | [
"This",
"is",
"an",
"implementation",
"of",
"the",
"rnac_to_json",
"function",
"with",
"the",
"difference",
"that",
"input",
"is",
"split",
"to",
"smaller",
"files",
"prior",
"to",
"the",
"json",
"generation",
".",
"It",
"exports",
"the",
"sequences",
"out",
... | def rnac_to_json_multi(seq_dir, fasta_dir, out_dir=None):
if out_dir is None:
out_dir = seq_dir
seq_files = os.listdir(seq_dir)
seq_files = filter(lambda x: string.find(x, ".txt") != -1, seq_files)
logging.basicConfig(filename=os.path.join(out_dir, "obsolete_seqs.log"),
f... | [
"def",
"rnac_to_json_multi",
"(",
"seq_dir",
",",
"fasta_dir",
",",
"out_dir",
"=",
"None",
")",
":",
"if",
"out_dir",
"is",
"None",
":",
"out_dir",
"=",
"seq_dir",
"seq_files",
"=",
"os",
".",
"listdir",
"(",
"seq_dir",
")",
"seq_files",
"=",
"filter",
... | This is an implementation of the rnac_to_json function with the
difference that input is split to smaller files prior to the json
generation. | [
"This",
"is",
"an",
"implementation",
"of",
"the",
"rnac_to_json",
"function",
"with",
"the",
"difference",
"that",
"input",
"is",
"split",
"to",
"smaller",
"files",
"prior",
"to",
"the",
"json",
"generation",
"."
] | [
"\"\"\"\n This is an implementation of the rnac_to_json function with the\n difference that input is split to smaller files prior to the json\n generation. It exports the sequences out of the Rfam's currenct version\n of fasta files.\n\n seq_dir: The path to the directory containing multiple seque... | [
{
"param": "seq_dir",
"type": null
},
{
"param": "fasta_dir",
"type": null
},
{
"param": "out_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_dir",
"type": null,
"docstring": null,
"docstring_to... |
9e49835af1b0bcc68886386baf6119f3fbebb612 | Rfam/rfam-production | scripts/export/rnac2json.py | [
"Apache-2.0"
] | Python | build_json_dict | <not_specific> | def build_json_dict(entry, sequence):
"""
RNAcentral specific method to build the json dictionary for each entry.
Sequences are provided as a parameter as they are exported using
esl-sfetch and ENA via the url API.
entry: A list of the fields in a DB entry resulting from
Rfam2RNAce... |
RNAcentral specific method to build the json dictionary for each entry.
Sequences are provided as a parameter as they are exported using
esl-sfetch and ENA via the url API.
entry: A list of the fields in a DB entry resulting from
Rfam2RNAcentral export
sequence: Entry's correspond... | RNAcentral specific method to build the json dictionary for each entry.
Sequences are provided as a parameter as they are exported using
esl-sfetch and ENA via the url API.
A list of the fields in a DB entry resulting from
Rfam2RNAcentral export
sequence: Entry's corresponding sequence | [
"RNAcentral",
"specific",
"method",
"to",
"build",
"the",
"json",
"dictionary",
"for",
"each",
"entry",
".",
"Sequences",
"are",
"provided",
"as",
"a",
"parameter",
"as",
"they",
"are",
"exported",
"using",
"esl",
"-",
"sfetch",
"and",
"ENA",
"via",
"the",
... | def build_json_dict(entry, sequence):
edict = {}
species = ''
edict["parent_accession"] = entry[SEQACC].partition('.')[0]
edict["seq_version"] = entry[VERSION]
edict["feature_location_start"] = entry[SEQ_START]
edict["feature_location_end"] = entry[SEQ_END]
edict["ncrna_class"] = entry[NCRNA... | [
"def",
"build_json_dict",
"(",
"entry",
",",
"sequence",
")",
":",
"edict",
"=",
"{",
"}",
"species",
"=",
"''",
"edict",
"[",
"\"parent_accession\"",
"]",
"=",
"entry",
"[",
"SEQACC",
"]",
".",
"partition",
"(",
"'.'",
")",
"[",
"0",
"]",
"edict",
"... | RNAcentral specific method to build the json dictionary for each entry. | [
"RNAcentral",
"specific",
"method",
"to",
"build",
"the",
"json",
"dictionary",
"for",
"each",
"entry",
"."
] | [
"\"\"\"\n RNAcentral specific method to build the json dictionary for each entry.\n Sequences are provided as a parameter as they are exported using\n esl-sfetch and ENA via the url API.\n\n entry: A list of the fields in a DB entry resulting from\n Rfam2RNAcentral export\n sequence: ... | [
{
"param": "entry",
"type": null
},
{
"param": "sequence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_token... |
9e49835af1b0bcc68886386baf6119f3fbebb612 | Rfam/rfam-production | scripts/export/rnac2json.py | [
"Apache-2.0"
] | Python | fa_some_records_to_json | null | def fa_some_records_to_json(seq_dir, fasta_dir, out_dir=None):
"""
This is a slightly different version of the rnac_to_json methods,
calling UCSCs faSomeRecords executable to retrieve sequences out of
fasta input files.
seq_dir: The path to the directory containing multiple sequence files
... |
This is a slightly different version of the rnac_to_json methods,
calling UCSCs faSomeRecords executable to retrieve sequences out of
fasta input files.
seq_dir: The path to the directory containing multiple sequence files
to be converted to json
fasta_dir: The path to the directo... | This is a slightly different version of the rnac_to_json methods,
calling UCSCs faSomeRecords executable to retrieve sequences out of
fasta input files.
The path to the directory containing multiple sequence files
to be converted to json
fasta_dir: The path to the directory containing the fasta files of the
current Rf... | [
"This",
"is",
"a",
"slightly",
"different",
"version",
"of",
"the",
"rnac_to_json",
"methods",
"calling",
"UCSCs",
"faSomeRecords",
"executable",
"to",
"retrieve",
"sequences",
"out",
"of",
"fasta",
"input",
"files",
".",
"The",
"path",
"to",
"the",
"directory",... | def fa_some_records_to_json(seq_dir, fasta_dir, out_dir=None):
if out_dir is None:
out_dir = seq_dir
seq_files = os.listdir(seq_dir)
seq_files = filter(lambda x: string.find(x, ".out") != -1, seq_files)
logging.basicConfig(filename=os.path.join(out_dir, "obsolete_seqs.log"),
... | [
"def",
"fa_some_records_to_json",
"(",
"seq_dir",
",",
"fasta_dir",
",",
"out_dir",
"=",
"None",
")",
":",
"if",
"out_dir",
"is",
"None",
":",
"out_dir",
"=",
"seq_dir",
"seq_files",
"=",
"os",
".",
"listdir",
"(",
"seq_dir",
")",
"seq_files",
"=",
"filter... | This is a slightly different version of the rnac_to_json methods,
calling UCSCs faSomeRecords executable to retrieve sequences out of
fasta input files. | [
"This",
"is",
"a",
"slightly",
"different",
"version",
"of",
"the",
"rnac_to_json",
"methods",
"calling",
"UCSCs",
"faSomeRecords",
"executable",
"to",
"retrieve",
"sequences",
"out",
"of",
"fasta",
"input",
"files",
"."
] | [
"\"\"\"\n This is a slightly different version of the rnac_to_json methods,\n calling UCSCs faSomeRecords executable to retrieve sequences out of\n fasta input files.\n\n seq_dir: The path to the directory containing multiple sequence files\n to be converted to json\n fasta_dir: The p... | [
{
"param": "seq_dir",
"type": null
},
{
"param": "fasta_dir",
"type": null
},
{
"param": "out_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_dir",
"type": null,
"docstring": null,
"docstring_to... |
9e49835af1b0bcc68886386baf6119f3fbebb612 | Rfam/rfam-production | scripts/export/rnac2json.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("Tool to convert rnacentral export to json")
parser.add_argument("--input",
help="A directory of multiple (Rfam2RNAcentral.pl) ... |
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("Tool to convert rnacentral export to json")
parser.add_argument("--input",
help="A directory of multiple (Rfam2RNAcentral.pl) dump files",
action="store")
parser.add_argument("--rfam-fasta",
... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"\"Tool to convert rnacentral export to json\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--input\"",
",",
"help",
"=",
"\"A directory of multiple (Rfam2RNAcentral.pl) dump fi... | 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": []
} |
4aed3e7c67fdfa6bed95a8465bc18ec0cb6717c2 | Rfam/rfam-production | scripts/preprocessing/zwd_import_precompute.py | [
"Apache-2.0"
] | Python | fasta_headers_to_urs_accessions | <not_specific> | def fasta_headers_to_urs_accessions(fasta_header_file):
"""
Extracts the URS accessions from a file containing
all zwd fasta header lines. Fasta headers can be
extracted using grep '>' new_zwd.fasta > fasta_header_file
fasta_header_file: A .txt file containing all header lines
from a new ZWD fa... |
Extracts the URS accessions from a file containing
all zwd fasta header lines. Fasta headers can be
extracted using grep '>' new_zwd.fasta > fasta_header_file
fasta_header_file: A .txt file containing all header lines
from a new ZWD fasta file
returns: A dictionary with all URS accessions as ... | Extracts the URS accessions from a file containing
all zwd fasta header lines. Fasta headers can be
extracted using grep '>' new_zwd.fasta > fasta_header_file
A .txt file containing all header lines
from a new ZWD fasta file
A dictionary with all URS accessions as keys | [
"Extracts",
"the",
"URS",
"accessions",
"from",
"a",
"file",
"containing",
"all",
"zwd",
"fasta",
"header",
"lines",
".",
"Fasta",
"headers",
"can",
"be",
"extracted",
"using",
"grep",
"'",
">",
"'",
"new_zwd",
".",
"fasta",
">",
"fasta_header_file",
"A",
... | def fasta_headers_to_urs_accessions(fasta_header_file):
urs_accs = {}
fp = open(fasta_header_file, 'r')
for line in fp:
urs_acc = line.strip().split(' ')[0][1:]
if urs_acc not in urs_accs:
urs_accs[urs_acc] = ""
fp.close()
return urs_accs | [
"def",
"fasta_headers_to_urs_accessions",
"(",
"fasta_header_file",
")",
":",
"urs_accs",
"=",
"{",
"}",
"fp",
"=",
"open",
"(",
"fasta_header_file",
",",
"'r'",
")",
"for",
"line",
"in",
"fp",
":",
"urs_acc",
"=",
"line",
".",
"strip",
"(",
")",
".",
"s... | Extracts the URS accessions from a file containing
all zwd fasta header lines. | [
"Extracts",
"the",
"URS",
"accessions",
"from",
"a",
"file",
"containing",
"all",
"zwd",
"fasta",
"header",
"lines",
"."
] | [
"\"\"\"\n Extracts the URS accessions from a file containing\n all zwd fasta header lines. Fasta headers can be\n extracted using grep '>' new_zwd.fasta > fasta_header_file\n\n fasta_header_file: A .txt file containing all header lines\n from a new ZWD fasta file\n\n returns: A dictionary with all... | [
{
"param": "fasta_header_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_header_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4aed3e7c67fdfa6bed95a8465bc18ec0cb6717c2 | Rfam/rfam-production | scripts/preprocessing/zwd_import_precompute.py | [
"Apache-2.0"
] | Python | load_rfam_urs_accessions_from_file | <not_specific> | def load_rfam_urs_accessions_from_file(urs_acc_list):
"""
Loads all existing Rfam URS accessions in a python
dictionary
urs_acc_list: A .txt file with all URS accession already
in Rfam
return: A python dictionary with all URS accessions as
keys.
"""
rfam_urs_accs = {}
fp = op... |
Loads all existing Rfam URS accessions in a python
dictionary
urs_acc_list: A .txt file with all URS accession already
in Rfam
return: A python dictionary with all URS accessions as
keys.
| Loads all existing Rfam URS accessions in a python
dictionary
A .txt file with all URS accession already
in Rfam
A python dictionary with all URS accessions as
keys. | [
"Loads",
"all",
"existing",
"Rfam",
"URS",
"accessions",
"in",
"a",
"python",
"dictionary",
"A",
".",
"txt",
"file",
"with",
"all",
"URS",
"accession",
"already",
"in",
"Rfam",
"A",
"python",
"dictionary",
"with",
"all",
"URS",
"accessions",
"as",
"keys",
... | def load_rfam_urs_accessions_from_file(urs_acc_list):
rfam_urs_accs = {}
fp = open(urs_acc_list, 'r')
for line in fp:
accession = line.strip()
if accession not in rfam_urs_accs:
rfam_urs_accs[accession] = ""
fp.close()
return rfam_urs_accs | [
"def",
"load_rfam_urs_accessions_from_file",
"(",
"urs_acc_list",
")",
":",
"rfam_urs_accs",
"=",
"{",
"}",
"fp",
"=",
"open",
"(",
"urs_acc_list",
",",
"'r'",
")",
"for",
"line",
"in",
"fp",
":",
"accession",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"... | Loads all existing Rfam URS accessions in a python
dictionary | [
"Loads",
"all",
"existing",
"Rfam",
"URS",
"accessions",
"in",
"a",
"python",
"dictionary"
] | [
"\"\"\"\n Loads all existing Rfam URS accessions in a python\n dictionary\n\n urs_acc_list: A .txt file with all URS accession already\n in Rfam\n\n return: A python dictionary with all URS accessions as\n keys.\n \"\"\""
] | [
{
"param": "urs_acc_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "urs_acc_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4aed3e7c67fdfa6bed95a8465bc18ec0cb6717c2 | Rfam/rfam-production | scripts/preprocessing/zwd_import_precompute.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Basic argument parsing using python's argparse library
"""
parser = argparse.ArgumentParser(description="Checks for novel ZWD accessions")
parser.add_argument("--zwd-headers",
help="A header file generated directly from ZWD fasta", action="store")... |
Basic argument parsing using python's argparse library
| Basic argument parsing using python's argparse library | [
"Basic",
"argument",
"parsing",
"using",
"python",
"'",
"s",
"argparse",
"library"
] | def parse_arguments():
parser = argparse.ArgumentParser(description="Checks for novel ZWD accessions")
parser.add_argument("--zwd-headers",
help="A header file generated directly from ZWD fasta", action="store")
parser.add_argument("--rfam-urs-list",
help="A f... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Checks for novel ZWD accessions\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--zwd-headers\"",
",",
"help",
"=",
"\"A header file generated directly... | Basic argument parsing using python's argparse library | [
"Basic",
"argument",
"parsing",
"using",
"python",
"'",
"s",
"argparse",
"library"
] | [
"\"\"\"\n Basic argument parsing using python's argparse library\n \"\"\"",
"# parser.add_argument(\"--dest-dir\",",
"# help=\"Destination directory where output will be stored\", action=\"store\")"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c43a33d83a09b7f19f14c2389b91d376df0d47af | Rfam/rfam-production | pdb_mapping/send_notification.py | [
"Apache-2.0"
] | Python | send_notification | null | def send_notification():
"""
Send notification to Slack channel using incoming webhook
"""
slack_message = ""
webhook_url = SLACK_WEBHOOK
with open('pdb_mapping/pdb_families.txt', 'r') as f:
for line in f:
slack_message += line
slack_json = {
"text": "PDB Mapping... |
Send notification to Slack channel using incoming webhook
| Send notification to Slack channel using incoming webhook | [
"Send",
"notification",
"to",
"Slack",
"channel",
"using",
"incoming",
"webhook"
] | def send_notification():
slack_message = ""
webhook_url = SLACK_WEBHOOK
with open('pdb_mapping/pdb_families.txt', 'r') as f:
for line in f:
slack_message += line
slack_json = {
"text": "PDB Mapping",
"blocks": [
{
"type": "section",
... | [
"def",
"send_notification",
"(",
")",
":",
"slack_message",
"=",
"\"\"",
"webhook_url",
"=",
"SLACK_WEBHOOK",
"with",
"open",
"(",
"'pdb_mapping/pdb_families.txt'",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"slack_message",
"+=",
"line",
... | Send notification to Slack channel using incoming webhook | [
"Send",
"notification",
"to",
"Slack",
"channel",
"using",
"incoming",
"webhook"
] | [
"\"\"\"\n Send notification to Slack channel using incoming webhook\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
740eb2d6e6b67af9e5c37653dcd82c5fa5ede7e2 | Rfam/rfam-production | scripts/processing/infernal_2_pdb_full_region.py | [
"Apache-2.0"
] | Python | parse_arguments | <not_specific> | def parse_arguments():
"""
Basic argument parsing
return: Argparse parser object
"""
parser = argparse.ArgumentParser()
parser.add_argument('--tblout', help="infernal's tblout file", action='store')
parser.add_argument('--dest-dir', help="destination directory to store output to", action="... |
Basic argument parsing
return: Argparse parser object
| Basic argument parsing
return: Argparse parser object | [
"Basic",
"argument",
"parsing",
"return",
":",
"Argparse",
"parser",
"object"
] | def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--tblout', help="infernal's tblout file", action='store')
parser.add_argument('--dest-dir', help="destination directory to store output to", action="store")
return parser | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--tblout'",
",",
"help",
"=",
"\"infernal's tblout file\"",
",",
"action",
"=",
"'store'",
")",
"parser",
".",
"add_argum... | Basic argument parsing
return: Argparse parser object | [
"Basic",
"argument",
"parsing",
"return",
":",
"Argparse",
"parser",
"object"
] | [
"\"\"\"\n Basic argument parsing\n\n return: Argparse parser object\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.