BlatTest.py -

Author:Andreas Heger
Release:$Id$
Date:December 09, 2013
Tags:Python

Code

exception BlatTest.Error

Bases: exceptions.Exception

Base class for exceptions in this module.

exception BlatTest.ParsingError(message, line=None)

Bases: BlatTest.Error

Exception raised for errors while parsing

Attributes:
message – explanation of the error
class BlatTest.Match

a psl match.

Block coordinates are on the forward strand for target and on the forward/reverse strand for the query depending on the strand.

The fields mQueryFrom/To and mSbjctFrom/To are always on the forward strand.

convertCoordinates()

convert coordinates.

This rescales the block positions so that they start at 0 and converts the query to forward and the sbjct to forward/reverse coordinates.

About the psl psl format from the manual at http://genome.ucsc.edu/google/goldenPath/help/pslSpec.html

‘’’ In general the coordinates in psl files are “zero based half open.” The first base in a sequence is numbered zero rather than one. When representing a range the end coordinate is not included in the range. Thus the first 100 bases of a sequence are represented as 0-100, and the second 100 bases are represented as 100-200.

There is a another little unusual feature in the .psl format. It has to do with how coordinates are handled on the negative strand. In the qStart/qEnd fields the coordinates are where it matches from the point of view of the forward strand (even when the match is on the reverse strand). However on the qStarts[] list, the coordinates are reversed. ‘’‘

I want to work in forward coordinates for the query and forward/reverse coordinates for the sbjct.

For a negative strand match, the following is done:
  • invert mSbjctFrom and mSbjctTo with mSbjctLength
  • add block sizes to mQueryStarts and mSbjctStarts
  • invert mQueryStarts and mSbjctStarts
  • reverse blocksize, mQueryStarts and mSbjctStarts
switchTargetStrand()

switch the target strand.

Use in cases in which a feature has been defined on the negative target strand with reverse coordinates. The result will be the same alignment using forward coordinates on the target.

This method will also update the query strand and coordinates.

fromMaq(maq)

build BLAT entry from a MAQ match.

see Maq.py

getBlocks()

return a list of aligned blocks.

getMapQuery2Target()

return a map between query to target.

If the strand is “-”, the coordinates for query are on the negative strand.

getMapTarget2Query()

return a map between target to query.

If the strand is “-”, the coordinates for query are on the negative strand.

fromMap(map_query2target, use_strand=None)

return a map between query to target.

fromPair(query_start, query_size, query_strand, query_seq, target_start, target_size, target_strand, target_seq)

fill from two aligned sequences.

Note that sequences are case-sensitive.

BlatTest.iterator(infile)

iterate over the contents of a psl file.

BlatTest.iterator_pslx(infile)

iterate over the contents of a pslx file.

BlatTest.iterator_target_overlap(infile, merge_distance)

iterate over psl formatted infile and return blocks of target overlapping alignments.

BlatTest.iterator_query_overlap(infile, merge_distance)

iterate over psl formatted infile and return blocks of target overlapping alignments.

BlatTest.iterator_test(infile, report_step=100000)

only output parseable lines from infile.

BlatTest.iterator_per_query(iterator_psl)

iterate over the contents of a psl file per query

Table Of Contents

Previous topic

<no title>

Next topic

CBioPortal.py - Interface with the Sloan-Kettering cBioPortal webservice

This Page