'bam2chicago.sh' problem

Create issue
Issue #43 new
Former user created an issue


I have run into problems with 'bam2chicago.sh' lately. Then I performed stepwise check and found "${bamname}_mappedToBaits_baitOnRight.bedpe" was somehow appended an "\t" at the end of each line. After adding a step of removing that tab, the script can run without an issue for me. This may be related to the issue reported in #41 and #39 (end of the stream). My work-around:

sed -i 's/\t$//' ${samplename}/${bamname}_mappedToBaits_baitOnRight.bedpe

It would nice if you look into the issue. Thanks.


Comments (1)

  1. Marco Blanchette

    Hi, found a bug in bam2chicago.sh, I was getting this error from bedtools:

    Error: Type checker found wrong number of fields while tokenizing data line.
    Perhaps you have extra TAB at the end of your line? Check with "cat -t"

    Traced it back to this bit in your code

    echo "Flipping all reads that overlap with the bait on to the right-hand side..."
    awk 'BEGIN{ OFS="\t" }                                                                                                                                                                                    
         if($1==$11 && (minRight-maxLeft)/($3-$2)>=0.6){                                                                                                                                                      
                  print $4,$5,$6,$1,$2,$3,$7,$8,$10,$9,$11,$12,$13,$14,$15                                                                                                                                    
         else {                                                                                                                                                                                               
                  print $0                                                                                                                                                                                    
    }' ${samplename}/${bamname}_mappedToBaits.bedpe > ${samplename}/${bamname}_mappedToBaits_baitOnRight.bedpe

    For some reason, you are trying to output $15 but ${samplename}/${bamname}_mappedToBaits.bedpe only has 14 fields. Remvoing $15 from the line fixed the issue.

  2. Log in to comment