def getLaTeXReport(self): table = LaTeX.ltxTable(2) table.addRow(["Total bp: ","{:,}".format(self.totalBp)]) table.addRow(["Peak: ",str(self.peak)]) table.addRow(["Mean base coverage: ", "{:.2f}".format(self.coverage)]) table.addRow(["",""]) table.addRow(["Unique good kmers: ","{:,}".format(self.unique_gkmers)]) table.addRow(["BGI genome size estimation: ", "{:,}".format(int(round(self.bgi)))]) table.addRow(["GSE kmers/peak: ","{:,}".format(self.kmersPerPeak)]) tex = table.getText() img = LaTeX.ltxImage(self.genSizeHistoPlot) tex = tex + img.getText() return tex
def getLaTeXReport(self): txt = "\\section{Fastqc of " +self.status.replace("_"," ")+"}\n" table = False imgs = 0 with open(self.outputFile) as reportReader: for line in reportReader: if "</h2>" in line and "Summary" not in line: txt = txt + "\\subsection*{"+re.findall(r"]\">(.*?)</h2>",line)[0]+"}\n" # if "Basic Statistics" in line: # smallReport = FastqSmallReport.FastqSmallReport() # smallReport.createSmallReport([self.forward], None) # txt = txt + smallReport.getLaTeXReport() # txt = txt + "\\\\" elif "<table>" in line: xml = "<table>" table = True elif "</table>" in line: xml = xml + "</table>" table = False domTable = minidom.parseString(xml) ltxTable = LaTeX.ltxTable(len(domTable.firstChild.firstChild.childNodes)) noOfRows = 0 for row in domTable.firstChild.childNodes: cols = [] noOfRows = noOfRows + 1 if noOfRows > 15: continue for col in row.childNodes: cols.append(col.firstChild.nodeValue.replace("%"," percent")) if "Filename" in cols[0]: continue ltxTable.addRow(cols) txt = txt + ltxTable.getText() if noOfRows > 15: txt = txt + "\\\\Total length of this table is "+ str(noOfRows) + ". The table is cut after 15 rows..." elif table == True: xml = xml + line.strip() elif "<img class=\"indented\"" in line: imgs = imgs +1 img = re.findall("src=\"(.*)\" alt=",line)[0] ltxImg = LaTeX.ltxImage(os.path.dirname(self.outputFile) + "/" + img) txt = txt + ltxImg.getText() if imgs % 2 == 0: txt = txt + "\\clearpage\n" return txt