コード例 #1
0
ファイル: pileup_user.py プロジェクト: Heanthor/rosalind
def main():
    global pileup
    reference = read_fa_file("data/reference.fa")
    reads = read_fa_file("data/reads.fa")
    # initialize object
    am = ApproximateMatcher(reference)
    pileup = PileUp(reference)
    d = 3
    for read in reads:
        # find matching positions for a given read
        # assumes positions is a list (even if only a single match is found)
        # with matching positions
        positions = am.get_matches(read, d)
        if len(positions) > 0:
            # add to pileup object
            pileup.insert(positions, read)

    # prints out mismatching positions
    # output is:
    # (<position>, <reference_character>, [(<variant_character>,
    # <num_times_aligned>)])
    # argument filters mismatch by frequency in which variant character
    # is observe, e.g., .01 means variant character has to be seen at least
    # once for every 100 aligned nucleotides
    pileup.print_mismatches(.01)
コード例 #2
0
def main(filename):
    text, patterns, d = readdat(filename)

    # initialize approximate matcher
    am = ApproximateMatcher(text)

    # find approximate matches for each pattern
    indices = []
    for pattern in patterns:
        indices += am.get_matches(pattern, d)

    print ' '.join(map(str, sorted(indices)))
コード例 #3
0
def main(filename):
    text, patterns, d = readdat(filename)

    # initialize approximate matcher
    am = ApproximateMatcher(text)

    # find approximate matches for each pattern
    indices = []
    for pattern in patterns:
        if not debug:
            indices += am.get_matches(pattern, d)
        else:
            indices += am._bwt.get_matches(pattern)
    print ' '.join(map(str, sorted(indices)))
コード例 #4
0
from pileup import PileUp
from approximate_matcher import ApproximateMatcher
import sys

# import the fasta files
f = open(sys.argv[1], 'r')
g = open(sys.argv[2], 'r')
reference = ""
for line in f:
    reference += line.rstrip()
reads = (g.readline()).rstrip().split()

reference.rstrip()
print reference[822:835]
# initialize object
am = ApproximateMatcher(reference)
pileup = PileUp(reference)
d = 3

for read in reads:
    # find matching positions for a given read
    # assumes positions is a list (even if only a single match is found)
    # with matching positions
    positions = am.get_matches(read, d)
    if len(positions) > 0:
        # add to pileup object
        pileup.insert(positions, read)

# prints out mismatching positions
# output is:
# (<position>, <reference_character>, [(<variant_character>,