]> git.donarmstrong.com Git - biopieces.git/commitdiff
clean up
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 18 Nov 2008 03:59:51 +0000 (03:59 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 18 Nov 2008 03:59:51 +0000 (03:59 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@316 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm
code_perl/Maasha/UCSC.pm

index d5a33fed710ae821170a2366d7c62cabca462166..ebf51a908d988c0fb7ca2497345dc7adf6d25ac9 100644 (file)
@@ -4518,6 +4518,20 @@ sub script_write_bed
 
             Maasha::UCSC::bed_put_entry( $new_record, $fh, $cols );
         }
+        elsif ( $record->{ 'tBaseInsert' } )                              # ---- Dirty addition to allow Affy data from MySQL to be dumped ----
+        {
+            $record = Maasha::UCSC::psl2record( $record );
+
+            $new_record = $record;
+            $new_record->{ "CHR" }     = $record->{ "S_ID" };
+            $new_record->{ "CHR_BEG" } = $record->{ "S_BEG" };
+            $new_record->{ "CHR_END" } = $record->{ "S_END" };
+            $new_record->{ "Q_ID" }    = $record->{ "Q_ID" };
+            $new_record->{ "SCORE" }   = $record->{ "SCORE" } || 999;
+            $new_record->{ "STRAND" }  = $record->{ "STRAND" };
+
+            Maasha::UCSC::bed_put_entry( $new_record, $fh, $cols );
+        }
         elsif ( $record->{ "CHR" } and defined $record->{ "CHR_BEG" } and $record->{ "CHR_END" } )  # ---- Generic data from tables ----
         {
             Maasha::UCSC::bed_put_entry( $record, $fh, $cols );
index 7ae2e37924b250bf7034954866ace0da1498088c..fcd08ffa5a7ccceeb4ae30dff4321d8e1f7b0d4b 100644 (file)
@@ -644,11 +644,11 @@ sub bed_upload_to_ucsc
         $args = join " ", $options->{ "database" }, $options->{ "table" }, "-tmpDir=$tmp_dir", $file;
     }
 
-    if ( $options->{ "sec_struct" } )
+    if ( $options->{ "table" } =~ /rnaSecStr/ )
     {
         $table = $options->{ "table" };
 
-        Maasha::Common::error( "Attempt to load secondary structure track without 'rnaSecStr' in table name" ) if not $table =~ /rnaSecStr/;
+        print qq(uploading secondary structure table:"$table"\n) if $options->{ "verbose" };
 
         $sql_file = "$tmp_dir/upload_RNA_SS.sql";
 
@@ -688,6 +688,50 @@ CREATE TABLE $table (
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PSL format <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
+sub psl2record
+{
+    # Martin A. Hansen, November 2008
+
+    # Converts PSL record keys to Biopiece record keys.
+
+    my ( $psl,   # hashref
+       ) = @_;
+
+    # returns hashref
+
+    my %record;
+
+    %record = (
+        REC_TYPE    => "PSL",
+        BLOCKSIZES  => $psl->{ 'blockSize' },
+        SNUMINSERT  => $psl->{ 'tNumInsert' },
+        Q_END       => $psl->{ 'qEnd' },
+        SBASEINSERT => $psl->{ 'tBaseInsert' },
+        S_END       => $psl->{ 'tEnd' },
+        QBASEINSERT => $psl->{ 'qBaseInsert' },
+        REPMATCHES  => $psl->{ 'repMatches' },
+        QNUMINSERT  => $psl->{ 'qNumInsert' },
+        MISMATCHES  => $psl->{ 'misMatches' },
+        BLOCKCOUNT  => $psl->{ 'blockCount' },
+        Q_LEN       => $psl->{ 'qSize' },
+        S_ID        => $psl->{ 'tName' },
+        STRAND      => $psl->{ 'strand' },
+        Q_ID        => $psl->{ 'qName' },
+        MATCHES     => $psl->{ 'matches' },
+        S_LEN       => $psl->{ 'tSize' },
+        NCOUNT      => $psl->{ 'nCount' },
+        Q_BEGS      => $psl->{ 'qStarts' },
+        S_BEGS      => $psl->{ 'tStarts' },
+        S_BEG       => $psl->{ 'tStart' },
+        Q_BEG       => $psl->{ 'qStart ' },
+    );
+
+    $record{ "SCORE" } = $record{ "MATCHES" } + int( $record{ "REPMATCHES" } / 2 ) - $record{ "MISMATCHES" } - $record{ "QNUMINSERT" } - $record{ "SNUMINSERT" };
+    $record{ "SPAN" }  = $record{ "Q_END" } - $record{ "Q_BEG" };
+
+    return wantarray ? %record : \%record;
+}
+
 
 sub psl_get_entry
 {
@@ -982,6 +1026,7 @@ sub ucsc_config_put_entry
                                                                                priority
                                                                                useScore
                                                                                visibility
+                                                                               maxHeightPixels
                                                                                color
                                                                                type );
 }