def main(recordFilenames, fastaFilename, title, xRange, eRange): """ Prints the reads that are at a specified offset with a specified evalue. recordFilename: the result of a blast run, using outfmt 5. fastaFilename: the fastafile that was originally blasted. title: the title of the subject sequence, as output by BLAST. ranges: The first parameter must be a number of an interval on the x-axis from where the reads should be searched. The second parameter is optional and should be a converted value or an interval of converted evalues. """ blastRecords = BlastRecords(recordFilenames, fastaFilename) hits = blastRecords.filterHits(whitelist=set([title]), negativeTitleRegex='.') if title not in hits.titles: print '%s: Title %r not found in BLAST output' % (sys.argv[0], title) sys.exit(3) hits.computePlotInfo() items = hits.titles[title]['plotInfo']['items'] for item in items: hsp = item['hsp'] if ((xRange is None or (xRange[0][0] <= hsp['subjectEnd'] and xRange[0][1] >= hsp['subjectStart'])) and (eRange is None or (eRange[0][0] <= item['convertedE'] <= eRange[0][1]))): print ('query: ', hits.fasta[item['readNum']].id, 'start: ', hsp['subjectStart'], 'end: ', hsp['subjectEnd'], 'E-value: ', item['convertedE'])
#!/usr/bin/env python """ This script needs work! Or will we never use it again? There should be a --find option, or something. """ from __future__ import print_function from dark.blast import BlastRecords from dark.graphics import evalueGraph if __name__ == '__main__': import sys if len(sys.argv) < 2: print('Usage: %s BLAST-hitfile...' % sys.argv[0], file=sys.stderr) else: blastRecords = BlastRecords(sys.argv[1:]) evalueGraph(blastRecords.records(), 10, 10, find=lambda title: title.find('HKU4') > -1 and title.find('complete genome') > -1, titles=False)
#!/usr/bin/env python from __future__ import print_function from dark.blast import BlastRecords from dark.blast.records import printBlastRecordForDerek if __name__ == '__main__': import sys if len(sys.argv) < 2: print('Usage: %s hitfiles...' % sys.argv[0], file=sys.stderr) else: blastRecords = BlastRecords(sys.argv[1:]) hits = 0 for i, result in enumerate(blastRecords.records(), start=1): oldHits = hits hits += printBlastRecordForDerek(result)
#!/usr/bin/env python import sys from dark.blast import BlastRecords if len(sys.argv) < 3: print >>sys.stderr, ( 'Usage: %s title record-file.(xml|json)...' % sys.argv[0]) sys.exit(1) else: title = sys.argv[1] blastRecords = BlastRecords(sys.argv[2:]) hits = blastRecords.filterHits(whitelist=set([title]), negativeTitleRegex='.') if title in hits.titles: print hits.titles[title] else: print 'Title %r was not hit by any reads.' % title
#!/usr/bin/env python from __future__ import print_function import sys from dark.blast import BlastRecords if len(sys.argv) < 3: print('Usage: %s title record-file.(xml|json)...' % sys.argv[0], file=sys.stderr) sys.exit(1) else: title = sys.argv[1] blastRecords = BlastRecords(sys.argv[2:]) hits = blastRecords.filterHits(whitelist=set([title]), negativeTitleRegex='.') if title in hits.titles: print(hits.titles[title]) else: print('Title %r was not hit by any reads.' % title)