Exemplo n.º 1
0
	def make_index(self):
		if not os.access(self.outdir, os.W_OK):
			mksymlink(self.files, os.path.join(self.indexdir, self.filename))
			files = os.path.join(self.indexdir, self.filename)
		else:
			files = self.files
		return files
Exemplo n.º 2
0
 def make_index(self):
     if not os.access(self.outdir, os.W_OK):
         mksymlink(self.files, os.path.join(self.indexdir, self.filename))
         files = os.path.join(self.indexdir, self.filename)
     else:
         files = self.files
     return files
Exemplo n.º 3
0
	def Step1_Filter(self):
		"""
		Step1 filter adapter, QC
		"""
		filter_tools = SOAPnuke()
		parameters = dict(((i, j) for i, j in self.conf.items('Filter Parameter') if j))
		parameters['clean_fq_type'] = self.conf.get('Sequencing data', 'outputQualitySystem') or 'sanger'
		parameters['qual_sys'] = self.conf.get('Sequencing data', 'qualitySystem') or 'illumina'
		parameters['seq_type'] = self.conf.get('Sequencing data', 'fqnameType') or 'new'
		for lane_number, fastq in self.messages.fq.SequenceData.iteritems():
			command = list()
			lane_name = '%s.lane.%d' % (self.sample, lane_number)
			s_out = os.path.join(self.workdir.Script, "Step1.Filter.{0}.sh".format(lane_name))
			bash = BASH(self.sample, s_out, self.log)
			symdir = os.path.join(self.workdir.RawData, lane_name)
			outdir = os.path.join(self.workdir.CleanData, lane_name)
			qcdir = os.path.join(self.workdir.QC, lane_name)
			parameters['outdir'] = outdir
			if not os.path.exists(symdir):
				os.makedirs(symdir)
			if not os.path.exists(outdir):
				os.makedirs(outdir)
			if not os.path.exists(qcdir):
				os.makedirs(qcdir)
			parameters['fq1'] = fastq[0][0]
			parameters['clean_fq1'] = "%s.lane.%d.clean.1.fq.gz" % (self.sample, lane_number)
			mksymlink(parameters['fq1'], os.path.join(symdir, os.path.basename(parameters['fq1'])))
			if fastq[0][1]:
				parameters['adapter1'] = fastq[0][1]
				mksymlink(parameters['adapter1'], os.path.join(symdir, os.path.basename(parameters['adapter1'])))
			else:
				parameters['adapter1'] = None
			if len(fastq) == 2:
				parameters['fq2'] = fastq[1][0]
				mksymlink(parameters['fq2'], os.path.join(symdir, os.path.basename(parameters['fq2'])))
				parameters['clean_fq2'] = "%s.lane.%d.clean.2.fq.gz" % (self.sample, lane_number)
				if fastq[1][1]:
					parameters['adapter2'] = fastq[1][1]
					mksymlink(parameters['adapter2'], os.path.join(symdir, os.path.basename(parameters['adapter2'])))
				else:
					parameters['adapter2'] = None
			command.append(bash.stat_command_formact(filter_tools.filter(**parameters),
			                                         'Step1 filter lane %d' % lane_number))
			command.append("mv %s/*.txt %s" % (outdir, qcdir))
			bash.write(bash.bash_header_and_foot(command, 'Step1 filter lane %d' % lane_number))
			bash.close()
Exemplo n.º 4
0
    def Step1_Filter(self):
        """
		Step1 filter adapter, QC
		"""
        filter_tools = SOAPnuke()
        parameters = dict(
            ((i, j) for i, j in self.conf.items('Filter Parameter') if j))
        parameters['clean_fq_type'] = self.conf.get(
            'Sequencing data', 'outputQualitySystem') or 'sanger'
        parameters['qual_sys'] = self.conf.get('Sequencing data',
                                               'qualitySystem') or 'illumina'
        parameters['seq_type'] = self.conf.get('Sequencing data',
                                               'fqnameType') or 'new'
        for lane_number, fastq in self.messages.fq.SequenceData.iteritems():
            command = list()
            lane_name = '%s.lane.%d' % (self.sample, lane_number)
            s_out = os.path.join(self.workdir.Script,
                                 "Step1.Filter.{0}.sh".format(lane_name))
            bash = BASH(self.sample, s_out, self.log)
            symdir = os.path.join(self.workdir.RawData, lane_name)
            outdir = os.path.join(self.workdir.CleanData, lane_name)
            qcdir = os.path.join(self.workdir.QC, lane_name)
            parameters['outdir'] = outdir
            if not os.path.exists(symdir):
                os.makedirs(symdir)
            if not os.path.exists(outdir):
                os.makedirs(outdir)
            if not os.path.exists(qcdir):
                os.makedirs(qcdir)
            parameters['fq1'] = fastq[0][0]
            parameters['clean_fq1'] = "%s.lane.%d.clean.1.fq.gz" % (
                self.sample, lane_number)
            mksymlink(
                parameters['fq1'],
                os.path.join(symdir, os.path.basename(parameters['fq1'])))
            if fastq[0][1]:
                parameters['adapter1'] = fastq[0][1]
                mksymlink(
                    parameters['adapter1'],
                    os.path.join(symdir,
                                 os.path.basename(parameters['adapter1'])))
            else:
                parameters['adapter1'] = None
            if len(fastq) == 2:
                parameters['fq2'] = fastq[1][0]
                mksymlink(
                    parameters['fq2'],
                    os.path.join(symdir, os.path.basename(parameters['fq2'])))
                parameters['clean_fq2'] = "%s.lane.%d.clean.2.fq.gz" % (
                    self.sample, lane_number)
                if fastq[1][1]:
                    parameters['adapter2'] = fastq[1][1]
                    mksymlink(
                        parameters['adapter2'],
                        os.path.join(symdir,
                                     os.path.basename(parameters['adapter2'])))
                else:
                    parameters['adapter2'] = None
            command.append(
                bash.stat_command_formact(filter_tools.filter(**parameters),
                                          'Step1 filter lane %d' %
                                          lane_number))
            command.append("mv %s/*.txt %s" % (outdir, qcdir))
            bash.write(
                bash.bash_header_and_foot(command, 'Step1 filter lane %d' %
                                          lane_number))
            bash.close()