Open ghutinet opened 3 years ago
Hey, I was having the same issue. In the end I used illustrator to align the arrows to the line. This kind of defeats the point. I'm posting this to emphasize that there is more interest for this option.
Other than that I enjoy the library!
@ghutinet @FruityPerdix there may be a trick to do that I am not 100% sure I understand what the expected result is, do you have a screenshot/schema?
This is what would be ideal:
This can be done by setting the record's feature_level_height
to 0, which can be done at record creation of afterwards. Here is a minimal example:
from dna_features_viewer import GraphicFeature, GraphicRecord
import numpy as np
record = GraphicRecord(sequence_length=1000, features=[
GraphicFeature(
start=50 * i + np.random.randint(-20, 20),
end=50 * i + np.random.randint(30, 70),
strand= [-1, 1][i % 2],
color=["limegreen", "yellow", "cyan"][i % 3],
)
for i in range(20)
])
record.feature_level_height = 0 # <=====
ax, _ = record.plot(figure_width=10);
Thanks, that works to align the arrows! However the annotation heights are not updated and stay at weird places:
I'm curious to know if there was ever a fix for this issue. I had to mess around with the label font size and labels_spacing settings to find a combination of values that resulted in all labels being attached to lines.
This problem is a bit complicated and may need refactoring, but redefining the below function before plotting at least connects the boxes until a proper solution is implemented:
def new_determine_annotation_height(levels):
return 1
record.determine_annotation_height = new_determine_annotation_height
How about circular genomes?
Great tool!
The only thing I couldn't figure is if you want all your gene arrows on the same line with overlapping arrows. I didn't find any option that would allow me to do so. Is there any? If yes would it draw the tip of the arrow on top the next gene arrow or on the bottom?
Thank you