round=2
threads=20
read1=/mnt/disk2/Lab_Users/KISHOR/mnspt4/tenili_reseq_50x/X101SC23121795-Z01-J001/00.CleanData/3157_3/3157_3_1.clean.fq.gz
read2=/mnt/disk2/Lab_Users/KISHOR/mnspt4/tenili_reseq_50x/X101SC23121795-Z01-J001/00.CleanData/3157_3/3157_3_2.clean.fq.gz
input=/mnt/disk2/Lab_Users/KISHOR/mnspt4/assembly_annotation/NECAT/manual/tenili.fa
for ((i=1; i<=${round};i++)); do
[main_samview] fail to read the header from "-".
[bam_mating_core] ERROR: Couldn't read header
samtools sort: failed to read header from "-"
[markdup] error reading header
samtools index: "sgs.sort.bam" is in a format that cannot be usefully indexed
[faidx] Could not build fai index tenili.polishtemp.fa.fai
Can i have please have any help to solve this issue?
Bash script:
Set input and parameters
round=2 threads=20 read1=/mnt/disk2/Lab_Users/KISHOR/mnspt4/tenili_reseq_50x/X101SC23121795-Z01-J001/00.CleanData/3157_3/3157_3_1.clean.fq.gz read2=/mnt/disk2/Lab_Users/KISHOR/mnspt4/tenili_reseq_50x/X101SC23121795-Z01-J001/00.CleanData/3157_3/3157_3_2.clean.fq.gz input=/mnt/disk2/Lab_Users/KISHOR/mnspt4/assembly_annotation/NECAT/manual/tenili.fa for ((i=1; i<=${round};i++)); do
step 1:
index the genome file and do alignment
bwa index ${input}; bwa mem -t ${threads} ${input} ${read1} ${read2}|samtools view --threads 3 -F 0x4 -b -|samtools fixmate -m --threads 3 - -|samtools sort -m 2g --threads 5 -|samtools markdup --threads 5 -r - sgs.sort.bam
index bam and genome files
samtools index -@ ${threads} sgs.sort.bam; samtools faidx ${input}; (base)[room@black01 manual]$ python /mnt/genome3/Lab_Users/Kishor/DISK_2/softwares/NextPolish/lib/nextpolish1.py -g ${input} -t 1 -p ${threads} -s sgs.sort.bam > tenili.polishtemp.fa; input=tenili.polishtemp.fa;
step2:
index genome file and do alignment
bwa index ${input}; bwa mem -t ${threads} ${input} ${read1} ${read2}|samtools view --threads 3 -F 0x4 -b -|samtools fixmate -m --threads 3 - -|samtools sort -m 2g --threads 5 -|samtools markdup --threads 5 -r - sgs.sort.bam
index bam and genome files
samtools index -@ ${threads} sgs.sort.bam; samtools faidx ${input};
polish genome file
pythonn /mnt/genome3/Lab_Users/Kishor/DISK_2/softwares/NextPolish/lib/nextpolish1.py -g ${input} -t 2 -p ${threads} -s sgs.sort.bam > tenili.nextpolish.fa; input=tenili.nextpolish.fa; done;
Finally polished genome file: tenili.nextpolish.fa
Error text:
[main_samview] fail to read the header from "-". [bam_mating_core] ERROR: Couldn't read header samtools sort: failed to read header from "-" [markdup] error reading header samtools index: "sgs.sort.bam" is in a format that cannot be usefully indexed [faidx] Could not build fai index tenili.polishtemp.fa.fai
Can i have please have any help to solve this issue?