flowcraft/templates/assembly_report.py
def _parse_assembly(self, assembly_file):
        """Parse an assembly file in fasta format.

        This is a Fasta parsing method that populates the
        :py:attr:`Assembly.contigs` attribute with data for each contig in the
         assembly.

        Parameters
        ----------
        assembly_file : str
            Path to the assembly fasta file.

        """

        with open(assembly_file) as fh:

            header = None
            logger.debug("Starting iteration of assembly file: {}".format(
                assembly_file))

            for line in fh:

                # Skip empty lines
                if not line.strip():
                    continue

                if line.startswith(">"):
                    # Add contig header to contig dictionary
                    header = line[1:].strip()
                    self.contigs[header] = []

                else:
                    # Add sequence string for the current contig
                    self.contigs[header].append(line.strip())

            # After populating the contigs dictionary, convert the values
            # list into a string sequence
            self.contigs = OrderedDict(
                (header, "".join(seq)) for header, seq in self.contigs.items())
def _parse_assembly(self, assembly_file):
        with open(assembly_file) as fh:

            header = None
            logger.debug("Starting iteration of assembly file: {}".format(
                assembly_file))

            for line in fh:

                # Skip empty lines
                if not line.strip():
                    continue

                if line.startswith(">"):
                    # Add contig header to contig dictionary
                    header = line[1:].strip()
                    self.contigs[header] = []

                else:
                    # Add sequence string for the current contig
                    self.contigs[header].append(line.strip())

            # After populating the contigs dictionary, convert the values
            # list into a string sequence
            self.contigs = OrderedDict(
                (header, "".join(seq)) for header, seq in self.contigs.items())
def _parse_assembly ( self , assembly_file ) : with open ( assembly_file ) as fh : header = None logger . debug ( "Starting iteration of assembly file: {}" . format ( assembly_file ) ) for line in fh : # Skip empty lines if not line . strip ( ) : continue if line . startswith ( ">" ) : # Add contig header to contig dictionary header = line [ 1 : ] . strip ( ) self . contigs [ header ] = [ ] else : # Add sequence string for the current contig self . contigs [ header ] . append ( line . strip ( ) ) # After populating the contigs dictionary, convert the values # list into a string sequence self . contigs = OrderedDict ( ( header , "" . join ( seq ) ) for header , seq in self . contigs . items ( ) )
Parse an assembly file in fasta format.

        This is a Fasta parsing method that populates the
        :py:attr:`Assembly.contigs` attribute with data for each contig in the
         assembly.

        Parameters
        ----------
        assembly_file : str
            Path to the assembly fasta file.
Parse an assembly file in fasta format .