paulstothard / cgview_comparison_tool

The CGView Comparison Tool (CCT) is a package for visually comparing bacterial, plasmid, chloroplast, and mitochondrial sequences.
https://paulstothard.github.io/cgview_comparison_tool/
GNU General Public License v3.0
30 stars 18 forks source link

Blast colors and filter #11

Closed fmalmeida closed 1 year ago

fmalmeida commented 1 year ago

Hello, Thank you for this nice tool!

I have two questions on the tool that I think would be of very much help when drawing it:

  1. Is it possible to filter the Blast alignments while running? Only allow the tool to use a set of hits with X identities and lengths.
  2. Is it possible to give a list of colors for the Blast alignments? The tool automatically repeats the colors for every three genomes added for comparison. However, I wanted one color for each comparison genome so it is easier to spot. Is that an option for it? Changing it directly from the .xml is too messy.

😄

paulstothard commented 1 year ago

Hello,

  1. When a project is created by cgview_comparison_tool the resulting folder will contain conf files like:

project_settings_cds_vs_cds.conf

project_settings_dna_vs_dna.conf

In these there is a section that can be edited to alter the BLAST settings, e.g.:

#The BLAST expect value to use. [Real].
expect = 0.1

#The minimum score required for BLAST hits. [Integer].
score = 0

#The number of BLAST hits to keep for each query. [Integer].
hits = 100000

#The minimum acceptable hit length for BLAST results, expressed as a
#proportion of the length of the query. [Real].
minimum_hit_proportion = 0.0
  1. When a project is created by cgview_comparison_tool the resulting folder will contain a copy of the script cgview_xml_builder.pl. To add more BLAST colors you can edit this script before generating the CGView maps.

So for example:

A. Download some data:

docker run --rm -v "$(pwd)":/dir -u "$(id -u)":"$(id -g)" -w /dir pstothard/cgview_comparison_tool fetch_genome_by_accession.sh -a AC_000022 -o ./

B. Create the projects:

docker run --rm -v "$(pwd)":/dir -u "$(id -u)":"$(id -g)" -w /dir pstothard/cgview_comparison_tool build_blast_atlas.sh -i AC_000022.gbk

C. Edit the conf files and edit cgview_xml_builder.pl:

Where to edit cgview_xml_builder.pl (line 143):

    blastColors => [
        "rgb(139,0,0)",    #dark red
        "rgb(0,100,0)",    #dark green
        "rgb(0,0,139)"     #dark blue
    ],

Add more colors to this array (as many as you want), e.g.:

    blastColors => [
        "rgb(139,0,0)",    #dark red
        "rgb(0,100,0)",    #dark green
        "rgb(0,0,139)",     #dark blue
        "rgb(0,0,0)",         #black
        "rgb(255,165,0)" #orange
    ],

D. Generate the maps:

docker run --rm -v "$(pwd)":/dir -u "$(id -u)":"$(id -g)" -w /dir pstothard/cgview_comparison_tool build_blast_atlas.sh -p AC_000022 -z medium

Paul

fmalmeida commented 1 year ago

Thank you very much for the fast and thorough! That was incredibly helpful! 😄