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
740eb2d6e6b67af9e5c37653dcd82c5fa5ede7e2
Rfam/rfam-production
scripts/processing/infernal_2_pdb_full_region.py
[ "Apache-2.0" ]
Python
convert_tblout_2_pdb_full_region
null
def convert_tblout_2_pdb_full_region(tblout_file, dest_dir=None): """ Converts Infernal's tblout file to pdb_full_region txt dump for direct import to the rfam_live database tblout_file: Infernal's tblout file return: Void """ if dest_dir is None: dest_dir = os.getcwd() # Rfa...
Converts Infernal's tblout file to pdb_full_region txt dump for direct import to the rfam_live database tblout_file: Infernal's tblout file return: Void
Converts Infernal's tblout file to pdb_full_region txt dump for direct import to the rfam_live database Infernal's tblout file Void
[ "Converts", "Infernal", "'", "s", "tblout", "file", "to", "pdb_full_region", "txt", "dump", "for", "direct", "import", "to", "the", "rfam_live", "database", "Infernal", "'", "s", "tblout", "file", "Void" ]
def convert_tblout_2_pdb_full_region(tblout_file, dest_dir=None): if dest_dir is None: dest_dir = os.getcwd() hex_colours = ["1fc01f", "c00f0f", "bdc000", "c008ae", "00bac0", "8484c0", "93c090", "c0af92", "8e2511", "f29242", "8585e6", "ff87fa", "008700", "454545", "...
[ "def", "convert_tblout_2_pdb_full_region", "(", "tblout_file", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "getcwd", "(", ")", "hex_colours", "=", "[", "\"1fc01f\"", ",", "\"c00f0f\"", ",", "\"bdc0...
Converts Infernal's tblout file to pdb_full_region txt dump for direct import to the rfam_live database
[ "Converts", "Infernal", "'", "s", "tblout", "file", "to", "pdb_full_region", "txt", "dump", "for", "direct", "import", "to", "the", "rfam_live", "database" ]
[ "\"\"\"\n Converts Infernal's tblout file to pdb_full_region txt dump\n for direct import to the rfam_live database\n\n tblout_file: Infernal's tblout file\n\n return: Void\n \"\"\"", "# Rfam website hex colours to randomly choose from", "# create a new pdb_full_region output file and mark the da...
[ { "param": "tblout_file", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tblout_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring...
ba4c493dbd6fbdfe1bd312b94b9d65252b0a3894
Rfam/rfam-production
scripts/export/metagenomics/fasta2metseq.py
[ "Apache-2.0" ]
Python
fasta_to_metseq_dump
null
def fasta_to_metseq_dump(fasta_input, filename=None, dest_dir=None): """ Convert UMGS fasta file header accessions to metseq txt dump fasta_input: A UMGS fasta file or a directory with multiple fasta files filename: The output filename. If None, uses the UMGS filename by default dest_dir: The desti...
Convert UMGS fasta file header accessions to metseq txt dump fasta_input: A UMGS fasta file or a directory with multiple fasta files filename: The output filename. If None, uses the UMGS filename by default dest_dir: The destination directory. If None, uses the input directory by default returns:...
Convert UMGS fasta file header accessions to metseq txt dump fasta_input: A UMGS fasta file or a directory with multiple fasta files filename: The output filename. If None, uses the UMGS filename by default dest_dir: The destination directory. If None, uses the input directory by default Void
[ "Convert", "UMGS", "fasta", "file", "header", "accessions", "to", "metseq", "txt", "dump", "fasta_input", ":", "A", "UMGS", "fasta", "file", "or", "a", "directory", "with", "multiple", "fasta", "files", "filename", ":", "The", "output", "filename", ".", "If"...
def fasta_to_metseq_dump(fasta_input, filename=None, dest_dir=None): if dest_dir is None: dest_dir = os.path.split(fasta_input)[0] if os.path.isdir(fasta_input): fasta_files = [x for x in os.listdir(fasta_input) if x.endswith(".fa") or x.endswith(".fasta")] for fasta_file in fasta_files:...
[ "def", "fasta_to_metseq_dump", "(", "fasta_input", ",", "filename", "=", "None", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "fasta_input", ")", "[", "0", "]", "if"...
Convert UMGS fasta file header accessions to metseq txt dump fasta_input: A UMGS fasta file or a directory with multiple fasta files filename: The output filename.
[ "Convert", "UMGS", "fasta", "file", "header", "accessions", "to", "metseq", "txt", "dump", "fasta_input", ":", "A", "UMGS", "fasta", "file", "or", "a", "directory", "with", "multiple", "fasta", "files", "filename", ":", "The", "output", "filename", "." ]
[ "\"\"\"\n Convert UMGS fasta file header accessions to metseq txt dump\n\n fasta_input: A UMGS fasta file or a directory with multiple fasta files\n filename: The output filename. If None, uses the UMGS filename by default\n dest_dir: The destination directory. If None, uses the input directory by defau...
[ { "param": "fasta_input", "type": null }, { "param": "filename", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fasta_input", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "docstring...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
fetch_ref_proteomes
<not_specific>
def fetch_ref_proteomes(): """ This method returns a list of all reference proteome accessions available from Uniprot """ ref_prot_list = [] response = urllib2.urlopen(REF_PROT_LIST_URL) for ref_prot in response: ref_prot_list.append(ref_prot.strip()) return ref_prot_list
This method returns a list of all reference proteome accessions available from Uniprot
This method returns a list of all reference proteome accessions available from Uniprot
[ "This", "method", "returns", "a", "list", "of", "all", "reference", "proteome", "accessions", "available", "from", "Uniprot" ]
def fetch_ref_proteomes(): ref_prot_list = [] response = urllib2.urlopen(REF_PROT_LIST_URL) for ref_prot in response: ref_prot_list.append(ref_prot.strip()) return ref_prot_list
[ "def", "fetch_ref_proteomes", "(", ")", ":", "ref_prot_list", "=", "[", "]", "response", "=", "urllib2", ".", "urlopen", "(", "REF_PROT_LIST_URL", ")", "for", "ref_prot", "in", "response", ":", "ref_prot_list", ".", "append", "(", "ref_prot", ".", "strip", "...
This method returns a list of all reference proteome accessions available from Uniprot
[ "This", "method", "returns", "a", "list", "of", "all", "reference", "proteome", "accessions", "available", "from", "Uniprot" ]
[ "\"\"\"\n This method returns a list of all reference proteome accessions available\n from Uniprot\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
export_gca_accessions
<not_specific>
def export_gca_accessions(upid_gca): """ Retrieves reference proteomes ids and their associated gca accessions as well as the taxonomic rank/domain (eukaryotes, bacteria etc) upid_gca: Uniprot's tab separated file (UPID_GCA.tsv) """ # need to check if the path provided is a valid file upid...
Retrieves reference proteomes ids and their associated gca accessions as well as the taxonomic rank/domain (eukaryotes, bacteria etc) upid_gca: Uniprot's tab separated file (UPID_GCA.tsv)
Retrieves reference proteomes ids and their associated gca accessions as well as the taxonomic rank/domain (eukaryotes, bacteria etc) Uniprot's tab separated file (UPID_GCA.tsv)
[ "Retrieves", "reference", "proteomes", "ids", "and", "their", "associated", "gca", "accessions", "as", "well", "as", "the", "taxonomic", "rank", "/", "domain", "(", "eukaryotes", "bacteria", "etc", ")", "Uniprot", "'", "s", "tab", "separated", "file", "(", "...
def export_gca_accessions(upid_gca): upid_gca_fp = open(upid_gca, 'r') prot_gca_pairs = {} for prot in upid_gca_fp: prot = prot.strip().split('\t') if prot[1] != '': prot_gca_pairs[prot[0]] = prot[1] else: prot_gca_pairs[prot[0]] = -1 upid_gca_fp.close() ...
[ "def", "export_gca_accessions", "(", "upid_gca", ")", ":", "upid_gca_fp", "=", "open", "(", "upid_gca", ",", "'r'", ")", "prot_gca_pairs", "=", "{", "}", "for", "prot", "in", "upid_gca_fp", ":", "prot", "=", "prot", ".", "strip", "(", ")", ".", "split", ...
Retrieves reference proteomes ids and their associated gca accessions as well as the taxonomic rank/domain (eukaryotes, bacteria etc)
[ "Retrieves", "reference", "proteomes", "ids", "and", "their", "associated", "gca", "accessions", "as", "well", "as", "the", "taxonomic", "rank", "/", "domain", "(", "eukaryotes", "bacteria", "etc", ")" ]
[ "\"\"\"\n Retrieves reference proteomes ids and their associated gca accessions\n as well as the taxonomic rank/domain (eukaryotes, bacteria etc)\n\n upid_gca: Uniprot's tab separated file (UPID_GCA.tsv)\n \"\"\"", "# need to check if the path provided is a valid file" ]
[ { "param": "upid_gca", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid_gca", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
extract_genome_acc
<not_specific>
def extract_genome_acc(prot_rdf): """ Extracts and returns the assembly accession from the proteome rdf which provided as input. Returns -1 if not available prot_rdf: A Uniprot's proteome rdf url or file path """ g = Graph() response = requests.get(prot_rdf).status_code if response ==...
Extracts and returns the assembly accession from the proteome rdf which provided as input. Returns -1 if not available prot_rdf: A Uniprot's proteome rdf url or file path
Extracts and returns the assembly accession from the proteome rdf which provided as input. Returns -1 if not available A Uniprot's proteome rdf url or file path
[ "Extracts", "and", "returns", "the", "assembly", "accession", "from", "the", "proteome", "rdf", "which", "provided", "as", "input", ".", "Returns", "-", "1", "if", "not", "available", "A", "Uniprot", "'", "s", "proteome", "rdf", "url", "or", "file", "path"...
def extract_genome_acc(prot_rdf): g = Graph() response = requests.get(prot_rdf).status_code if response == httplib.OK: g.load(prot_rdf) for s, p, o in g: if string.find(o, "GCA") != -1: return os.path.split(o)[1] return -1
[ "def", "extract_genome_acc", "(", "prot_rdf", ")", ":", "g", "=", "Graph", "(", ")", "response", "=", "requests", ".", "get", "(", "prot_rdf", ")", ".", "status_code", "if", "response", "==", "httplib", ".", "OK", ":", "g", ".", "load", "(", "prot_rdf"...
Extracts and returns the assembly accession from the proteome rdf which provided as input.
[ "Extracts", "and", "returns", "the", "assembly", "accession", "from", "the", "proteome", "rdf", "which", "provided", "as", "input", "." ]
[ "\"\"\"\n Extracts and returns the assembly accession from the proteome rdf\n which provided as input. Returns -1 if not available\n\n prot_rdf: A Uniprot's proteome rdf url or file path\n \"\"\"" ]
[ { "param": "prot_rdf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "prot_rdf", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
proteome_rdf_scanner
<not_specific>
def proteome_rdf_scanner(proteome): """ Scans a Uniprot's reference proteome rdf file and looks for all available accessions. Returns a dictionary with GCA and WGS accessions where applicable prot_rdf: Uniprot's proteome rdf url or file path """ # need to do some http error handling here a...
Scans a Uniprot's reference proteome rdf file and looks for all available accessions. Returns a dictionary with GCA and WGS accessions where applicable prot_rdf: Uniprot's proteome rdf url or file path
Scans a Uniprot's reference proteome rdf file and looks for all available accessions. Returns a dictionary with GCA and WGS accessions where applicable Uniprot's proteome rdf url or file path
[ "Scans", "a", "Uniprot", "'", "s", "reference", "proteome", "rdf", "file", "and", "looks", "for", "all", "available", "accessions", ".", "Returns", "a", "dictionary", "with", "GCA", "and", "WGS", "accessions", "where", "applicable", "Uniprot", "'", "s", "pro...
def proteome_rdf_scanner(proteome): prot_rdf = PROTEOME_URL % proteome accessions = {"GCA": -1, "WGS": -1} wgs_flag = False g = Graph() if requests.get(prot_rdf).status_code == httplib.OK: g.load(prot_rdf) for s, p, o in g: if string.find(o, "/embl/") != -1: ...
[ "def", "proteome_rdf_scanner", "(", "proteome", ")", ":", "prot_rdf", "=", "PROTEOME_URL", "%", "proteome", "accessions", "=", "{", "\"GCA\"", ":", "-", "1", ",", "\"WGS\"", ":", "-", "1", "}", "wgs_flag", "=", "False", "g", "=", "Graph", "(", ")", "if...
Scans a Uniprot's reference proteome rdf file and looks for all available accessions.
[ "Scans", "a", "Uniprot", "'", "s", "reference", "proteome", "rdf", "file", "and", "looks", "for", "all", "available", "accessions", "." ]
[ "\"\"\"\n Scans a Uniprot's reference proteome rdf file and looks for all\n available accessions. Returns a dictionary with GCA and WGS accessions\n where applicable\n\n prot_rdf: Uniprot's proteome rdf url or file path\n \"\"\"", "# need to do some http error handling here and if resource is unava...
[ { "param": "proteome", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "proteome", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
proteome_xml_scanner
<not_specific>
def proteome_xml_scanner(proteome): """ Scans a Uniprot's reference proteome rdf file and looks for all available accessions. Returns a dictionary with GCA and WGS accessions where applicable prot_xml: Uniprot's proteome rdf url or file path """ # need to do some http error handling here a...
Scans a Uniprot's reference proteome rdf file and looks for all available accessions. Returns a dictionary with GCA and WGS accessions where applicable prot_xml: Uniprot's proteome rdf url or file path
Scans a Uniprot's reference proteome rdf file and looks for all available accessions. Returns a dictionary with GCA and WGS accessions where applicable Uniprot's proteome rdf url or file path
[ "Scans", "a", "Uniprot", "'", "s", "reference", "proteome", "rdf", "file", "and", "looks", "for", "all", "available", "accessions", ".", "Returns", "a", "dictionary", "with", "GCA", "and", "WGS", "accessions", "where", "applicable", "Uniprot", "'", "s", "pro...
def proteome_xml_scanner(proteome): prot_xml = PROTEOME_XML_URL % proteome prefix = "{http://uniprot.org/uniprot}%s" accessions = {"GCA": -1, "WGS": -1} if requests.get(prot_xml).status_code == httplib.OK: xml_root = ET.fromstring(requests.get(prot_xml).content) proteome = xml_root.find(...
[ "def", "proteome_xml_scanner", "(", "proteome", ")", ":", "prot_xml", "=", "PROTEOME_XML_URL", "%", "proteome", "prefix", "=", "\"{http://uniprot.org/uniprot}%s\"", "accessions", "=", "{", "\"GCA\"", ":", "-", "1", ",", "\"WGS\"", ":", "-", "1", "}", "if", "re...
Scans a Uniprot's reference proteome rdf file and looks for all available accessions.
[ "Scans", "a", "Uniprot", "'", "s", "reference", "proteome", "rdf", "file", "and", "looks", "for", "all", "available", "accessions", "." ]
[ "\"\"\"\n Scans a Uniprot's reference proteome rdf file and looks for all\n available accessions. Returns a dictionary with GCA and WGS accessions\n where applicable\n\n prot_xml: Uniprot's proteome rdf url or file path\n \"\"\"", "# need to do some http error handling here and if resource is unava...
[ { "param": "proteome", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "proteome", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
fetch_ena_file
<not_specific>
def fetch_ena_file(acc, file_format, dest_dir, compressed=True): """ Retrieves a file given a valid ENA accession and stores it in the indicated destination in the selected format acc: A valid ENA entry accession format: A valid ENA file format (xml, fasta, txt) dest_dit: A valid path to destin...
Retrieves a file given a valid ENA accession and stores it in the indicated destination in the selected format acc: A valid ENA entry accession format: A valid ENA file format (xml, fasta, txt) dest_dit: A valid path to destination directory
Retrieves a file given a valid ENA accession and stores it in the indicated destination in the selected format A valid ENA entry accession format: A valid ENA file format (xml, fasta, txt) dest_dit: A valid path to destination directory
[ "Retrieves", "a", "file", "given", "a", "valid", "ENA", "accession", "and", "stores", "it", "in", "the", "indicated", "destination", "in", "the", "selected", "format", "A", "valid", "ENA", "entry", "accession", "format", ":", "A", "valid", "ENA", "file", "...
def fetch_ena_file(acc, file_format, dest_dir, compressed=True): seq_url = None file_path = None if file_format.find("xml") != -1: seq_url = ENA_XML_URL % acc file_path = os.path.join(dest_dir, acc + FORMATS[file_format]) else: if compressed is True: seq_url = ENA_DAT...
[ "def", "fetch_ena_file", "(", "acc", ",", "file_format", ",", "dest_dir", ",", "compressed", "=", "True", ")", ":", "seq_url", "=", "None", "file_path", "=", "None", "if", "file_format", ".", "find", "(", "\"xml\"", ")", "!=", "-", "1", ":", "seq_url", ...
Retrieves a file given a valid ENA accession and stores it in the indicated destination in the selected format
[ "Retrieves", "a", "file", "given", "a", "valid", "ENA", "accession", "and", "stores", "it", "in", "the", "indicated", "destination", "in", "the", "selected", "format" ]
[ "\"\"\"\n Retrieves a file given a valid ENA accession and stores it in the\n indicated destination in the selected format\n\n acc: A valid ENA entry accession\n format: A valid ENA file format (xml, fasta, txt)\n dest_dit: A valid path to destination directory\n \"\"\"", "# fetching compressed ...
[ { "param": "acc", "type": null }, { "param": "file_format", "type": null }, { "param": "dest_dir", "type": null }, { "param": "compressed", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "acc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file_format", "type": null, "docstring": null, "docstring_toke...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
extract_assembly_accs
<not_specific>
def extract_assembly_accs(accession): """ Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes accession: A valid ENA GCA accession (without the assembly version) """ accessions = [] root = None assembly_link = ...
Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes accession: A valid ENA GCA accession (without the assembly version)
Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes A valid ENA GCA accession (without the assembly version)
[ "Loads", "an", "xml", "tree", "from", "a", "file", "or", "a", "string", "(", "usually", "an", "http", "response", ")", "and", "returns", "a", "list", "with", "the", "genome", "assembly", "'", "s", "chromosomes", "A", "valid", "ENA", "GCA", "accession", ...
def extract_assembly_accs(accession): accessions = [] root = None assembly_link = None assembly = None assembly_xml = requests.get(ENA_XML_URL % accession).content if os.path.isfile(assembly_xml): root = ET.parse(assembly_xml).getroot() else: root = ET.fromstring(assembly_xml...
[ "def", "extract_assembly_accs", "(", "accession", ")", ":", "accessions", "=", "[", "]", "root", "=", "None", "assembly_link", "=", "None", "assembly", "=", "None", "assembly_xml", "=", "requests", ".", "get", "(", "ENA_XML_URL", "%", "accession", ")", ".", ...
Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes
[ "Loads", "an", "xml", "tree", "from", "a", "file", "or", "a", "string", "(", "usually", "an", "http", "response", ")", "and", "returns", "a", "list", "with", "the", "genome", "assembly", "'", "s", "chromosomes" ]
[ "\"\"\"\n Loads an xml tree from a file or a string (usually an http response),\n and returns a list with the genome assembly's chromosomes\n\n accession: A valid ENA GCA accession (without the assembly version)\n \"\"\"", "# parse xml tree and return root node", "# fromstring returns the xml root d...
[ { "param": "accession", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
download_genomes
<not_specific>
def download_genomes(gen, dest_dir): """ Downloads all chromosome files of a given assembly accession (ENA) in dest_dir gen: Single accession (string) or a list of genome accessions (GC*) dest_dir: The path of the destination directory to export the fasta files """ # need to add loggin...
Downloads all chromosome files of a given assembly accession (ENA) in dest_dir gen: Single accession (string) or a list of genome accessions (GC*) dest_dir: The path of the destination directory to export the fasta files
Downloads all chromosome files of a given assembly accession (ENA) in dest_dir Single accession (string) or a list of genome accessions (GC*) dest_dir: The path of the destination directory to export the fasta files
[ "Downloads", "all", "chromosome", "files", "of", "a", "given", "assembly", "accession", "(", "ENA", ")", "in", "dest_dir", "Single", "accession", "(", "string", ")", "or", "a", "list", "of", "genome", "accessions", "(", "GC", "*", ")", "dest_dir", ":", "...
def download_genomes(gen, dest_dir): accessions = None if os.path.isfile(gen): gen_fp = open(gen, 'r') for gen_acc in gen_fp: gen_acc = string.strip(gen_acc) if string.find(gen_acc, '.') != -1: gen_acc = gen_acc.partition('.') gen_acc = gen...
[ "def", "download_genomes", "(", "gen", ",", "dest_dir", ")", ":", "accessions", "=", "None", "if", "os", ".", "path", ".", "isfile", "(", "gen", ")", ":", "gen_fp", "=", "open", "(", "gen", ",", "'r'", ")", "for", "gen_acc", "in", "gen_fp", ":", "g...
Downloads all chromosome files of a given assembly accession (ENA) in dest_dir
[ "Downloads", "all", "chromosome", "files", "of", "a", "given", "assembly", "accession", "(", "ENA", ")", "in", "dest_dir" ]
[ "\"\"\"\n Downloads all chromosome files of a given assembly accession (ENA) in\n dest_dir\n\n gen: Single accession (string) or a list of genome accessions (GC*)\n dest_dir: The path of the destination directory to export the fasta\n files\n \"\"\"", "# need to add logging", "# if no accessio...
[ { "param": "gen", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gen", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_tokens"...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
fetch_genome
null
def fetch_genome(gen, dest_dir): """ Downloads and parses xml file of the given genome accession (gen), and downloads all chromosome files in fasta format in destination directory (dest_dir). The xml file is deleted after completion. gen: ENA assembly accession (GCA*) dest_dir: Destination of t...
Downloads and parses xml file of the given genome accession (gen), and downloads all chromosome files in fasta format in destination directory (dest_dir). The xml file is deleted after completion. gen: ENA assembly accession (GCA*) dest_dir: Destination of the output directory
Downloads and parses xml file of the given genome accession (gen), and downloads all chromosome files in fasta format in destination directory (dest_dir). The xml file is deleted after completion. ENA assembly accession (GCA*) dest_dir: Destination of the output directory
[ "Downloads", "and", "parses", "xml", "file", "of", "the", "given", "genome", "accession", "(", "gen", ")", "and", "downloads", "all", "chromosome", "files", "in", "fasta", "format", "in", "destination", "directory", "(", "dest_dir", ")", ".", "The", "xml", ...
def fetch_genome(gen, dest_dir): gen_dir = os.path.join(dest_dir, gen.partition('.')[0]) try: os.mkdir(gen_dir) except: pass fetch_ena_file(gen, "xml", gen_dir) gen_xml = os.path.join(gen_dir, gen + ".xml") chroms = extract_assembly_accs(gen_xml) for chrom in chroms: ...
[ "def", "fetch_genome", "(", "gen", ",", "dest_dir", ")", ":", "gen_dir", "=", "os", ".", "path", ".", "join", "(", "dest_dir", ",", "gen", ".", "partition", "(", "'.'", ")", "[", "0", "]", ")", "try", ":", "os", ".", "mkdir", "(", "gen_dir", ")",...
Downloads and parses xml file of the given genome accession (gen), and downloads all chromosome files in fasta format in destination directory (dest_dir).
[ "Downloads", "and", "parses", "xml", "file", "of", "the", "given", "genome", "accession", "(", "gen", ")", "and", "downloads", "all", "chromosome", "files", "in", "fasta", "format", "in", "destination", "directory", "(", "dest_dir", ")", "." ]
[ "\"\"\"\n Downloads and parses xml file of the given genome accession (gen), and\n downloads all chromosome files in fasta format in destination directory\n (dest_dir). The xml file is deleted after completion.\n\n gen: ENA assembly accession (GCA*)\n dest_dir: Destination of the output directory\n ...
[ { "param": "gen", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gen", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_tokens"...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
rdf_accession_search
<not_specific>
def rdf_accession_search(ref_prot_acc, sub_str): """ Parses rdf url and returns a list of ENA accessions rdf_url: The url to a Uniprot's reference proteome rdf url sub_str: A sub string to look for in the rdf file """ accessions = [] rdf_graph = Graph() rdf_url = PROTEOME_URL % ref_pro...
Parses rdf url and returns a list of ENA accessions rdf_url: The url to a Uniprot's reference proteome rdf url sub_str: A sub string to look for in the rdf file
Parses rdf url and returns a list of ENA accessions rdf_url: The url to a Uniprot's reference proteome rdf url sub_str: A sub string to look for in the rdf file
[ "Parses", "rdf", "url", "and", "returns", "a", "list", "of", "ENA", "accessions", "rdf_url", ":", "The", "url", "to", "a", "Uniprot", "'", "s", "reference", "proteome", "rdf", "url", "sub_str", ":", "A", "sub", "string", "to", "look", "for", "in", "the...
def rdf_accession_search(ref_prot_acc, sub_str): accessions = [] rdf_graph = Graph() rdf_url = PROTEOME_URL % ref_prot_acc response = requests.get(rdf_url).status_code if response == httplib.OK: rdf_graph.load(rdf_url) for s, p, o in rdf_graph: if string.find(o, sub_str) ...
[ "def", "rdf_accession_search", "(", "ref_prot_acc", ",", "sub_str", ")", ":", "accessions", "=", "[", "]", "rdf_graph", "=", "Graph", "(", ")", "rdf_url", "=", "PROTEOME_URL", "%", "ref_prot_acc", "response", "=", "requests", ".", "get", "(", "rdf_url", ")",...
Parses rdf url and returns a list of ENA accessions rdf_url: The url to a Uniprot's reference proteome rdf url sub_str: A sub string to look for in the rdf file
[ "Parses", "rdf", "url", "and", "returns", "a", "list", "of", "ENA", "accessions", "rdf_url", ":", "The", "url", "to", "a", "Uniprot", "'", "s", "reference", "proteome", "rdf", "url", "sub_str", ":", "A", "sub", "string", "to", "look", "for", "in", "the...
[ "\"\"\"\n Parses rdf url and returns a list of ENA accessions\n\n rdf_url: The url to a Uniprot's reference proteome rdf url\n sub_str: A sub string to look for in the rdf file\n \"\"\"", "# return http status code", "# return response.status_code" ]
[ { "param": "ref_prot_acc", "type": null }, { "param": "sub_str", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ref_prot_acc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sub_str", "type": null, "docstring": null, "docstring...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
assembly_report_parser
<not_specific>
def assembly_report_parser(assembly_report, url=True): """ Parses an assembly report file and returns a list of all available accessions (scaffolds, contigs etc) report_url: A url provided within an ENA assembly xml file. This is the text of URL tag under ASSEMBLY/ASSEMBLY_LINKS/ASSEMBLY_LINK.By de...
Parses an assembly report file and returns a list of all available accessions (scaffolds, contigs etc) report_url: A url provided within an ENA assembly xml file. This is the text of URL tag under ASSEMBLY/ASSEMBLY_LINKS/ASSEMBLY_LINK.By default this is an ftp request url. Converting to http to fe...
Parses an assembly report file and returns a list of all available accessions (scaffolds, contigs etc) A url provided within an ENA assembly xml file. This is the text of URL tag under ASSEMBLY/ASSEMBLY_LINKS/ASSEMBLY_LINK.By default this is an ftp request url. Converting to http to fetch assembly accessions.
[ "Parses", "an", "assembly", "report", "file", "and", "returns", "a", "list", "of", "all", "available", "accessions", "(", "scaffolds", "contigs", "etc", ")", "A", "url", "provided", "within", "an", "ENA", "assembly", "xml", "file", ".", "This", "is", "the"...
def assembly_report_parser(assembly_report, url=True): accessions = [] report_url = None ass_rep_file = None if url is True: report_url = assembly_report.replace("ftp://", "http://") ass_rep_file = requests.get(report_url).content.split('\n')[1:] if ass_rep_file[len(ass_rep_file)...
[ "def", "assembly_report_parser", "(", "assembly_report", ",", "url", "=", "True", ")", ":", "accessions", "=", "[", "]", "report_url", "=", "None", "ass_rep_file", "=", "None", "if", "url", "is", "True", ":", "report_url", "=", "assembly_report", ".", "repla...
Parses an assembly report file and returns a list of all available accessions (scaffolds, contigs etc)
[ "Parses", "an", "assembly", "report", "file", "and", "returns", "a", "list", "of", "all", "available", "accessions", "(", "scaffolds", "contigs", "etc", ")" ]
[ "\"\"\"\n Parses an assembly report file and returns a list of all available\n accessions (scaffolds, contigs etc)\n\n report_url: A url provided within an ENA assembly xml file. This is the\n text of URL tag under ASSEMBLY/ASSEMBLY_LINKS/ASSEMBLY_LINK.By default this\n is an ftp request url. Convert...
[ { "param": "assembly_report", "type": null }, { "param": "url", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "assembly_report", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
lsf_cmd_generator
<not_specific>
def lsf_cmd_generator(upid, gca_acc, domain, exec_path, proj_dir): """ Generates an lsf job command for downloading a new genome. Returns an LSF specific bsub command upid: Uniprot's reference proteome id gca_acc: ENA's genome accession. -1 if there's no available id domain: Proteome's taxonomi...
Generates an lsf job command for downloading a new genome. Returns an LSF specific bsub command upid: Uniprot's reference proteome id gca_acc: ENA's genome accession. -1 if there's no available id domain: Proteome's taxonomic domain exec_path: The path to the pipeline executable proj_dir: ...
Generates an lsf job command for downloading a new genome. Returns an LSF specific bsub command Uniprot's reference proteome id gca_acc: ENA's genome accession. -1 if there's no available id domain: Proteome's taxonomic domain exec_path: The path to the pipeline executable proj_dir: The path to the project directory
[ "Generates", "an", "lsf", "job", "command", "for", "downloading", "a", "new", "genome", ".", "Returns", "an", "LSF", "specific", "bsub", "command", "Uniprot", "'", "s", "reference", "proteome", "id", "gca_acc", ":", "ENA", "'", "s", "genome", "accession", ...
def lsf_cmd_generator(upid, gca_acc, domain, exec_path, proj_dir): subdir_idx = upid[8:] prot_dir = os.path.join(os.path.join(proj_dir, subdir_idx), upid) cmd = ("bsub -M %s " "-R \"rusage[mem=%s,tmp=%s]\" " "-o \"%s\" " "-e \"%s\" " "-u \"%s\" " "-n 4 ...
[ "def", "lsf_cmd_generator", "(", "upid", ",", "gca_acc", ",", "domain", ",", "exec_path", ",", "proj_dir", ")", ":", "subdir_idx", "=", "upid", "[", "8", ":", "]", "prot_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "join", ...
Generates an lsf job command for downloading a new genome.
[ "Generates", "an", "lsf", "job", "command", "for", "downloading", "a", "new", "genome", "." ]
[ "\"\"\"\n Generates an lsf job command for downloading a new genome. Returns an\n LSF specific bsub command\n\n upid: Uniprot's reference proteome id\n gca_acc: ENA's genome accession. -1 if there's no available id\n domain: Proteome's taxonomic domain\n exec_path: The path to the pipeline executa...
[ { "param": "upid", "type": null }, { "param": "gca_acc", "type": null }, { "param": "domain", "type": null }, { "param": "exec_path", "type": null }, { "param": "proj_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gca_acc", "type": null, "docstring": null, "docstring_tokens"...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
genome_script_generator
null
def genome_script_generator(upid, domain, gen_size, out_dir): """ Generates a shell script for a proteome with ip upid under out_dir. Memory is reserved according to genome size upid: Uniprot's unique proteome id domain: The domain under which a proteome has been classified gen_size: The genome...
Generates a shell script for a proteome with ip upid under out_dir. Memory is reserved according to genome size upid: Uniprot's unique proteome id domain: The domain under which a proteome has been classified gen_size: The genome's size out_dir: Destination directory
Generates a shell script for a proteome with ip upid under out_dir. Memory is reserved according to genome size Uniprot's unique proteome id domain: The domain under which a proteome has been classified gen_size: The genome's size out_dir: Destination directory
[ "Generates", "a", "shell", "script", "for", "a", "proteome", "with", "ip", "upid", "under", "out_dir", ".", "Memory", "is", "reserved", "according", "to", "genome", "size", "Uniprot", "'", "s", "unique", "proteome", "id", "domain", ":", "The", "domain", "u...
def genome_script_generator(upid, domain, gen_size, out_dir): shell_fp = open(os.path.join(out_dir, upid + ".sh"), 'w') mem_size = 8000 tmp_size = gen_size * 2 tmp_dir = "/tmp/%s_$LSB_JOBID" % (upid) prot_dest_dir = os.path.join( os.path.join(os.path.split(out_dir)[0], domain), upid) she...
[ "def", "genome_script_generator", "(", "upid", ",", "domain", ",", "gen_size", ",", "out_dir", ")", ":", "shell_fp", "=", "open", "(", "os", ".", "path", ".", "join", "(", "out_dir", ",", "upid", "+", "\".sh\"", ")", ",", "'w'", ")", "mem_size", "=", ...
Generates a shell script for a proteome with ip upid under out_dir.
[ "Generates", "a", "shell", "script", "for", "a", "proteome", "with", "ip", "upid", "under", "out_dir", "." ]
[ "\"\"\"\n Generates a shell script for a proteome with ip upid under out_dir.\n Memory is reserved according to genome size\n\n upid: Uniprot's unique proteome id\n domain: The domain under which a proteome has been classified\n gen_size: The genome's size\n out_dir: Destination directory\n \"\...
[ { "param": "upid", "type": null }, { "param": "domain", "type": null }, { "param": "gen_size", "type": null }, { "param": "out_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "domain", "type": null, "docstring": null, "docstring_tokens":...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
load_upid_gca_pairs
<not_specific>
def load_upid_gca_pairs(): """ This is an alternative version to load_upid_gca_file loading the pairs from Uniprot's REST API. Returns a dictionary of upid, gca accession pairs, including the species kingdom """ id_pairs = {} response = requests.get(gc.REF_PROT_REST_URL) if response.st...
This is an alternative version to load_upid_gca_file loading the pairs from Uniprot's REST API. Returns a dictionary of upid, gca accession pairs, including the species kingdom
This is an alternative version to load_upid_gca_file loading the pairs from Uniprot's REST API. Returns a dictionary of upid, gca accession pairs, including the species kingdom
[ "This", "is", "an", "alternative", "version", "to", "load_upid_gca_file", "loading", "the", "pairs", "from", "Uniprot", "'", "s", "REST", "API", ".", "Returns", "a", "dictionary", "of", "upid", "gca", "accession", "pairs", "including", "the", "species", "kingd...
def load_upid_gca_pairs(): id_pairs = {} response = requests.get(gc.REF_PROT_REST_URL) if response.status_code == 200: content = response.content prot_lines = content.split('\n') prot_lines.pop(0) for prot_line in prot_lines: if prot_line != '': pr...
[ "def", "load_upid_gca_pairs", "(", ")", ":", "id_pairs", "=", "{", "}", "response", "=", "requests", ".", "get", "(", "gc", ".", "REF_PROT_REST_URL", ")", "if", "response", ".", "status_code", "==", "200", ":", "content", "=", "response", ".", "content", ...
This is an alternative version to load_upid_gca_file loading the pairs from Uniprot's REST API.
[ "This", "is", "an", "alternative", "version", "to", "load_upid_gca_file", "loading", "the", "pairs", "from", "Uniprot", "'", "s", "REST", "API", "." ]
[ "\"\"\"\n This is an alternative version to load_upid_gca_file loading the pairs from\n Uniprot's REST API. Returns a dictionary of upid, gca accession pairs,\n including the species kingdom\n \"\"\"", "# remove header line", "# raise an error here" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
fetch_genome_accessions
<not_specific>
def fetch_genome_accessions(upid, gca_acc): """ Fetches and returns a list of all accessions for a specific ref. proteome upid: Uniprot's ref. proteome id gca_acc: An ENA GCA accession associated with the upid (if available or -1) """ gen_accs = [] gca_acc = str(gca_acc) # there's a G...
Fetches and returns a list of all accessions for a specific ref. proteome upid: Uniprot's ref. proteome id gca_acc: An ENA GCA accession associated with the upid (if available or -1)
Fetches and returns a list of all accessions for a specific ref. proteome upid: Uniprot's ref. proteome id gca_acc: An ENA GCA accession associated with the upid (if available or -1)
[ "Fetches", "and", "returns", "a", "list", "of", "all", "accessions", "for", "a", "specific", "ref", ".", "proteome", "upid", ":", "Uniprot", "'", "s", "ref", ".", "proteome", "id", "gca_acc", ":", "An", "ENA", "GCA", "accession", "associated", "with", "t...
def fetch_genome_accessions(upid, gca_acc): gen_accs = [] gca_acc = str(gca_acc) if gca_acc != "-1": gca_acc = gca_acc.split('.')[0] gen_accs = extract_assembly_accs(gca_acc) else: prot_accs = proteome_rdf_scanner(upid) if prot_accs["GCA"] == -1 and prot_accs["WGS"] == -1...
[ "def", "fetch_genome_accessions", "(", "upid", ",", "gca_acc", ")", ":", "gen_accs", "=", "[", "]", "gca_acc", "=", "str", "(", "gca_acc", ")", "if", "gca_acc", "!=", "\"-1\"", ":", "gca_acc", "=", "gca_acc", ".", "split", "(", "'.'", ")", "[", "0", ...
Fetches and returns a list of all accessions for a specific ref.
[ "Fetches", "and", "returns", "a", "list", "of", "all", "accessions", "for", "a", "specific", "ref", "." ]
[ "\"\"\"\n Fetches and returns a list of all accessions for a specific ref. proteome\n\n upid: Uniprot's ref. proteome id\n gca_acc: An ENA GCA accession associated with the upid (if available or -1)\n \"\"\"", "# there's a GCA accession", "# no GCA or WGS, get any accessions from proteome rdf", "#...
[ { "param": "upid", "type": null }, { "param": "gca_acc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gca_acc", "type": null, "docstring": null, "docstring_tokens"...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
fetch_wgs_range_accs
<not_specific>
def fetch_wgs_range_accs(wgs_range): """ Splits the WGS range into distinct accessions for metadata retrieval wgs_range: A valid ENA-WGS set range """ wgs_accs = [] wgs_end_points = wgs_range.strip().split('-') wgs_prefix = wgs_end_points[0][0:5] wgs_start = int(wgs_end_points[0][5:]...
Splits the WGS range into distinct accessions for metadata retrieval wgs_range: A valid ENA-WGS set range
Splits the WGS range into distinct accessions for metadata retrieval wgs_range: A valid ENA-WGS set range
[ "Splits", "the", "WGS", "range", "into", "distinct", "accessions", "for", "metadata", "retrieval", "wgs_range", ":", "A", "valid", "ENA", "-", "WGS", "set", "range" ]
def fetch_wgs_range_accs(wgs_range): wgs_accs = [] wgs_end_points = wgs_range.strip().split('-') wgs_prefix = wgs_end_points[0][0:5] wgs_start = int(wgs_end_points[0][5:]) wgs_end = int(wgs_end_points[1][5:]) wgs_acc = '' while wgs_start < wgs_end: wgs_acc = wgs_prefix + str(wgs_star...
[ "def", "fetch_wgs_range_accs", "(", "wgs_range", ")", ":", "wgs_accs", "=", "[", "]", "wgs_end_points", "=", "wgs_range", ".", "strip", "(", ")", ".", "split", "(", "'-'", ")", "wgs_prefix", "=", "wgs_end_points", "[", "0", "]", "[", "0", ":", "5", "]"...
Splits the WGS range into distinct accessions for metadata retrieval wgs_range: A valid ENA-WGS set range
[ "Splits", "the", "WGS", "range", "into", "distinct", "accessions", "for", "metadata", "retrieval", "wgs_range", ":", "A", "valid", "ENA", "-", "WGS", "set", "range" ]
[ "\"\"\"\n Splits the WGS range into distinct accessions for metadata retrieval\n\n wgs_range: A valid ENA-WGS set range\n \"\"\"", "# include the last accession" ]
[ { "param": "wgs_range", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wgs_range", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
genome_download_validator
null
def genome_download_validator(genome_dir): """ Loop over Genome Download output directory and report any upids with erroneous output genome_dir: The path to Genome Download output directory """ erroneous_genomes = {} # list all kingdom dirs under genome output directory project_dirs =...
Loop over Genome Download output directory and report any upids with erroneous output genome_dir: The path to Genome Download output directory
Loop over Genome Download output directory and report any upids with erroneous output The path to Genome Download output directory
[ "Loop", "over", "Genome", "Download", "output", "directory", "and", "report", "any", "upids", "with", "erroneous", "output", "The", "path", "to", "Genome", "Download", "output", "directory" ]
def genome_download_validator(genome_dir): erroneous_genomes = {} project_dirs = os.listdir(genome_dir) kingdom_dirs = [x for x in project_dirs if os.path.isdir(os.path.join(genome_dir, x))] for kingdom in kingdom_dirs: erroneous_genomes[kingdom] = [] kingdom_dir_loc = os.path.join(genom...
[ "def", "genome_download_validator", "(", "genome_dir", ")", ":", "erroneous_genomes", "=", "{", "}", "project_dirs", "=", "os", ".", "listdir", "(", "genome_dir", ")", "kingdom_dirs", "=", "[", "x", "for", "x", "in", "project_dirs", "if", "os", ".", "path", ...
Loop over Genome Download output directory and report any upids with erroneous output
[ "Loop", "over", "Genome", "Download", "output", "directory", "and", "report", "any", "upids", "with", "erroneous", "output" ]
[ "\"\"\"\n Loop over Genome Download output directory and report any upids with\n erroneous output\n\n genome_dir: The path to Genome Download output directory\n \"\"\"", "# list all kingdom dirs under genome output directory", "# filter out items that are not directories", "# list all genome direc...
[ { "param": "genome_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "genome_dir", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
download_fasta_from_ncbi
<not_specific>
def download_fasta_from_ncbi(accession, dest_dir): """ Download fasta sequences from NCBI. In case of ENA obsolete sequences use this function to download the relevant files accession: A genome accession to download dest_dir: Destination directory to save the file to return: True on success, o...
Download fasta sequences from NCBI. In case of ENA obsolete sequences use this function to download the relevant files accession: A genome accession to download dest_dir: Destination directory to save the file to return: True on success, otherwise False
Download fasta sequences from NCBI. In case of ENA obsolete sequences use this function to download the relevant files A genome accession to download dest_dir: Destination directory to save the file to True on success, otherwise False
[ "Download", "fasta", "sequences", "from", "NCBI", ".", "In", "case", "of", "ENA", "obsolete", "sequences", "use", "this", "function", "to", "download", "the", "relevant", "files", "A", "genome", "accession", "to", "download", "dest_dir", ":", "Destination", "d...
def download_fasta_from_ncbi(accession, dest_dir): seq_url = None file_path = None seq_url = NCBI_SEQ_URL % (accession) file_path = os.path.join(dest_dir, accession + '.fa') urllib.urlretrieve(seq_url, file_path) if os.path.exists(file_path): return True return False
[ "def", "download_fasta_from_ncbi", "(", "accession", ",", "dest_dir", ")", ":", "seq_url", "=", "None", "file_path", "=", "None", "seq_url", "=", "NCBI_SEQ_URL", "%", "(", "accession", ")", "file_path", "=", "os", ".", "path", ".", "join", "(", "dest_dir", ...
Download fasta sequences from NCBI.
[ "Download", "fasta", "sequences", "from", "NCBI", "." ]
[ "\"\"\"\n Download fasta sequences from NCBI. In case of ENA obsolete sequences use\n this function to download the relevant files\n\n accession: A genome accession to download\n dest_dir: Destination directory to save the file to\n\n return: True on success, otherwise False\n \"\"\"" ]
[ { "param": "accession", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_t...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
download_sequence_report_files
null
def download_sequence_report_files(project_dir, upid_gca_file): """ Loads upid_gca_file json file and downloads from ENA all sequence report files per GCA accession. Skips if no GCA accession available project_dir: The path to a project directory as generated by Genome Download pipeline (genome_dow...
Loads upid_gca_file json file and downloads from ENA all sequence report files per GCA accession. Skips if no GCA accession available project_dir: The path to a project directory as generated by Genome Download pipeline (genome_downloader.py) upid_gca_file: upid_gca file in json format as generate...
Loads upid_gca_file json file and downloads from ENA all sequence report files per GCA accession. Skips if no GCA accession available The path to a project directory as generated by Genome Download pipeline (genome_downloader.py) upid_gca_file: upid_gca file in json format as generated by the Genome download pipeline ...
[ "Loads", "upid_gca_file", "json", "file", "and", "downloads", "from", "ENA", "all", "sequence", "report", "files", "per", "GCA", "accession", ".", "Skips", "if", "no", "GCA", "accession", "available", "The", "path", "to", "a", "project", "directory", "as", "...
def download_sequence_report_files(project_dir, upid_gca_file): err_seq_rep_files = {} upid_gca_fp = open(upid_gca_file, 'r') acc_pairs = json.load(upid_gca_fp) upid_gca_fp.close() for upid in acc_pairs.keys(): if acc_pairs[upid]["GCA"] != -1: domain_dir = os.path.join(project_di...
[ "def", "download_sequence_report_files", "(", "project_dir", ",", "upid_gca_file", ")", ":", "err_seq_rep_files", "=", "{", "}", "upid_gca_fp", "=", "open", "(", "upid_gca_file", ",", "'r'", ")", "acc_pairs", "=", "json", ".", "load", "(", "upid_gca_fp", ")", ...
Loads upid_gca_file json file and downloads from ENA all sequence report files per GCA accession.
[ "Loads", "upid_gca_file", "json", "file", "and", "downloads", "from", "ENA", "all", "sequence", "report", "files", "per", "GCA", "accession", "." ]
[ "\"\"\"\n Loads upid_gca_file json file and downloads from ENA all sequence report\n files per GCA accession. Skips if no GCA accession available\n\n project_dir: The path to a project directory as generated by Genome\n Download pipeline (genome_downloader.py)\n upid_gca_file: upid_gca file in json f...
[ { "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...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
sequence_report_to_json
<not_specific>
def sequence_report_to_json(seq_report_file, dest_dir=None): """ Convert a GCA sequence report file (ENA) from .txt to .json format seq_report_file: The path to a valid GCA related sequence report file dest_dir: The path to destination directory. If None use the directory of the input file ret...
Convert a GCA sequence report file (ENA) from .txt to .json format seq_report_file: The path to a valid GCA related sequence report file dest_dir: The path to destination directory. If None use the directory of the input file return: Accession dictionary
Convert a GCA sequence report file (ENA) from .txt to .json format seq_report_file: The path to a valid GCA related sequence report file dest_dir: The path to destination directory. If None use the directory of the input file Accession dictionary
[ "Convert", "a", "GCA", "sequence", "report", "file", "(", "ENA", ")", "from", ".", "txt", "to", ".", "json", "format", "seq_report_file", ":", "The", "path", "to", "a", "valid", "GCA", "related", "sequence", "report", "file", "dest_dir", ":", "The", "pat...
def sequence_report_to_json(seq_report_file, dest_dir=None): acc_dict = {} seq_rep_fp = open(seq_report_file, 'r') seq_rep_fp.readline() for line in seq_rep_fp: line = line.strip().split('\t') acc_dict[line[0]] = {"sequence_name": line[1], "sequence-length": line[2], ...
[ "def", "sequence_report_to_json", "(", "seq_report_file", ",", "dest_dir", "=", "None", ")", ":", "acc_dict", "=", "{", "}", "seq_rep_fp", "=", "open", "(", "seq_report_file", ",", "'r'", ")", "seq_rep_fp", ".", "readline", "(", ")", "for", "line", "in", "...
Convert a GCA sequence report file (ENA) from .txt to .json format seq_report_file: The path to a valid GCA related sequence report file dest_dir: The path to destination directory.
[ "Convert", "a", "GCA", "sequence", "report", "file", "(", "ENA", ")", "from", ".", "txt", "to", ".", "json", "format", "seq_report_file", ":", "The", "path", "to", "a", "valid", "GCA", "related", "sequence", "report", "file", "dest_dir", ":", "The", "pat...
[ "\"\"\"\n Convert a GCA sequence report file (ENA) from .txt to .json format\n\n seq_report_file: The path to a valid GCA related sequence report file\n dest_dir: The path to destination directory. If None use the directory\n of the input file\n\n return: Accession dictionary\n \"\"\"", "# disca...
[ { "param": "seq_report_file", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seq_report_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docst...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
split_and_download
null
def split_and_download(wgs_range, dest_dir): """ Function to split and download smaller segments of large genome assemblies wgs_range: A WGS assembly sequence accession range from ENA (e.g. CBTL0100000001-CBTL0111673940) dest_dir: The path to the destination directory returns: void """ ...
Function to split and download smaller segments of large genome assemblies wgs_range: A WGS assembly sequence accession range from ENA (e.g. CBTL0100000001-CBTL0111673940) dest_dir: The path to the destination directory returns: void
Function to split and download smaller segments of large genome assemblies wgs_range: A WGS assembly sequence accession range from ENA dest_dir: The path to the destination directory void
[ "Function", "to", "split", "and", "download", "smaller", "segments", "of", "large", "genome", "assemblies", "wgs_range", ":", "A", "WGS", "assembly", "sequence", "accession", "range", "from", "ENA", "dest_dir", ":", "The", "path", "to", "the", "destination", "...
def split_and_download(wgs_range, dest_dir): accessions = fetch_wgs_range_accs(wgs_range) file_no = len(accessions) / MAX_SEQS remainder = len(accessions) % MAX_SEQS count = 0 idx1 = 0 idx2 = MAX_SEQS while count < file_no: accession = accessions[idx1] + '-' + accessions[idx2] ...
[ "def", "split_and_download", "(", "wgs_range", ",", "dest_dir", ")", ":", "accessions", "=", "fetch_wgs_range_accs", "(", "wgs_range", ")", "file_no", "=", "len", "(", "accessions", ")", "/", "MAX_SEQS", "remainder", "=", "len", "(", "accessions", ")", "%", ...
Function to split and download smaller segments of large genome assemblies wgs_range: A WGS assembly sequence accession range from ENA (e.g.
[ "Function", "to", "split", "and", "download", "smaller", "segments", "of", "large", "genome", "assemblies", "wgs_range", ":", "A", "WGS", "assembly", "sequence", "accession", "range", "from", "ENA", "(", "e", ".", "g", "." ]
[ "\"\"\"\n Function to split and download smaller segments of large genome assemblies\n\n wgs_range: A WGS assembly sequence accession range from ENA\n (e.g. CBTL0100000001-CBTL0111673940)\n dest_dir: The path to the destination directory\n\n returns: void\n \"\"\"", "# split the range into sepa...
[ { "param": "wgs_range", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wgs_range", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_t...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
fetch_accessions_from_proteome_xml
<not_specific>
def fetch_accessions_from_proteome_xml(proteome): """ Parses Uniprot's proteome xml and extracts all available ENA accessions proteome: A valid Uniprot's proteome accession returns: A list of genome accessions """ prot_accessions = [] # namespace prefix # or register a namespace in the ET...
Parses Uniprot's proteome xml and extracts all available ENA accessions proteome: A valid Uniprot's proteome accession returns: A list of genome accessions
Parses Uniprot's proteome xml and extracts all available ENA accessions proteome: A valid Uniprot's proteome accession A list of genome accessions
[ "Parses", "Uniprot", "'", "s", "proteome", "xml", "and", "extracts", "all", "available", "ENA", "accessions", "proteome", ":", "A", "valid", "Uniprot", "'", "s", "proteome", "accession", "A", "list", "of", "genome", "accessions" ]
def fetch_accessions_from_proteome_xml(proteome): prot_accessions = [] prefix = "{http://uniprot.org/uniprot}%s" response = requests.get(gc.PROTEOME_XML_URL % proteome) if response.status_code == 200: prot_tree_root = ET.fromstring(response.content) proteome = prot_tree_root.find(prefix ...
[ "def", "fetch_accessions_from_proteome_xml", "(", "proteome", ")", ":", "prot_accessions", "=", "[", "]", "prefix", "=", "\"{http://uniprot.org/uniprot}%s\"", "response", "=", "requests", ".", "get", "(", "gc", ".", "PROTEOME_XML_URL", "%", "proteome", ")", "if", ...
Parses Uniprot's proteome xml and extracts all available ENA accessions proteome: A valid Uniprot's proteome accession
[ "Parses", "Uniprot", "'", "s", "proteome", "xml", "and", "extracts", "all", "available", "ENA", "accessions", "proteome", ":", "A", "valid", "Uniprot", "'", "s", "proteome", "accession" ]
[ "\"\"\"\n Parses Uniprot's proteome xml and extracts all available ENA accessions\n\n proteome: A valid Uniprot's proteome accession\n\n returns: A list of genome accessions\n \"\"\"", "# namespace prefix # or register a namespace in the ET", "# convert from string to xml format", "# get proteome ...
[ { "param": "proteome", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "proteome", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
check_accession_availability
<not_specific>
def check_accession_availability(accession): """ Check whether a specific accession is available from ENA accession: sequence accession return: True if accession is available, False otherwise """ # we can expand this by adding a db option (e.g. ena, uniprot, ncbi) response = requests.get(E...
Check whether a specific accession is available from ENA accession: sequence accession return: True if accession is available, False otherwise
Check whether a specific accession is available from ENA accession: sequence accession return: True if accession is available, False otherwise
[ "Check", "whether", "a", "specific", "accession", "is", "available", "from", "ENA", "accession", ":", "sequence", "accession", "return", ":", "True", "if", "accession", "is", "available", "False", "otherwise" ]
def check_accession_availability(accession): response = requests.get(ENA_XML_URL % accession) if response.status_code == httplib.OK: xml_root = ET.fromstring(response.content) entry_node = None entry_node = xml_root.find("entry") if entry_node is None: return False ...
[ "def", "check_accession_availability", "(", "accession", ")", ":", "response", "=", "requests", ".", "get", "(", "ENA_XML_URL", "%", "accession", ")", "if", "response", ".", "status_code", "==", "httplib", ".", "OK", ":", "xml_root", "=", "ET", ".", "fromstr...
Check whether a specific accession is available from ENA accession: sequence accession return: True if accession is available, False otherwise
[ "Check", "whether", "a", "specific", "accession", "is", "available", "from", "ENA", "accession", ":", "sequence", "accession", "return", ":", "True", "if", "accession", "is", "available", "False", "otherwise" ]
[ "\"\"\"\n Check whether a specific accession is available from ENA\n\n accession: sequence accession\n return: True if accession is available, False otherwise\n \"\"\"", "# we can expand this by adding a db option (e.g. ena, uniprot, ncbi)", "# If the entry exists, there should be an entry node in t...
[ { "param": "accession", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
copy_wgs_set_from_ftp
null
def copy_wgs_set_from_ftp(wgs_acc, dest_dir): """ Copy wgs set sequences from physical location on cluster wsg_acc: A valid WGS set accession (e.g. AAVU01000000) dest_dir: Destination directory where the sequences will be copied to return: void """ # build path wgs_subdir = os.path.jo...
Copy wgs set sequences from physical location on cluster wsg_acc: A valid WGS set accession (e.g. AAVU01000000) dest_dir: Destination directory where the sequences will be copied to return: void
Copy wgs set sequences from physical location on cluster wsg_acc: A valid WGS set accession dest_dir: Destination directory where the sequences will be copied to void
[ "Copy", "wgs", "set", "sequences", "from", "physical", "location", "on", "cluster", "wsg_acc", ":", "A", "valid", "WGS", "set", "accession", "dest_dir", ":", "Destination", "directory", "where", "the", "sequences", "will", "be", "copied", "to", "void" ]
def copy_wgs_set_from_ftp(wgs_acc, dest_dir): wgs_subdir = os.path.join(gc.ENA_FTP_WGS_PUB, wgs_acc[0:2].lower()) wgs_filename = wgs_acc[0:6] + ".fasta.gz" if os.path.exists(os.path.join(wgs_subdir, wgs_filename)): shutil.copyfile(os.path.join(wgs_subdir, wgs_filename), os.p...
[ "def", "copy_wgs_set_from_ftp", "(", "wgs_acc", ",", "dest_dir", ")", ":", "wgs_subdir", "=", "os", ".", "path", ".", "join", "(", "gc", ".", "ENA_FTP_WGS_PUB", ",", "wgs_acc", "[", "0", ":", "2", "]", ".", "lower", "(", ")", ")", "wgs_filename", "=", ...
Copy wgs set sequences from physical location on cluster wsg_acc: A valid WGS set accession (e.g.
[ "Copy", "wgs", "set", "sequences", "from", "physical", "location", "on", "cluster", "wsg_acc", ":", "A", "valid", "WGS", "set", "accession", "(", "e", ".", "g", "." ]
[ "\"\"\"\n Copy wgs set sequences from physical location on cluster\n\n wsg_acc: A valid WGS set accession (e.g. AAVU01000000)\n dest_dir: Destination directory where the sequences will be copied to\n\n return: void\n \"\"\"", "# build path", "#AA", "# check if wgs sequences are in public dir an...
[ { "param": "wgs_acc", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wgs_acc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_tok...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
proteome_xml_accessions_to_dict
<not_specific>
def proteome_xml_accessions_to_dict(upid): """ Parses a valid proteome xml file and returns all accessions in the form of a dictionary. Component names from proteome xml are used as dictionary keys upid: A valid Uniprot proteome upid returns: A dictionary with all proteome associated accessions. ...
Parses a valid proteome xml file and returns all accessions in the form of a dictionary. Component names from proteome xml are used as dictionary keys upid: A valid Uniprot proteome upid returns: A dictionary with all proteome associated accessions.
Parses a valid proteome xml file and returns all accessions in the form of a dictionary. Component names from proteome xml are used as dictionary keys A valid Uniprot proteome upid A dictionary with all proteome associated accessions.
[ "Parses", "a", "valid", "proteome", "xml", "file", "and", "returns", "all", "accessions", "in", "the", "form", "of", "a", "dictionary", ".", "Component", "names", "from", "proteome", "xml", "are", "used", "as", "dictionary", "keys", "A", "valid", "Uniprot", ...
def proteome_xml_accessions_to_dict(upid): proteome_accs = {"GCA": -1, "WGS": -1} other = {} prefix = "{http://uniprot.org/uniprot}%s" response = requests.get(gc.PROTEOME_XML_URL % upid) if response.status_code == 200: prot_tree_root = ET.fromstring(response.content) proteome = prot_...
[ "def", "proteome_xml_accessions_to_dict", "(", "upid", ")", ":", "proteome_accs", "=", "{", "\"GCA\"", ":", "-", "1", ",", "\"WGS\"", ":", "-", "1", "}", "other", "=", "{", "}", "prefix", "=", "\"{http://uniprot.org/uniprot}%s\"", "response", "=", "requests", ...
Parses a valid proteome xml file and returns all accessions in the form of a dictionary.
[ "Parses", "a", "valid", "proteome", "xml", "file", "and", "returns", "all", "accessions", "in", "the", "form", "of", "a", "dictionary", "." ]
[ "\"\"\"\n Parses a valid proteome xml file and returns all accessions in the form of\n a dictionary. Component names from proteome xml are used as dictionary keys\n\n upid: A valid Uniprot proteome upid\n\n returns: A dictionary with all proteome associated accessions.\n \"\"\"", "# namespace prefi...
[ { "param": "upid", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
copy_gca_report_file_from_ftp
<not_specific>
def copy_gca_report_file_from_ftp(gca_accession, dest_dir): """ Copies the corresponding GCA report file from the ftp gca_accession: A valid GCA accession return: True if the file was found, False otherwise """ seq_report_file = gca_accession + "_sequence_report.txt" genomic_regions_file ...
Copies the corresponding GCA report file from the ftp gca_accession: A valid GCA accession return: True if the file was found, False otherwise
Copies the corresponding GCA report file from the ftp gca_accession: A valid GCA accession True if the file was found, False otherwise
[ "Copies", "the", "corresponding", "GCA", "report", "file", "from", "the", "ftp", "gca_accession", ":", "A", "valid", "GCA", "accession", "True", "if", "the", "file", "was", "found", "False", "otherwise" ]
def copy_gca_report_file_from_ftp(gca_accession, dest_dir): seq_report_file = gca_accession + "_sequence_report.txt" genomic_regions_file = gca_accession + "_regions.txt" gca_dir = os.path.join(gc.ENA_GCA_SEQ_REPORT, gca_accession[0:7]) gca_dir = os.path.join(gca_dir, gca_accession[0:10]) report_fil...
[ "def", "copy_gca_report_file_from_ftp", "(", "gca_accession", ",", "dest_dir", ")", ":", "seq_report_file", "=", "gca_accession", "+", "\"_sequence_report.txt\"", "genomic_regions_file", "=", "gca_accession", "+", "\"_regions.txt\"", "gca_dir", "=", "os", ".", "path", "...
Copies the corresponding GCA report file from the ftp gca_accession: A valid GCA accession
[ "Copies", "the", "corresponding", "GCA", "report", "file", "from", "the", "ftp", "gca_accession", ":", "A", "valid", "GCA", "accession" ]
[ "\"\"\"\n Copies the corresponding GCA report file from the ftp\n\n gca_accession: A valid GCA accession\n\n return: True if the file was found, False otherwise\n \"\"\"", "# 1st layer subdir GCA_XXX", "# 2nd layer subdir GCA_XXXXXX", "# sanity check if the file actually exists" ]
[ { "param": "gca_accession", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gca_accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstri...
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
extract_wgs_acc_from_gca_xml
<not_specific>
def extract_wgs_acc_from_gca_xml(gca_accession): """ Parses ENA's GCA xml file and extracts the WGS set accession if available gca_accession: A valid GCA accession return: A WGS set accesison, None if not found """ xml_root = None wgs_acc = None assembly_xml = requests.get(ENA_XML_UR...
Parses ENA's GCA xml file and extracts the WGS set accession if available gca_accession: A valid GCA accession return: A WGS set accesison, None if not found
Parses ENA's GCA xml file and extracts the WGS set accession if available gca_accession: A valid GCA accession A WGS set accesison, None if not found
[ "Parses", "ENA", "'", "s", "GCA", "xml", "file", "and", "extracts", "the", "WGS", "set", "accession", "if", "available", "gca_accession", ":", "A", "valid", "GCA", "accession", "A", "WGS", "set", "accesison", "None", "if", "not", "found" ]
def extract_wgs_acc_from_gca_xml(gca_accession): xml_root = None wgs_acc = None assembly_xml = requests.get(ENA_XML_URL % gca_accession).content if os.path.isfile(assembly_xml): xml_root = ET.parse(assembly_xml).getroot() else: xml_root = ET.fromstring(assembly_xml) assembly = xm...
[ "def", "extract_wgs_acc_from_gca_xml", "(", "gca_accession", ")", ":", "xml_root", "=", "None", "wgs_acc", "=", "None", "assembly_xml", "=", "requests", ".", "get", "(", "ENA_XML_URL", "%", "gca_accession", ")", ".", "content", "if", "os", ".", "path", ".", ...
Parses ENA's GCA xml file and extracts the WGS set accession if available gca_accession: A valid GCA accession
[ "Parses", "ENA", "'", "s", "GCA", "xml", "file", "and", "extracts", "the", "WGS", "set", "accession", "if", "available", "gca_accession", ":", "A", "valid", "GCA", "accession" ]
[ "\"\"\"\n Parses ENA's GCA xml file and extracts the WGS set accession if available\n\n gca_accession: A valid GCA accession\n\n return: A WGS set accesison, None if not found\n \"\"\"", "# parse xml tree and return root node", "# fromstring returns the xml root directly", "# no assembly link pro...
[ { "param": "gca_accession", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gca_accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8a0780c002a6f23c782f35e6cd0023c85eb32c56
Rfam/rfam-production
scripts/export/genomes/genome_fetch.py
[ "Apache-2.0" ]
Python
download_gca_report_file_from_url
<not_specific>
def download_gca_report_file_from_url(gca_accession, dest_dir): """ Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes accession: A valid ENA GCA accession (without the assembly version) """ accessions = [] root =...
Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes accession: A valid ENA GCA accession (without the assembly version)
Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes A valid ENA GCA accession (without the assembly version)
[ "Loads", "an", "xml", "tree", "from", "a", "file", "or", "a", "string", "(", "usually", "an", "http", "response", ")", "and", "returns", "a", "list", "with", "the", "genome", "assembly", "'", "s", "chromosomes", "A", "valid", "ENA", "GCA", "accession", ...
def download_gca_report_file_from_url(gca_accession, dest_dir): accessions = [] root = None assembly_link = None assembly = None url_links = [] assembly_xml = requests.get(ENA_XML_URL % gca_accession).content if os.path.isfile(assembly_xml): root = ET.parse(assembly_xml).getroot() ...
[ "def", "download_gca_report_file_from_url", "(", "gca_accession", ",", "dest_dir", ")", ":", "accessions", "=", "[", "]", "root", "=", "None", "assembly_link", "=", "None", "assembly", "=", "None", "url_links", "=", "[", "]", "assembly_xml", "=", "requests", "...
Loads an xml tree from a file or a string (usually an http response), and returns a list with the genome assembly's chromosomes
[ "Loads", "an", "xml", "tree", "from", "a", "file", "or", "a", "string", "(", "usually", "an", "http", "response", ")", "and", "returns", "a", "list", "with", "the", "genome", "assembly", "'", "s", "chromosomes" ]
[ "\"\"\"\n Loads an xml tree from a file or a string (usually an http response),\n and returns a list with the genome assembly's chromosomes\n\n accession: A valid ENA GCA accession (without the assembly version)\n \"\"\"", "# parse xml tree and return root node", "# fromstring returns the xml root d...
[ { "param": "gca_accession", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gca_accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstri...
e1adc3d5a1566283ebe0be575b139f8395d78208
Rfam/rfam-production
scripts/release/uniprot_file_converter.py
[ "Apache-2.0" ]
Python
convert_proteome_list_to_upid_gca_file
null
def convert_proteome_list_to_upid_gca_file(input_file, filename=None, dest_dir=None): """ Converts a proteome list file in tabular format to the upid_gca file format used with the genome_downloader and genome_search pipelines input_file: A proteome-all.tab file downloaded from Uniprot's proteomes websi...
Converts a proteome list file in tabular format to the upid_gca file format used with the genome_downloader and genome_search pipelines input_file: A proteome-all.tab file downloaded from Uniprot's proteomes website filename: A name for the new file to be generated. Defaults to input_file filename ...
Converts a proteome list file in tabular format to the upid_gca file format used with the genome_downloader and genome_search pipelines A proteome-all.tab file downloaded from Uniprot's proteomes website filename: A name for the new file to be generated. Defaults to input_file filename if None dest_dir: A path to an o...
[ "Converts", "a", "proteome", "list", "file", "in", "tabular", "format", "to", "the", "upid_gca", "file", "format", "used", "with", "the", "genome_downloader", "and", "genome_search", "pipelines", "A", "proteome", "-", "all", ".", "tab", "file", "downloaded", "...
def convert_proteome_list_to_upid_gca_file(input_file, filename=None, dest_dir=None): input_fp = open(input_file, 'r') if filename is None: filename = os.path.basename(input_file).partition('.')[0] if dest_dir is None: dest_dir = os.path.split(input_file)[0] output_fp = open(os.path.join...
[ "def", "convert_proteome_list_to_upid_gca_file", "(", "input_file", ",", "filename", "=", "None", ",", "dest_dir", "=", "None", ")", ":", "input_fp", "=", "open", "(", "input_file", ",", "'r'", ")", "if", "filename", "is", "None", ":", "filename", "=", "os",...
Converts a proteome list file in tabular format to the upid_gca file format used with the genome_downloader and genome_search pipelines
[ "Converts", "a", "proteome", "list", "file", "in", "tabular", "format", "to", "the", "upid_gca", "file", "format", "used", "with", "the", "genome_downloader", "and", "genome_search", "pipelines" ]
[ "\"\"\"\n Converts a proteome list file in tabular format to the upid_gca file format\n used with the genome_downloader and genome_search pipelines\n\n input_file: A proteome-all.tab file downloaded from Uniprot's proteomes website\n filename: A name for the new file to be generated. Defaults to input_f...
[ { "param": "input_file", "type": null }, { "param": "filename", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "docstring_...
e1adc3d5a1566283ebe0be575b139f8395d78208
Rfam/rfam-production
scripts/release/uniprot_file_converter.py
[ "Apache-2.0" ]
Python
dump_new_upids_to_file
null
def dump_new_upids_to_file(upid_gca_old, upid_gca_new, dest_dir=None): """ Compares two upid_gca files from different Uniprot proteome releases and dumps the new upids in a new upid_gca file all resulting from the newer version of the proteome file (upid_gca_new). To be used for downloading a subset...
Compares two upid_gca files from different Uniprot proteome releases and dumps the new upids in a new upid_gca file all resulting from the newer version of the proteome file (upid_gca_new). To be used for downloading a subset of genomes. upid_gca_out: A valid upid_gca file in .tsv format of an old...
Compares two upid_gca files from different Uniprot proteome releases and dumps the new upids in a new upid_gca file all resulting from the newer version of the proteome file (upid_gca_new). To be used for downloading a subset of genomes. A valid upid_gca file in .tsv format of an older reference proteome release upid_...
[ "Compares", "two", "upid_gca", "files", "from", "different", "Uniprot", "proteome", "releases", "and", "dumps", "the", "new", "upids", "in", "a", "new", "upid_gca", "file", "all", "resulting", "from", "the", "newer", "version", "of", "the", "proteome", "file",...
def dump_new_upids_to_file(upid_gca_old, upid_gca_new, dest_dir=None): old_upids = {} upid_gca_old_fp = open(upid_gca_old, 'r') upid_gca_new_fp = open(upid_gca_new, 'r') for line in upid_gca_old_fp: fields = line.strip().split('\t') if fields[0] not in old_upids: old_upids[fi...
[ "def", "dump_new_upids_to_file", "(", "upid_gca_old", ",", "upid_gca_new", ",", "dest_dir", "=", "None", ")", ":", "old_upids", "=", "{", "}", "upid_gca_old_fp", "=", "open", "(", "upid_gca_old", ",", "'r'", ")", "upid_gca_new_fp", "=", "open", "(", "upid_gca_...
Compares two upid_gca files from different Uniprot proteome releases and dumps the new upids in a new upid_gca file all resulting from the newer version of the proteome file (upid_gca_new).
[ "Compares", "two", "upid_gca", "files", "from", "different", "Uniprot", "proteome", "releases", "and", "dumps", "the", "new", "upids", "in", "a", "new", "upid_gca", "file", "all", "resulting", "from", "the", "newer", "version", "of", "the", "proteome", "file",...
[ "\"\"\"\n Compares two upid_gca files from different Uniprot proteome releases\n and dumps the new upids in a new upid_gca file all resulting from the\n newer version of the proteome file (upid_gca_new). To be used for\n downloading a subset of genomes.\n\n upid_gca_out: A valid upid_gca file in .tsv...
[ { "param": "upid_gca_old", "type": null }, { "param": "upid_gca_new", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid_gca_old", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "upid_gca_new", "type": null, "docstring": null, "docs...
3a6a01f1187d5db6c8b60fe8ac62b56dd6b5927b
Rfam/rfam-production
scripts/release/genome_browser_hub_generator.py
[ "Apache-2.0" ]
Python
generate_genome_text_file_from_file
null
def generate_genome_text_file_from_file(names_list, release_version, dest_dir): """ Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings names_list: A tab delimited file containing mappings of the assembly name and the genome scientific name e.g...
Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings names_list: A tab delimited file containing mappings of the assembly name and the genome scientific name e.g hg38\thomo_sapiens version: The version of the release dest_dir: The destinati...
Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings A tab delimited file containing mappings of the assembly name and the genome scientific name e.g hg38\thomo_sapiens version: The version of the release dest_dir: The destination directory where the genome.txt fil...
[ "Generates", "the", "genome", ".", "txt", "file", "for", "the", "genome_browser_hup", "given", "a", "list", "of", "assembly", "-", "scientific", "name", "mappings", "A", "tab", "delimited", "file", "containing", "mappings", "of", "the", "assembly", "name", "an...
def generate_genome_text_file_from_file(names_list, release_version, dest_dir): trackdb_url = "ftp://ftp.ebi.ac.uk/pub/databases/Rfam/%s/genome_browser_hub/%s/trackDb.txt" fp_in = open(names_list, 'r') name_mappings = {} for line in fp_in: line = line.strip().split('\t') if line[0] not i...
[ "def", "generate_genome_text_file_from_file", "(", "names_list", ",", "release_version", ",", "dest_dir", ")", ":", "trackdb_url", "=", "\"ftp://ftp.ebi.ac.uk/pub/databases/Rfam/%s/genome_browser_hub/%s/trackDb.txt\"", "fp_in", "=", "open", "(", "names_list", ",", "'r'", ")",...
Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings
[ "Generates", "the", "genome", ".", "txt", "file", "for", "the", "genome_browser_hup", "given", "a", "list", "of", "assembly", "-", "scientific", "name", "mappings" ]
[ "\"\"\"\n Generates the genome.txt file for the genome_browser_hup given a list\n of assembly-scientific name mappings\n\n names_list: A tab delimited file containing mappings of the\n assembly name and the genome scientific name e.g hg38\\thomo_sapiens\n version: The version of the release\n dest...
[ { "param": "names_list", "type": null }, { "param": "release_version", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "names_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "release_version", "type": null, "docstring": null, "doc...
3a6a01f1187d5db6c8b60fe8ac62b56dd6b5927b
Rfam/rfam-production
scripts/release/genome_browser_hub_generator.py
[ "Apache-2.0" ]
Python
generate_genome_text_file_from_dict
null
def generate_genome_text_file_from_dict(accession_dict, release_version, dest_dir): """ Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings names_list: A tab delimited file containing mappings of the assembly name and the genome scientific name...
Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings names_list: A tab delimited file containing mappings of the assembly name and the genome scientific name e.g hg38\thomo_sapiens version: The version of the release dest_dir: The destinati...
Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings A tab delimited file containing mappings of the assembly name and the genome scientific name e.g hg38\thomo_sapiens version: The version of the release dest_dir: The destination directory where the genome.txt fil...
[ "Generates", "the", "genome", ".", "txt", "file", "for", "the", "genome_browser_hup", "given", "a", "list", "of", "assembly", "-", "scientific", "name", "mappings", "A", "tab", "delimited", "file", "containing", "mappings", "of", "the", "assembly", "name", "an...
def generate_genome_text_file_from_dict(accession_dict, release_version, dest_dir): trackdb_url = "ftp://ftp.ebi.ac.uk/pub/databases/Rfam/%s/genome_browser_hub/%s/trackDb.txt" fp_out = open(os.path.join(dest_dir, "genomes.txt"), 'w') for genome in accession_dict.keys(): fp_out.write("genome %s\n" % ...
[ "def", "generate_genome_text_file_from_dict", "(", "accession_dict", ",", "release_version", ",", "dest_dir", ")", ":", "trackdb_url", "=", "\"ftp://ftp.ebi.ac.uk/pub/databases/Rfam/%s/genome_browser_hub/%s/trackDb.txt\"", "fp_out", "=", "open", "(", "os", ".", "path", ".", ...
Generates the genome.txt file for the genome_browser_hup given a list of assembly-scientific name mappings
[ "Generates", "the", "genome", ".", "txt", "file", "for", "the", "genome_browser_hup", "given", "a", "list", "of", "assembly", "-", "scientific", "name", "mappings" ]
[ "\"\"\"\n Generates the genome.txt file for the genome_browser_hup given a list\n of assembly-scientific name mappings\n\n names_list: A tab delimited file containing mappings of the\n assembly name and the genome scientific name e.g hg38\\thomo_sapiens\n version: The version of the release\n dest...
[ { "param": "accession_dict", "type": null }, { "param": "release_version", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "accession_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "release_version", "type": null, "docstring": null, ...
3a6a01f1187d5db6c8b60fe8ac62b56dd6b5927b
Rfam/rfam-production
scripts/release/genome_browser_hub_generator.py
[ "Apache-2.0" ]
Python
generate_hub_txt_file
null
def generate_hub_txt_file(release_version, dest_dir): """ Generates the hub.txt file for the new Rfam release release_version: The Rfam release version dest_dir: return: void """ # convert to string and chop off the decimals rel_version_int = str(release_version).partition(".")[0] ...
Generates the hub.txt file for the new Rfam release release_version: The Rfam release version dest_dir: return: void
Generates the hub.txt file for the new Rfam release release_version: The Rfam release version dest_dir. void
[ "Generates", "the", "hub", ".", "txt", "file", "for", "the", "new", "Rfam", "release", "release_version", ":", "The", "Rfam", "release", "version", "dest_dir", ".", "void" ]
def generate_hub_txt_file(release_version, dest_dir): rel_version_int = str(release_version).partition(".")[0] fp_out = open(os.path.join(dest_dir, "hub.txt"), 'w') fp_out.write("hub rfam%s\n" % rel_version_int) fp_out.write("shortLabel rfam%s_ncRNA\n" % rel_version_int) fp_out.write("longLabel Rfam...
[ "def", "generate_hub_txt_file", "(", "release_version", ",", "dest_dir", ")", ":", "rel_version_int", "=", "str", "(", "release_version", ")", ".", "partition", "(", "\".\"", ")", "[", "0", "]", "fp_out", "=", "open", "(", "os", ".", "path", ".", "join", ...
Generates the hub.txt file for the new Rfam release release_version: The Rfam release version dest_dir:
[ "Generates", "the", "hub", ".", "txt", "file", "for", "the", "new", "Rfam", "release", "release_version", ":", "The", "Rfam", "release", "version", "dest_dir", ":" ]
[ "\"\"\"\n Generates the hub.txt file for the new Rfam release\n\n release_version: The Rfam release version\n dest_dir:\n\n return: void\n \"\"\"", "# convert to string and chop off the decimals" ]
[ { "param": "release_version", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "release_version", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docst...
3a6a01f1187d5db6c8b60fe8ac62b56dd6b5927b
Rfam/rfam-production
scripts/release/genome_browser_hub_generator.py
[ "Apache-2.0" ]
Python
genome_browser_hub_id_list_parser
<not_specific>
def genome_browser_hub_id_list_parser(genome_id_list): """ Parses the input file of genome browser hub and returns a dictionary with the ids to be used to generate all related sub directories and files genome_id_list: A tab delimited file containing the genome upids, assembly names and scientif...
Parses the input file of genome browser hub and returns a dictionary with the ids to be used to generate all related sub directories and files genome_id_list: A tab delimited file containing the genome upids, assembly names and scientific names for each genome return: A dictionary in the form...
Parses the input file of genome browser hub and returns a dictionary with the ids to be used to generate all related sub directories and files A tab delimited file containing the genome upids, assembly names and scientific names for each genome
[ "Parses", "the", "input", "file", "of", "genome", "browser", "hub", "and", "returns", "a", "dictionary", "with", "the", "ids", "to", "be", "used", "to", "generate", "all", "related", "sub", "directories", "and", "files", "A", "tab", "delimited", "file", "c...
def genome_browser_hub_id_list_parser(genome_id_list): accession_mapings = {} fp_in = open(genome_id_list, 'r') if genome_id_list.endswith(".json"): accession_mapings = json.load(fp_in) else: for line in fp_in: line = line.strip().split('\t') if line[0] not in acc...
[ "def", "genome_browser_hub_id_list_parser", "(", "genome_id_list", ")", ":", "accession_mapings", "=", "{", "}", "fp_in", "=", "open", "(", "genome_id_list", ",", "'r'", ")", "if", "genome_id_list", ".", "endswith", "(", "\".json\"", ")", ":", "accession_mapings",...
Parses the input file of genome browser hub and returns a dictionary with the ids to be used to generate all related sub directories and files
[ "Parses", "the", "input", "file", "of", "genome", "browser", "hub", "and", "returns", "a", "dictionary", "with", "the", "ids", "to", "be", "used", "to", "generate", "all", "related", "sub", "directories", "and", "files" ]
[ "\"\"\"\n Parses the input file of genome browser hub and returns\n a dictionary with the ids to be used to generate all\n related sub directories and files\n\n genome_id_list: A tab delimited file containing the genome upids, assembly names and\n scientific names for each genome\n\n return: A dic...
[ { "param": "genome_id_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "genome_id_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3a6a01f1187d5db6c8b60fe8ac62b56dd6b5927b
Rfam/rfam-production
scripts/release/genome_browser_hub_generator.py
[ "Apache-2.0" ]
Python
generate_trackdb_file
null
def generate_trackdb_file(species, release_version, dest_dir): """ Creates a new species trackDb.txt file for a given Rfam release version species: The name of the species directory release_version: The version of the Rfam release dest_dir: The path to the species directory where the trackDb file w...
Creates a new species trackDb.txt file for a given Rfam release version species: The name of the species directory release_version: The version of the Rfam release dest_dir: The path to the species directory where the trackDb file will be generated return: void
Creates a new species trackDb.txt file for a given Rfam release version species: The name of the species directory release_version: The version of the Rfam release dest_dir: The path to the species directory where the trackDb file will be generated void
[ "Creates", "a", "new", "species", "trackDb", ".", "txt", "file", "for", "a", "given", "Rfam", "release", "version", "species", ":", "The", "name", "of", "the", "species", "directory", "release_version", ":", "The", "version", "of", "the", "Rfam", "release", ...
def generate_trackdb_file(species, release_version, dest_dir): trackDb_fp = open(os.path.join(dest_dir, "trackDb.txt"), 'w') trackDb_fp.write("track Rfam\n") trackDb_fp.write("bigDataUrl ftp://ftp.ebi.ac.uk/pub/databases/Rfam/%s/genome_browser_hub/%s/bigBed\n" % (release_version, specie...
[ "def", "generate_trackdb_file", "(", "species", ",", "release_version", ",", "dest_dir", ")", ":", "trackDb_fp", "=", "open", "(", "os", ".", "path", ".", "join", "(", "dest_dir", ",", "\"trackDb.txt\"", ")", ",", "'w'", ")", "trackDb_fp", ".", "write", "(...
Creates a new species trackDb.txt file for a given Rfam release version species: The name of the species directory release_version: The version of the Rfam release dest_dir: The path to the species directory where the trackDb file will be generated
[ "Creates", "a", "new", "species", "trackDb", ".", "txt", "file", "for", "a", "given", "Rfam", "release", "version", "species", ":", "The", "name", "of", "the", "species", "directory", "release_version", ":", "The", "version", "of", "the", "Rfam", "release", ...
[ "\"\"\"\n Creates a new species trackDb.txt file for a given Rfam release version\n\n species: The name of the species directory\n release_version: The version of the Rfam release\n dest_dir: The path to the species directory where the trackDb file will\n be generated\n\n return: void\n \"\"\""...
[ { "param": "species", "type": null }, { "param": "release_version", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "species", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "release_version", "type": null, "docstring": null, "docstr...
3a6a01f1187d5db6c8b60fe8ac62b56dd6b5927b
Rfam/rfam-production
scripts/release/genome_browser_hub_generator.py
[ "Apache-2.0" ]
Python
generate_new_genome_browser_hub_directories
null
def generate_new_genome_browser_hub_directories(genome_id_file, release_version, dest_dir, genome_project_dir): """ Generates a new genome_browser_hub directory for an upcoming Rfam release genome_id_file: A tab delimited file containing the genome upids, assembly names and scientific names for each ge...
Generates a new genome_browser_hub directory for an upcoming Rfam release genome_id_file: A tab delimited file containing the genome upids, assembly names and scientific names for each genome release_version: The Rfam version the genome browser hub derives from dest_dir: A valid path where to gene...
Generates a new genome_browser_hub directory for an upcoming Rfam release genome_id_file: A tab delimited file containing the genome upids, assembly names and scientific names for each genome release_version: The Rfam version the genome browser hub derives from dest_dir: A valid path where to generate the directories. ...
[ "Generates", "a", "new", "genome_browser_hub", "directory", "for", "an", "upcoming", "Rfam", "release", "genome_id_file", ":", "A", "tab", "delimited", "file", "containing", "the", "genome", "upids", "assembly", "names", "and", "scientific", "names", "for", "each"...
def generate_new_genome_browser_hub_directories(genome_id_file, release_version, dest_dir, genome_project_dir): accession_mapings = genome_browser_hub_id_list_parser(genome_id_file) if not os.path.exists(dest_dir): os.mkdir(dest_dir) bed_files_dir = os.path.join(dest_dir, "bed_files") os.mkdir(b...
[ "def", "generate_new_genome_browser_hub_directories", "(", "genome_id_file", ",", "release_version", ",", "dest_dir", ",", "genome_project_dir", ")", ":", "accession_mapings", "=", "genome_browser_hub_id_list_parser", "(", "genome_id_file", ")", "if", "not", "os", ".", "p...
Generates a new genome_browser_hub directory for an upcoming Rfam release genome_id_file: A tab delimited file containing the genome upids, assembly names and scientific names for each genome release_version: The Rfam version the genome browser hub derives from dest_dir: A valid path where to generate the directories.
[ "Generates", "a", "new", "genome_browser_hub", "directory", "for", "an", "upcoming", "Rfam", "release", "genome_id_file", ":", "A", "tab", "delimited", "file", "containing", "the", "genome", "upids", "assembly", "names", "and", "scientific", "names", "for", "each"...
[ "\"\"\"\n Generates a new genome_browser_hub directory for an upcoming Rfam release\n\n genome_id_file: A tab delimited file containing the genome upids, assembly names and\n scientific names for each genome\n release_version: The Rfam version the genome browser hub derives from\n dest_dir: A valid p...
[ { "param": "genome_id_file", "type": null }, { "param": "release_version", "type": null }, { "param": "dest_dir", "type": null }, { "param": "genome_project_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "genome_id_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "release_version", "type": null, "docstring": null, ...
e77e368243c16e3fee537c1b554298218306a70d
Rfam/rfam-production
scripts/support/populate_seed_region_md5.py
[ "Apache-2.0" ]
Python
fetch_sequence
<not_specific>
def fetch_sequence(seq_file, seq_acc, seq_start, seq_end): """ Extracts a sequence from sequence file seq_file using rfamseq_acc and sequence start-end positions (seq_start, seq_end) seq_file: A sequence file in fasta format to extract a sequence from seq_acc: The accession of the sequence to extrac...
Extracts a sequence from sequence file seq_file using rfamseq_acc and sequence start-end positions (seq_start, seq_end) seq_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...
Extracts a sequence from sequence file seq_file using rfamseq_acc and sequence start-end positions (seq_start, seq_end) seq_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 end pos...
[ "Extracts", "a", "sequence", "from", "sequence", "file", "seq_file", "using", "rfamseq_acc", "and", "sequence", "start", "-", "end", "positions", "(", "seq_start", "seq_end", ")", "seq_file", ":", "A", "sequence", "file", "in", "fasta", "format", "to", "extrac...
def fetch_sequence(seq_file, seq_acc, seq_start, seq_end): cmd = "%s %s %s/%s-%s" % (ESL_PATH, seq_file, str(seq_acc), str(seq_start), str(seq_end)) proc = subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE) seq = proc.communicate...
[ "def", "fetch_sequence", "(", "seq_file", ",", "seq_acc", ",", "seq_start", ",", "seq_end", ")", ":", "cmd", "=", "\"%s %s %s/%s-%s\"", "%", "(", "ESL_PATH", ",", "seq_file", ",", "str", "(", "seq_acc", ")", ",", "str", "(", "seq_start", ")", ",", "str",...
Extracts a sequence from sequence file seq_file using rfamseq_acc and sequence start-end positions (seq_start, seq_end) seq_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 end pos...
[ "Extracts", "a", "sequence", "from", "sequence", "file", "seq_file", "using", "rfamseq_acc", "and", "sequence", "start", "-", "end", "positions", "(", "seq_start", "seq_end", ")", "seq_file", ":", "A", "sequence", "file", "in", "fasta", "format", "to", "extrac...
[ "\"\"\"\n Extracts a sequence from sequence file seq_file using rfamseq_acc\n and sequence start-end positions (seq_start, seq_end)\n seq_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 the sequ...
[ { "param": "seq_file", "type": null }, { "param": "seq_acc", "type": null }, { "param": "seq_start", "type": null }, { "param": "seq_end", "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...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
fetch_seed_sequence_coordinates
<not_specific>
def fetch_seed_sequence_coordinates(seed_seq, full_seq): """ Returns seed sequence start and end coordinates based on the accession provided as input accession: A valid GenBank|ENA\RNAcentral accession return: A tuple with start and end coordinates in this order """ start = 0 end = 0 ...
Returns seed sequence start and end coordinates based on the accession provided as input accession: A valid GenBank|ENA\RNAcentral accession return: A tuple with start and end coordinates in this order
Returns seed sequence start and end coordinates based on the accession provided as input A tuple with start and end coordinates in this order
[ "Returns", "seed", "sequence", "start", "and", "end", "coordinates", "based", "on", "the", "accession", "provided", "as", "input", "A", "tuple", "with", "start", "and", "end", "coordinates", "in", "this", "order" ]
def fetch_seed_sequence_coordinates(seed_seq, full_seq): start = 0 end = 0 start = full_seq.find(seed_seq) end = start + len(seed_seq) if start != -1: return (start+1, end) return (0, 0)
[ "def", "fetch_seed_sequence_coordinates", "(", "seed_seq", ",", "full_seq", ")", ":", "start", "=", "0", "end", "=", "0", "start", "=", "full_seq", ".", "find", "(", "seed_seq", ")", "end", "=", "start", "+", "len", "(", "seed_seq", ")", "if", "start", ...
Returns seed sequence start and end coordinates based on the accession provided as input
[ "Returns", "seed", "sequence", "start", "and", "end", "coordinates", "based", "on", "the", "accession", "provided", "as", "input" ]
[ "\"\"\"\n Returns seed sequence start and end coordinates based on the\n accession provided as input\n\n accession: A valid GenBank|ENA\\RNAcentral accession\n\n return: A tuple with start and end coordinates in this order\n \"\"\"", "# use accession to fetch the coordinates - sequence might be nee...
[ { "param": "seed_seq", "type": null }, { "param": "full_seq", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed_seq", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "full_seq", "type": null, "docstring": null, "docstring_to...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
load_fasta_file_to_dict
<not_specific>
def load_fasta_file_to_dict(fasta): """ Loads a fasta file (seqdb) into a dictionary with the sequence accession used as a key and the sequence as a value fasta: A valid sequence file in fasta format return: A python dictionary with accession:sequence pairs """ fasta_dict = {} fasta_...
Loads a fasta file (seqdb) into a dictionary with the sequence accession used as a key and the sequence as a value fasta: A valid sequence file in fasta format return: A python dictionary with accession:sequence pairs
Loads a fasta file (seqdb) into a dictionary with the sequence accession used as a key and the sequence as a value A valid sequence file in fasta format A python dictionary with accession:sequence pairs
[ "Loads", "a", "fasta", "file", "(", "seqdb", ")", "into", "a", "dictionary", "with", "the", "sequence", "accession", "used", "as", "a", "key", "and", "the", "sequence", "as", "a", "value", "A", "valid", "sequence", "file", "in", "fasta", "format", "A", ...
def load_fasta_file_to_dict(fasta): fasta_dict = {} fasta_fp = open(fasta, 'r') accession = "" flag_init_seq = 0 for line in fasta_fp: if line[0] == '>': line = line.strip() elements = line[1:].split(' ') accession = elements[0] fasta_dict[acce...
[ "def", "load_fasta_file_to_dict", "(", "fasta", ")", ":", "fasta_dict", "=", "{", "}", "fasta_fp", "=", "open", "(", "fasta", ",", "'r'", ")", "accession", "=", "\"\"", "flag_init_seq", "=", "0", "for", "line", "in", "fasta_fp", ":", "if", "line", "[", ...
Loads a fasta file (seqdb) into a dictionary with the sequence accession used as a key and the sequence as a value
[ "Loads", "a", "fasta", "file", "(", "seqdb", ")", "into", "a", "dictionary", "with", "the", "sequence", "accession", "used", "as", "a", "key", "and", "the", "sequence", "as", "a", "value" ]
[ "\"\"\"\n Loads a fasta file (seqdb) into a dictionary with the sequence\n accession used as a key and the sequence as a value\n\n fasta: A valid sequence file in fasta format\n\n return: A python dictionary with accession:sequence pairs\n \"\"\"", "# fetching accession from fasta header", "# wit...
[ { "param": "fasta", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fasta", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
stockhom_to_pfam_format
<not_specific>
def stockhom_to_pfam_format(stk_msa, dest_dir=None): """ Converts a stockholm MSA to the Pfam format stk_msa: A valid MSA in strockholm format dest_dir: The destination directory where the new MSA will be generated return: The output MSA in Pfam format, None otherwise """ filename = os...
Converts a stockholm MSA to the Pfam format stk_msa: A valid MSA in strockholm format dest_dir: The destination directory where the new MSA will be generated return: The output MSA in Pfam format, None otherwise
Converts a stockholm MSA to the Pfam format stk_msa: A valid MSA in strockholm format dest_dir: The destination directory where the new MSA will be generated The output MSA in Pfam format, None otherwise
[ "Converts", "a", "stockholm", "MSA", "to", "the", "Pfam", "format", "stk_msa", ":", "A", "valid", "MSA", "in", "strockholm", "format", "dest_dir", ":", "The", "destination", "directory", "where", "the", "new", "MSA", "will", "be", "generated", "The", "output...
def stockhom_to_pfam_format(stk_msa, dest_dir=None): filename = os.path.basename(stk_msa).partition('.')[0] output_pfam_msa = os.path.join(dest_dir, filename + ".pfam") cmd = "esl-reformat pfam %s > %s" % (stk_msa, output_pfam_msa) subprocess.call(cmd, shell=True) if not os.path.exists(output_pfam_m...
[ "def", "stockhom_to_pfam_format", "(", "stk_msa", ",", "dest_dir", "=", "None", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "stk_msa", ")", ".", "partition", "(", "'.'", ")", "[", "0", "]", "output_pfam_msa", "=", "os", ".", "pa...
Converts a stockholm MSA to the Pfam format stk_msa: A valid MSA in strockholm format dest_dir: The destination directory where the new MSA will be generated
[ "Converts", "a", "stockholm", "MSA", "to", "the", "Pfam", "format", "stk_msa", ":", "A", "valid", "MSA", "in", "strockholm", "format", "dest_dir", ":", "The", "destination", "directory", "where", "the", "new", "MSA", "will", "be", "generated" ]
[ "\"\"\"\n Converts a stockholm MSA to the Pfam format\n\n stk_msa: A valid MSA in strockholm format\n dest_dir: The destination directory where the new MSA\n will be generated\n\n return: The output MSA in Pfam format, None otherwise\n \"\"\"" ]
[ { "param": "stk_msa", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stk_msa", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_tok...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
pfam_to_stockholm_format
<not_specific>
def pfam_to_stockholm_format(pfam_msa, dest_dir=None): """ Converts a Pfam MSA to the stockholm format pfam_msa: A valid MSA in Pfam format dest_dir: The destination directory where the new MSA will be generated return: The output MSA in Stockholm format, None otherwise """ filename =...
Converts a Pfam MSA to the stockholm format pfam_msa: A valid MSA in Pfam format dest_dir: The destination directory where the new MSA will be generated return: The output MSA in Stockholm format, None otherwise
Converts a Pfam MSA to the stockholm format pfam_msa: A valid MSA in Pfam format dest_dir: The destination directory where the new MSA will be generated The output MSA in Stockholm format, None otherwise
[ "Converts", "a", "Pfam", "MSA", "to", "the", "stockholm", "format", "pfam_msa", ":", "A", "valid", "MSA", "in", "Pfam", "format", "dest_dir", ":", "The", "destination", "directory", "where", "the", "new", "MSA", "will", "be", "generated", "The", "output", ...
def pfam_to_stockholm_format(pfam_msa, dest_dir=None): filename = os.path.basename(pfam_msa).partition('.')[0] output_stk_msa = os.path.join(dest_dir, filename + ".stk") cmd = "esl-reformat stockholm %s > %s" % (pfam_msa, output_stk_msa) subprocess.call(cmd, shell=True) if not os.path.exists(output_...
[ "def", "pfam_to_stockholm_format", "(", "pfam_msa", ",", "dest_dir", "=", "None", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "pfam_msa", ")", ".", "partition", "(", "'.'", ")", "[", "0", "]", "output_stk_msa", "=", "os", ".", "...
Converts a Pfam MSA to the stockholm format pfam_msa: A valid MSA in Pfam format dest_dir: The destination directory where the new MSA will be generated
[ "Converts", "a", "Pfam", "MSA", "to", "the", "stockholm", "format", "pfam_msa", ":", "A", "valid", "MSA", "in", "Pfam", "format", "dest_dir", ":", "The", "destination", "directory", "where", "the", "new", "MSA", "will", "be", "generated" ]
[ "\"\"\"\n Converts a Pfam MSA to the stockholm format\n\n pfam_msa: A valid MSA in Pfam format\n dest_dir: The destination directory where the new MSA\n will be generated\n\n return: The output MSA in Stockholm format, None otherwise\n \"\"\"" ]
[ { "param": "pfam_msa", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pfam_msa", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_to...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
relabel_seed_accessions
<not_specific>
def relabel_seed_accessions(seed, accession_coords, dest_dir = None): """ Re-writes a seed file with the sequence coordinates appended to the sequence accessions seed: A seed file with no star-end sequence coordinates return: The path to the newly relabelled SEED alignment """ if dest_dir...
Re-writes a seed file with the sequence coordinates appended to the sequence accessions seed: A seed file with no star-end sequence coordinates return: The path to the newly relabelled SEED alignment
Re-writes a seed file with the sequence coordinates appended to the sequence accessions A seed file with no star-end sequence coordinates The path to the newly relabelled SEED alignment
[ "Re", "-", "writes", "a", "seed", "file", "with", "the", "sequence", "coordinates", "appended", "to", "the", "sequence", "accessions", "A", "seed", "file", "with", "no", "star", "-", "end", "sequence", "coordinates", "The", "path", "to", "the", "newly", "r...
def relabel_seed_accessions(seed, accession_coords, dest_dir = None): if dest_dir is None: dest_dir = os.path.split(seed)[0] sequence_label = 0 new_line = '' filename = os.path.split(seed)[1].partition('.')[0] new_seed_loc = os.path.join(dest_dir, filename+'_relabelled') seed_fp = open(s...
[ "def", "relabel_seed_accessions", "(", "seed", ",", "accession_coords", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "seed", ")", "[", "0", "]", "sequence_label", "=",...
Re-writes a seed file with the sequence coordinates appended to the sequence accessions
[ "Re", "-", "writes", "a", "seed", "file", "with", "the", "sequence", "coordinates", "appended", "to", "the", "sequence", "accessions" ]
[ "\"\"\"\n Re-writes a seed file with the sequence coordinates appended to the\n sequence accessions\n\n seed: A seed file with no star-end sequence coordinates\n\n return: The path to the newly relabelled SEED alignment\n \"\"\"", "# fetch path of seed alignment", "# check if this is an actual se...
[ { "param": "seed", "type": null }, { "param": "accession_coords", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "accession_coords", "type": null, "docstring": null, "docstrin...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
fetch_RNAcentral_id
<not_specific>
def fetch_RNAcentral_id(sequence): """ Looks for a sequence match in RNAcentral based on sequence md5 and fetches the corresponding RNAcentral accession sequence: A valid DNA/RNA sequence return: Returns RNAcentral id, otherwise returns None """ sequence_md5 = sequence_to_md5(sequence) ...
Looks for a sequence match in RNAcentral based on sequence md5 and fetches the corresponding RNAcentral accession sequence: A valid DNA/RNA sequence return: Returns RNAcentral id, otherwise returns None
Looks for a sequence match in RNAcentral based on sequence md5 and fetches the corresponding RNAcentral accession A valid DNA/RNA sequence Returns RNAcentral id, otherwise returns None
[ "Looks", "for", "a", "sequence", "match", "in", "RNAcentral", "based", "on", "sequence", "md5", "and", "fetches", "the", "corresponding", "RNAcentral", "accession", "A", "valid", "DNA", "/", "RNA", "sequence", "Returns", "RNAcentral", "id", "otherwise", "returns...
def fetch_RNAcentral_id(sequence): sequence_md5 = sequence_to_md5(sequence) rnacentral_url = 'https://rnacentral.org/api/v1/rna' response = requests.get(rnacentral_url, params={'md5': sequence_md5}) data = response.json() if data['count'] > 0: return data['results'][0]['rnacentral_id'] r...
[ "def", "fetch_RNAcentral_id", "(", "sequence", ")", ":", "sequence_md5", "=", "sequence_to_md5", "(", "sequence", ")", "rnacentral_url", "=", "'https://rnacentral.org/api/v1/rna'", "response", "=", "requests", ".", "get", "(", "rnacentral_url", ",", "params", "=", "...
Looks for a sequence match in RNAcentral based on sequence md5 and fetches the corresponding RNAcentral accession
[ "Looks", "for", "a", "sequence", "match", "in", "RNAcentral", "based", "on", "sequence", "md5", "and", "fetches", "the", "corresponding", "RNAcentral", "accession" ]
[ "\"\"\"\n Looks for a sequence match in RNAcentral based on sequence md5\n and fetches the corresponding RNAcentral accession\n\n sequence: A valid DNA/RNA sequence\n\n return: Returns RNAcentral id, otherwise returns None\n \"\"\"" ]
[ { "param": "sequence", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sequence", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
generate_seed_id_from_RNAcentral
<not_specific>
def generate_seed_id_from_RNAcentral(sequence): """ Generates a seed accession based on a sequence mad5 match in RNAcentral sequence: A valid DNA/RNA sequence return: Returns RNAcentral id, otherwise returns None """ sequence_md5 = sequence_to_md5(sequence) rnacentral_url = 'https://rnac...
Generates a seed accession based on a sequence mad5 match in RNAcentral sequence: A valid DNA/RNA sequence return: Returns RNAcentral id, otherwise returns None
Generates a seed accession based on a sequence mad5 match in RNAcentral sequence: A valid DNA/RNA sequence Returns RNAcentral id, otherwise returns None
[ "Generates", "a", "seed", "accession", "based", "on", "a", "sequence", "mad5", "match", "in", "RNAcentral", "sequence", ":", "A", "valid", "DNA", "/", "RNA", "sequence", "Returns", "RNAcentral", "id", "otherwise", "returns", "None" ]
def generate_seed_id_from_RNAcentral(sequence): sequence_md5 = sequence_to_md5(sequence) rnacentral_url = 'https://rnacentral.org/api/v1/rna' response = requests.get(rnacentral_url, params={'md5': sequence_md5}) data = response.json() if data['count'] > 0: return data['results'][0]['rnacentr...
[ "def", "generate_seed_id_from_RNAcentral", "(", "sequence", ")", ":", "sequence_md5", "=", "sequence_to_md5", "(", "sequence", ")", "rnacentral_url", "=", "'https://rnacentral.org/api/v1/rna'", "response", "=", "requests", ".", "get", "(", "rnacentral_url", ",", "params...
Generates a seed accession based on a sequence mad5 match in RNAcentral sequence: A valid DNA/RNA sequence
[ "Generates", "a", "seed", "accession", "based", "on", "a", "sequence", "mad5", "match", "in", "RNAcentral", "sequence", ":", "A", "valid", "DNA", "/", "RNA", "sequence" ]
[ "\"\"\"\n Generates a seed accession based on a sequence mad5 match in RNAcentral\n\n sequence: A valid DNA/RNA sequence\n\n return: Returns RNAcentral id, otherwise returns None\n \"\"\"" ]
[ { "param": "sequence", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sequence", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
sequence_to_md5
<not_specific>
def sequence_to_md5(sequence): """ Converts a sequence to an md5 hash after replacing Us with Ts sequence: A valid RNA/DNA sequence return: MD5 hash of the sequence """ md5_converter = hashlib.md5() # convert to DNA sequence = sequence.replace('U', 'T') md5_converter.update(se...
Converts a sequence to an md5 hash after replacing Us with Ts sequence: A valid RNA/DNA sequence return: MD5 hash of the sequence
Converts a sequence to an md5 hash after replacing Us with Ts A valid RNA/DNA sequence MD5 hash of the sequence
[ "Converts", "a", "sequence", "to", "an", "md5", "hash", "after", "replacing", "Us", "with", "Ts", "A", "valid", "RNA", "/", "DNA", "sequence", "MD5", "hash", "of", "the", "sequence" ]
def sequence_to_md5(sequence): md5_converter = hashlib.md5() sequence = sequence.replace('U', 'T') md5_converter.update(sequence.encode('utf-8')) sequence_md5 = md5_converter.hexdigest() return sequence_md5
[ "def", "sequence_to_md5", "(", "sequence", ")", ":", "md5_converter", "=", "hashlib", ".", "md5", "(", ")", "sequence", "=", "sequence", ".", "replace", "(", "'U'", ",", "'T'", ")", "md5_converter", ".", "update", "(", "sequence", ".", "encode", "(", "'u...
Converts a sequence to an md5 hash after replacing Us with Ts
[ "Converts", "a", "sequence", "to", "an", "md5", "hash", "after", "replacing", "Us", "with", "Ts" ]
[ "\"\"\"\n Converts a sequence to an md5 hash after replacing Us with\n Ts\n\n sequence: A valid RNA/DNA sequence\n\n return: MD5 hash of the sequence\n \"\"\"", "# convert to DNA" ]
[ { "param": "sequence", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sequence", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
validate_sequences
<not_specific>
def validate_sequences(seed_sequence, extracted_full_seq, rnac=True): """ Validates whether the SEED sequence matches the sequence extracted at specific coordinates seed_sequence: A DNA/RNA sequecne extracted from the SEED alignment extracted_full: A DNA/RNA subsequence extracted at specific locati...
Validates whether the SEED sequence matches the sequence extracted at specific coordinates seed_sequence: A DNA/RNA sequecne extracted from the SEED alignment extracted_full: A DNA/RNA subsequence extracted at specific locations return: True if the sequences match, False otherwise. Returns False ...
Validates whether the SEED sequence matches the sequence extracted at specific coordinates A DNA/RNA sequecne extracted from the SEED alignment extracted_full: A DNA/RNA subsequence extracted at specific locations True if the sequences match, False otherwise. Returns False by default
[ "Validates", "whether", "the", "SEED", "sequence", "matches", "the", "sequence", "extracted", "at", "specific", "coordinates", "A", "DNA", "/", "RNA", "sequecne", "extracted", "from", "the", "SEED", "alignment", "extracted_full", ":", "A", "DNA", "/", "RNA", "...
def validate_sequences(seed_sequence, extracted_full_seq, rnac=True): new_seed_sequence = seed_sequence if rnac is False: new_seed_sequence = seed_sequence.replace('U', 'T') if extracted_full_seq.find(new_seed_sequence) != -1: return True return False
[ "def", "validate_sequences", "(", "seed_sequence", ",", "extracted_full_seq", ",", "rnac", "=", "True", ")", ":", "new_seed_sequence", "=", "seed_sequence", "if", "rnac", "is", "False", ":", "new_seed_sequence", "=", "seed_sequence", ".", "replace", "(", "'U'", ...
Validates whether the SEED sequence matches the sequence extracted at specific coordinates
[ "Validates", "whether", "the", "SEED", "sequence", "matches", "the", "sequence", "extracted", "at", "specific", "coordinates" ]
[ "\"\"\"\n Validates whether the SEED sequence matches the sequence\n extracted at specific coordinates\n\n seed_sequence: A DNA/RNA sequecne extracted from the SEED alignment\n extracted_full: A DNA/RNA subsequence extracted at specific locations\n\n return: True if the sequences match, False otherwi...
[ { "param": "seed_sequence", "type": null }, { "param": "extracted_full_seq", "type": null }, { "param": "rnac", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed_sequence", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "extracted_full_seq", "type": null, "docstring": null, ...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
seed_to_fasta
<not_specific>
def seed_to_fasta(seed_msa, dest_dir=None): """ Converts a multiple sequence alignment (MSA) to fasta param seed_msa: A valid Rfam SEED file in stockholm format to convert to fasta return: Path to updated seed file """ filename = "" path_elements = os.path.split(seed_msa) if dest_di...
Converts a multiple sequence alignment (MSA) to fasta param seed_msa: A valid Rfam SEED file in stockholm format to convert to fasta return: Path to updated seed file
Converts a multiple sequence alignment (MSA) to fasta param seed_msa: A valid Rfam SEED file in stockholm format to convert to fasta Path to updated seed file
[ "Converts", "a", "multiple", "sequence", "alignment", "(", "MSA", ")", "to", "fasta", "param", "seed_msa", ":", "A", "valid", "Rfam", "SEED", "file", "in", "stockholm", "format", "to", "convert", "to", "fasta", "Path", "to", "updated", "seed", "file" ]
def seed_to_fasta(seed_msa, dest_dir=None): filename = "" path_elements = os.path.split(seed_msa) if dest_dir is None: dest_dir = path_elements[0] if "." in path_elements[1]: filename = path_elements[1].partition('.')[0] else: filename = path_elements[1] cmd = "esl-sfetch...
[ "def", "seed_to_fasta", "(", "seed_msa", ",", "dest_dir", "=", "None", ")", ":", "filename", "=", "\"\"", "path_elements", "=", "os", ".", "path", ".", "split", "(", "seed_msa", ")", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "path_elements", ...
Converts a multiple sequence alignment (MSA) to fasta param seed_msa: A valid Rfam SEED file in stockholm format to convert to fasta
[ "Converts", "a", "multiple", "sequence", "alignment", "(", "MSA", ")", "to", "fasta", "param", "seed_msa", ":", "A", "valid", "Rfam", "SEED", "file", "in", "stockholm", "format", "to", "convert", "to", "fasta" ]
[ "\"\"\"\n Converts a multiple sequence alignment (MSA) to fasta\n\n param seed_msa: A valid Rfam SEED file in stockholm format to convert to fasta\n\n return: Path to updated seed file\n \"\"\"", "# clean temp file", "# return None if the fasta file was not created" ]
[ { "param": "seed_msa", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed_msa", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_to...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
align_sequences_to_cm
<not_specific>
def align_sequences_to_cm(cmfile, fasta_file, dest_dir=None): """ Aligns a fasta to a covariance model using cmalign cmfile: A valid covariance model fasta_file: A valid nucleotide fasta file dest_dir: Destination directory where to generate any output return: Returns path to the aligned sequ...
Aligns a fasta to a covariance model using cmalign cmfile: A valid covariance model fasta_file: A valid nucleotide fasta file dest_dir: Destination directory where to generate any output return: Returns path to the aligned sequences, otherwise returns None if file does not exist
Aligns a fasta to a covariance model using cmalign cmfile: A valid covariance model fasta_file: A valid nucleotide fasta file Destination directory where to generate any output Returns path to the aligned sequences, otherwise returns None if file does not exist
[ "Aligns", "a", "fasta", "to", "a", "covariance", "model", "using", "cmalign", "cmfile", ":", "A", "valid", "covariance", "model", "fasta_file", ":", "A", "valid", "nucleotide", "fasta", "file", "Destination", "directory", "where", "to", "generate", "any", "out...
def align_sequences_to_cm(cmfile, fasta_file, dest_dir=None): if dest_dir is None: dest_dir = os.path.split(fasta_file)[0] out_filename = os.path.basename(fasta_file).partition('.')[0] out_filename += "_aln.stk" new_seed = os.path.join(dest_dir, out_filename) cmd = "cmalign %s %s | grep -Ev ...
[ "def", "align_sequences_to_cm", "(", "cmfile", ",", "fasta_file", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "fasta_file", ")", "[", "0", "]", "out_filename", "=", ...
Aligns a fasta to a covariance model using cmalign cmfile: A valid covariance model fasta_file: A valid nucleotide fasta file
[ "Aligns", "a", "fasta", "to", "a", "covariance", "model", "using", "cmalign", "cmfile", ":", "A", "valid", "covariance", "model", "fasta_file", ":", "A", "valid", "nucleotide", "fasta", "file" ]
[ "\"\"\"\n Aligns a fasta to a covariance model using cmalign\n\n cmfile: A valid covariance model\n fasta_file: A valid nucleotide fasta file\n\n dest_dir: Destination directory where to generate any output\n\n return: Returns path to the aligned sequences, otherwise\n returns None if file does no...
[ { "param": "cmfile", "type": null }, { "param": "fasta_file", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cmfile", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fasta_file", "type": null, "docstring": null, "docstring_to...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
map_rnacentral_urs_wirh_db_accessions
<not_specific>
def map_rnacentral_urs_wirh_db_accessions(db_accession, expert_db): """ Maps a database accession with a URS accession assigned by RNAcentral. The limitation db_accession: A valid member database accession already imported to RNAcentral expert_db: RNAcentral expert database to map the SEED acce...
Maps a database accession with a URS accession assigned by RNAcentral. The limitation db_accession: A valid member database accession already imported to RNAcentral expert_db: RNAcentral expert database to map the SEED accessions to return: The corresponding RNAcentral accession (URS)
Maps a database accession with a URS accession assigned by RNAcentral. The limitation A valid member database accession already imported to RNAcentral expert_db: RNAcentral expert database to map the SEED accessions to The corresponding RNAcentral accession (URS)
[ "Maps", "a", "database", "accession", "with", "a", "URS", "accession", "assigned", "by", "RNAcentral", ".", "The", "limitation", "A", "valid", "member", "database", "accession", "already", "imported", "to", "RNAcentral", "expert_db", ":", "RNAcentral", "expert", ...
def map_rnacentral_urs_wirh_db_accessions(db_accession, expert_db): rnacentral_url = "http://www.ebi.ac.uk/ebisearch/ws/rest/rnacentral?query=\"%s\" AND expert_db:\"%s\" AND so_rna_type_name:\"%s\"" response = requests.get(rnacentral_url % (db_accession, expert_db, DB_RNA_TYPES[expert_db.lower()])) rnacentr...
[ "def", "map_rnacentral_urs_wirh_db_accessions", "(", "db_accession", ",", "expert_db", ")", ":", "rnacentral_url", "=", "\"http://www.ebi.ac.uk/ebisearch/ws/rest/rnacentral?query=\\\"%s\\\" AND expert_db:\\\"%s\\\" AND so_rna_type_name:\\\"%s\\\"\"", "response", "=", "requests", ".", "...
Maps a database accession with a URS accession assigned by RNAcentral.
[ "Maps", "a", "database", "accession", "with", "a", "URS", "accession", "assigned", "by", "RNAcentral", "." ]
[ "\"\"\"\n Maps a database accession with a URS accession assigned by\n RNAcentral. The limitation\n\n db_accession: A valid member database accession already imported\n to RNAcentral\n expert_db: RNAcentral expert database to map the SEED accessions to\n\n return: The corresponding RNAcentral acce...
[ { "param": "db_accession", "type": null }, { "param": "expert_db", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "db_accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expert_db", "type": null, "docstring": null, "docstri...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
fetch_sequence_from_rnacentral
<not_specific>
def fetch_sequence_from_rnacentral(rnacentral_id): """ Uses RNAcentral's API to fetch corresponding sequence based on RNAcentral URS id rnacentral_id: A valid RNAcentral URS identifier e.g. return: Corresponding sequence if available, none otherwise """ # isolate URS if necessary if r...
Uses RNAcentral's API to fetch corresponding sequence based on RNAcentral URS id rnacentral_id: A valid RNAcentral URS identifier e.g. return: Corresponding sequence if available, none otherwise
Uses RNAcentral's API to fetch corresponding sequence based on RNAcentral URS id A valid RNAcentral URS identifier e.g. Corresponding sequence if available, none otherwise
[ "Uses", "RNAcentral", "'", "s", "API", "to", "fetch", "corresponding", "sequence", "based", "on", "RNAcentral", "URS", "id", "A", "valid", "RNAcentral", "URS", "identifier", "e", ".", "g", ".", "Corresponding", "sequence", "if", "available", "none", "otherwise...
def fetch_sequence_from_rnacentral(rnacentral_id): if rnacentral_id.find('_') != -1: rnacentral_id = rnacentral_id.partition('_')[0] rnacentral_url = "https://rnacentral.org/api/v1/rna/%s.fasta" response = requests.get(rnacentral_url % rnacentral_id) sequence = None if response.status_code =...
[ "def", "fetch_sequence_from_rnacentral", "(", "rnacentral_id", ")", ":", "if", "rnacentral_id", ".", "find", "(", "'_'", ")", "!=", "-", "1", ":", "rnacentral_id", "=", "rnacentral_id", ".", "partition", "(", "'_'", ")", "[", "0", "]", "rnacentral_url", "=",...
Uses RNAcentral's API to fetch corresponding sequence based on RNAcentral URS id
[ "Uses", "RNAcentral", "'", "s", "API", "to", "fetch", "corresponding", "sequence", "based", "on", "RNAcentral", "URS", "id" ]
[ "\"\"\"\n Uses RNAcentral's API to fetch corresponding sequence based on\n RNAcentral URS id\n\n rnacentral_id: A valid RNAcentral URS identifier e.g.\n\n return: Corresponding sequence if available, none otherwise\n \"\"\"", "# isolate URS if necessary", "# if request status is OK - remove heade...
[ { "param": "rnacentral_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rnacentral_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
relabel_seeds_from_rnacentral_md5_mapping
<not_specific>
def relabel_seeds_from_rnacentral_md5_mapping(seed, dest_dir=None): """ Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. seed: A reformatted seed in Pfam format dest_di...
Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. seed: A reformatted seed in Pfam format dest_dir: The path to the destination directory. None by default return: The ...
Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. A reformatted seed in Pfam format dest_dir: The path to the destination directory. None by default The path to the relabelled SEED alignement
[ "Relabels", "the", "accessions", "of", "a", "SEED", "alignment", "using", "RNAcentral", "identifiers", ".", "This", "is", "done", "by", "matching", "the", "seed", "sequences", "with", "sequences", "existing", "in", "RNAcentral", "using", "md5", "hashing", ".", ...
def relabel_seeds_from_rnacentral_md5_mapping(seed, dest_dir=None): if dest_dir is None: dest_dir = os.path.split(seed)[0] sequence_label = 0 new_line = '' filename = os.path.split(seed)[1].partition('.')[0] new_seed_loc = os.path.join(dest_dir, filename+'_relabelled') seed_fp = open(see...
[ "def", "relabel_seeds_from_rnacentral_md5_mapping", "(", "seed", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "seed", ")", "[", "0", "]", "sequence_label", "=", "0", "...
Relabels the accessions of a SEED alignment using RNAcentral identifiers.
[ "Relabels", "the", "accessions", "of", "a", "SEED", "alignment", "using", "RNAcentral", "identifiers", "." ]
[ "\"\"\"\n Relabels the accessions of a SEED alignment using RNAcentral\n identifiers. This is done by matching the seed sequences, with\n sequences existing in RNAcentral using md5 hashing.\n\n seed: A reformatted seed in Pfam format\n dest_dir: The path to the destination directory. None by default\...
[ { "param": "seed", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_tokens...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
rewrite_seed_with_sscons
<not_specific>
def rewrite_seed_with_sscons(input_seed, ss_cons, dest_dir=None): """ Rewrites a SEED alignment in stockholm format with a ss_cons param input_seed: Initial seed to rewrite and add ss_cons to. The seed alignment needs to be in stockholm format param ss_cons: Consensus secondary structure to add to...
Rewrites a SEED alignment in stockholm format with a ss_cons param input_seed: Initial seed to rewrite and add ss_cons to. The seed alignment needs to be in stockholm format param ss_cons: Consensus secondary structure to add to the alignment return: The path to the new SEED is successful, other...
Rewrites a SEED alignment in stockholm format with a ss_cons param input_seed: Initial seed to rewrite and add ss_cons to. The seed alignment needs to be in stockholm format param ss_cons: Consensus secondary structure to add to the alignment The path to the new SEED is successful, otherwise None
[ "Rewrites", "a", "SEED", "alignment", "in", "stockholm", "format", "with", "a", "ss_cons", "param", "input_seed", ":", "Initial", "seed", "to", "rewrite", "and", "add", "ss_cons", "to", ".", "The", "seed", "alignment", "needs", "to", "be", "in", "stockholm",...
def rewrite_seed_with_sscons(input_seed, ss_cons, dest_dir=None): if dest_dir is None: dest_dir = os.path.split(input_seed)[0] filename = os.path.basename(input_seed).partition('.')[0] new_seed_loc = os.path.join(dest_dir, filename + "ss_cons.stk") new_seed_fp = open(new_seed_loc, 'w') old_s...
[ "def", "rewrite_seed_with_sscons", "(", "input_seed", ",", "ss_cons", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "input_seed", ")", "[", "0", "]", "filename", "=", ...
Rewrites a SEED alignment in stockholm format with a ss_cons param input_seed: Initial seed to rewrite and add ss_cons to.
[ "Rewrites", "a", "SEED", "alignment", "in", "stockholm", "format", "with", "a", "ss_cons", "param", "input_seed", ":", "Initial", "seed", "to", "rewrite", "and", "add", "ss_cons", "to", "." ]
[ "\"\"\"\n Rewrites a SEED alignment in stockholm format with a ss_cons\n\n param input_seed: Initial seed to rewrite and add ss_cons to.\n The seed alignment needs to be in stockholm format\n\n param ss_cons: Consensus secondary structure to add to the alignment\n\n return: The path to the new SEED i...
[ { "param": "input_seed", "type": null }, { "param": "ss_cons", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ss_cons", "type": null, "docstring": null, "docstring_t...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
merge_seeds
<not_specific>
def merge_seeds(seed1, seed2, filename=None, dest_dir=None): """ Merges two alignments into one using esl-alimerge seed1: The path to SEED alignment 1 seed2: The path to SEED alignment 2 filename: A string specifying the filename of the merged alignment dest_dir: The path to the destination dir...
Merges two alignments into one using esl-alimerge seed1: The path to SEED alignment 1 seed2: The path to SEED alignment 2 filename: A string specifying the filename of the merged alignment dest_dir: The path to the destination directory. If None uses current working directory return: The ...
Merges two alignments into one using esl-alimerge seed1: The path to SEED alignment 1 seed2: The path to SEED alignment 2 filename: A string specifying the filename of the merged alignment dest_dir: The path to the destination directory. If None uses current working directory The path to the merged SEED if it exists, ...
[ "Merges", "two", "alignments", "into", "one", "using", "esl", "-", "alimerge", "seed1", ":", "The", "path", "to", "SEED", "alignment", "1", "seed2", ":", "The", "path", "to", "SEED", "alignment", "2", "filename", ":", "A", "string", "specifying", "the", ...
def merge_seeds(seed1, seed2, filename=None, dest_dir=None): if dest_dir is None: dest_dir = os.getcwd() merged_seed_loc = os.path.join(dest_dir, filename + '_merged.stk') cmd = "esl-alimerge -o %s %s %s" % (merged_seed_loc, seed1, seed2) subprocess.call(cmd, shell=True) if os.path.exists(me...
[ "def", "merge_seeds", "(", "seed1", ",", "seed2", ",", "filename", "=", "None", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "getcwd", "(", ")", "merged_seed_loc", "=", "os", ".", "path", "....
Merges two alignments into one using esl-alimerge seed1: The path to SEED alignment 1 seed2: The path to SEED alignment 2 filename: A string specifying the filename of the merged alignment dest_dir: The path to the destination directory.
[ "Merges", "two", "alignments", "into", "one", "using", "esl", "-", "alimerge", "seed1", ":", "The", "path", "to", "SEED", "alignment", "1", "seed2", ":", "The", "path", "to", "SEED", "alignment", "2", "filename", ":", "A", "string", "specifying", "the", ...
[ "\"\"\"\n Merges two alignments into one using esl-alimerge\n\n seed1: The path to SEED alignment 1\n seed2: The path to SEED alignment 2\n filename: A string specifying the filename of the merged alignment\n dest_dir: The path to the destination directory. If None uses current\n working directory...
[ { "param": "seed1", "type": null }, { "param": "seed2", "type": null }, { "param": "filename", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "seed2", "type": null, "docstring": null, "docstring_tokens":...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
remove_all_gap_columns
<not_specific>
def remove_all_gap_columns(seed, filename, dest_dir=None): """ Uses esl-reformat to remove all-gap columns from a SEED alignment seed: A valid SEED alignment in stockholm format filename: A string specifying the modified SEED name dest_dir: The path to the destination directory where the ou...
Uses esl-reformat to remove all-gap columns from a SEED alignment seed: A valid SEED alignment in stockholm format filename: A string specifying the modified SEED name dest_dir: The path to the destination directory where the output will be generated return: Returns the path to the update...
Uses esl-reformat to remove all-gap columns from a SEED alignment A valid SEED alignment in stockholm format filename: A string specifying the modified SEED name dest_dir: The path to the destination directory where the output will be generated Returns the path to the updated SEED if it exists, otherwise it returns N...
[ "Uses", "esl", "-", "reformat", "to", "remove", "all", "-", "gap", "columns", "from", "a", "SEED", "alignment", "A", "valid", "SEED", "alignment", "in", "stockholm", "format", "filename", ":", "A", "string", "specifying", "the", "modified", "SEED", "name", ...
def remove_all_gap_columns(seed, filename, dest_dir=None): if dest_dir is None: dest_dir = os.path.split(os.path.abspath(seed))[0] new_seed_loc = os.path.join(dest_dir, filename + '_nogaps.stk') cmd = "esl-reformat -o %s --mingap --wussify stockholm %s" % (new_seed_loc, seed) subprocess.call(cmd...
[ "def", "remove_all_gap_columns", "(", "seed", ",", "filename", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "abspath", "(", "seed", ")", ")...
Uses esl-reformat to remove all-gap columns from a SEED alignment
[ "Uses", "esl", "-", "reformat", "to", "remove", "all", "-", "gap", "columns", "from", "a", "SEED", "alignment" ]
[ "\"\"\"\n Uses esl-reformat to remove all-gap columns from a SEED\n alignment\n\n seed: A valid SEED alignment in stockholm format\n filename: A string specifying the modified SEED name\n dest_dir: The path to the destination directory where\n the output will be generated\n\n return: Returns th...
[ { "param": "seed", "type": null }, { "param": "filename", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
relabel_seeds_from_rnacentral_urs_mapping
<not_specific>
def relabel_seeds_from_rnacentral_urs_mapping(seed, expert_db=None, dest_dir=None, clean=False): """ Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. seed: A reformatted se...
Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. seed: A reformatted seed in Pfam format expert_db: An existing RNAcentral expert database dest_dir: The path to the de...
Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. A reformatted seed in Pfam format expert_db: An existing RNAcentral expert database dest_dir: The path to the destination directory. None by de...
[ "Relabels", "the", "accessions", "of", "a", "SEED", "alignment", "using", "RNAcentral", "identifiers", ".", "This", "is", "done", "by", "matching", "the", "seed", "sequences", "with", "sequences", "existing", "in", "RNAcentral", "using", "md5", "hashing", ".", ...
def relabel_seeds_from_rnacentral_urs_mapping(seed, expert_db=None, dest_dir=None, clean=False): if dest_dir is None: dest_dir = os.path.split(seed)[0] sequence_label = 0 new_line = '' write_log = False filename = os.path.split(seed)[1].partition('.')[0] new_seed_filename = filename + '_...
[ "def", "relabel_seeds_from_rnacentral_urs_mapping", "(", "seed", ",", "expert_db", "=", "None", ",", "dest_dir", "=", "None", ",", "clean", "=", "False", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", ...
Relabels the accessions of a SEED alignment using RNAcentral identifiers.
[ "Relabels", "the", "accessions", "of", "a", "SEED", "alignment", "using", "RNAcentral", "identifiers", "." ]
[ "\"\"\"\n Relabels the accessions of a SEED alignment using RNAcentral\n identifiers. This is done by matching the seed sequences, with\n sequences existing in RNAcentral using md5 hashing.\n\n seed: A reformatted seed in Pfam format\n expert_db: An existing RNAcentral expert database\n dest_dir: ...
[ { "param": "seed", "type": null }, { "param": "expert_db", "type": null }, { "param": "dest_dir", "type": null }, { "param": "clean", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expert_db", "type": null, "docstring": null, "docstring_token...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
write_fasta_seed_file
<not_specific>
def write_fasta_seed_file(sequence_collection, filename="sequences", dest_dir=None): """ Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file sequence_collection: A python dictionary with the candidate sequ...
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file sequence_collection: A python dictionary with the candidate sequences filename: A string specifying the sequence file name dest_dir: Destination dir...
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file A python dictionary with the candidate sequences filename: A string specifying the sequence file name dest_dir: Destination directory where to generate output Returns fasta fil...
[ "Writes", "a", "fasta", "file", "in", "destination", "directory", "based", "on", "a", "dictionary", "of", "sequence_accession", ":", "sequence", "pairs", "to", "be", "used", "to", "generate", "a", "fasta", "file", "A", "python", "dictionary", "with", "the", ...
def write_fasta_seed_file(sequence_collection, filename="sequences", dest_dir=None): if dest_dir is None: sys.exit("\nNo destination directory was provided for fasta generation!\n") fasta_file = os.path.join(dest_dir, filename + '.fa') fasta_fp = open(fasta_file, 'w') for seq_acc in sequence_col...
[ "def", "write_fasta_seed_file", "(", "sequence_collection", ",", "filename", "=", "\"sequences\"", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "sys", ".", "exit", "(", "\"\\nNo destination directory was provided for fasta generation!\\n\...
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file
[ "Writes", "a", "fasta", "file", "in", "destination", "directory", "based", "on", "a", "dictionary", "of", "sequence_accession", ":", "sequence", "pairs", "to", "be", "used", "to", "generate", "a", "fasta", "file" ]
[ "\"\"\"\n Writes a fasta file in destination directory based on a\n dictionary of sequence_accession : sequence pairs to be\n used to generate a fasta file\n\n sequence_collection: A python dictionary with the candidate\n sequences\n filename: A string specifying the sequence file name\n dest_d...
[ { "param": "sequence_collection", "type": null }, { "param": "filename", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sequence_collection", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "d...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
write_fasta_file
<not_specific>
def write_fasta_file(sequence_collection, filename="sequences", dest_dir=None): """ Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file sequence_collection: A python dictionary with the candidate sequences...
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file sequence_collection: A python dictionary with the candidate sequences filename: A string specifying the sequence file name dest_dir: Destination dir...
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file A python dictionary with the candidate sequences filename: A string specifying the sequence file name dest_dir: Destination directory where to generate output Returns fasta fil...
[ "Writes", "a", "fasta", "file", "in", "destination", "directory", "based", "on", "a", "dictionary", "of", "sequence_accession", ":", "sequence", "pairs", "to", "be", "used", "to", "generate", "a", "fasta", "file", "A", "python", "dictionary", "with", "the", ...
def write_fasta_file(sequence_collection, filename="sequences", dest_dir=None): if dest_dir is None: sys.exit("\nNo destination directory was provided for fasta generation!\n") fasta_file = os.path.join(dest_dir, filename + '.fa') fasta_fp = open(fasta_file, 'w') for seq_acc in sequence_collecti...
[ "def", "write_fasta_file", "(", "sequence_collection", ",", "filename", "=", "\"sequences\"", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "sys", ".", "exit", "(", "\"\\nNo destination directory was provided for fasta generation!\\n\"", ...
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file
[ "Writes", "a", "fasta", "file", "in", "destination", "directory", "based", "on", "a", "dictionary", "of", "sequence_accession", ":", "sequence", "pairs", "to", "be", "used", "to", "generate", "a", "fasta", "file" ]
[ "\"\"\"\n Writes a fasta file in destination directory based on a\n dictionary of sequence_accession : sequence pairs to be\n used to generate a fasta file\n\n sequence_collection: A python dictionary with the candidate\n sequences\n filename: A string specifying the sequence file name\n dest_d...
[ { "param": "sequence_collection", "type": null }, { "param": "filename", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sequence_collection", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "d...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
map_sequence_segments
<not_specific>
def map_sequence_segments(seed_seq, rnac_seq, no_segments=4): """ Splits a seed sequence into smaller segments and maps the individual segments to the RNAcentral sequence param seed_seq: param rnac_seq: no_segments: return: RNAcentral subsequence if segments match by 75%, None otherwise ...
Splits a seed sequence into smaller segments and maps the individual segments to the RNAcentral sequence param seed_seq: param rnac_seq: no_segments: return: RNAcentral subsequence if segments match by 75%, None otherwise
Splits a seed sequence into smaller segments and maps the individual segments to the RNAcentral sequence param seed_seq: param rnac_seq: no_segments. RNAcentral subsequence if segments match by 75%, None otherwise
[ "Splits", "a", "seed", "sequence", "into", "smaller", "segments", "and", "maps", "the", "individual", "segments", "to", "the", "RNAcentral", "sequence", "param", "seed_seq", ":", "param", "rnac_seq", ":", "no_segments", ".", "RNAcentral", "subsequence", "if", "s...
def map_sequence_segments(seed_seq, rnac_seq, no_segments=4): segment_hits = {} output = {} seq_match_score = 0 seed_length = len(seed_seq) reference_start = None remainder = seed_length % no_segments segment_size = int((seed_length - remainder) / no_segments) index = 0 start = 0 ...
[ "def", "map_sequence_segments", "(", "seed_seq", ",", "rnac_seq", ",", "no_segments", "=", "4", ")", ":", "segment_hits", "=", "{", "}", "output", "=", "{", "}", "seq_match_score", "=", "0", "seed_length", "=", "len", "(", "seed_seq", ")", "reference_start",...
Splits a seed sequence into smaller segments and maps the individual segments to the RNAcentral sequence param seed_seq: param rnac_seq: no_segments:
[ "Splits", "a", "seed", "sequence", "into", "smaller", "segments", "and", "maps", "the", "individual", "segments", "to", "the", "RNAcentral", "sequence", "param", "seed_seq", ":", "param", "rnac_seq", ":", "no_segments", ":" ]
[ "\"\"\"\n Splits a seed sequence into smaller segments and maps the\n individual segments to the RNAcentral sequence\n param seed_seq:\n param rnac_seq:\n no_segments:\n\n return: RNAcentral subsequence if segments match by 75%, None otherwise\n \"\"\"", "# calculate number of remaining nts t...
[ { "param": "seed_seq", "type": null }, { "param": "rnac_seq", "type": null }, { "param": "no_segments", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed_seq", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rnac_seq", "type": null, "docstring": null, "docstring_to...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
build_temporary_cm_from_seed
<not_specific>
def build_temporary_cm_from_seed(seed_file, dest_dir=None): """ Build a temporary covariance model based on the seed_file, which is provided as input using cmbuild. seed_file: Seed alignment in Stockhold format to be used as input to cmbuild dest_dir: Destination directory where the output wil...
Build a temporary covariance model based on the seed_file, which is provided as input using cmbuild. seed_file: Seed alignment in Stockhold format to be used as input to cmbuild dest_dir: Destination directory where the output will be generated return: True if the covariance model exists...
Build a temporary covariance model based on the seed_file, which is provided as input using cmbuild. Seed alignment in Stockhold format to be used as input to cmbuild Destination directory where the output will be generated True if the covariance model exists, False otherwise
[ "Build", "a", "temporary", "covariance", "model", "based", "on", "the", "seed_file", "which", "is", "provided", "as", "input", "using", "cmbuild", ".", "Seed", "alignment", "in", "Stockhold", "format", "to", "be", "used", "as", "input", "to", "cmbuild", "Des...
def build_temporary_cm_from_seed(seed_file, dest_dir=None): if dest_dir is None: dest_dir = os.path.split(seed_file)[0] filename = os.path.basename(seed_file).partition('.')[0] cm_file = os.path.join(dest_dir, filename+'.cm') cmd = "cmbuild -F %s %s" % (cm_file, seed_file) subprocess.call(cm...
[ "def", "build_temporary_cm_from_seed", "(", "seed_file", ",", "dest_dir", "=", "None", ")", ":", "if", "dest_dir", "is", "None", ":", "dest_dir", "=", "os", ".", "path", ".", "split", "(", "seed_file", ")", "[", "0", "]", "filename", "=", "os", ".", "p...
Build a temporary covariance model based on the seed_file, which is provided as input using cmbuild.
[ "Build", "a", "temporary", "covariance", "model", "based", "on", "the", "seed_file", "which", "is", "provided", "as", "input", "using", "cmbuild", "." ]
[ "\"\"\"\n Build a temporary covariance model based on the seed_file,\n which is provided as input using cmbuild.\n\n seed_file: Seed alignment in Stockhold format to be used as\n input to cmbuild\n\n dest_dir: Destination directory where the output will be\n generated\n\n return: True if the co...
[ { "param": "seed_file", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_t...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
fix_coordinates
<not_specific>
def fix_coordinates(seed_file, dest_dir=None): """ Replaces 0 starting points with 1s in SEED sequences seed_file: Seed alignment in Stockhold format dest_dir: dest_dir: Destination directory where the output will be generated return: The path to the updated SEED """ filename = os.pa...
Replaces 0 starting points with 1s in SEED sequences seed_file: Seed alignment in Stockhold format dest_dir: dest_dir: Destination directory where the output will be generated return: The path to the updated SEED
Replaces 0 starting points with 1s in SEED sequences seed_file: Seed alignment in Stockhold format Destination directory where the output will be generated The path to the updated SEED
[ "Replaces", "0", "starting", "points", "with", "1s", "in", "SEED", "sequences", "seed_file", ":", "Seed", "alignment", "in", "Stockhold", "format", "Destination", "directory", "where", "the", "output", "will", "be", "generated", "The", "path", "to", "the", "up...
def fix_coordinates(seed_file, dest_dir=None): filename = os.path.basename(seed_file).partition('.')[0] pfam_aln = stockhom_to_pfam_format(seed_file, dest_dir=dest_dir) if pfam_aln is None: sys.exit("Unsuccessul stockholm to pfam conversion!") fp = open(pfam_aln, 'r') outfile = os.path.join(...
[ "def", "fix_coordinates", "(", "seed_file", ",", "dest_dir", "=", "None", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "seed_file", ")", ".", "partition", "(", "'.'", ")", "[", "0", "]", "pfam_aln", "=", "stockhom_to_pfam_format", ...
Replaces 0 starting points with 1s in SEED sequences seed_file: Seed alignment in Stockhold format
[ "Replaces", "0", "starting", "points", "with", "1s", "in", "SEED", "sequences", "seed_file", ":", "Seed", "alignment", "in", "Stockhold", "format" ]
[ "\"\"\"\n Replaces 0 starting points with 1s in SEED sequences\n\n seed_file: Seed alignment in Stockhold format\n\n dest_dir: dest_dir: Destination directory where the output will be\n generated\n\n return: The path to the updated SEED\n \"\"\"" ]
[ { "param": "seed_file", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest_dir", "type": null, "docstring": null, "docstring_t...
4128beadfa258555d5cf673fca90d58317708929
Rfam/rfam-production
scripts/preprocessing/relabel_seed.py
[ "Apache-2.0" ]
Python
parse_arguments
<not_specific>
def parse_arguments(): """ Basic argument parsing return: Argparse parser object """ parser = argparse.ArgumentParser(description='Script to relabel SEED alignments') required_arguments = parser.add_argument_group("required arguments") required_arguments.add_argument("--seed", help="SEED ...
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(description='Script to relabel SEED alignments') required_arguments = parser.add_argument_group("required arguments") required_arguments.add_argument("--seed", help="SEED alignment in stockholm format to relabel", type=str) mutually_exclusive_argum...
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Script to relabel SEED alignments'", ")", "required_arguments", "=", "parser", ".", "add_argument_group", "(", "\"required arguments\"", ")", "required_...
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 \"\"\"", "# mutually exclusive arguments", "# group together related arguments" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
06d0dd1d37c91aad3d6f2136a7f5034a6cf8d62e
Rfam/rfam-production
scripts/support/group_cms.py
[ "Apache-2.0" ]
Python
group_cms
null
def group_cms(cm_dir, no_of_cms=6, dest_dir=None): """ Fetch all family accessions from the database and sort in DESC order according to seed size. Split the cms into multiple files defined by no_of_cms making sure that we split the large families across the multiple cms cm_dir: A directory with al...
Fetch all family accessions from the database and sort in DESC order according to seed size. Split the cms into multiple files defined by no_of_cms making sure that we split the large families across the multiple cms cm_dir: A directory with all Rfam single covariance model files no_of_cms: The nu...
Fetch all family accessions from the database and sort in DESC order according to seed size. Split the cms into multiple files defined by no_of_cms making sure that we split the large families across the multiple cms A directory with all Rfam single covariance model files no_of_cms: The number of sub covariance model ...
[ "Fetch", "all", "family", "accessions", "from", "the", "database", "and", "sort", "in", "DESC", "order", "according", "to", "seed", "size", ".", "Split", "the", "cms", "into", "multiple", "files", "defined", "by", "no_of_cms", "making", "sure", "that", "we",...
def group_cms(cm_dir, no_of_cms=6, dest_dir=None): rfam_accs = db.fetch_rfam_accs_sorted(order='DESC') rfam_cms = [x for x in os.listdir(cm_dir) if x.endswith('.cm')] if dest_dir is None: dest_dir = cm_dir idx = 1 for cm_file in rfam_cms: cm_file_loc = os.path.join(cm_dir, cm_file) ...
[ "def", "group_cms", "(", "cm_dir", ",", "no_of_cms", "=", "6", ",", "dest_dir", "=", "None", ")", ":", "rfam_accs", "=", "db", ".", "fetch_rfam_accs_sorted", "(", "order", "=", "'DESC'", ")", "rfam_cms", "=", "[", "x", "for", "x", "in", "os", ".", "l...
Fetch all family accessions from the database and sort in DESC order according to seed size.
[ "Fetch", "all", "family", "accessions", "from", "the", "database", "and", "sort", "in", "DESC", "order", "according", "to", "seed", "size", "." ]
[ "\"\"\"\n Fetch all family accessions from the database and sort in DESC order according to\n seed size. Split the cms into multiple files defined by no_of_cms making sure that\n we split the large families across the multiple cms\n\n cm_dir: A directory with all Rfam single covariance model files\n ...
[ { "param": "cm_dir", "type": null }, { "param": "no_of_cms", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cm_dir", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "no_of_cms", "type": null, "docstring": null, "docstring_tok...
419a83050c522e75a2e51b6eced5d9191af90297
Rfam/rfam-production
scripts/export/genomes/ncbi_genome_downloader.py
[ "Apache-2.0" ]
Python
gcf_report_parser
<not_specific>
def gcf_report_parser(gcf_report): """ Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report: return: a list of wgs accessions listed in the gcf report file """ fp = open(gcf_report, 'r') accessions = [x.strip().split('\t')[4] for x in fp if x[0] != '#'] ...
Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report: return: a list of wgs accessions listed in the gcf report file
Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report. a list of wgs accessions listed in the gcf report file
[ "Parses", "a", "GCF", "report", "file", "from", "NCBI", "and", "returns", "all", "the", "NCBI", "accessions", "gcf_report", ".", "a", "list", "of", "wgs", "accessions", "listed", "in", "the", "gcf", "report", "file" ]
def gcf_report_parser(gcf_report): fp = open(gcf_report, 'r') accessions = [x.strip().split('\t')[4] for x in fp if x[0] != '#'] return accessions
[ "def", "gcf_report_parser", "(", "gcf_report", ")", ":", "fp", "=", "open", "(", "gcf_report", ",", "'r'", ")", "accessions", "=", "[", "x", ".", "strip", "(", ")", ".", "split", "(", "'\\t'", ")", "[", "4", "]", "for", "x", "in", "fp", "if", "x"...
Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report:
[ "Parses", "a", "GCF", "report", "file", "from", "NCBI", "and", "returns", "all", "the", "NCBI", "accessions", "gcf_report", ":" ]
[ "\"\"\"\n Parses a GCF report file from NCBI and returns all the NCBI accessions\n\n gcf_report:\n\n return: a list of wgs accessions listed in the gcf report file\n \"\"\"" ]
[ { "param": "gcf_report", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gcf_report", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
419a83050c522e75a2e51b6eced5d9191af90297
Rfam/rfam-production
scripts/export/genomes/ncbi_genome_downloader.py
[ "Apache-2.0" ]
Python
load_accession_list
<not_specific>
def load_accession_list(accession_list): """ Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report: return: a list of wgs accessions listed in the gcf report file """ fp = open(accession_list, 'r') accessions = [x.strip() for x in fp] return accessions
Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report: return: a list of wgs accessions listed in the gcf report file
Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report. a list of wgs accessions listed in the gcf report file
[ "Parses", "a", "GCF", "report", "file", "from", "NCBI", "and", "returns", "all", "the", "NCBI", "accessions", "gcf_report", ".", "a", "list", "of", "wgs", "accessions", "listed", "in", "the", "gcf", "report", "file" ]
def load_accession_list(accession_list): fp = open(accession_list, 'r') accessions = [x.strip() for x in fp] return accessions
[ "def", "load_accession_list", "(", "accession_list", ")", ":", "fp", "=", "open", "(", "accession_list", ",", "'r'", ")", "accessions", "=", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "fp", "]", "return", "accessions" ]
Parses a GCF report file from NCBI and returns all the NCBI accessions gcf_report:
[ "Parses", "a", "GCF", "report", "file", "from", "NCBI", "and", "returns", "all", "the", "NCBI", "accessions", "gcf_report", ":" ]
[ "\"\"\"\n Parses a GCF report file from NCBI and returns all the NCBI accessions\n\n gcf_report:\n\n return: a list of wgs accessions listed in the gcf report file\n \"\"\"" ]
[ { "param": "accession_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "accession_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b775c331a7afca40f8f9830d36f643ed8640fed
Rfam/rfam-production
scripts/support/rnac2rfamseq.py
[ "Apache-2.0" ]
Python
parse_arguments
<not_specific>
def parse_arguments(): """ Basic argument parsing using python's argparse return: void """ parser = argparse.ArgumentParser(description="Script to convert RNAcentral sequence metadata to Rfamseq") parser.add_argument("--rnac-csv", help="A valid csv file with RNAcentral...
Basic argument parsing using python's argparse return: void
Basic argument parsing using python's argparse return: void
[ "Basic", "argument", "parsing", "using", "python", "'", "s", "argparse", "return", ":", "void" ]
def parse_arguments(): parser = argparse.ArgumentParser(description="Script to convert RNAcentral sequence metadata to Rfamseq") parser.add_argument("--rnac-csv", help="A valid csv file with RNAcentral sequence metadata", action="store") parser.add_argument("--source", ...
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Script to convert RNAcentral sequence metadata to Rfamseq\"", ")", "parser", ".", "add_argument", "(", "\"--rnac-csv\"", ",", "help", "=", "\"A valid c...
Basic argument parsing using python's argparse return: void
[ "Basic", "argument", "parsing", "using", "python", "'", "s", "argparse", "return", ":", "void" ]
[ "\"\"\"\n Basic argument parsing using python's argparse\n\n return: void\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
304d0081eea06482af8dee28bb79f795ae19acb1
Rfam/rfam-production
scripts/export/rfam_svn_file_export.py
[ "Apache-2.0" ]
Python
export_rfam_family_files
null
def export_rfam_family_files(f_types, out_dir): """ Fetches all Rfam family accessions from rfam_live, checks out each family and copies the files in f_types in their corresponding directories f_types: A list of file type keywords we need to export (e.g. ["SEED", "CM"]) out_dir: Th...
Fetches all Rfam family accessions from rfam_live, checks out each family and copies the files in f_types in their corresponding directories f_types: A list of file type keywords we need to export (e.g. ["SEED", "CM"]) out_dir: The path to the output directory. If it does not exist it...
Fetches all Rfam family accessions from rfam_live, checks out each family and copies the files in f_types in their corresponding directories A list of file type keywords we need to export out_dir: The path to the output directory. If it does not exist it will be created
[ "Fetches", "all", "Rfam", "family", "accessions", "from", "rfam_live", "checks", "out", "each", "family", "and", "copies", "the", "files", "in", "f_types", "in", "their", "corresponding", "directories", "A", "list", "of", "file", "type", "keywords", "we", "nee...
def export_rfam_family_files(f_types, out_dir): if (not os.path.exists(out_dir)): os.mkdir(out_dir) if (string.find(os.getcwd(), out_dir) == -1): os.chdir(out_dir) file_path = '' for f_type in f_types: file_path = os.path.join(out_dir, f_type) if (not os.path.exists(file_...
[ "def", "export_rfam_family_files", "(", "f_types", ",", "out_dir", ")", ":", "if", "(", "not", "os", ".", "path", ".", "exists", "(", "out_dir", ")", ")", ":", "os", ".", "mkdir", "(", "out_dir", ")", "if", "(", "string", ".", "find", "(", "os", "....
Fetches all Rfam family accessions from rfam_live, checks out each family and copies the files in f_types in their corresponding directories
[ "Fetches", "all", "Rfam", "family", "accessions", "from", "rfam_live", "checks", "out", "each", "family", "and", "copies", "the", "files", "in", "f_types", "in", "their", "corresponding", "directories" ]
[ "\"\"\"\n Fetches all Rfam family accessions from rfam_live, checks out each\n family and copies the files in f_types in their corresponding\n directories\n\n f_types: A list of file type keywords we need to\n export (e.g. [\"SEED\", \"CM\"])\n out_dir: The path to the output directory. I...
[ { "param": "f_types", "type": null }, { "param": "out_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f_types", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "out_dir", "type": null, "docstring": null, "docstring_toke...
304d0081eea06482af8dee28bb79f795ae19acb1
Rfam/rfam-production
scripts/export/rfam_svn_file_export.py
[ "Apache-2.0" ]
Python
usage
null
def usage(): """ Displays information on how to run rfam_svn_file_export """ print "\nUsage:\n------" print "\npython rfam_svn_file_export.py out_dir" print "\nout_dir: Path to an output directory" print "\n-h option for usage\n"
Displays information on how to run rfam_svn_file_export
Displays information on how to run rfam_svn_file_export
[ "Displays", "information", "on", "how", "to", "run", "rfam_svn_file_export" ]
def usage(): print "\nUsage:\n------" print "\npython rfam_svn_file_export.py out_dir" print "\nout_dir: Path to an output directory" print "\n-h option for usage\n"
[ "def", "usage", "(", ")", ":", "print", "\"\\nUsage:\\n------\"", "print", "\"\\npython rfam_svn_file_export.py out_dir\"", "print", "\"\\nout_dir: Path to an output directory\"", "print", "\"\\n-h option for usage\\n\"" ]
Displays information on how to run rfam_svn_file_export
[ "Displays", "information", "on", "how", "to", "run", "rfam_svn_file_export" ]
[ "\"\"\"\n Displays information on how to run rfam_svn_file_export\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9a7ee469bb363a323e358f5161f9acab025f7b42
Rfam/rfam-production
scripts/release/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 current 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 current 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 current 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", "current", "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 current 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": [] }
8f822a80d47a50a9576d445a86bee522e56d3c8c
Rfam/rfam-production
scripts/support/mirnas/find_family_overlaps.py
[ "Apache-2.0" ]
Python
extract_tax_ids_from_species_file
<not_specific>
def extract_tax_ids_from_species_file(species_file): """ Parses family's species file and extracts all distinct tax ids :param species_file: The path to a family's species file :return: A dictionary of """ tax_ids = {} seen_ga = False fp = open(species_file, 'r') for line in fp:...
Parses family's species file and extracts all distinct tax ids :param species_file: The path to a family's species file :return: A dictionary of
Parses family's species file and extracts all distinct tax ids
[ "Parses", "family", "'", "s", "species", "file", "and", "extracts", "all", "distinct", "tax", "ids" ]
def extract_tax_ids_from_species_file(species_file): tax_ids = {} seen_ga = False fp = open(species_file, 'r') for line in fp: if line[0] != '#' and not seen_ga: line = line.strip().split() if line[3] not in tax_ids: if line[5] != '-': ...
[ "def", "extract_tax_ids_from_species_file", "(", "species_file", ")", ":", "tax_ids", "=", "{", "}", "seen_ga", "=", "False", "fp", "=", "open", "(", "species_file", ",", "'r'", ")", "for", "line", "in", "fp", ":", "if", "line", "[", "0", "]", "!=", "'...
Parses family's species file and extracts all distinct tax ids
[ "Parses", "family", "'", "s", "species", "file", "and", "extracts", "all", "distinct", "tax", "ids" ]
[ "\"\"\"\n Parses family's species file and extracts all distinct tax ids\n\n :param species_file: The path to a family's species file\n\n :return: A dictionary of\n \"\"\"", "# if not a comment line" ]
[ { "param": "species_file", "type": null } ]
{ "returns": [ { "docstring": "A dictionary of", "docstring_tokens": [ "A", "dictionary", "of" ], "type": null } ], "raises": [], "params": [ { "identifier": "species_file", "type": null, "docstring": "The path to a family's species f...
8f822a80d47a50a9576d445a86bee522e56d3c8c
Rfam/rfam-production
scripts/support/mirnas/find_family_overlaps.py
[ "Apache-2.0" ]
Python
count_total_num_hits
<not_specific>
def count_total_num_hits(outlist_hits): """ Counts total number of family hits :param outlist_hits: A dictionary in the form of {rfamseq_acc: [(s1,e1),...] :return: Total number of hits found in the dictionary """ total_num_hits = 0 for accession in outlist_hits.keys(): total_num...
Counts total number of family hits :param outlist_hits: A dictionary in the form of {rfamseq_acc: [(s1,e1),...] :return: Total number of hits found in the dictionary
Counts total number of family hits
[ "Counts", "total", "number", "of", "family", "hits" ]
def count_total_num_hits(outlist_hits): total_num_hits = 0 for accession in outlist_hits.keys(): total_num_hits += len(outlist_hits[accession]) return total_num_hits
[ "def", "count_total_num_hits", "(", "outlist_hits", ")", ":", "total_num_hits", "=", "0", "for", "accession", "in", "outlist_hits", ".", "keys", "(", ")", ":", "total_num_hits", "+=", "len", "(", "outlist_hits", "[", "accession", "]", ")", "return", "total_num...
Counts total number of family hits
[ "Counts", "total", "number", "of", "family", "hits" ]
[ "\"\"\"\n Counts total number of family hits\n\n :param outlist_hits: A dictionary in the form of {rfamseq_acc: [(s1,e1),...]\n\n :return: Total number of hits found in the dictionary\n \"\"\"" ]
[ { "param": "outlist_hits", "type": null } ]
{ "returns": [ { "docstring": "Total number of hits found in the dictionary", "docstring_tokens": [ "Total", "number", "of", "hits", "found", "in", "the", "dictionary" ], "type": null } ], "raises": [], "params": [ ...
a89b735f05c5ab647f18d3ecc85c1fd7c879f5be
Rfam/rfam-production
scripts/support/genome_restore_launcher.py
[ "Apache-2.0" ]
Python
bsub_redownload_genome_from_gca_report
null
def bsub_redownload_genome_from_gca_report(updir, gca_report_file): """ Launch the genome downloads on LSF :return: """ cmd = "bsub -M 6000 -R \"rusage[mem=6000]\" -o %s -e %s python %s %s %s" bsub_cmd = cmd % (os.path.join(updir, 'restore.out'), os.path.join(updir, 'res...
Launch the genome downloads on LSF :return:
Launch the genome downloads on LSF
[ "Launch", "the", "genome", "downloads", "on", "LSF" ]
def bsub_redownload_genome_from_gca_report(updir, gca_report_file): cmd = "bsub -M 6000 -R \"rusage[mem=6000]\" -o %s -e %s python %s %s %s" bsub_cmd = cmd % (os.path.join(updir, 'restore.out'), os.path.join(updir, 'restore.err'), os.path.join(os.getcwd(), "restore_ge...
[ "def", "bsub_redownload_genome_from_gca_report", "(", "updir", ",", "gca_report_file", ")", ":", "cmd", "=", "\"bsub -M 6000 -R \\\"rusage[mem=6000]\\\" -o %s -e %s python %s %s %s\"", "bsub_cmd", "=", "cmd", "%", "(", "os", ".", "path", ".", "join", "(", "updir", ",", ...
Launch the genome downloads on LSF
[ "Launch", "the", "genome", "downloads", "on", "LSF" ]
[ "\"\"\"\n Launch the genome downloads on LSF\n\n :return:\n \"\"\"", "#print bsub_cmd" ]
[ { "param": "updir", "type": null }, { "param": "gca_report_file", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "updir", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
751bd93d19401a7e9df717f717570e90597fd7fe
Rfam/rfam-production
scripts/support/merge_fasta.py
[ "Apache-2.0" ]
Python
merge_genome_files
null
def merge_genome_files(upid_dir): """ Merge all sequence files of a genome in a single file upid_dir: The path to a genome directory :return: """ sequence_dir_loc = os.path.join(upid_dir, "sequences") seq_dir_contents = os.listdir(sequence_dir_loc) upid = os.path.split(upid_dir)[1] ...
Merge all sequence files of a genome in a single file upid_dir: The path to a genome directory :return:
Merge all sequence files of a genome in a single file upid_dir: The path to a genome directory
[ "Merge", "all", "sequence", "files", "of", "a", "genome", "in", "a", "single", "file", "upid_dir", ":", "The", "path", "to", "a", "genome", "directory" ]
def merge_genome_files(upid_dir): sequence_dir_loc = os.path.join(upid_dir, "sequences") seq_dir_contents = os.listdir(sequence_dir_loc) upid = os.path.split(upid_dir)[1] genome_fasta = open(os.path.join(upid_dir, upid + '.fa'), 'w') if os.path.isfile(os.path.join(sequence_dir_loc, seq_dir_contents[...
[ "def", "merge_genome_files", "(", "upid_dir", ")", ":", "sequence_dir_loc", "=", "os", ".", "path", ".", "join", "(", "upid_dir", ",", "\"sequences\"", ")", "seq_dir_contents", "=", "os", ".", "listdir", "(", "sequence_dir_loc", ")", "upid", "=", "os", ".", ...
Merge all sequence files of a genome in a single file upid_dir: The path to a genome directory
[ "Merge", "all", "sequence", "files", "of", "a", "genome", "in", "a", "single", "file", "upid_dir", ":", "The", "path", "to", "a", "genome", "directory" ]
[ "\"\"\"\n Merge all sequence files of a genome in a single file\n\n upid_dir: The path to a genome directory\n\n :return:\n \"\"\"", "# open a new sequence file for the genome", "# check if it's divided in subdirs", "# decompress file", "# work with multiple subdirectories", "# decompress file...
[ { "param": "upid_dir", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "upid_dir", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": nul...
623b67835bef73fc620a53961b7a4dd1540bf0a0
Rfam/rfam-production
scripts/validation/validate_miRNA_seqs.py
[ "Apache-2.0" ]
Python
seed_to_dict
<not_specific>
def seed_to_dict(seed): """ Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. seed: A reformatted seed in Pfam format dest_dir: The path to the destination directory. No...
Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. seed: A reformatted seed in Pfam format dest_dir: The path to the destination directory. None by default return: The ...
Relabels the accessions of a SEED alignment using RNAcentral identifiers. This is done by matching the seed sequences, with sequences existing in RNAcentral using md5 hashing. A reformatted seed in Pfam format dest_dir: The path to the destination directory. None by default The path to the relabelled SEED alignement
[ "Relabels", "the", "accessions", "of", "a", "SEED", "alignment", "using", "RNAcentral", "identifiers", ".", "This", "is", "done", "by", "matching", "the", "seed", "sequences", "with", "sequences", "existing", "in", "RNAcentral", "using", "md5", "hashing", ".", ...
def seed_to_dict(seed): rnac_miRNA_mappings = {} miRNA_mappings = {} filename = os.path.split(seed)[1].partition('.')[0] seed_fp = open(seed, 'r') for line in seed_fp: if line[0] != '#' and len(line) > 1 and line[0:2] != '//': line_elements = [x for x in line.strip().split(' ') i...
[ "def", "seed_to_dict", "(", "seed", ")", ":", "rnac_miRNA_mappings", "=", "{", "}", "miRNA_mappings", "=", "{", "}", "filename", "=", "os", ".", "path", ".", "split", "(", "seed", ")", "[", "1", "]", ".", "partition", "(", "'.'", ")", "[", "0", "]"...
Relabels the accessions of a SEED alignment using RNAcentral identifiers.
[ "Relabels", "the", "accessions", "of", "a", "SEED", "alignment", "using", "RNAcentral", "identifiers", "." ]
[ "\"\"\"\n Relabels the accessions of a SEED alignment using RNAcentral\n identifiers. This is done by matching the seed sequences, with\n sequences existing in RNAcentral using md5 hashing.\n\n seed: A reformatted seed in Pfam format\n dest_dir: The path to the destination directory. None by default\...
[ { "param": "seed", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9ad1440865c552d231401d94409993b649602888
Rfam/rfam-production
scripts/view/job_dequeuer.py
[ "Apache-2.0" ]
Python
job_dequeue_from_file
null
def job_dequeue_from_file(fam_pend_jobs, out_dir): """ Calls family_view_process based on a list of family job_uuid pairs as listed in fam_jobs file fam_pend_jobs: A list of all pending rfam jobs obtained from _post_process table export (rfam_acc\tuuid) out_dir: Path to output di...
Calls family_view_process based on a list of family job_uuid pairs as listed in fam_jobs file fam_pend_jobs: A list of all pending rfam jobs obtained from _post_process table export (rfam_acc\tuuid) out_dir: Path to output directory where .err and .out will be generated ...
Calls family_view_process based on a list of family job_uuid pairs as listed in fam_jobs file A list of all pending rfam jobs obtained from _post_process table export (rfam_acc\tuuid) out_dir: Path to output directory where .err and .out will be generated upon lsf job completion (to be used for debugging purposes)
[ "Calls", "family_view_process", "based", "on", "a", "list", "of", "family", "job_uuid", "pairs", "as", "listed", "in", "fam_jobs", "file", "A", "list", "of", "all", "pending", "rfam", "jobs", "obtained", "from", "_post_process", "table", "export", "(", "rfam_a...
def job_dequeue_from_file(fam_pend_jobs, out_dir): fp_out = open(os.path.join(out_dir, "famview_job_ids.txt"), 'w') jobs_fp = open(fam_pend_jobs, 'r') os.mkdir(os.path.join(out_dir, "scripts")) for job in jobs_fp: job = job.strip().split('\t') print "job: ", job filepath = lsf_sc...
[ "def", "job_dequeue_from_file", "(", "fam_pend_jobs", ",", "out_dir", ")", ":", "fp_out", "=", "open", "(", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"famview_job_ids.txt\"", ")", ",", "'w'", ")", "jobs_fp", "=", "open", "(", "fam_pend_jobs", ...
Calls family_view_process based on a list of family job_uuid pairs as listed in fam_jobs file
[ "Calls", "family_view_process", "based", "on", "a", "list", "of", "family", "job_uuid", "pairs", "as", "listed", "in", "fam_jobs", "file" ]
[ "\"\"\"\n Calls family_view_process based on a list of family job_uuid pairs as\n listed in fam_jobs file\n\n fam_pend_jobs: A list of all pending rfam jobs obtained from\n _post_process table export (rfam_acc\\tuuid)\n out_dir: Path to output directory where .err and .out will be gene...
[ { "param": "fam_pend_jobs", "type": null }, { "param": "out_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fam_pend_jobs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "out_dir", "type": null, "docstring": null, "docstrin...
9ad1440865c552d231401d94409993b649602888
Rfam/rfam-production
scripts/view/job_dequeuer.py
[ "Apache-2.0" ]
Python
lsf_script_generator
<not_specific>
def lsf_script_generator(rfam_acc, uuid, out_dir): """ Generates a shell script per family to ease re-running family view process upon failure rfam_acc: Family specific accession uuid: Family associated uuid out_dir: Path to output directory where scripts will be generated """ mem = No...
Generates a shell script per family to ease re-running family view process upon failure rfam_acc: Family specific accession uuid: Family associated uuid out_dir: Path to output directory where scripts will be generated
Generates a shell script per family to ease re-running family view process upon failure Family specific accession uuid: Family associated uuid out_dir: Path to output directory where scripts will be generated
[ "Generates", "a", "shell", "script", "per", "family", "to", "ease", "re", "-", "running", "family", "view", "process", "upon", "failure", "Family", "specific", "accession", "uuid", ":", "Family", "associated", "uuid", "out_dir", ":", "Path", "to", "output", ...
def lsf_script_generator(rfam_acc, uuid, out_dir): mem = None if (rfam_acc in DEM_FAMS): mem = MEM_D else: mem = MEM_R filepath = os.path.join(os.path.join(out_dir, "scripts"), rfam_acc + ".sh") fp = open(filepath, 'w') filename = rfam_acc fv_cmd = "%s -id %s -f %s family" % ...
[ "def", "lsf_script_generator", "(", "rfam_acc", ",", "uuid", ",", "out_dir", ")", ":", "mem", "=", "None", "if", "(", "rfam_acc", "in", "DEM_FAMS", ")", ":", "mem", "=", "MEM_D", "else", ":", "mem", "=", "MEM_R", "filepath", "=", "os", ".", "path", "...
Generates a shell script per family to ease re-running family view process upon failure
[ "Generates", "a", "shell", "script", "per", "family", "to", "ease", "re", "-", "running", "family", "view", "process", "upon", "failure" ]
[ "\"\"\"\n Generates a shell script per family to ease re-running family view\n process upon failure\n\n rfam_acc: Family specific accession\n uuid: Family associated uuid\n out_dir: Path to output directory where scripts will be generated\n \"\"\"", "# get where shell script will be generated", ...
[ { "param": "rfam_acc", "type": null }, { "param": "uuid", "type": null }, { "param": "out_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rfam_acc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uuid", "type": null, "docstring": null, "docstring_tokens...
9ad1440865c552d231401d94409993b649602888
Rfam/rfam-production
scripts/view/job_dequeuer.py
[ "Apache-2.0" ]
Python
parse_arguments
<not_specific>
def parse_arguments(): """ Basic argument parsing return: Python's argparse parser object """ parser = argparse.ArgumentParser(description="View process dequeuer") parser.add_argument("--view-list", help="A list of rfam_acc\tuuids to run View plugins on", type=str) parser.add_argument("--...
Basic argument parsing return: Python's argparse parser object
Basic argument parsing return: Python's argparse parser object
[ "Basic", "argument", "parsing", "return", ":", "Python", "'", "s", "argparse", "parser", "object" ]
def parse_arguments(): parser = argparse.ArgumentParser(description="View process dequeuer") parser.add_argument("--view-list", help="A list of rfam_acc\tuuids to run View plugins on", type=str) parser.add_argument("--dest-dir", help="An existing destination directory to store logs", type=str) return pa...
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"View process dequeuer\"", ")", "parser", ".", "add_argument", "(", "\"--view-list\"", ",", "help", "=", "\"A list of rfam_acc\\tuuids to run View plugi...
Basic argument parsing return: Python's argparse parser object
[ "Basic", "argument", "parsing", "return", ":", "Python", "'", "s", "argparse", "parser", "object" ]
[ "\"\"\"\n Basic argument parsing\n\n return: Python's argparse parser object\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
8371e4ff61a6c4fdb63bb3c7744f80d9a9f255d9
Rfam/rfam-production
scripts/support/genome_size_calculator.py
[ "Apache-2.0" ]
Python
calculate_genome_size
<not_specific>
def calculate_genome_size(genome_source): """ Calculate the size of a given sequence file (this should be a genome) and return the total number of nucleotides in the file, or if genome_fasta is a directory, return a dictionary of genome_ids: size pairs genome_source: A valid sequence file in fasta ...
Calculate the size of a given sequence file (this should be a genome) and return the total number of nucleotides in the file, or if genome_fasta is a directory, return a dictionary of genome_ids: size pairs genome_source: A valid sequence file in fasta format or a directory of fasta files return:...
Calculate the size of a given sequence file (this should be a genome) and return the total number of nucleotides in the file, or if genome_fasta is a directory, return a dictionary of genome_ids: size pairs A valid sequence file in fasta format or a directory of fasta files A dictionary or the an integer number which...
[ "Calculate", "the", "size", "of", "a", "given", "sequence", "file", "(", "this", "should", "be", "a", "genome", ")", "and", "return", "the", "total", "number", "of", "nucleotides", "in", "the", "file", "or", "if", "genome_fasta", "is", "a", "directory", ...
def calculate_genome_size(genome_source): genome_files = [] genome_sizes = {} if os.path.isdir(genome_source): genome_files = [x for x in os.listdir(genome_source) if x.endswith('.fa') or x.endswith('.fasta')] for seq_file in genome_files: try: ...
[ "def", "calculate_genome_size", "(", "genome_source", ")", ":", "genome_files", "=", "[", "]", "genome_sizes", "=", "{", "}", "if", "os", ".", "path", ".", "isdir", "(", "genome_source", ")", ":", "genome_files", "=", "[", "x", "for", "x", "in", "os", ...
Calculate the size of a given sequence file (this should be a genome) and return the total number of nucleotides in the file, or if genome_fasta is a directory, return a dictionary of genome_ids: size pairs
[ "Calculate", "the", "size", "of", "a", "given", "sequence", "file", "(", "this", "should", "be", "a", "genome", ")", "and", "return", "the", "total", "number", "of", "nucleotides", "in", "the", "file", "or", "if", "genome_fasta", "is", "a", "directory", ...
[ "\"\"\"\n Calculate the size of a given sequence file (this should be a genome) and return the total\n number of nucleotides in the file, or if genome_fasta is a directory, return a dictionary\n of genome_ids: size pairs\n\n genome_source: A valid sequence file in fasta format or a directory of fasta fi...
[ { "param": "genome_source", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "genome_source", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2a087e92601fbf634f7432b8f0081bc5bde2af5d
Rfam/rfam-production
scripts/export/generate_ftp_files.py
[ "Apache-2.0" ]
Python
create_seed_archive
null
def create_seed_archive(destination): """ Create a combined Rfam.seed file and compress it. """ cwd = os.getcwd() os.chdir(destination) cmd = "rm -f Rfam.seed && cat *.seed > Rfam.seed && gzip -c Rfam.seed > Rfam.seed.gz" status = os.system(cmd.format(destination)) if status: rai...
Create a combined Rfam.seed file and compress it.
Create a combined Rfam.seed file and compress it.
[ "Create", "a", "combined", "Rfam", ".", "seed", "file", "and", "compress", "it", "." ]
def create_seed_archive(destination): cwd = os.getcwd() os.chdir(destination) cmd = "rm -f Rfam.seed && cat *.seed > Rfam.seed && gzip -c Rfam.seed > Rfam.seed.gz" status = os.system(cmd.format(destination)) if status: raise Exception('There was a problem generating Rfam.seed.gz in {}'.forma...
[ "def", "create_seed_archive", "(", "destination", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "destination", ")", "cmd", "=", "\"rm -f Rfam.seed && cat *.seed > Rfam.seed && gzip -c Rfam.seed > Rfam.seed.gz\"", "status", "=", "os", ...
Create a combined Rfam.seed file and compress it.
[ "Create", "a", "combined", "Rfam", ".", "seed", "file", "and", "compress", "it", "." ]
[ "\"\"\"\n Create a combined Rfam.seed file and compress it.\n \"\"\"" ]
[ { "param": "destination", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "destination", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2a087e92601fbf634f7432b8f0081bc5bde2af5d
Rfam/rfam-production
scripts/export/generate_ftp_files.py
[ "Apache-2.0" ]
Python
create_combined_cm_file
null
def create_combined_cm_file(destination): """ Create a combined Rfam.cm file. """ cwd = os.getcwd() os.chdir(destination) cmd = "rm -f Rfam.cm && cat *.CM > Rfam.cm" status = os.system(cmd.format(destination)) if status: raise Exception('There was a problem generating Rfam.cm in ...
Create a combined Rfam.cm file.
Create a combined Rfam.cm file.
[ "Create", "a", "combined", "Rfam", ".", "cm", "file", "." ]
def create_combined_cm_file(destination): cwd = os.getcwd() os.chdir(destination) cmd = "rm -f Rfam.cm && cat *.CM > Rfam.cm" status = os.system(cmd.format(destination)) if status: raise Exception('There was a problem generating Rfam.cm in {}'.format(destination)) os.chdir(cwd)
[ "def", "create_combined_cm_file", "(", "destination", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "destination", ")", "cmd", "=", "\"rm -f Rfam.cm && cat *.CM > Rfam.cm\"", "status", "=", "os", ".", "system", "(", "cmd", "."...
Create a combined Rfam.cm file.
[ "Create", "a", "combined", "Rfam", ".", "cm", "file", "." ]
[ "\"\"\"\n Create a combined Rfam.cm file.\n \"\"\"" ]
[ { "param": "destination", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "destination", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2a087e92601fbf634f7432b8f0081bc5bde2af5d
Rfam/rfam-production
scripts/export/generate_ftp_files.py
[ "Apache-2.0" ]
Python
create_tree_archive
null
def create_tree_archive(destination): """ Create a combined Rfam.seed_tree file. """ cwd = os.getcwd() os.chdir(destination) cmd = "rm -f Rfam.seed_tree && cat *.taxtree > Rfam.seed_tree && gzip -c Rfam.seed_tree > Rfam.seed_tree.gz" status = os.system(cmd.format(destination)) if status:...
Create a combined Rfam.seed_tree file.
Create a combined Rfam.seed_tree file.
[ "Create", "a", "combined", "Rfam", ".", "seed_tree", "file", "." ]
def create_tree_archive(destination): cwd = os.getcwd() os.chdir(destination) cmd = "rm -f Rfam.seed_tree && cat *.taxtree > Rfam.seed_tree && gzip -c Rfam.seed_tree > Rfam.seed_tree.gz" status = os.system(cmd.format(destination)) if status: raise Exception('There was a problem generating Rf...
[ "def", "create_tree_archive", "(", "destination", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "destination", ")", "cmd", "=", "\"rm -f Rfam.seed_tree && cat *.taxtree > Rfam.seed_tree && gzip -c Rfam.seed_tree > Rfam.seed_tree.gz\"", "sta...
Create a combined Rfam.seed_tree file.
[ "Create", "a", "combined", "Rfam", ".", "seed_tree", "file", "." ]
[ "\"\"\"\n Create a combined Rfam.seed_tree file.\n \"\"\"" ]
[ { "param": "destination", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "destination", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2a087e92601fbf634f7432b8f0081bc5bde2af5d
Rfam/rfam-production
scripts/export/generate_ftp_files.py
[ "Apache-2.0" ]
Python
validate_seed_archive
null
def validate_seed_archive(destination, rfam_accs): """ Check that Rfam.seed contains the correct number of entries. """ cwd = os.getcwd() os.chdir(destination) family_count = 0 with open(os.path.join(destination, 'Rfam.seed')) as f_seed: for line in f_seed: if line.starts...
Check that Rfam.seed contains the correct number of entries.
Check that Rfam.seed contains the correct number of entries.
[ "Check", "that", "Rfam", ".", "seed", "contains", "the", "correct", "number", "of", "entries", "." ]
def validate_seed_archive(destination, rfam_accs): cwd = os.getcwd() os.chdir(destination) family_count = 0 with open(os.path.join(destination, 'Rfam.seed')) as f_seed: for line in f_seed: if line.startswith('# STOCKHOLM 1.0'): family_count += 1 os.chdir(cwd) ...
[ "def", "validate_seed_archive", "(", "destination", ",", "rfam_accs", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "destination", ")", "family_count", "=", "0", "with", "open", "(", "os", ".", "path", ".", "join", "(", ...
Check that Rfam.seed contains the correct number of entries.
[ "Check", "that", "Rfam", ".", "seed", "contains", "the", "correct", "number", "of", "entries", "." ]
[ "\"\"\"\n Check that Rfam.seed contains the correct number of entries.\n \"\"\"" ]
[ { "param": "destination", "type": null }, { "param": "rfam_accs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "destination", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rfam_accs", "type": null, "docstring": null, "docstrin...
bd8cfba0084258c6c7168b998885c9007bf1a86b
Rfam/rfam-production
scripts/release/clan_file_generator.py
[ "Apache-2.0" ]
Python
parse_clan_file
<not_specific>
def parse_clan_file(clan_list): """ Parses a list of Rfam clan accessions clan_list: A plain .txt file containing a list of Rfam Clan Accessions return: A list of clan accessions """ fp = open(clan_list, 'r') clan_accessions = [x.strip() for x in fp] fp.close() return clan_acce...
Parses a list of Rfam clan accessions clan_list: A plain .txt file containing a list of Rfam Clan Accessions return: A list of clan accessions
Parses a list of Rfam clan accessions clan_list: A plain .txt file containing a list of Rfam Clan Accessions A list of clan accessions
[ "Parses", "a", "list", "of", "Rfam", "clan", "accessions", "clan_list", ":", "A", "plain", ".", "txt", "file", "containing", "a", "list", "of", "Rfam", "Clan", "Accessions", "A", "list", "of", "clan", "accessions" ]
def parse_clan_file(clan_list): fp = open(clan_list, 'r') clan_accessions = [x.strip() for x in fp] fp.close() return clan_accessions
[ "def", "parse_clan_file", "(", "clan_list", ")", ":", "fp", "=", "open", "(", "clan_list", ",", "'r'", ")", "clan_accessions", "=", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "fp", "]", "fp", ".", "close", "(", ")", "return", "clan_accession...
Parses a list of Rfam clan accessions clan_list: A plain .txt file containing a list of Rfam Clan Accessions
[ "Parses", "a", "list", "of", "Rfam", "clan", "accessions", "clan_list", ":", "A", "plain", ".", "txt", "file", "containing", "a", "list", "of", "Rfam", "Clan", "Accessions" ]
[ "\"\"\"\n Parses a list of Rfam clan accessions\n\n clan_list: A plain .txt file containing a list of Rfam Clan Accessions\n\n return: A list of clan accessions\n \"\"\"" ]
[ { "param": "clan_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "clan_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bd8cfba0084258c6c7168b998885c9007bf1a86b
Rfam/rfam-production
scripts/release/clan_file_generator.py
[ "Apache-2.0" ]
Python
clan_file_generator
null
def clan_file_generator(output_dir, clan_comp_type='FULL', clan_acc=None): """ Generates clan files for clan competition output_dir: The path to the output directory. It will be created if it does not exist clan_comp_type: This can be 'FULL' for clan competition on on full_region_table or PDB f...
Generates clan files for clan competition output_dir: The path to the output directory. It will be created if it does not exist clan_comp_type: This can be 'FULL' for clan competition on on full_region_table or PDB for clan competition on pdb_full_region returns: void
Generates clan files for clan competition output_dir: The path to the output directory. It will be created if it does not exist clan_comp_type: This can be 'FULL' for clan competition on on full_region_table or PDB for clan competition on pdb_full_region void
[ "Generates", "clan", "files", "for", "clan", "competition", "output_dir", ":", "The", "path", "to", "the", "output", "directory", ".", "It", "will", "be", "created", "if", "it", "does", "not", "exist", "clan_comp_type", ":", "This", "can", "be", "'", "FULL...
def clan_file_generator(output_dir, clan_comp_type='FULL', clan_acc=None): if os.path.exists(output_dir) is False: os.mkdir(output_dir) clans = [] if clan_acc is None: clans = rfamdb.fetch_clan_accessions() elif os.path.isfile(clan_acc): clans = parse_clan_file(clan_acc) elif...
[ "def", "clan_file_generator", "(", "output_dir", ",", "clan_comp_type", "=", "'FULL'", ",", "clan_acc", "=", "None", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "output_dir", ")", "is", "False", ":", "os", ".", "mkdir", "(", "output_dir", ")",...
Generates clan files for clan competition output_dir: The path to the output directory.
[ "Generates", "clan", "files", "for", "clan", "competition", "output_dir", ":", "The", "path", "to", "the", "output", "directory", "." ]
[ "\"\"\"\n Generates clan files for clan competition\n\n output_dir: The path to the output directory. It will be created if\n it does not exist\n clan_comp_type: This can be 'FULL' for clan competition on on full_region_table\n or PDB for clan competition on pdb_full_region\n\n returns: void\n ...
[ { "param": "output_dir", "type": null }, { "param": "clan_comp_type", "type": null }, { "param": "clan_acc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "output_dir", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "clan_comp_type", "type": null, "docstring": null, "docs...
bd8cfba0084258c6c7168b998885c9007bf1a86b
Rfam/rfam-production
scripts/release/clan_file_generator.py
[ "Apache-2.0" ]
Python
parse_arguments
<not_specific>
def parse_arguments(): """ Performs some basic argument parsing return: parser object """ parser = argparse.ArgumentParser(description='Generates required clan competition input files') mutualy_exclusive = parser.add_mutually_exclusive_group() parser.add_argument("--dest-dir", help="Desti...
Performs some basic argument parsing return: parser object
Performs some basic argument parsing return: parser object
[ "Performs", "some", "basic", "argument", "parsing", "return", ":", "parser", "object" ]
def parse_arguments(): parser = argparse.ArgumentParser(description='Generates required clan competition input files') mutualy_exclusive = parser.add_mutually_exclusive_group() parser.add_argument("--dest-dir", help="Destination directory where to generate the files", type=str, actio...
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Generates required clan competition input files'", ")", "mutualy_exclusive", "=", "parser", ".", "add_mutually_exclusive_group", "(", ")", "parser", "."...
Performs some basic argument parsing return: parser object
[ "Performs", "some", "basic", "argument", "parsing", "return", ":", "parser", "object" ]
[ "\"\"\"\n Performs some basic argument parsing\n\n return: parser object\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_gca_data
<not_specific>
def fetch_gca_data(upid, assembly_acc, kingdom): """ Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens) assembly_acc: A valid ENA GCA accession kingdom: The corresponding species k...
Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens) assembly_acc: A valid ENA GCA accession kingdom: The corresponding species kingdom
Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary A valid Uniprot proteome accession assembly_acc: A valid ENA GCA accession kingdom: The corresponding species kingdom
[ "Parses", "ENA", "GCA", "accession", "xml", "and", "returns", "the", "accession", "'", "s", "data", "in", "the", "form", "of", "a", "dictionary", "A", "valid", "Uniprot", "proteome", "accession", "assembly_acc", ":", "A", "valid", "ENA", "GCA", "accession", ...
def fetch_gca_data(upid, assembly_acc, kingdom): genome_entry = {} fields = {} tmp_acc = assembly_acc response = requests.get(gc.ENA_XML_URL % tmp_acc) if response.status_code == httplib.OK: assembly_xml = response.content root = ET.fromstring(assembly_xml) assembly = root.fi...
[ "def", "fetch_gca_data", "(", "upid", ",", "assembly_acc", ",", "kingdom", ")", ":", "genome_entry", "=", "{", "}", "fields", "=", "{", "}", "tmp_acc", "=", "assembly_acc", "response", "=", "requests", ".", "get", "(", "gc", ".", "ENA_XML_URL", "%", "tmp...
Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary
[ "Parses", "ENA", "GCA", "accession", "xml", "and", "returns", "the", "accession", "'", "s", "data", "in", "the", "form", "of", "a", "dictionary" ]
[ "\"\"\"\n Parses ENA GCA accession xml, and returns the accession's data in the\n form of a dictionary\n\n upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens)\n assembly_acc: A valid ENA GCA accession\n kingdom: The corresponding species kingdom\n \"\"\"", "# check status"...
[ { "param": "upid", "type": null }, { "param": "assembly_acc", "type": null }, { "param": "kingdom", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "assembly_acc", "type": null, "docstring": null, "docstring_to...
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_assembly_accessions
<not_specific>
def fetch_assembly_accessions(upid, gca_acc, acc_ftp_link, reg_ftp_link=None): """ Parses assembly report file and exports all assembly accessions in a dict format to be easily loaded via Django ORM upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens) gca_acc: A valid ENA GCA ...
Parses assembly report file and exports all assembly accessions in a dict format to be easily loaded via Django ORM upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens) gca_acc: A valid ENA GCA accession acc_ftp_link: Assembly report file ftp url (as retrieved from GCA xml fi...
Parses assembly report file and exports all assembly accessions in a dict format to be easily loaded via Django ORM A valid Uniprot proteome accession gca_acc: A valid ENA GCA accession acc_ftp_link: Assembly report file ftp url (as retrieved from GCA xml file) reg_ftp_link: Assembly region file ftp url (as retrieved ...
[ "Parses", "assembly", "report", "file", "and", "exports", "all", "assembly", "accessions", "in", "a", "dict", "format", "to", "be", "easily", "loaded", "via", "Django", "ORM", "A", "valid", "Uniprot", "proteome", "accession", "gca_acc", ":", "A", "valid", "E...
def fetch_assembly_accessions(upid, gca_acc, acc_ftp_link, reg_ftp_link=None): assembly_accs = [] fields = {} entry = {} regions = None if reg_ftp_link is not None: regions = region_loader(reg_ftp_link) http_link = acc_ftp_link.replace("ftp://", "http://") response = requests.get(htt...
[ "def", "fetch_assembly_accessions", "(", "upid", ",", "gca_acc", ",", "acc_ftp_link", ",", "reg_ftp_link", "=", "None", ")", ":", "assembly_accs", "=", "[", "]", "fields", "=", "{", "}", "entry", "=", "{", "}", "regions", "=", "None", "if", "reg_ftp_link",...
Parses assembly report file and exports all assembly accessions in a dict format to be easily loaded via Django ORM
[ "Parses", "assembly", "report", "file", "and", "exports", "all", "assembly", "accessions", "in", "a", "dict", "format", "to", "be", "easily", "loaded", "via", "Django", "ORM" ]
[ "\"\"\"\n Parses assembly report file and exports all assembly accessions in a\n dict format to be easily loaded via Django ORM\n\n upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens)\n gca_acc: A valid ENA GCA accession\n acc_ftp_link: Assembly report file ftp url (as retrieve...
[ { "param": "upid", "type": null }, { "param": "gca_acc", "type": null }, { "param": "acc_ftp_link", "type": null }, { "param": "reg_ftp_link", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gca_acc", "type": null, "docstring": null, "docstring_tokens"...
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
region_loader
<not_specific>
def region_loader(reg_ftp_link): """ Parses an assembly's region file and builds a dictionary of accessions and start-end coordinates which are stored in a tuple format reg_ftp_link: The ftp url of the corresponding region file """ region_dict = {} http_link = reg_ftp_link.replace("ftp://...
Parses an assembly's region file and builds a dictionary of accessions and start-end coordinates which are stored in a tuple format reg_ftp_link: The ftp url of the corresponding region file
Parses an assembly's region file and builds a dictionary of accessions and start-end coordinates which are stored in a tuple format The ftp url of the corresponding region file
[ "Parses", "an", "assembly", "'", "s", "region", "file", "and", "builds", "a", "dictionary", "of", "accessions", "and", "start", "-", "end", "coordinates", "which", "are", "stored", "in", "a", "tuple", "format", "The", "ftp", "url", "of", "the", "correspond...
def region_loader(reg_ftp_link): region_dict = {} http_link = reg_ftp_link.replace("ftp://", "http://") response = requests.get(http_link).content regions = response.strip().split('\n') regions.pop(0) for region in regions: region = region.strip().split('\t') coords = region[5].s...
[ "def", "region_loader", "(", "reg_ftp_link", ")", ":", "region_dict", "=", "{", "}", "http_link", "=", "reg_ftp_link", ".", "replace", "(", "\"ftp://\"", ",", "\"http://\"", ")", "response", "=", "requests", ".", "get", "(", "http_link", ")", ".", "content",...
Parses an assembly's region file and builds a dictionary of accessions and start-end coordinates which are stored in a tuple format
[ "Parses", "an", "assembly", "'", "s", "region", "file", "and", "builds", "a", "dictionary", "of", "accessions", "and", "start", "-", "end", "coordinates", "which", "are", "stored", "in", "a", "tuple", "format" ]
[ "\"\"\"\n Parses an assembly's region file and builds a dictionary of accessions and\n start-end coordinates which are stored in a tuple format\n\n reg_ftp_link: The ftp url of the corresponding region file\n \"\"\"", "# remove header" ]
[ { "param": "reg_ftp_link", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reg_ftp_link", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_wgs_metadata
<not_specific>
def fetch_wgs_metadata(upid, assembly_acc, domain): """ Parses ENA WGS accession xml, and returns the accession's data in the form of a dictionary upid: A valid Uniprot's proteome id assembly_acc: A valid ENA's WGS accession domain: A string representing the domain a species belongs to (e.g.vir...
Parses ENA WGS accession xml, and returns the accession's data in the form of a dictionary upid: A valid Uniprot's proteome id assembly_acc: A valid ENA's WGS accession domain: A string representing the domain a species belongs to (e.g.viruses)
Parses ENA WGS accession xml, and returns the accession's data in the form of a dictionary A valid Uniprot's proteome id assembly_acc: A valid ENA's WGS accession domain: A string representing the domain a species belongs to
[ "Parses", "ENA", "WGS", "accession", "xml", "and", "returns", "the", "accession", "'", "s", "data", "in", "the", "form", "of", "a", "dictionary", "A", "valid", "Uniprot", "'", "s", "proteome", "id", "assembly_acc", ":", "A", "valid", "ENA", "'", "s", "...
def fetch_wgs_metadata(upid, assembly_acc, domain): wgs_entry = {} fields = {} response = requests.get(gc.ENA_XML_URL % assembly_acc) if response.status_code == httplib.OK: assembly_xml = ET.fromstring(response.content) entry = assembly_xml.find("entry") fields["gca_acc"] = Non...
[ "def", "fetch_wgs_metadata", "(", "upid", ",", "assembly_acc", ",", "domain", ")", ":", "wgs_entry", "=", "{", "}", "fields", "=", "{", "}", "response", "=", "requests", ".", "get", "(", "gc", ".", "ENA_XML_URL", "%", "assembly_acc", ")", "if", "response...
Parses ENA WGS accession xml, and returns the accession's data in the form of a dictionary
[ "Parses", "ENA", "WGS", "accession", "xml", "and", "returns", "the", "accession", "'", "s", "data", "in", "the", "form", "of", "a", "dictionary" ]
[ "\"\"\"\n Parses ENA WGS accession xml, and returns the accession's data in the\n form of a dictionary\n\n upid: A valid Uniprot's proteome id\n assembly_acc: A valid ENA's WGS accession\n domain: A string representing the domain a species belongs to (e.g.viruses)\n \"\"\"", "# root", "# post ...
[ { "param": "upid", "type": null }, { "param": "assembly_acc", "type": null }, { "param": "domain", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "assembly_acc", "type": null, "docstring": null, "docstring_to...
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_wgs_accs_metadata
<not_specific>
def fetch_wgs_accs_metadata(upid, assembly_acc, wgs_range): """ This function runs over the wgs range and exports all metadata for every accession in the provided wgs range wgs_range: A valid ENA-WGS set range """ wgs_entries = [] entry = {} fields = {} wgs_accs = gf.fetch_wgs_ran...
This function runs over the wgs range and exports all metadata for every accession in the provided wgs range wgs_range: A valid ENA-WGS set range
This function runs over the wgs range and exports all metadata for every accession in the provided wgs range A valid ENA-WGS set range
[ "This", "function", "runs", "over", "the", "wgs", "range", "and", "exports", "all", "metadata", "for", "every", "accession", "in", "the", "provided", "wgs", "range", "A", "valid", "ENA", "-", "WGS", "set", "range" ]
def fetch_wgs_accs_metadata(upid, assembly_acc, wgs_range): wgs_entries = [] entry = {} fields = {} wgs_accs = gf.fetch_wgs_range_accs(wgs_range) for acc in wgs_accs: fields = fetch_wgs_acc_metadata(acc) if fields.keys() == 0: continue entry["model"] = gc.GENSEQ_M...
[ "def", "fetch_wgs_accs_metadata", "(", "upid", ",", "assembly_acc", ",", "wgs_range", ")", ":", "wgs_entries", "=", "[", "]", "entry", "=", "{", "}", "fields", "=", "{", "}", "wgs_accs", "=", "gf", ".", "fetch_wgs_range_accs", "(", "wgs_range", ")", "for",...
This function runs over the wgs range and exports all metadata for every accession in the provided wgs range
[ "This", "function", "runs", "over", "the", "wgs", "range", "and", "exports", "all", "metadata", "for", "every", "accession", "in", "the", "provided", "wgs", "range" ]
[ "\"\"\"\n This function runs over the wgs range and exports all metadata for every\n accession in the provided wgs range\n\n wgs_range: A valid ENA-WGS set range\n \"\"\"", "# skip if fields dict is empty. This could be due to obsolete accessions", "# adding upid and wgs_acc in entry fields" ]
[ { "param": "upid", "type": null }, { "param": "assembly_acc", "type": null }, { "param": "wgs_range", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "assembly_acc", "type": null, "docstring": null, "docstring_to...
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_wgs_acc_metadata
<not_specific>
def fetch_wgs_acc_metadata(wgs_acc): """ Return a fields dictionary wgs_acc: A valid ENA wgs accession """ fields = {} response = requests.get(gf.ENA_XML_URL % wgs_acc) if response.status_code == httplib.OK: acc_xml = ET.fromstring(response.content) entry = acc_xml.find("e...
Return a fields dictionary wgs_acc: A valid ENA wgs accession
Return a fields dictionary wgs_acc: A valid ENA wgs accession
[ "Return", "a", "fields", "dictionary", "wgs_acc", ":", "A", "valid", "ENA", "wgs", "accession" ]
def fetch_wgs_acc_metadata(wgs_acc): fields = {} response = requests.get(gf.ENA_XML_URL % wgs_acc) if response.status_code == httplib.OK: acc_xml = ET.fromstring(response.content) entry = acc_xml.find("entry") if entry is None: return fields fields["seq_version"] ...
[ "def", "fetch_wgs_acc_metadata", "(", "wgs_acc", ")", ":", "fields", "=", "{", "}", "response", "=", "requests", ".", "get", "(", "gf", ".", "ENA_XML_URL", "%", "wgs_acc", ")", "if", "response", ".", "status_code", "==", "httplib", ".", "OK", ":", "acc_x...
Return a fields dictionary wgs_acc: A valid ENA wgs accession
[ "Return", "a", "fields", "dictionary", "wgs_acc", ":", "A", "valid", "ENA", "wgs", "accession" ]
[ "\"\"\"\n Return a fields dictionary\n\n wgs_acc: A valid ENA wgs accession\n \"\"\"", "# need to check this one", "# this takes the date of the entry is created", "# when adding a new genome" ]
[ { "param": "wgs_acc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wgs_acc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_assembly_attributes
<not_specific>
def fetch_assembly_attributes(attrs_node): """ Runs over the attributes node in the xml file and returns all attribute tag-value pairs in a dictionary format attrs_node: GCA xml's attributes node """ attribute_values = {} attributes = attrs_node.findall("ASSEMBLY_ATTRIBUTE") for attr ...
Runs over the attributes node in the xml file and returns all attribute tag-value pairs in a dictionary format attrs_node: GCA xml's attributes node
Runs over the attributes node in the xml file and returns all attribute tag-value pairs in a dictionary format GCA xml's attributes node
[ "Runs", "over", "the", "attributes", "node", "in", "the", "xml", "file", "and", "returns", "all", "attribute", "tag", "-", "value", "pairs", "in", "a", "dictionary", "format", "GCA", "xml", "'", "s", "attributes", "node" ]
def fetch_assembly_attributes(attrs_node): attribute_values = {} attributes = attrs_node.findall("ASSEMBLY_ATTRIBUTE") for attr in attributes: tag = attr.find("TAG").text value = attr.find("VALUE").text attribute_values[tag] = value return attribute_values
[ "def", "fetch_assembly_attributes", "(", "attrs_node", ")", ":", "attribute_values", "=", "{", "}", "attributes", "=", "attrs_node", ".", "findall", "(", "\"ASSEMBLY_ATTRIBUTE\"", ")", "for", "attr", "in", "attributes", ":", "tag", "=", "attr", ".", "find", "(...
Runs over the attributes node in the xml file and returns all attribute tag-value pairs in a dictionary format
[ "Runs", "over", "the", "attributes", "node", "in", "the", "xml", "file", "and", "returns", "all", "attribute", "tag", "-", "value", "pairs", "in", "a", "dictionary", "format" ]
[ "\"\"\"\n Runs over the attributes node in the xml file and returns all attribute\n tag-value pairs in a dictionary format\n\n attrs_node: GCA xml's attributes node\n \"\"\"" ]
[ { "param": "attrs_node", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "attrs_node", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_gca_acc_metadata
<not_specific>
def fetch_gca_acc_metadata(accession): """ Fetch accession metadata and return a dictionary with ncbi_id, molecule's type, description and tax id accession: A valid GCA accession from ENA """ metadata = {} response = requests.get(gc.ENA_XML_URL % accession) if response.status_code ==...
Fetch accession metadata and return a dictionary with ncbi_id, molecule's type, description and tax id accession: A valid GCA accession from ENA
Fetch accession metadata and return a dictionary with ncbi_id, molecule's type, description and tax id A valid GCA accession from ENA
[ "Fetch", "accession", "metadata", "and", "return", "a", "dictionary", "with", "ncbi_id", "molecule", "'", "s", "type", "description", "and", "tax", "id", "A", "valid", "GCA", "accession", "from", "ENA" ]
def fetch_gca_acc_metadata(accession): metadata = {} response = requests.get(gc.ENA_XML_URL % accession) if response.status_code == httplib.OK: xml_str = response.content xml_root = ET.fromstring(xml_str) entry = xml_root.find("entry") if entry is None: return met...
[ "def", "fetch_gca_acc_metadata", "(", "accession", ")", ":", "metadata", "=", "{", "}", "response", "=", "requests", ".", "get", "(", "gc", ".", "ENA_XML_URL", "%", "accession", ")", "if", "response", ".", "status_code", "==", "httplib", ".", "OK", ":", ...
Fetch accession metadata and return a dictionary with ncbi_id, molecule's type, description and tax id
[ "Fetch", "accession", "metadata", "and", "return", "a", "dictionary", "with", "ncbi_id", "molecule", "'", "s", "type", "description", "and", "tax", "id" ]
[ "\"\"\"\n Fetch accession metadata and return a dictionary with ncbi_id, molecule's\n type, description and tax id\n\n accession: A valid GCA accession from ENA\n \"\"\"", "# return an empty dictionary if the accession is unavailable", "# None if no moleculeType found", "# get molecule description...
[ { "param": "accession", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "accession", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
fetch_assembly_links
<not_specific>
def fetch_assembly_links(gca_acc): """ Retrieves and returns a dictionary with all ftp links found in the GCA xml file gca_acc: A valid GCA accession from ENA """ gca_ftp_links = {} response = requests.get(gc.ENA_XML_URL % gca_acc) if response.status_code == httplib.OK: xml_...
Retrieves and returns a dictionary with all ftp links found in the GCA xml file gca_acc: A valid GCA accession from ENA
Retrieves and returns a dictionary with all ftp links found in the GCA xml file A valid GCA accession from ENA
[ "Retrieves", "and", "returns", "a", "dictionary", "with", "all", "ftp", "links", "found", "in", "the", "GCA", "xml", "file", "A", "valid", "GCA", "accession", "from", "ENA" ]
def fetch_assembly_links(gca_acc): gca_ftp_links = {} response = requests.get(gc.ENA_XML_URL % gca_acc) if response.status_code == httplib.OK: xml_tree = ET.fromstring(response.content) assembly_node = xml_tree.find("ASSEMBLY") assembly_links = assembly_node.find( "ASSEMB...
[ "def", "fetch_assembly_links", "(", "gca_acc", ")", ":", "gca_ftp_links", "=", "{", "}", "response", "=", "requests", ".", "get", "(", "gc", ".", "ENA_XML_URL", "%", "gca_acc", ")", "if", "response", ".", "status_code", "==", "httplib", ".", "OK", ":", "...
Retrieves and returns a dictionary with all ftp links found in the GCA xml file
[ "Retrieves", "and", "returns", "a", "dictionary", "with", "all", "ftp", "links", "found", "in", "the", "GCA", "xml", "file" ]
[ "\"\"\"\n Retrieves and returns a dictionary with all ftp links found in the GCA xml\n file\n\n gca_acc: A valid GCA accession from ENA\n \"\"\"", "# fetch assembly links node", "# loop over all available links" ]
[ { "param": "gca_acc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gca_acc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
extract_uniprot_genome_metadata
<not_specific>
def extract_uniprot_genome_metadata(upid): """ Parses a proteome's xml file from Uniprot and converts it to a json like object which is returned upid: A valid Uniprot Proteome identifier returns: A dictionary """ proteome_dict = {} # namespace prefix # or register a namespace in the ...
Parses a proteome's xml file from Uniprot and converts it to a json like object which is returned upid: A valid Uniprot Proteome identifier returns: A dictionary
Parses a proteome's xml file from Uniprot and converts it to a json like object which is returned A valid Uniprot Proteome identifier A dictionary
[ "Parses", "a", "proteome", "'", "s", "xml", "file", "from", "Uniprot", "and", "converts", "it", "to", "a", "json", "like", "object", "which", "is", "returned", "A", "valid", "Uniprot", "Proteome", "identifier", "A", "dictionary" ]
def extract_uniprot_genome_metadata(upid): proteome_dict = {} prefix = "{http://uniprot.org/uniprot}%s" response = requests.get(gc.PROTEOME_XML_URL % upid) if response.status_code == httplib.OK: prot_tree_root = ET.fromstring(response.content) proteome = prot_tree_root.find(prefix % "pro...
[ "def", "extract_uniprot_genome_metadata", "(", "upid", ")", ":", "proteome_dict", "=", "{", "}", "prefix", "=", "\"{http://uniprot.org/uniprot}%s\"", "response", "=", "requests", ".", "get", "(", "gc", ".", "PROTEOME_XML_URL", "%", "upid", ")", "if", "response", ...
Parses a proteome's xml file from Uniprot and converts it to a json like object which is returned
[ "Parses", "a", "proteome", "'", "s", "xml", "file", "from", "Uniprot", "and", "converts", "it", "to", "a", "json", "like", "object", "which", "is", "returned" ]
[ "\"\"\"\n Parses a proteome's xml file from Uniprot and converts it to a json\n like object which is returned\n\n upid: A valid Uniprot Proteome identifier\n\n returns: A dictionary\n \"\"\"", "# namespace prefix # or register a namespace in the ET", "# check if we got an OK http reponse", "# i...
[ { "param": "upid", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
dump_uniprot_genome_metadata
<not_specific>
def dump_uniprot_genome_metadata(upid, kingdom): """ Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary proteome_dict: A proteome dict built from Uniprot's proteome xml files upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens) assem...
Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary proteome_dict: A proteome dict built from Uniprot's proteome xml files upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens) assembly_acc: A valid ENA GCA accession kingdom: The corr...
Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary A proteome dict built from Uniprot's proteome xml files upid: A valid Uniprot proteome accession assembly_acc: A valid ENA GCA accession kingdom: The corresponding species' kingdom
[ "Parses", "ENA", "GCA", "accession", "xml", "and", "returns", "the", "accession", "'", "s", "data", "in", "the", "form", "of", "a", "dictionary", "A", "proteome", "dict", "built", "from", "Uniprot", "'", "s", "proteome", "xml", "files", "upid", ":", "A",...
def dump_uniprot_genome_metadata(upid, kingdom): genome_entry = {} fields = {} proteome_dict = extract_uniprot_genome_metadata(upid) if len(proteome_dict.keys()) > 0: fields["gca_acc"] = None fields["gca_version"] = None fields["ensembl_id"] = None fields["ensembl_source"...
[ "def", "dump_uniprot_genome_metadata", "(", "upid", ",", "kingdom", ")", ":", "genome_entry", "=", "{", "}", "fields", "=", "{", "}", "proteome_dict", "=", "extract_uniprot_genome_metadata", "(", "upid", ")", "if", "len", "(", "proteome_dict", ".", "keys", "("...
Parses ENA GCA accession xml, and returns the accession's data in the form of a dictionary
[ "Parses", "ENA", "GCA", "accession", "xml", "and", "returns", "the", "accession", "'", "s", "data", "in", "the", "form", "of", "a", "dictionary" ]
[ "\"\"\"\n Parses ENA GCA accession xml, and returns the accession's data in the\n form of a dictionary\n\n proteome_dict: A proteome dict built from Uniprot's proteome xml files\n upid: A valid Uniprot proteome accession (e.g. UP000005640 - Homo Sapiens)\n assembly_acc: A valid ENA GCA accession\n ...
[ { "param": "upid", "type": null }, { "param": "kingdom", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "upid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kingdom", "type": null, "docstring": null, "docstring_tokens"...
5d23a3733de3c0bfee152bd31e7f1292bb87da0f
Rfam/rfam-production
scripts/export/genomes/fetch_gen_metadata.py
[ "Apache-2.0" ]
Python
import_chromosome_names
null
def import_chromosome_names(): """ Parse GCA accession XML to import chromosome name and chromosome types into genseq table. """ import django import django sys.path.append("/Users/ikalvari/RfamWorkspace/Rfam_resource/rfam_schemas") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rfam_...
Parse GCA accession XML to import chromosome name and chromosome types into genseq table.
Parse GCA accession XML to import chromosome name and chromosome types into genseq table.
[ "Parse", "GCA", "accession", "XML", "to", "import", "chromosome", "name", "and", "chromosome", "types", "into", "genseq", "table", "." ]
def import_chromosome_names(): import django import django sys.path.append("/Users/ikalvari/RfamWorkspace/Rfam_resource/rfam_schemas") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rfam_schemas.rfam_schemas.settings") django.setup() from rfam_schemas.RfamLive.models import Genome, Genseq ...
[ "def", "import_chromosome_names", "(", ")", ":", "import", "django", "import", "django", "sys", ".", "path", ".", "append", "(", "\"/Users/ikalvari/RfamWorkspace/Rfam_resource/rfam_schemas\"", ")", "os", ".", "environ", ".", "setdefault", "(", "\"DJANGO_SETTINGS_MODULE\...
Parse GCA accession XML to import chromosome name and chromosome types into genseq table.
[ "Parse", "GCA", "accession", "XML", "to", "import", "chromosome", "name", "and", "chromosome", "types", "into", "genseq", "table", "." ]
[ "\"\"\"\n Parse GCA accession XML to import chromosome name and chromosome types\n into genseq table.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6a7c971e4372e2232abdadf289eb250b93829ccf
Rfam/rfam-production
scripts/validation/xml_validator.py
[ "Apache-2.0" ]
Python
validate_xml_dump
<not_specific>
def validate_xml_dump(xml_file): """ Validates Rfam XML dumps using xmllint xml_file: An XML dump used to index Rfam release data return: True upon success, False for failure """ process = Popen(["xmllint", "--schema", "http://www.ebi.ac.uk/ebisearch/XML4dbDumps.xsd", "--noout", xml_file], ...
Validates Rfam XML dumps using xmllint xml_file: An XML dump used to index Rfam release data return: True upon success, False for failure
Validates Rfam XML dumps using xmllint xml_file: An XML dump used to index Rfam release data True upon success, False for failure
[ "Validates", "Rfam", "XML", "dumps", "using", "xmllint", "xml_file", ":", "An", "XML", "dump", "used", "to", "index", "Rfam", "release", "data", "True", "upon", "success", "False", "for", "failure" ]
def validate_xml_dump(xml_file): process = Popen(["xmllint", "--schema", "http://www.ebi.ac.uk/ebisearch/XML4dbDumps.xsd", "--noout", xml_file], stdin=PIPE, stdout=PIPE, stderr=PIPE) output = process.communicate()[1] if output.find("validates") == -1: return False return True
[ "def", "validate_xml_dump", "(", "xml_file", ")", ":", "process", "=", "Popen", "(", "[", "\"xmllint\"", ",", "\"--schema\"", ",", "\"http://www.ebi.ac.uk/ebisearch/XML4dbDumps.xsd\"", ",", "\"--noout\"", ",", "xml_file", "]", ",", "stdin", "=", "PIPE", ",", "stdo...
Validates Rfam XML dumps using xmllint xml_file: An XML dump used to index Rfam release data
[ "Validates", "Rfam", "XML", "dumps", "using", "xmllint", "xml_file", ":", "An", "XML", "dump", "used", "to", "index", "Rfam", "release", "data" ]
[ "\"\"\"\n Validates Rfam XML dumps using xmllint\n\n xml_file: An XML dump used to index Rfam release data\n\n return: True upon success, False for failure\n \"\"\"", "# check if output contains the keyword validates" ]
[ { "param": "xml_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xml_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6a7c971e4372e2232abdadf289eb250b93829ccf
Rfam/rfam-production
scripts/validation/xml_validator.py
[ "Apache-2.0" ]
Python
parse_arguments
<not_specific>
def parse_arguments(): """ Simple argument parsing using python's argparse return: Python's argparse parser object """ parser = argparse.ArgumentParser() parser.add_argument("--input", help="Single XML file or directory", action="store") parser.add_argument("--log", help="Generate a log f...
Simple argument parsing using python's argparse return: Python's argparse parser object
Simple argument parsing using python's argparse return: Python's argparse parser object
[ "Simple", "argument", "parsing", "using", "python", "'", "s", "argparse", "return", ":", "Python", "'", "s", "argparse", "parser", "object" ]
def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument("--input", help="Single XML file or directory", action="store") parser.add_argument("--log", help="Generate a log file listing all XML files failining validation", action="store_true") return parser
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"--input\"", ",", "help", "=", "\"Single XML file or directory\"", ",", "action", "=", "\"store\"", ")", "parser", ".", "...
Simple argument parsing using python's argparse return: Python's argparse parser object
[ "Simple", "argument", "parsing", "using", "python", "'", "s", "argparse", "return", ":", "Python", "'", "s", "argparse", "parser", "object" ]
[ "\"\"\"\n Simple argument parsing using python's argparse\n\n return: Python's argparse parser object\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }