Skip to content

Fix notebook NameErrors and add scan/enrichment examples - #10

Open
ShinyaYoshida-biomet wants to merge 2 commits into
asntech:clifrom
ShinyaYoshida-biomet:feature/notebook-analysis-examples
Open

Fix notebook NameErrors and add scan/enrichment examples#10
ShinyaYoshida-biomet wants to merge 2 commits into
asntech:clifrom
ShinyaYoshida-biomet:feature/notebook-analysis-examples

Conversation

@ShinyaYoshida-biomet

Copy link
Copy Markdown

Summary

Since I got these errors when I tried to execute the notebook, I fixed the name and attribute references, respectively.

Fix 1

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[16], line 3
      1 from pyjaspar.analysis import pearson_correlation, best_correlation
----> 3 m1 = jdb.fetch_motif_by_id("MA0001.1")
      4 m2 = jdb.fetch_motif_by_id("MA0002.1")
      6 # Column-wise Pearson correlation

NameError: name 'jdb' is not defined

before:

m1 = jdb.fetch_motif_by_id("MA0001.1")
m2 = jdb.fetch_motif_by_id("MA0002.1")

after:

m1 = jdb_obj.fetch_motif_by_id("MA0001.1")
m2 = jdb_obj.fetch_motif_by_id("MA0002.1")

Fix 2

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[21], line 4
      2 models = jdb.dl.search_models(tf_name="REST", cell_line="K562")
      3 for m in models:
----> 4     print(f"{m.model_id}: {m.tf_name} ({m.cell_line}) ({p.tax_group})")

NameError: name 'p' is not defined

before:

# Search profiles by TF name and combined filters
models = jdb.dl.search_models(tf_name="REST", cell_line="K562")
for m in models:
    print(f"{m.model_id}: {m.tf_name} ({m.cell_line}) ({p.tax_group})")

after:

# Search profiles by TF name and combined filters
models = jdb.dl.search_models(tf_name="REST", cell_line="K562")
for m in models:
    print(f"{m.model_id}: {m.tf_name} ({m.cell_line}) ({m.tax_id})")

Added scan and enrichment examples

The "Analysis module" section only had a similarity/correlation example. I added a scan_sequence example (CTCF motif against a sequence containing its consensus) and a motif_enrichment example (pulling a small set of candidate motifs by tf_family="Homeo" rather than by hardcoded ID, then showing that only the true positive comes out enriched against a matched-length background set).

Both new cells were executed and their outputs saved, same as the rest of the notebook.

Test plan

  • Ran the full notebook top to bottom (jupyter execute --inplace) after each fix, confirmed no errors
  • Verified the two NameErrors no longer occur
  • Verified the new scan/enrichment cells produce correct, sensible output (CTCF hits found in the scan sequence; only the Dbx motif enriched in the enrichment example, as designed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant