more from around line 77
coord = read.reference_start
pol = 'F'
dic[(chrom, coord, pol)].append(read.query_sequence)
for key in dic:
dic[key] = set(dic[key])
return dic
def query_positions(self, bam_object, overlap):
all_query_positions = defaultdict(list)
for genomicKey in self.alignement_dic.keys():
chrom, coord, pol = genomicKey
if pol == 'F' and len(self.alignement_dic[(chrom,
coord+overlap-1,
'R')]) > 0:
all_query_positions[chrom].append(coord)
for chrom in all_query_positions:
all_query_positions[chrom] = sorted(
list(set(all_query_positions[chrom])))
return all_query_positions
def pairing(self):
F = open(self.output, 'w')
query_range = self.query_range
target_range = self.target_range
overlap = self.overlap
stringresult = []
header_template = '>%s|coord=%s|strand %s|size=%s|nreads=%s\n%s\n'
for chrom in sorted(self.chromosomes):
for pos in self.all_query_positions[chrom]:
stringbuffer = []
uppers = self.alignement_dic[chrom, pos, 'F']
lowers = self.alignement_dic[chrom, pos+overlap-1, 'R']
if uppers and lowers:
for upread in uppers:
Your
overlapping_reads.pycode would be helpful :) ThanksAnd your python version.
python version is Python 3.6.3. overlap.py code is bellow. I have tried to down grade the python but the 3.6.3 still shows in my terminal. couldn't paste the entire code because of the number of characters. this is only part of the code.
Can you just give us a link to github or something? BTW, the function you posted isn't terribly informative for your question.