Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to put label off #40

Open
sameerh opened this issue Aug 6, 2020 · 3 comments
Open

How to put label off #40

sameerh opened this issue Aug 6, 2020 · 3 comments

Comments

@sameerh
Copy link

sameerh commented Aug 6, 2020

While plotting from genbank file, how to keep the label off?

@veghp
Copy link
Member

veghp commented Aug 6, 2020

I have not found such option in the docs, but if you remove labels then you can get a plot without labels:

from dna_features_viewer import BiopythonTranslator
graphic_record = BiopythonTranslator().translate_record("example_sequence.gb")
for feature in graphic_record.features:
    feature.label = None
graphic_record.plot(figure_width=5)

index

@Zulko
Copy link
Member

Zulko commented Aug 6, 2020

One way is to redefine compute_feature_label like in the last example in the Readme. Here is the minimal version:

from dna_features_viewer import BiopythonTranslator

class MyCustomTranslator(BiopythonTranslator):
    def compute_feature_label(self, feature):
        # display labels for CDS only, no label for other features
        return "CDS here" if (feature.type == "CDS") else None

graphic_record = MyCustomTranslator().translate_record("example_sequence.gb")

@sameerh
Copy link
Author

sameerh commented Aug 7, 2020

I have not found such option in the docs, but if you remove labels then you can get a plot without labels:

from dna_features_viewer import BiopythonTranslator
graphic_record = BiopythonTranslator().translate_record("example_sequence.gb")
for feature in graphic_record.features:
    feature.label = None
graphic_record.plot(figure_width=5)

Hi Veghp and Zulko,
Thank you for your help. I will try this.
Appreciate your help.

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

No branches or pull requests

3 participants