question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python interface?

See original GitHub issue

I was wondering - is there a good way to call umi_tools methods directly from a python script, rather than through the executable?

I have a python script in which I collect a set of reads at a given position and then want to do things with them based on their UMI groups. At the moment I do this by first running umi_tools group on the BAM file (using the adjacency method), reading the grouped BAM file in my script and extracting the UMI group tag from that.

However, it would be much more convenient if I could simply read the original BAM file, extract the raw UMI sequences myself, and then simply call umi_tools to do the adjacency grouping.

Looking at your code it seems like I might be able to do something similar to this: https://github.com/CGATOxford/UMI-tools/blob/master/umi_tools/group.py#L510

Eg.

import umi_tools.network
processor = umi_tools.network.UMIClusterer('adjacency')
umi_groups = processor(umi_raw_seqs, umi_raw_counts)

Where umi_raw_seqs is my list of UMIs at a given location and umi_raw_counts a dict of their counts. I would then assume I would get back a list of UMI groups with the raw UMIs in each.

Is that correct?

It would be great if there was an official interface for this though, in particular since I’d want to be sure that this doesn’t get broken with the next update.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
TomSmithCGATcommented, Aug 17, 2017

We are expecting to release 0.5 tomorrow! 😁

0reactions
koellingcommented, Aug 22, 2017

This is perfect, thank you very much @TomSmithCGAT @IanSudbery!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing an Interface in Python - Real Python
At a high level, an interface acts as a blueprint for designing classes. Like classes, interfaces define methods. Unlike classes, these methods are...
Read more >
How to Create Interface in Python with Examples - eduCBA
An interface acts as a template for designing classes. Interfaces also define methods the same as classes, but abstract methods, whereas class contains ......
Read more >
How do I implement interfaces in python? - Stack Overflow
Implementing interfaces with abstract base classes is much simpler in modern Python 3 and they serve a purpose as an interface contract ...
Read more >
Python-interface module - GeeksforGeeks
In object-oriented languages like Python, the interface is a collection of method signatures that should be provided by the implementing ...
Read more >
Interfaces and Metaclasses in Python - GoDaddy
Unfortunately, Python doesn't have interfaces, or at least, not quite built into the language. Enter Python's abstract base class, or, cutely, ABC. Functionally ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found