parameters: (self)
return_statement: return '\t'.join(sam_parts) + '\n'
docstring: Returns a SAM alignment line.
docstring_summary: Returns a SAM alignment line.
docstring_tokens: Returns a SAM alignment line .
function: def get_sam_line(self):
          """
          Returns a SAM alignment line.
          """
          sam_parts = [self.read.name]  # Query template name
          if self.rev_comp:
              sam_parts.append('16')  # Bitwise flag
          else:
              sam_parts.append('0')  # Bitwise flag
          sam_parts.append(self.ref.name)  # Reference sequence name
          sam_parts.append(str(self.ref_start_pos + 1))  # 1-based leftmost mapping position
          sam_parts.append('255')  # Mapping quality (255 means unavailable)
          sam_parts.append(''.join(self.cigar_parts))  # CIGAR string
          sam_parts.append('*')  # Ref. name of the mate/next read (* means unavailable)
          sam_parts.append('0')  # Position of the mate/next read (0 means unavailable)
          sam_parts.append('0')  # Observed template length (0 means unavailable)
  
          if self.rev_comp:
              sam_parts.append(reverse_complement(self.read.sequence))  # Segment sequence
              sam_parts.append(self.read.qualities[::-1])  # ASCII of Phred-scaled base quality+33
          else:
              sam_parts.append(self.read.sequence)  # Segment sequence
              sam_parts.append(self.read.qualities)  # ASCII of Phred-scaled base quality+33
  
          sam_parts.append('AS:i:' + str(self.raw_score))  # Alignment score generated by aligner
  
          edit_distance = self.mismatch_count + self.insertion_count + self.deletion_count
          sam_parts.append('NM:i:' + str(edit_distance))  # Edit distance to the reference, including
          # ambiguous bases but excluding clipping
          return '\t'.join(sam_parts) + '\n'
function_tokens: def get_sam_line ( self ) : sam_parts = [ self . read . name ] # Query template name if self . rev_comp : sam_parts . append ( '16' ) # Bitwise flag else : sam_parts . append ( '0' ) # Bitwise flag sam_parts . append ( self . ref . name ) # Reference sequence name sam_parts . append ( str ( self . ref_start_pos + 1 ) ) # 1-based leftmost mapping position sam_parts . append ( '255' ) # Mapping quality (255 means unavailable) sam_parts . append ( '' . join ( self . cigar_parts ) ) # CIGAR string sam_parts . append ( '*' ) # Ref. name of the mate/next read (* means unavailable) sam_parts . append ( '0' ) # Position of the mate/next read (0 means unavailable) sam_parts . append ( '0' ) # Observed template length (0 means unavailable) if self . rev_comp : sam_parts . append ( reverse_complement ( self . read . sequence ) ) # Segment sequence sam_parts . append ( self . read . qualities [ : : - 1 ] ) # ASCII of Phred-scaled base quality+33 else : sam_parts . append ( self . read . sequence ) # Segment sequence sam_parts . append ( self . read . qualities ) # ASCII of Phred-scaled base quality+33 sam_parts . append ( 'AS:i:' + str ( self . raw_score ) ) # Alignment score generated by aligner edit_distance = self . mismatch_count + self . insertion_count + self . deletion_count sam_parts . append ( 'NM:i:' + str ( edit_distance ) ) # Edit distance to the reference, including # ambiguous bases but excluding clipping return '\t' . join ( sam_parts ) + '\n'