Пример #1
0
    def __init__(self,work_path,compact,sample_name,lib_method,data_type):

        self.work_times = 0  # rework times 
        self.result = {}
    
        self.compact = compact
        self.sample_name = sample_name
        self.lib_method = lib_method
        self.data_type = data_type
        # get path
        self.path = {   'QC'    :   '%s/QC'%work_path,
                        'split' :   '%s/Split'%work_path,
                    }
        self.path['compact'] = '%s/%s'%(self.path['QC'],self.compact)
        self.path['sample'] = '%s/%s_%s'%(self.path['compact'],self.sample_name,lib_method)
        try:
            self.check_path()
        except:
            sys.stderr.write('## Permisson ERROR!\t#some problem accured when create path!\n')
            return False

        #get read
        raw_reads_path = '%s/%s/%s'%(self.path['split'],self.compact,self.sample_name)
        try:
            (self.read1,self.read2) = get_reads(raw_reads_path,self.lib_method)
        except:
            sys.stderr.write('### row reads read failed! %s:%s\n'%(self.compact,self.sample_name))
            return False

        #get primer
        self.f_primer,self.r_primer = get_primer(lib_method,data_type)
Пример #2
0
    def __init__(self,work_path,compact,sample_name,lib_method,data_type):

        self.work_times = 0  # rework times 
        self.result = {}
    
        self.compact = compact
        self.sample_name = sample_name
        self.lib_method = lib_method
        self.data_type = data_type
        # get path
        self.path = {   'QC'    :   '%s/QC'%work_path,
                        'split' :   '%s/Split'%work_path,
                    }
        self.path['compact'] = '%s/%s'%(self.path['QC'],self.compact)
        self.path['sample'] = '%s/%s_%s'%(self.path['compact'],self.sample_name,lib_method)
        try:
            self.check_path()
        except:
            sys.stderr.write('## Permisson ERROR!\t#some problem accured when create path!\n')

        #get read
        raw_reads_path = '%s/%s/%s'%(self.path['split'],self.compact,self.sample_name)
        try:
            read1,read2 = get_reads(raw_reads_path,self.lib_method)
            self.read = Reads(read1,read2)
        except Exception,ex:
            sys.stderr.write('%s:%s\n'%(Exception,ex))
Пример #3
0
 def stat_raw_reads(self,compact,data_type,lib_method,sample_name):
     raw_path = '%s/%s/%s'%(self.path['split'],compact,sample_name)
     try:
         (read_file,read_file2) = get_reads(raw_path,lib_method)
         reads_num =  self.get_fq_num(read_file)
         self.sample_struct[compact][data_type][lib_method][sample_name]['raw_reads'] = reads_num
         self.total_reads[lib_method] += reads_num
     except:
         sys.stderr.write('get raw data failed: %s:%s\n'%(compact,sample_name))
         self.sample_struct[compact][data_type][lib_method][sample_name]['raw_reads'] = 0