Links .fastq files created above to :sequencepath

def fastqmover(self):
        """Links .fastq files created above to :sequencepath"""
        # Create the sequence path if necessary
        make_path(self.sequencepath)
        # Iterate through all the sample names
        for sample in self.metadata.samples:
            # Make directory variables
            outputdir = os.path.join(self.sequencepath, sample.name)
            # Demultiplexed files will be present in the project name subfolder within the fastq destination folder
            if self.demultiplex:
                glob_dir = self.projectpath
            # Undemultiplexed reads (Undetermined_S0_R1_001.fastq.gz) are present in the fastq destination folder
            else:
                glob_dir = self.fastqdestination
            # Sometimes the files are put in self.fastqdestination rather than self.projectpath? Matt has this problem
            # and I don't understands what's going on
            if not os.path.isdir(glob_dir):
                glob_dir = os.path.dirname(glob_dir)
            # Glob all the .gz files in the subfolders - projectpath/Sample_:sample.name/*.gz
            for fastq in sorted(glob(os.path.join(glob_dir, '*.gz'))):
                fastqname = os.path.basename(fastq)
                # Set the name of the destination file
                outputfile = os.path.join(self.sequencepath, fastqname)
                # Link the file if it doesn't already exist
                if not os.path.isfile(outputfile):
                    relative_symlink(src_file=fastq,
                                     output_dir=self.sequencepath)
            # Repopulate .strainfastqfiles with the freshly-linked/copied files
            if self.demultiplex:
                fastqfiles = glob(os.path.join(self.sequencepath, '{}*.fastq*'.format(sample.name)))
                fastqfiles = sorted([fastq for fastq in fastqfiles if 'trimmed' not in os.path.basename(fastq)])
            # Undemultiplexed files will not have the sample name in the file name
            else:
                fastqfiles = sorted(glob(os.path.join(glob_dir, '*.gz')))
            # Populate the metadata object with the name/path of the fastq files
            sample.general.fastqfiles = fastqfiles
            # Save the outputdir to the metadata object
            sample.run.outputdirectory = outputdir
            sample.general.outputdirectory = outputdir
            sample.general.bestassemblyfile = True
            sample.general.trimmedcorrectedfastqfiles = sorted(sample.general.fastqfiles)
            sample.general.logout = os.path.join(sample.general.outputdirectory, 'logout')
            sample.general.logerr = os.path.join(sample.general.outputdirectory, 'logerr')
            sample.commands = GenObject()