Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ SamFixCigar.jar of jvarkit will convert M to X/= in cigar of sam file, if do thi
```

#### ToDo:<br>
&nbsp;&nbsp;&nbsp;&nbsp; support Hi-C data/reads mapping
&nbsp;&nbsp;&nbsp;&nbsp; support julia/python api to call clustersploter
&nbsp;&nbsp;&nbsp;&nbsp; support GC plot and defined subtrack for gff file,like read_mapping subtrack<br>
&nbsp;&nbsp;&nbsp;&nbsp; support Hi-C data/reads mapping<br>
&nbsp;&nbsp;&nbsp;&nbsp; support julia/python api to call clustersploter<br>
&nbsp;&nbsp;**2018-12-28**:<br>
&nbsp;&nbsp;&nbsp;&nbsp;1. add gtf fomrat, not only gff format<br>
&nbsp;&nbsp;&nbsp;&nbsp;2. add blat_spl and mummer4 fomrat, not only blast_m8 or paf format<br>
Expand Down
14 changes: 8 additions & 6 deletions src/myth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ sub shift_tracks_x(){
}

sub show_segment_strand(){
my ($info, $id_line_x, $id_line_y, $id_line_height, $id_line_width, $reverse)=@_;
my ($info, $id_line_x, $id_line_y, $id_line_height, $id_line_width, $reverse,$font_family)=@_;
die "error: display_segment_strand=$info format error, should like display_segment_strand=5:5,3:3,color:black,fontsize:5\n" if($info!~ /^5:(.*),3:(.*),color:(.*),fontsize:([\d\.]+)$/);
my ($five,$three,$color,$fsize)=($1, $2, $3, $4);
return "" if(!$five || !$three);
Expand All @@ -81,8 +81,8 @@ sub show_segment_strand(){
$five=$three_tmp;
$three=$five_tmp;
}
my $left="<text class='myth' x=\"$five_x\" y=\"$five_y\" style=\"font-family:Times New Roman;font-size:${fsize}px;fill:$color;text-anchor:end;alignment-baseline:middle\" >$five</text>\n";
my $right="<text class='myth' x=\"$three_x\" y=\"$three_y\" style=\"font-family:Times New Roman;font-size:${fsize}px;fill:$color;text-anchor:start;alignment-baseline:middle\" >$three</text>\n";
my $left="<text class='myth' x=\"$five_x\" y=\"$five_y\" style=\"font-family:$font_family;font-size:${fsize}px;fill:$color;text-anchor:end;alignment-baseline:middle\" >$five</text>\n";
my $right="<text class='myth' x=\"$three_x\" y=\"$three_y\" style=\"font-family:$font_family;font-size:${fsize}px;fill:$color;text-anchor:start;alignment-baseline:middle\" >$three</text>\n";
return "$left $right";
}

Expand Down Expand Up @@ -610,6 +610,7 @@ sub draw_genes(){
my $feature_shift_x=&get_para("feature_shift_x", $feature_id, $conf);
my $label_text_alignment_baseline=&get_para("label_text_alignment_baseline", $feature_id, $conf);
my $feature_popup_title=&get_para("feature_popup_title", $feature_id, $conf);
my $font_family = $conf->{font_family};
if($feature_popup_title){
my @kvs=split(/;/, $feature_popup_title);
$feature_popup_title="\n";
Expand Down Expand Up @@ -862,7 +863,7 @@ sub draw_genes(){
}

## draw label of feature
$orders->{$order_f_label}.= "<text class='myth' x=\"$label_x\" y=\"$label_y\" style=\"font-family:Times New Roman;font-size:${index_label_size}px;fill:$index_label_col;text-anchor:$label_text_anchor;$label_text_alignment_baseline$feature_label_autowidth\" transform=\"rotate($index_label_angle $label_x $label_y)\" >$index_label_content</text>\n" if($display_feature_label!~ /no/i && $display_feature_label!~ /no,no/i ); # label of feature
$orders->{$order_f_label}.= "<text class='myth' x=\"$label_x\" y=\"$label_y\" style=\"font-family:$font_family;font-size:${index_label_size}px;fill:$index_label_col;text-anchor:$label_text_anchor;$label_text_alignment_baseline$feature_label_autowidth\" transform=\"rotate($index_label_angle $label_x $label_y)\" >$index_label_content</text>\n" if($display_feature_label!~ /no/i && $display_feature_label!~ /no,no/i ); # label of feature
}
# check this feature if is in crossing_link
#print "ssfeature_id is $feature_id\n";
Expand Down Expand Up @@ -974,7 +975,7 @@ sub draw_genes(){

## draw label of feature
die "die:label_y is $label_y, id is $feature_id\n" if(!$label_y);
$orders->{$order_f_label}.= "<text class='myth' x=\"$label_x\" y=\"$label_y\" style=\"font-family:Times New Roman;font-size:${index_label_size}px;fill:$index_label_col;text-anchor:$label_text_anchor;$label_text_alignment_baseline$feature_label_autowidth\" transform=\"rotate($index_label_angle $label_x $label_y)\" >$index_label_content</text>\n" if($display_feature_label!~ /no/i && $display_feature_label!~ /no,no/i); # label of feature
$orders->{$order_f_label}.= "<text class='myth' x=\"$label_x\" y=\"$label_y\" style=\"font-family:$font_family;font-size:${index_label_size}px;fill:$index_label_col;text-anchor:$label_text_anchor;$label_text_alignment_baseline$feature_label_autowidth\" transform=\"rotate($index_label_angle $label_x $label_y)\" >$index_label_content</text>\n" if($display_feature_label!~ /no/i && $display_feature_label!~ /no,no/i); # label of feature
}
# check this feature if is in crossing_link
#print "feature_id is $feature_id\n";
Expand Down Expand Up @@ -1077,7 +1078,7 @@ sub draw_genes(){


## draw label of feature
$orders->{$order_f_label}.= "<text class='myth' x=\"$label_x\" y=\"$label_y\" style=\"font-family:Times New Roman;font-size:${index_label_size}px;fill:$index_label_col;text-anchor:$label_text_anchor;$label_text_alignment_baseline$feature_label_autowidth\" transform=\"rotate($index_label_angle $label_x $label_y)\" >$index_label_content</text>\n" if($display_feature_label!~ /no/i && $display_feature_label!~ /no,no/i); # label of feature
$orders->{$order_f_label}.= "<text class='myth' x=\"$label_x\" y=\"$label_y\" style=\"font-family:$font_family;font-size:${index_label_size}px;fill:$index_label_col;text-anchor:$label_text_anchor;$label_text_alignment_baseline$feature_label_autowidth\" transform=\"rotate($index_label_angle $label_x $label_y)\" >$index_label_content</text>\n" if($display_feature_label!~ /no/i && $display_feature_label!~ /no,no/i); # label of feature
}
# check this feature if is in crossing_link
if(exists $conf->{crossing_link2}->{features}->{$feature_id}){
Expand Down Expand Up @@ -1161,6 +1162,7 @@ sub read_conf(){

sub default_setting(){
my ($skip_not_exists, %conf) = @_;
$conf{font_family} ||="Times New Roman";
$conf{svg_width_height} ||= '600,1500';
#$conf{anchor_positon_ratio} ||= 1;
$conf{feature_keywords} ||=",";
Expand Down
11 changes: 5 additions & 6 deletions src/plot.genome.featureCluster.pl
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@

die "
perl $0 [options]:
* --list <str> two formats: [sample gff genome seq_id1 seq_draw_start1 seq_draw_end1 genome seq_id2 seq_draw_start2 seq_draw_end2 ...]
or [sample gff genome]no seq_id mean full length of whole gff
* --list <str> [track_name gene.gff genome.fa seq_id1 seq_draw_start1 seq_draw_end1 seq_id2 seq_draw_start2 seq_draw_end2 ...]
* --prefix <str>
* --outdir <str>
* --conf <str>
* --conf <str>

writed by myth
" unless($list && $prefix && $outdir && $conf);
Expand Down Expand Up @@ -233,7 +232,7 @@
#reversed_block{$sample}{$block_index}
my @block_region=&get_real_feature_region($reverse_block_flag, $start_once, $end_once, $start_once, $end_once, "+", $gff{$sample}{scf}{$scf[0]}, "block"); # "$start-$end", $start, $end, $strand);
$orders{$track_order}.="<g class='myth'><title>$scf[0]:$block_region[0]</title>\n<rect x=\"$id_line_x\" y=\"$id_line_y\" width=\"$id_line_width\" height=\"$id_line_height\" style=\"$conf{track_style}\" /></g>\n";
$orders{$track_order}.=&show_segment_strand($conf{display_segment_strand}, $id_line_x, $id_line_y, $id_line_height, $id_line_width, $reverse_block_flag);
$orders{$track_order}.=&show_segment_strand($conf{display_segment_strand}, $id_line_x, $id_line_y, $id_line_height, $id_line_width, $reverse_block_flag, $conf{font_family});

if($display_segment_name_flag=~ /yes/i){
my $segment_baseline;
Expand Down Expand Up @@ -955,7 +954,7 @@ ()
$tick_label=&format_scale($tick_label);
$tick_label.="bp" if($tick == 0);
$orders{$conf{scale_order}}.="<line x1=\"$tick_x\" y1=\"$tick_y1\" x2=\"$tick_x\" y2=\"$tick_y2\" style=\"stroke:$conf{scale_color};stroke-width:$conf{scale_width};opacity:$conf{scale_tick_opacity}\"/>\n"; # ticks
$orders{$conf{scale_order}}.= "<text class='myth' x=\"$tick_x\" y=\"$tick_label_y\" style=\"font-size:${font_size}px;fill:$conf{scale_color};text-anchor:middle;font-family:Times New Roman;\">$tick_label</text>\n"; # label of feature
$orders{$conf{scale_order}}.= "<text class='myth' x=\"$tick_x\" y=\"$tick_label_y\" style=\"font-size:${font_size}px;fill:$conf{scale_color};text-anchor:middle;font-family:$conf{font_family};\">$tick_label</text>\n"; # label of feature

}
print "cluster_width_ratio $cluster_width_ratio*$svg_width % $unit_scale\n";
Expand All @@ -965,7 +964,7 @@ ()
my $last_tick_label=&format_scale($max_length+$scale_start-1);
$last_tick_label.="bp";

$orders{$conf{scale_order}}.= "<text class='myth' x=\"$x_end_scale\" y=\"$tick_label_y\" style=\"font-size:${font_size}px;fill:$conf{scale_color};text-anchor:middle;font-family:Times New Roman\">$last_tick_label</text>\n"; # label of feature
$orders{$conf{scale_order}}.= "<text class='myth' x=\"$x_end_scale\" y=\"$tick_label_y\" style=\"font-size:${font_size}px;fill:$conf{scale_color};text-anchor:middle;font-family:$conf{font_family}\">$last_tick_label</text>\n"; # label of feature

}

Expand Down