From fe0b08151a523b9cc25b24d858f461b583b7ff69 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Tue, 27 Oct 2009 07:47:58 +0000 Subject: [PATCH] revised KISS format git-svn-id: http://biopieces.googlecode.com/svn/trunk@710 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/upload_to_KISS | 3 +-- code_perl/Maasha/KISS/Draw.pm | 32 ++++++++++++++++++++++++++++++++ code_perl/Maasha/KISS/IO.pm | 25 +++++++++++++++---------- www/cgi-bin/index.cgi | 2 ++ 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/bp_bin/upload_to_KISS b/bp_bin/upload_to_KISS index c030708..28ccde3 100755 --- a/bp_bin/upload_to_KISS +++ b/bp_bin/upload_to_KISS @@ -130,8 +130,6 @@ sub bulk_load_file my ( $sql ); - #LOAD DATA INFILE....(col1, @dummy) SET col2 = IF(@dummy = '.', NULL, @dummy) - $sql = qq(LOAD DATA LOCAL INFILE "$file" INTO TABLE $table); print STDERR "$sql\n" if $verbose; @@ -167,6 +165,7 @@ sub create_table "BLOCK_COUNT TINYINT, INDEX BLOCK_COUNT_index (BLOCK_COUNT)", "BLOCK_BEGS VARCHAR(1024)", "BLOCK_LENS VARCHAR(1024)", + "BLOCK_TYPE VARCHAR(1024)", ); $field_str = join( ", ", @fields ); diff --git a/code_perl/Maasha/KISS/Draw.pm b/code_perl/Maasha/KISS/Draw.pm index df21300..100b330 100644 --- a/code_perl/Maasha/KISS/Draw.pm +++ b/code_perl/Maasha/KISS/Draw.pm @@ -102,7 +102,39 @@ sub svg_frame sub svg_track_dna { + # Martin A. Hansen, October 2009. + + # Given a DNA sequence as a list add a string + # of chars to a SVG object. + + my ( $width, # width + $svg, # SVG object + $dna, + ) = @_; + + # Returns nothing. + + my ( $track ); + $dna = 'GAACGACGAGCATCAGCGGACACTACATCATATACTACATC'; + + $track = $svg->group( + id => 'TRACK_DNA', + style => { + # 'stroke-width' => 5, + # stroke => 'black', # TODO can this be removed? + 'font-family' => 'Courier New', + 'font-size' => '15px', + 'letter-spacing' => '15', + } + ); + + $track->text( + id => 'DNA', + x => 0, + y => 20, + -cdata => $dna, + ); } diff --git a/code_perl/Maasha/KISS/IO.pm b/code_perl/Maasha/KISS/IO.pm index 7276f0a..5ff6a51 100644 --- a/code_perl/Maasha/KISS/IO.pm +++ b/code_perl/Maasha/KISS/IO.pm @@ -49,6 +49,7 @@ use constant { BLOCK_COUNT => 8, BLOCK_BEGS => 9, BLOCK_LENS => 10, + BLOCK_TYPE => 11, }; # 0 1 2 @@ -68,9 +69,10 @@ use constant { # BLOCK_COUNT => 2 # BLOCK_BEGS => 1,6 # BLOCK_LENS => 3,3 +# BLOCK_TYPE => 1,1 # # -# 'S.aur complete genome' 3 12 'TAG_000001' 1 + 31 2 1,6 3,3 +# 'S.aur complete genome' 3 12 'TAG_000001' 1 + 31 2 1,6 3,3 1,1 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @@ -93,7 +95,7 @@ sub kiss_entry_get @fields = split /\t/, $line; - Maasha::Common::error( qq( BAD kiss entry: $line) ) if not @fields == 11; + Maasha::Common::error( qq( BAD kiss entry: $line) ) if not @fields == 12; $entry{ 'S_ID' } = $fields[ S_ID ]; $entry{ 'S_BEG' } = $fields[ S_BEG ]; @@ -106,6 +108,7 @@ sub kiss_entry_get $entry{ 'BLOCK_COUNT' } = $fields[ BLOCK_COUNT ]; $entry{ 'BLOCK_BEGS' } = $fields[ BLOCK_BEGS ]; $entry{ 'BLOCK_LENS' } = $fields[ BLOCK_LENS ]; + $entry{ 'BLOCK_TYPE' } = $fields[ BLOCK_TYPE ]; return wantarray ? %entry : \%entry; } @@ -124,17 +127,18 @@ sub kiss_entry_put $fh ||= \*STDOUT; - $fields[ S_ID ] = $entry->{ 'S_ID' }; - $fields[ S_BEG ] = $entry->{ 'S_BEG' }; - $fields[ S_END ] = $entry->{ 'S_END' }; - $fields[ Q_ID ] = $entry->{ 'Q_ID' }; - $fields[ SCORE ] = $entry->{ 'SCORE' }; - $fields[ STRAND ] = $entry->{ 'STRAND' }; - $fields[ HITS ] = $entry->{ 'HITS' }; - $fields[ ALIGN ] = $entry->{ 'ALIGN' }; + $fields[ S_ID ] = $entry->{ 'S_ID' }; + $fields[ S_BEG ] = $entry->{ 'S_BEG' }; + $fields[ S_END ] = $entry->{ 'S_END' }; + $fields[ Q_ID ] = $entry->{ 'Q_ID' }; + $fields[ SCORE ] = $entry->{ 'SCORE' }; + $fields[ STRAND ] = $entry->{ 'STRAND' }; + $fields[ HITS ] = $entry->{ 'HITS' }; + $fields[ ALIGN ] = $entry->{ 'ALIGN' }; $fields[ BLOCK_COUNT ] = $entry->{ 'BLOCK_COUNT' }; $fields[ BLOCK_BEGS ] = $entry->{ 'BLOCK_BEGS' }; $fields[ BLOCK_LENS ] = $entry->{ 'BLOCK_LENS' }; + $fields[ BLOCK_TYPE ] = $entry->{ 'BLOCK_TYPE' }; print $fh join( "\t", @fields ), "\n"; } @@ -176,6 +180,7 @@ sub biopiece2kiss $record->{ 'BLOCK_COUNT' } ||= "."; $record->{ 'BLOCK_BEGS' } ||= "."; $record->{ 'BLOCK_LENS' } ||= "."; + $record->{ 'BLOCK_TYPE' } ||= "."; $record->{ 'ALIGN' } ||= $record->{ 'DESCRIPTOR' } || "."; return wantarray ? %{ $record } : $record; diff --git a/www/cgi-bin/index.cgi b/www/cgi-bin/index.cgi index 525dfd1..f2e6460 100755 --- a/www/cgi-bin/index.cgi +++ b/www/cgi-bin/index.cgi @@ -192,6 +192,8 @@ sub sec_browse $t0 = Time::HiRes::gettimeofday(); Maasha::KISS::Draw::svg_frame( 800, 1200, $svg ); + Maasha::KISS::Draw::svg_track_dna( 1200, $svg, 'dna', 'ATCG' ); + if ( @$entries > $MAX ) { Maasha::KISS::Draw::svg_track_histogram( $svg, $features, 'track id', 'green' ) if $features; } else { -- 2.39.5