Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/konapun/dotplot-generator-advanced

Create a dotplot that supports conservation score filtering and AJAX-ready JSON output
https://github.com/konapun/dotplot-generator-advanced

Last synced: 22 days ago
JSON representation

Create a dotplot that supports conservation score filtering and AJAX-ready JSON output

Awesome Lists containing this project

README

        

# Advanced Dotplot Generator
Generate a dotplot that supports score-based filters along with alignment filters. In addition, this version supports AJAX-friendly JSON output for found alignments

### Filters
There are two types of filters:
- Alignment filters
- Score filters
A score filter may represent a conservation value ranging from 0 to 1 and an alignment filter specifies the minimum match length for a non-gapped alignment.
The alignment filter is first generated through the function `find_alignments` and then applied through `apply_alignments`. A value filter can be imported
as a text file or given as an array.

## Generator Program
Builds a configurable dotplot

Usage: `genplot [OPTIONS] `
### Options
* **x** file to use as the first score filter for sequence1
* **y** file to use as the first score filter for sequence2
* **p** file to use as the second score filter for sequence1
* **q** file to use as the second score filter for sequence2
* **n** minimum alignment length
* **w** width (in pixels) of the resulting file
* **h** height (in pixels) of the resulting file

## API
### dotplot *create_dotplot(char *seq1, char *seq2)
Creates an unfiltered dotplot from two sequence strings

### dotplot *create_dotplot_from_fasta(char *file1, char *file2) (UNIX only)
Creates an unfiltered dotplot from two files containing sequences. Currently, only sequence files are supported **without the fasta header** because text processing in C is a pain

### dotplot *zero_dotplot(dotplot *dp)
Creates one dotplot from another with all the cells cleared (values set to 0.0)

### dotplot *clone_dotlot(dotplot *dp)
Creates a clone of a dotplot

### void destroy_dotplot(dotplot *dp)
Frees allocated memory for a dotplot

### list_t *find_alignments(dotplot *dp, int length)
Find alignments of minimum length `length` and return them as a list to be applied in a later step

### dotplot *apply_alignments(dotplot *dp, list_t *alignments)
Apply alignments to a dotplot, returning a new dotplot with the filter applied

### void destroy_alignments(list_t *alignments)
Free allocated memory for a list of alignments created through `find_alignments`

### void print_alignments(list_t *alignments, char *seq1, char *seq2)
Print JSON output describing the list of alignments in the format
```js
[
{
"sequence": "ACTG",
"position": {
"x": 1,
"y": 1
}
}
]
```

### filter *create_filter(int width, int, height, float **vals)
Create a filter with `vals` associating to each cell in the dotplot with each cell in the array as a value between 0 and 1

### filter *create_filter_from_values(char *file1, char *file2) (UNIX only)
Create a filter as above but with the values coming from a filemask for seq1 and seq2

### dotplot *apply_filter(dotplot *dp, filter *f)
Apply a score filter generated by `create_filter` and return the resulting dotplot

### dotplot *apply_filter_safe(dotplot *dp, filter *f)
Same as `apply_filter`, but asserts dotplot and filter dimensions are the same

### void destroy_filter(filter *f)
Free allocated memory for a filter

### int set_value(dotplot *dp, int x, int y, float value)
Set the value at a cell in the dotplot. Returns 1 or 0 depending on whether or not the operation succeeded (ie., not out of bounds)

### gdImagePtr render_dotplot(dotplot *dp, int width, int height)
Render the dotplot to an internal image representation with image dimensions of (width, height)

### color_chooser *create_color_chooser(color default_color)
Create a color chooser to be used for rendering a continuous dotplot with a score filter (color is a struct with properties red, green, and blue)

### destroy_color_chooser(color_chooser *cc)
Free allocated memory for a color chooser

### int add_color(color_chooser *cc, float start, float end, color c)
Add a color to be chosen for a range between start and end when rendering a dotplot with a score filter. Returns 1 or 0 depending on whether or not the operation succeeded (ie., not out of bounds)

### color color_for(color_chooser *cc, float value)
Find the color to be chosen for a color_chooser `cc` given value `value`

### gdImagePtr render_dotplot_continuous(dotplot *dp, color_chooser *cc, int width, int height)
Render a multicolored dotplot where each color relates to a value from the applied score filter