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

PDF #95

Open
GuyBenzvi opened this issue Sep 28, 2023 · 4 comments
Open

PDF #95

GuyBenzvi opened this issue Sep 28, 2023 · 4 comments
Assignees

Comments

@GuyBenzvi
Copy link

Hey,
is there a wat to get a single fasta as pdf instad of html format?
many thanks

@josiahseaman
Copy link
Owner

Hi Guy,
I agree that the HTML format would certainly be inconvenient if you're using large amounts of sequence. The intended use case is that you're highlighting sequences to search in your own FASTA files or BLAST online. Can you tell me more about the use case for a PDF export? How big of a sequence window would you want exported? FluentDNA chunks up the (sometimes very large) FASTA files to be usable by the browser.
All the best,
Josiah Seaman, PhD

@GuyBenzvi
Copy link
Author

Hey Josiah,
my use case is a bit different, we want to print one chromosome or just a fragment of it for science day,
we want to create a maze of dna with annotation to explain the DNA role, size, and the repetitions.
hope it is possible,
Guy Ben Zvi

@josiahseaman
Copy link
Owner

Hi Guy,
That sounds like a really great use case. Your question make more sense now. If you want a high quality large scale print, then you probably actually want a TIFF. I myself made a giant interactive touch poster of the full Arabidopsis thaliana genome for a museum display as part of my PhD thesis using FluentDNA. It's a great application for that. For those sorts of uses, I'd recommend minor modifications to the code, rather than using the site directly. Do you know programming or know someone who does?

By increasing the margin variable in the renderer from 0 to 1 you can get a visible space filling curve like the ones you can see in Figure 2 and Figure 8. That will help people understand how DNA continually snakes back on itself in repetitions. Yan Wong and I discussed ways to show annotations in the expanded space filling curve, but ultimately I decided to go with the light shading that you see in the final paper. It's a bit more clear and closely mirrors real world regional maps people are familiar with.

The whole FluentDNA project is open source so people can hack on it to make educational figures, productions and posters. If you don't have access to any programmers, I might be able to do it eventually, but my October is looking pretty busy. What's your timeline?

image

@josiahseaman
Copy link
Owner

Here's some guidance for Maxim to get started on this issue.

Annotations

  • Once you have the chromosome look that you desire you may want to modify annotation appearance, especially if you're adding margin.
  • Ideogram inherits from . So the main action happens in draw_extras_for_chromosome. This defines the colors, naming, and priority of the annotation layers, even their sources.
  • One thing which bears clarification is things like coordinate_frame["title_padding"] is in the linear 1D coordinates of DNA. It's the amount of sequence space allocated to a label etc. The code is a whole lot simpler if you don't have text labels and just edit them into the images afterwards.
  • We have the ability to draw outlines and shadows which is a pretty cool ability that's not currently being used. It might be worth experimenting with depending on your application.

How to Annotate with Ideogram Margins

If you want the snaking maze look of DNA and also the ability to show an annotated gene region, you've got to find the outline of this complex area with margins around it. This is never a feature that I tackled, but looking at the code it's definitely possible.

  • An Annotation is just a set of points: self.points = annotation_points(GFF_annotation, renderer, start_offset)
  • I wrote a function to calculate the outline of a set of point to any radius you want. In this case radius two will give you the outline of a maze: def outlines(annotation_points, radius, width, height): to outlines(maze_points, 2, , markup_image.width, markup_image.height)
  • Then you can draw / shade these new outline points

Image Export Format: PDF

  • Changing file format to another image filetype is as simple as changing PNG on this line
  • Probably also the output_file_name
  • For PDF, I'd recommend exporting an image and then using another program to create the PDF. You could import a whole new python library. My understanding is PDF can be quite involved.

Good luck with your project. Let me know if you have any other questions.

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

No branches or pull requests

2 participants