def compare(self): errornum=0 errormsg='' [filenum,msg]=PathJF.check_pathlist(self.brespath,self.nrespath,'Novel','result.txt') if msg !='': return [0, msg,self.testcaseid] else: print str(filenum)+" result.txt file needs to be checked" for i in range(len(self.brespath)): [errornum1, errormsg1]=FileOverlap.CompFiles(Configurations_param.fusion_overlap_result_toler,self.brespath[i],self.nrespath[i],[0,1,2,3,4,5,6],' ') # result.txt checking self.testcaseid.append(76745) errornum=errornum+errornum1 errormsg=errormsg+'\n'+errormsg1 [filenum,msg]=PathJF.check_pathlist(self.bfuspath,self.nfuspath,'Novel','fusion.out') if filenum==0: # if there is no file in baseline print msg return [0, '',self.testcaseid] elif filenum !=0 and msg !='': # if there is file in baseline but not equal number of file in baseline and run foler return [1,msg,self.testcaseid] else: for i in range(len(self.bfuspath)): print "checking the fusion.out file under tophat_main: "+ self.bfuspath[i]+self.nfuspath[i] [errornum2, errormsg2]=FileOverlap.CompFiles(Configurations_param.fusion_overlap_fusionout_toler,self.bfuspath[i],self.nfuspath[i],[0,1,2,3,4,5,6],' ') # fusion.out checking self.testcaseid.append(76746) errornum=errornum+errornum2 errormsg=errormsg+'\n'+errormsg2 if errornum>0: return [1,'Fusion calling error: '+errormsg1+'\n'+errormsg2,self.testcaseid] else: return [0, '',list(set(self.testcaseid))]
def __init__(self,bpath,npath): print "********************\n",strftime("%Y-%m-%d %H:%M:%S", gmtime()),"Start Variant calling Checking" self.bpath=bpath self.npath=npath self.name='Variantcalling' self.testcaseid=[] self.bvcfpath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'genome.vcf.gz','variants') self.nvcfpath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'genome.vcf.gz','variants')
def __init__(self, bpath,npath): print "********************\n",strftime("%Y-%m-%d %H:%M:%S", gmtime()),"Start ReadFiltering" self.bpath=bpath self.npath=npath self.name='ReadFiltering' self.testcaseid=[] self.bfilterpath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'fastq.gz.info','filtered') self.nfilternpath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'fastq.gz.info','filtered')
def __init__(self, bpath,npath): print "********************\n",strftime("%Y-%m-%d %H:%M:%S", gmtime()),"Start Fusion calling Checking" self.bpath=bpath self.npath=npath self.name='Novel' self.testcaseid=[] self.brespath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'result.txt','tophat_fusion') self.bfuspath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'fusion.out','tophat_main') self.nrespath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'result.txt','tophat_fusion') self.nfuspath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'fusion.out','tophat_main')
def __init__(self, bpath,npath): print "********************\n",strftime("%Y-%m-%d %H:%M:%S", gmtime()),"Start Differentail Expression Checking" self.bpath=bpath self.npath=npath self.name='DiffExp' self.testcaseid=[] self.bgenjsonpath=PathJF.getfullname_parent(os.path.join(self.bpath,'differential'),'Genes.json','cuffdiff') # find all the Genes.json file under the diffential folder self.btranjsonpath=PathJF.getfullname_parent(os.path.join(self.bpath,'differential'),'Transcripts.json','cuffdiff') # find all the Transcripts.json file under the diffential folder self.ngenjsonpath=PathJF.getfullname_parent(os.path.join(self.npath,'differential'),'Genes.json','cuffdiff') self.ntranjsonpath=PathJF.getfullname_parent(os.path.join(self.npath,'differential'),'Transcripts.json','cuffdiff')
def compare(self): [errornum,errormsg]=PathJF.folderchecking(self.bpath,self.npath) #Test if both two folders exist and the total number of folder is the same self.testcaseid.append(76303) if errornum >0: return [errornum,errormsg,76303] [errornum,errormsg]=PathJF.filechecking(self.bpath,self.npath) #1. Test if the total number of files is the same. 2. Test if the difference of the filesize beyone tolerance self.testcaseid.append(76620) self.testcaseid.append(76313) if errornum >0: return [errornum,errormsg,[76620,76313]] [errornum,errormsg]=PathJF.csvchecking(self.bpath,self.npath) #Test if the content in the index.html is the identical or in tolerance range. self.testcaseid.append(76691) if errornum >0: return [errornum,errormsg,76691] #[errornum,errormsg]=PathJF.imagechecking(self.bpath,self.npath) #Test if the difference of two set of images are in tolerance range. #self.testcaseid.append(77984) if errornum >0: return [errornum,errormsg,77984] return [0, '',list(set(self.testcaseid))]
def __init__(self, bpath,npath): print "********************\n",strftime("%Y-%m-%d %H:%M:%S", gmtime()),"Start Novel Transcript Checking" self.bpath=bpath self.npath=npath self.testcaseid=[] self.name='Novel assemblies' self.bisopath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'isoforms.fpkm_tracking','novel') self.bgenepath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'genes.fpkm_tracking','novel') self.bgtfpath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'merged.gtf','cuffmerge') self.nisopath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'isoforms.fpkm_tracking','novel') self.ngenepath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'genes.fpkm_tracking','novel') self.ngtfpath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'merged.gtf','cuffmerge')
def __init__(self, bpath,npath): print "********************\n",strftime("%Y-%m-%d %H:%M:%S", gmtime()),"Start Alignment Checking" self.bpath=bpath self.npath=npath self.name='Alignment' self.testcaseid=[] self.bsamalignpath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'Metrics.csv','sampled_alignment') self.nsamalignpath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'Metrics.csv','sampled_alignment') self.bfullaligpath=PathJF.getfullname_parent(os.path.join(self.bpath,'samples'),'Metrics.csv','full_alignment') self.nfullaligpath=PathJF.getfullname_parent(os.path.join(self.npath,'samples'),'Metrics.csv','full_alignment') self.bbampath=PathJF.getfullname(self.npath,'bam') # file all the bam files self.nbampath=PathJF.getfullname(self.bpath,'bam')
def getio(argv): baselinefolder ='' newfolder = '' testresultfolder = '' if argv == None or len(argv) == 0: print 'main.py -b <baseline run folder> -n <new run folder> -o <test result folder>' sys.exit(1) try: opts, args = getopt.getopt(argv,"hb:n:o:",["baselinefolder=","newfolder=","testresultfolder="]) except getopt.GetoptError: print 'main.py -b <baseline run folder> -n <new run folder> -o <test result folder>' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'main.py -b <baseline run folder> -n <new run folder) -o <test result folder>' sys.exit(3) if opt in ("-b", "--baselinefolder"): baselinefolder = arg if opt in ("-n", "--newfolder"): newfolder = arg if opt in ("-o", "--testresultfolder"): testresultfolder = PathJF.namebytime(arg) if not os.path.isdir(testresultfolder): try: os.makedirs(testresultfolder) except OSError: print "can't make the test result folder" sys.exit(4) if os.path.exists(baselinefolder) and os.path.exists(newfolder): print 'baseline run folder is ', baselinefolder print 'new run folder is ', newfolder print 'test result folder is ', testresultfolder return [baselinefolder,newfolder,testresultfolder] else: print 'can not find the input baseline folder or new run folder!' print 'Usage: main.py -b <baseline run folder> -n <new run folder>' sys.exit(5)