def best_assemblyfile(self):
        """
        Determine whether the contigs.fasta output file from the assembler is present. If not, set the .bestassembly
        attribute to 'NA'
        """
        for sample in self.metadata:
            try:
                # Set the name of the filtered assembly file
                filtered_outputfile = os.path.join(self.path, 'raw_assemblies', '{}.fasta'.format(sample.name))
                # Set the name of the unfiltered spades assembly output file
                if os.path.isfile(sample.general.assemblyfile):
                    size = os.path.getsize(sample.general.assemblyfile)
                    # Ensure that the assembly isn't just an empty file
                    if size == 0:
                        sample.general.bestassemblyfile = 'NA'
                    else:
                        sample.general.bestassemblyfile = sample.general.assemblyfile
                        shutil.copyfile(sample.general.bestassemblyfile, filtered_outputfile)
                else:
                    sample.general.bestassemblyfile = 'NA'
                # Add the name and path of the filtered file to the metadata
                sample.general.filteredfile = filtered_outputfile
            except AttributeError:
                sample.general.assemblyfile = 'NA'
                sample.general.bestassemblyfile = 'NA'
def best_assemblyfile ( self ) : for sample in self . metadata : try : filtered_outputfile = os . path . join ( self . path , 'raw_assemblies' , '{}.fasta' . format ( sample . name ) ) if os . path . isfile ( sample . general . assemblyfile ) : size = os . path . getsize ( sample . general . assemblyfile ) if size == 0 : sample . general . bestassemblyfile = 'NA' else : sample . general . bestassemblyfile = sample . general . assemblyfile shutil . copyfile ( sample . general . bestassemblyfile , filtered_outputfile ) else : sample . general . bestassemblyfile = 'NA' sample . general . filteredfile = filtered_outputfile except AttributeError : sample . general . assemblyfile = 'NA' sample . general . bestassemblyfile = 'NA'
Determine whether the contigs.fasta output file from the assembler is present. If not, set the .bestassembly
        attribute to 'NA'