dspin 1.1.2__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dspin-1.1.2/dspin.egg-info → dspin-1.3.0}/PKG-INFO +1 -1
- {dspin-1.1.2 → dspin-1.3.0}/dspin/annotate.py +17 -16
- dspin-1.3.0/dspin/compute.py +1289 -0
- dspin-1.3.0/dspin/dspin.py +726 -0
- {dspin-1.1.2 → dspin-1.3.0/dspin.egg-info}/PKG-INFO +1 -1
- {dspin-1.1.2 → dspin-1.3.0}/setup.py +1 -1
- dspin-1.1.2/dspin/compute.py +0 -910
- dspin-1.1.2/dspin/dspin.py +0 -785
- {dspin-1.1.2 → dspin-1.3.0}/LICENSE +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/README.md +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/__init__.cpython-310.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/__init__.cpython-37.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/compute.cpython-310.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/compute.cpython-37.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/dspin_abstract.cpython-310.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/plot.cpython-310.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/__pycache__/plotting.cpython-37.pyc +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/dspin/__init__.py +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/dspin/plot.py +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/dspin.egg-info/SOURCES.txt +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/dspin.egg-info/dependency_links.txt +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/dspin.egg-info/requires.txt +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/dspin.egg-info/top_level.txt +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/requirements.txt +0 -0
- {dspin-1.1.2 → dspin-1.3.0}/setup.cfg +0 -0
|
@@ -82,9 +82,9 @@ def automatic_david_annotation(data_folder, file_name, token_name, species='huma
|
|
|
82
82
|
|
|
83
83
|
# Save results to Excel
|
|
84
84
|
save_to_excel(data_folder, file_name,
|
|
85
|
-
|
|
85
|
+
gene_id_map_reverse, all_onmf_df.columns.tolist(), full=False)
|
|
86
86
|
save_to_excel(data_folder, file_name,
|
|
87
|
-
|
|
87
|
+
gene_id_map_reverse, all_onmf_df.columns.tolist(), full=True)
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
def make_user_prompt_with_score(genes, feature_df=[], direct=False, customized_prompt=None):
|
|
@@ -285,10 +285,10 @@ def setup_david_client(token_name):
|
|
|
285
285
|
|
|
286
286
|
from suds.client import Client
|
|
287
287
|
|
|
288
|
-
url = 'https://
|
|
288
|
+
url = 'https://davidbioinformatics.nih.gov/webservice/services/DAVIDWebService?wsdl'
|
|
289
289
|
client = Client(url)
|
|
290
290
|
client.wsdl.services[0].setlocation(
|
|
291
|
-
'https://
|
|
291
|
+
'https://davidbioinformatics.nih.gov/webservice/services/DAVIDWebService.DAVIDWebServiceHttpSoap11Endpoint/')
|
|
292
292
|
client.service.authenticate(token_name)
|
|
293
293
|
return client
|
|
294
294
|
|
|
@@ -359,7 +359,7 @@ def process_gene_lists(data_folder, file_name, all_onmf_df, gene_id_map, client)
|
|
|
359
359
|
for i in range(num_lists):
|
|
360
360
|
cur_gene_list = all_onmf_df.iloc[:, i].dropna()
|
|
361
361
|
cur_gene_list = map_gene_ids(gene_id_map, cur_gene_list)
|
|
362
|
-
save_path = os.path.join(save_folder, f'list_{i}.csv')
|
|
362
|
+
save_path = os.path.join(save_folder, f'list_{all_onmf_df.columns[i]}.csv')
|
|
363
363
|
|
|
364
364
|
input_ids = ','.join(cur_gene_list)
|
|
365
365
|
id_type = 'ENSEMBL_GENE_ID'
|
|
@@ -370,7 +370,7 @@ def process_gene_lists(data_folder, file_name, all_onmf_df, gene_id_map, client)
|
|
|
370
370
|
term_clustering_report = client.service.getTermClusterReport(
|
|
371
371
|
overlap, initialSeed, finalSeed, linkage, kappa)
|
|
372
372
|
|
|
373
|
-
print(f'Gene list {i} ', end='\t')
|
|
373
|
+
print(f'Gene list {all_onmf_df.columns[i]} ', end='\t')
|
|
374
374
|
# print(term_clustering_report)
|
|
375
375
|
if term_clustering_report is None:
|
|
376
376
|
raise Exception(
|
|
@@ -379,7 +379,7 @@ def process_gene_lists(data_folder, file_name, all_onmf_df, gene_id_map, client)
|
|
|
379
379
|
parse_david_output(term_clustering_report, save_path)
|
|
380
380
|
|
|
381
381
|
|
|
382
|
-
def save_to_excel(data_folder, file_name, gene_id_map_reverse,
|
|
382
|
+
def save_to_excel(data_folder, file_name, gene_id_map_reverse, list_name, full=True):
|
|
383
383
|
"""
|
|
384
384
|
Save the parsed DAVID output to an Excel file, with an option to include full or filtered results.
|
|
385
385
|
|
|
@@ -387,7 +387,7 @@ def save_to_excel(data_folder, file_name, gene_id_map_reverse, num_lists, full=T
|
|
|
387
387
|
data_folder (str): The folder where the data files are located.
|
|
388
388
|
file_name (str): The name of the original CSV file containing gene data.
|
|
389
389
|
gene_id_map_reverse (dict): A dictionary mapping ENSEMBL IDs to gene symbols.
|
|
390
|
-
|
|
390
|
+
list_name (list): A list of gene list names.
|
|
391
391
|
full (bool): Whether to save the full results. If False, only results with Pvalue <= 0.05 are saved.
|
|
392
392
|
"""
|
|
393
393
|
|
|
@@ -433,8 +433,8 @@ def save_to_excel(data_folder, file_name, gene_id_map_reverse, num_lists, full=T
|
|
|
433
433
|
'.csv', '_david_full.xlsx') if full else file_name.replace('.csv', '_david.xlsx')
|
|
434
434
|
|
|
435
435
|
with pd.ExcelWriter(data_folder + xlsx_name) as writer:
|
|
436
|
-
for
|
|
437
|
-
cur_pd = pd.read_csv(save_folder + 'list_
|
|
436
|
+
for lname in list_name:
|
|
437
|
+
cur_pd = pd.read_csv(save_folder + f'list_{lname}.csv', sep='\t', names=[
|
|
438
438
|
'Category', 'Term', 'Count', '%', 'Pvalue', 'Genes', 'List Total', 'Pop Hits', 'Pop Total', 'Fold Enrichment', 'Bonferroni', 'Benjamini', 'FDR'])
|
|
439
439
|
filt1 = cur_pd['Category'] == 'UP_SEQ_FEATURE'
|
|
440
440
|
filt2 = cur_pd['Pvalue'].apply(filt_fun)
|
|
@@ -453,9 +453,10 @@ def save_to_excel(data_folder, file_name, gene_id_map_reverse, num_lists, full=T
|
|
|
453
453
|
cur_pd = pd.DataFrame(np.insert(
|
|
454
454
|
cur_pd.values, ind + kk, values=[" "] * len(cur_pd.columns), axis=0), columns=cur_pd.columns)
|
|
455
455
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
writer.sheets[
|
|
459
|
-
writer.sheets[
|
|
460
|
-
writer.sheets[
|
|
461
|
-
writer.sheets[
|
|
456
|
+
sheet_name = lname
|
|
457
|
+
cur_pd.to_excel(writer, sheet_name=sheet_name, index=False)
|
|
458
|
+
writer.sheets[sheet_name].set_column(0, 0, 25)
|
|
459
|
+
writer.sheets[sheet_name].set_column(1, 1, 50)
|
|
460
|
+
writer.sheets[sheet_name].set_column(2, 2, 5)
|
|
461
|
+
writer.sheets[sheet_name].set_column(3, 3, 5)
|
|
462
|
+
writer.sheets[sheet_name].set_column(5, 5, 100)
|