TRON-Bioinformatics / seq2HLA

In-silico method written in Python and R to determine HLA genotypes of a sample. seq2HLA takes standard RNA-Seq sequence reads in fastq format as input, uses a bowtie index comprising all HLA alleles and outputs the most likely HLA class I and class II genotypes (in 4 digit resolution), a p-value for each call, and the expression of each class.
MIT License
46 stars 7 forks source link

version 2.3 error #15

Open gengbaobao opened 10 months ago

gengbaobao commented 10 months ago

Hello developer

When I run seq2hla.py version 2.3, I get this error:

Traceback (most recent call last): File "/home/gbb/tools/seq2HLA-master/seq2HLA.py", line 791, in main() File "/home/gbb/tools/seq2HLA-master/seq2HLA.py", line 786, in main pipe.run() File "/home/gbb/tools/seq2HLA-master/seq2HLA.py", line 140, in run self.call_HLA( File "/home/gbb/tools/seq2HLA-master/seq2HLA.py", line 252, in call_HLA self.expression(locus_list, length_dict, map, run_name) File "/home/gbb/tools/seq2HLA-master/seq2HLA.py", line 694, in expression totalreads = float(linecache.getline(logfile, 1).split(':')[1]) IndexError: list index out of range

powerinformatics commented 7 months ago

Reason

Here is an extral first line exists in the .bowtielog file. The code 'totalreads = ...' want to extract the reads number from the 1st line in logfile. But actually the 1st line is a warning messages, the wanted numbers were export to 2nd line. See example here https://github.com/TRON-Bioinformatics/seq2HLA/issues/1#issuecomment-847477646

Solution

modify codes related to this issue in seq2HLA.py.

Way 1 - inhibit warning messages (recommanded).

If you are familiar with bowtie, located "mapping_cmd = ..." lines (should be at line372/374/376), then add '-x ' argument before bowtiebuild.

#mapping_cmd = "(bowtie -3 {} -S {} --al {}.aligned {} -1 {} -2 {} |  awk -F \'\\t\' '$3 != \"*\"{{ print $0 }}' > {}) 2> {}.bowtielog".format(self.trim3, mapopt, run_name, bowtiebuild, fq1, fq2, sam, run_name)
mapping_cmd = "(bowtie -3 {} -S {} --al {}.aligned -x {} -1 {} -2 {} |  awk -F \'\\t\' '$3 != \"*\"{{ print $0 }}' > {}) 2> {}.bowtielog".format(self.trim3, mapopt, run_name, bowtiebuild, fq1, fq2, sam, run_name) #add -x argument

Way 2 - skip warning messages.

Feed correct line number to linecache.getline() function.

#totalreads = float(linecache.getline(logfile, 1).split(':')[1])
totalreads = float(linecache.getline(logfile, 2).split(':')[1]) #load line2