Ah, that is very clever! Yes it did find some troubles:
$ awk '/[^a-zA-Z]/ && $0 !~"^>" {print "invalid char at line ", NR}' fusion38-10k.fa
invalid char at line 44558934
invalid char at line 46471885
$ sed '44558934q;d' fusion38-10k.fa
TGCTTAGATGTAAGAGATAAACATTTAAAAGTGGAGTGAGCTAACCTCAATTGCAAGAGTCAAGCCCTGGAGCGCCAACTCCCAGAAGGGGGCGAACCAA
TTGAGCACTCTCACACACACCAAAAAGATTTTCCCTTTTCTTTGTACAGGGTTGGTTTCACCTCAACACCATAAAAGATCCGGAAACGGTGAAGGGCTTG
$ sed '46471885q;d' fusion38-10k.fa
GTGTTCAAAATC@AACGCTAAGTGTCGCCCCGAACGACGTAGGGAAGCTAAAGAAAATAAGACACCTGGGTATCTTCTTGAACTATGTCGTAAACGAATG
looks like there is a newline or a gap in the former and the "@" character I don't know how it came out in the first place. Both are present in the file I prepared:
$ grep -n "^>" fusion38-10k.fa
1:>chr1 AC:CM000663.2 gi:568336023 LN:248956422 rl:Chromosome M5:6aef897c3d6ff0c78aff06ac189178dd AS:GRCh38
...
44282437:>chrEBV AC:AJ507799.2 gi:86261677 LN:171823 rl:decoy M5:6743bd63b3ff2b5b8985d8933c53290a SP:Human_herpesvirus_4 tp:circular
44284893:>chrV AC:KI270741.1 gi:86261678 LN:370064105 rl:Chromosome M5:5aa5be7025d7baa666a8651e0909e4ce AS:GRCh38 SP:All_viruses
I amended the "@" with:
$ sed 's/@//' fusion38-10k.fa > fusion38-10k2.fa
$ grep @ fusion38-10k2.fa
I tried to solve the former problem with:
sed '44558934s/[[:space:]]*/\n/' fusion38-10k.fa > fusion38-10k2.fa
but the illegal character was not a space/tab; by using a text editor I found that it was some kind of unformatted value. So I removed it manually from the text editor. Checked the quality of the file with the awk command, re-cat it and re-index it. I am testing the alignment now, I will update on the outcome. Thanks!
Does this help?
That would be weird because I could align to the individual genomes individually. How could spaces be introduced by simply concatenating two files? And that post indicates that "spaces in the header are OK". Anyway, I'll try this, thank you.
Nope, it did not. I tried with both
sed -i 's/\s*$//g'(for spaces in the sequence) andsed -i 's/^[^>]\s*$//g'(for spaces in the header) followed bybwa indexbut the result was always the sae.I also tried with printf "field\t...field\n" but I got the same error.
Let's check if the line ending terminators are correct.
If the output is
<fusion.fa>: ASCII text, with CRLF line terminatorsyou should installdos2unixand rundos2unix <fusion.fa>.fin swimmer
That was a good tip that I shall remember, but there no Windows here:
Could you please try to reindex
fusion38-10k.fa. But this time without any parameters.For -a bwtsw` you used I see a warning in the manual about it:
Without setting the algorithm bwa will auto select the best one.
fin swimmer
exactly the same error...
<human.fa>only?<virus.fa>only?grep "chrV" -A 5 -B 5 <fusion.fa>?Hm, so the problem arises only in the concatenated file. The position in <fusion.fa> where the file were concatenated looks fine to me.
Which version of
bwaare you using? Have you done anything else aftercat <human.fa> <virus.fa> > <fusion.fa>other thanbwa index <fusion.fa>?fin swimmer
BWA is Version:
0.7.17-r1188. I did nothing else. You might notice that I changed the fields of chrV to match those of the human chromosome, but no improvements.Although unlikely, could the word length of the sequences (excluding the headers) affect the alignment? The human genomes has 80 characters per line and the virus has 100.