Pyrice module

pyrice.build_dictionary module

pyrice.build_dictionary.gunzip_shutil(source_filepath, dest_filepath, block_size=65536)[source]

Function to unzip file

Parameters:
  • source_filepath – (str) source file path file .zip
  • dest_filepath – (str) destination file path
  • block_size – (int)
pyrice.build_dictionary.update_gene_dictionary()[source]

Update function for gene dictionary

pyrice.build_dictionary.update_local_database(rapdb_url, oryzabase_url)[source]

Update function for rapdb database and oryzabase database

Parameters:
  • rapdb_url – (str) url for download rapdb database
  • oryzabase_url – (list) url for download oryzabase database (1st: url of genes, 2nd: url of refs)

pyrice.multi_query module

class pyrice.multi_query.MultiQuery[source]

Bases: object

This class will represent query gene rice for database

query(iricname, db, qfields=[], verbose=False)[source]

Query one gene by id or loc on each database

Parameters:
  • iricname – (str) iricname or id of gene
  • db – (str) name database in 8 databases
  • qfields – (list) list of loc, id
  • verbose – (bool) if True print for debug
Returns:

a list with format: [iricname,name_db,iric_on_db]

query_by_chromosome(chro, start_pos, end_pos, number_process=1, multi_processing=False, multi_threading=True, dbs='all', query_expansion=False)[source]

Query gene by chromosome

Parameters:
  • chro – (str) chromosome (ex: “chr01”)
  • start_pos – (str) start of chromosome
  • end_pos – (str) end of chromosome
  • number_process – (int) number of process or number of threading
  • multi_processing – (bool) if True, use multi_processing
  • multi_threading – (bool) if True, use multi_threading
  • dbs – (list) list databases (support 10 available databases)
  • query_expansion – (bool) if True, find list list of associated genes
Returns:

a dictionary, format : gene:{database: attributes}

query_by_ids(ids=None, locs=None, irics=None, number_process=1, multi_processing=False, multi_threading=True, dbs='all', query_expansion=False)[source]

Query gene using id, loc or iric

Parameters:
  • ids – (list) list id of gene
  • locs – (list) list loc of gene
  • irics – (list) list iric name of gene
  • number_process – (int) number of process or number of threading
  • multi_processing – (bool) if True use multi_processing
  • multi_threading – (bool) if True use multi_threading
  • dbs – (list) databases (support 10 available databases)
  • query_expansion – (bool) if True, find list list of associated genes
Returns:

a dictionary, format: gene:{database: attribute}

query_expansion(ids=None, locs=None, irics=None, number_process=1)[source]

Query gene using id, loc or iric

Parameters:
  • ids – (list) list id of gene
  • locs – (list) list loc of gene
  • irics – (list) list iric name of gene
  • number_process – (int) number of process or number of threading
Returns:

a dictionary, format: gene:{database: attribute}

query_multi_threading(list_key, list_dbs, list_ids, number_threading=2)[source]

Query function when using both of multi_processing and multi_threading

Parameters:
  • list_key – (list) list of iricname
  • list_dbs – (list) list of database
  • list_ids – (list) list of id or locus
  • number_threading – (int) number threading per core
Returns:

a dictionary, format: gene:{database:attributes}

query_new_database(atts, number_process=1, multi_processing=False, multi_threading=True, dbs=None)[source]

Query for new attributes on new databases

Parameters:
  • atts – (list) list of new attributes
  • number_process – (int) number of process or number of threading
  • multi_processing – (bool) if True use multi_processing
  • multi_threading – (bool) if True use multi_threading
  • dbs – (list) list of new databases
Returns:

dictionary, format : attribute:{database: information of attribute}

save(result, save_path, format=None, hyper_link=False)[source]

Save result of query with differents types of files

Parameters:
  • result – (dictionary) get after query with query functions
  • save_path – (str) path to save result after call function
  • format – (list) 4 format: html, csv, json, pkl
  • hyper_link – (bool) hyper_link in csv file
search_on_chromosome(chro, start_pos, end_pos, number_process=1, save_path=None, dbs='all')[source]

Search gene by potision on chromosome

Parameters:
  • chro – (str) chromosome (ex: “chr01”)
  • start_pos – (str) start of chromosome
  • end_pos – (str) end of chromosome
  • number_process – (int) number of threading
  • dbs – (list) list databases (support 3 available databases)
  • save_path – (str) path to save result after call function
Returns:

a dictionary, format: iricname:{{msu7Name:LOC_Os..},{raprepName:Os..},{contig:chr0..},{fmin:12..},{fmax:22…}}

pyrice.utils module

pyrice.utils.connection_error(link, data='', type=None, db=None, gene_id=None)[source]
Get result with request post or get; with JavaScript
Parameters:
  • link – (str) url
  • data – (str) data to give to the form
  • type – (str) use with JavaScript format
  • db – (str) database name - use with JavaScript format
  • gene_id – (str) gene id - use with JavaScript format
Returns:

object of requests

pyrice.utils.execute_query(db, qfields=[], verbose=False)[source]

Get url and result of api databases

Parameters:
  • db – (str) name of database
  • qfields – (list) list of loc,id
  • verbose – (bool) if True print for debug
Returns:

information of gene after send request to url api

pyrice.utils.search(df, text)[source]

Search function on result (file .pkl)

Parameters:
  • df – (dataframe) dataframe of pandas
  • text – (str) text
Returns:

a dataframe of pandas that include text

Module contents