Mercurial > repos > artbio > small_rna_signatures
diff overlapping_reads.py @ 4:20d28cfdeefe draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit cfdc08418887bfe4a35588cd78d0a2b6ffa6e19e
author | artbio |
---|---|
date | Fri, 08 Sep 2017 04:44:22 -0400 |
parents | 4d9682bd3a6b |
children | a7fd04208764 |
line wrap: on
line diff
--- a/overlapping_reads.py Sat Sep 02 06:35:15 2017 -0400 +++ b/overlapping_reads.py Fri Sep 08 04:44:22 2017 -0400 @@ -51,10 +51,10 @@ for read in bam_object.fetch(chrom): if not read.is_reverse: all_query_positions[chrom].append( - read.get_reference_positions(full_length=True)[0]) + read.reference_start) else: all_query_positions[chrom].append( - read.get_reference_positions(full_length=True)[-1]) + read.reference_end) all_query_positions[chrom] = sorted( list(set(all_query_positions[chrom]))) return all_query_positions @@ -77,42 +77,38 @@ start=pos, end=pos+overlap-1) # 1 for queryread in iterreads_1: - if queryread.get_reference_positions( - full_length=True)[0] == pos and \ + if queryread.reference_start == pos and \ queryread.query_alignment_length in query_range \ and not queryread.is_reverse: for targetread in iterreads_2: if (targetread. - get_reference_positions(full_length=True)[-1] + get_reference_positions()[-1] == queryread.get_reference_positions( - full_length=True)[overlap-1] and + )[overlap-1] and targetread.query_alignment_length in target_range and targetread.is_reverse): targetreadseq = self.revcomp( targetread.query_sequence) stringresult.append( '>%s|%s|%s|%s|n=%s\n%s\n' % - (chrom, queryread.get_reference_positions( - full_length=True)[0]+1, + (chrom, queryread.reference_start+1, 'F', queryread.query_alignment_length, self.readdic[queryread.query_sequence], queryread.query_sequence)) stringresult.append( '>%s|%s|%s|%s|n=%s\n%s\n' % - (chrom, targetread.get_reference_positions( - full_length=True)[0]+1, + (chrom, targetread.reference_start+1, 'R', targetread.query_alignment_length, self.readdic[targetread.query_sequence], targetreadseq)) # 2 for queryread in iterreads_3: - if queryread.get_reference_positions( - full_length=True)[-1] == pos+overlap-1 and \ + if queryread.reference_end-1 == pos+overlap-1 and \ queryread.query_alignment_length in query_range \ and queryread.is_reverse: for targetread in iterreads_4: if (targetread. - get_reference_positions(full_length=True)[0] + reference_start == pos and targetread.query_alignment_length in target_range and not targetread.is_reverse): @@ -121,15 +117,13 @@ targetreadseq = targetread.query_sequence stringresult.append( '>%s|%s|%s|%s|n=%s\n%s\n' % - (chrom, queryread.get_reference_positions( - full_length=True)[0]+1, 'R', + (chrom, queryread.reference_start+1, 'R', queryread.query_alignment_length, self.readdic[queryread.query_sequence], queryreadseq)) stringresult.append( '>%s|%s|%s|%s|n=%s\n%s\n' % - (chrom, targetread.get_reference_positions( - full_length=True)[0]+1, + (chrom, targetread.reference_start+1, 'F', targetread.query_alignment_length, self.readdic[targetread.query_sequence], targetreadseq))