I have just started using srst this week and I think it is great!
However I think that there might be a minor bug in srst.py. Basically, it crashes when it can't find a particular allele. Having looked at the code I believe that this is because the location of samtools.pl is incorrect, all of the installation of samtools that I have worked with hold this perl script in the misc folder rather than with the samtools executable.
I guess the user can move samtools.pl up a directory or modify the script to point to the correct place.
I hope that this is useful.
Thanks,
Emily
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am also finding a similar error. I really want it to work, so I am debugging it now with my limited knowledge of Python. I believe that it is due to using samtools.pl to generate a fastq file (and also, the samtools.pl path is incorrect; you are right). However, the authors should use the command that Samtools recommends:
I fixed the script by altering the following subroutine. In essence, samtools is not being used correctly. I believe that the current version of SRST does not support the newest version of samtools, and this should help.
Additionally, I added the following lines near line 430 denoted with #LK
whilepos<here:holes+=1pos+=1iflen(t)<5:#LKt.append("")#LKv=pile(t[2],t[4])#thesubroutineIchangeddefgetNovelAllele(variant,locus,ranges,files,workDir,logFile,samtools,bwa,resBase,nameSep,refSeqs,paired,insertSize):allele_name=locus+nameSep+variant###CHECKDELIMITERVARIABLENAME#getreferencesequence=closestmatchtypeFn=allele_name+".fa"typeFile=open(typeFn,"w")s=refSeqs[allele_name]Bio.SeqIO.write([Bio.SeqRecord.SeqRecord(s, id=allele_name)],typeFile,"fasta")typeFile.close()#indexitnull=open(os.devnull,'w')p=subprocess.call([bwa, 'index', typeFn],stderr=null)#alignreadstoitsais=alignReads(workDir,resBase+"."+allele_name,paired,typeFn,files,logFile,bwa)bam=bamify(workDir,resBase+"."+allele_name,files,sais,typeFn,False,logFile,insertSize,bwa,samtools)bamFn=resBase+"."+allele_name+".bam"p=subprocess.call(['mv',bam,bamFn],stderr=null)#copytocurrentdirectoryfromworkingdirprint>>logFile,"Alignments are in "+bamFn#generatepileupandfastqpiFn=resBase+"."+allele_name+'.pileup'vcfFn=resBase+"."+allele_name+'.vcf'fqFn=resBase+"."+allele_name+'.fastq'print>>logFile,'Writing pileup to '+piFn#indexp=subprocess.Popen([samtools, 'index', bamFn],stdout=subprocess.PIPE,stderr=null)#createvcfp=subprocess.Popen([samtools, 'mpileup', '-uf', typeFn, bamFn],stdout=subprocess.PIPE)p=subprocess.Popen(['bcftools', 'view', '-cg', '-'],stdin=p.stdout,stdout=subprocess.PIPE)vcf=open(vcfFn,'w')forlinp.stdout:vcf.write(l)vcf.close()#createthefastqfilep=subprocess.Popen(['vcfutils.pl', 'vcf2fq', vcfFn],stdout=subprocess.PIPE)f=open(fqFn,'w')forlinp.stdout:f.write(l)f.close()fq=Bio.SeqIO.read(fqFn,"fastq")slice=fq[ ranges[allele_name][0]:ranges[allele_name][1]]slice.id=resBase+"."+allele_nameBio.SeqIO.write(slice,fqFn,"fastq")
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have just started using srst this week and I think it is great!
However I think that there might be a minor bug in srst.py. Basically, it crashes when it can't find a particular allele. Having looked at the code I believe that this is because the location of samtools.pl is incorrect, all of the installation of samtools that I have worked with hold this perl script in the misc folder rather than with the samtools executable.
I guess the user can move samtools.pl up a directory or modify the script to point to the correct place.
I hope that this is useful.
Thanks,
Emily
I am also finding a similar error. I really want it to work, so I am debugging it now with my limited knowledge of Python. I believe that it is due to using samtools.pl to generate a fastq file (and also, the samtools.pl path is incorrect; you are right). However, the authors should use the command that Samtools recommends:
samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
Additionally, SRST should make sure that the user has samtools, bcftools, and vcftools.pl in the PATH.
I fixed the script by altering the following subroutine. In essence, samtools is not being used correctly. I believe that the current version of SRST does not support the newest version of samtools, and this should help.
Additionally, I added the following lines near line 430 denoted with #LK