}
-sub psl_put_header
-{
- # Martin A. Hansen, September 2007.
-
- # Write a PSL header to file.
-
- my ( $fh, # file handle - OPTIONAL
- ) = @_;
-
- # Returns nothing.
-
- $fh = \*STDOUT if not $fh;
-
- print $fh qq(psLayout version 3
-match mis- rep. N's Q gap Q gap T gap T gap strand Q Q Q Q T T T T block blockSizes qStart match match count bases count bases name size start end name size start end count
----------------------------------------------------------------------------------------------------------------------------------------------------------------
-);
-}
-
-
-sub psl_put_entry
-{
- # Martin A. Hansen, September 2007.
-
- # Write a PSL entry to file.
-
- my ( $record, # hashref
- $fh, # file handle - OPTIONAL
- ) = @_;
-
- # Returns nothing.
-
- $fh = \*STDOUT if not $fh;
-
- my @output;
-
- push @output, $record->{ "MATCHES" };
- push @output, $record->{ "MISMATCHES" };
- push @output, $record->{ "REPMATCHES" };
- push @output, $record->{ "NCOUNT" };
- push @output, $record->{ "QNUMINSERT" };
- push @output, $record->{ "QBASEINSERT" };
- push @output, $record->{ "SNUMINSERT" };
- push @output, $record->{ "SBASEINSERT" };
- push @output, $record->{ "STRAND" };
- push @output, $record->{ "Q_ID" };
- push @output, $record->{ "Q_LEN" };
- push @output, $record->{ "Q_BEG" };
- push @output, $record->{ "Q_END" } + 1;
- push @output, $record->{ "S_ID" };
- push @output, $record->{ "S_LEN" };
- push @output, $record->{ "S_BEG" };
- push @output, $record->{ "S_END" } + 1;
- push @output, $record->{ "BLOCK_COUNT" };
- push @output, $record->{ "BLOCK_LENS" };
- push @output, $record->{ "Q_BEGS" };
- push @output, $record->{ "S_BEGS" };
-
- print $fh join( "\t", @output ), "\n";
-}
-
-
sub psl_upload_to_ucsc
{
# Martin A. Hansen, September 2007.
while ( $line = <$fh> )
{
+ next if $line !~ /^\d/;
+
chomp $line;
@fields = split "\t", $line;
- return wantarray ? @fields : \@fields if scalar @fields == 21;
+ return wantarray ? @fields : \@fields; # 21 fields
}
return undef;
%record = (
REC_TYPE => "PSL",
- BLOCK_LENS => $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' },
- BLOCK_COUNT => $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 ' },
+ BLOCK_LENS => $psl->[ blockSizes ],
+ 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 ],
+ BLOCK_COUNT => $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" };
}
+sub psl_put_header
+{
+ # Martin A. Hansen, September 2007.
+
+ # Write a PSL header to file.
+
+ my ( $fh, # file handle - OPTIONAL
+ ) = @_;
+
+ # Returns nothing.
+
+ $fh = \*STDOUT if not $fh;
+
+ print $fh qq(psLayout version 3
+match mis- rep. N's Q gap Q gap T gap T gap strand Q Q Q Q T T T T block blockSizes qStart match match count bases count bases name size start end name size start end count
+---------------------------------------------------------------------------------------------------------------------------------------------------------------
+);
+}
+
+
+sub psl_put_entry
+{
+ # Martin A. Hansen, September 2007.
+
+ # Write a PSL entry to file.
+
+ my ( $record, # hashref
+ $fh, # file handle - OPTIONAL
+ ) = @_;
+
+ # Returns nothing.
+
+ $fh = \*STDOUT if not $fh;
+
+ my @output;
+
+ push @output, $record->{ "MATCHES" };
+ push @output, $record->{ "MISMATCHES" };
+ push @output, $record->{ "REPMATCHES" };
+ push @output, $record->{ "NCOUNT" };
+ push @output, $record->{ "QNUMINSERT" };
+ push @output, $record->{ "QBASEINSERT" };
+ push @output, $record->{ "SNUMINSERT" };
+ push @output, $record->{ "SBASEINSERT" };
+ push @output, $record->{ "STRAND" };
+ push @output, $record->{ "Q_ID" };
+ push @output, $record->{ "Q_LEN" };
+ push @output, $record->{ "Q_BEG" };
+ push @output, $record->{ "Q_END" } + 1;
+ push @output, $record->{ "S_ID" };
+ push @output, $record->{ "S_LEN" };
+ push @output, $record->{ "S_BEG" };
+ push @output, $record->{ "S_END" } + 1;
+ push @output, $record->{ "BLOCK_COUNT" };
+ push @output, $record->{ "BLOCK_LENS" };
+ push @output, $record->{ "Q_BEGS" };
+ push @output, $record->{ "S_BEGS" };
+
+ print $fh join( "\t", @output ), "\n";
+}
+
+
+
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<