code: def build_one(self, object, lines, fasta, fw, newagp=None):
          
          components = []
  
          total_bp = 0
          for line in lines:
  
              if line.is_gap:
                  seq = 'N' * line.gap_length
                  if newagp:
                      print(line, file=newagp)
              else:
                  seq = fasta.sequence(dict(chr=line.component_id,
                          start=line.component_beg,
                          stop=line.component_end,
                          strand=line.orientation))
                  # Check for dangling N's
                  if newagp:
                      trimNs(seq, line, newagp)
  
              components.append(seq)
              total_bp += len(seq)
  
              if self.validate:
                  assert total_bp == line.object_end, \
                          "cumulative base pairs (%d) does not match (%d)" % \
                          (total_bp, line.object_end)
  
          if not newagp:
              rec = SeqRecord(Seq(''.join(components)), id=object, description="")
              SeqIO.write([rec], fw, "fasta")
              if len(rec) > 1000000:
                  logging.debug("Write object %s to `%s`" % (object, fw.name))
docs: Construct molecule using component fasta sequence