This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Intersectbed Tool Generating Empty File

I have used the Bedtools command intersectBed to check the overlap between two bed files. A is my INDEL file and B is my Reference file. But it is producing an empty output file. I thought the problem was that the file B is much larger than file A. But I tried changing the file order and it is still not creating any output.

Here is the reference B file (larger):

gff_seqname      0        1395    gene    0    +
gff_seqname      0        1395    exon    0    +
gff_seqname    1397    2498    gene    0    +
gff_seqname    1397    2498    exon    0    +
gff_seqname    2524    3619    gene    0    +

Here is my A file with just 51 INDELS:

NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME    174708    174713    -GCCGG:2/6
NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME    1078686    1078686    +A:105/112
NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME    1229123    1229125    -CT:800/870
NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME    1234830    1234830    +AT:134/134
NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME    1234833    1234834    -A:134/134

here is my command:

intersectBed -a SOD_pal_BWA_GMM.PE.sorted.bam.sorted_cleaned_GMM.bam.sorted.hr.bam.raw.bed  -b sodalis_galaxy.bed  -wa -wb  >test13.bed
bedtools intersect galaxy

in bed files, the chromosome is the first column. It looks like your chromosomes don't match so there can never be overlaps.

So, do you think I need to change my reference file where the first column is gffseqname to NC0077121SODALISGLOSSINIDIUSSTRMORSITANS_CHROMOSOME to get the match?

1 answer

chromosome names don't match (brentp was first)

I used the galaxy (gff to BED) and the refseq (genebank to gff) link you mentioned last time. It automatically created the reference output file in bed format.

Is there any option to change the column name for my reference in galaxy during converting gff to BED format?

not during conversion but you can use the Text Manipulation tools to Cut the first column and then Add Column as first column with the new chromosome

I have managed to add the new Chromosome column but its coming up as the last column. There is no option to choose a particular column (in my case column 1) you want your new data in. Any other ideas? Here is the new data:

0       4171146 source  0   +   NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME
0       1395    gene    0   +   NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME
0       1395    CDS     0   +   NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME
1397    2498    gene    0   +   NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME
1397    2498    CDS     0   +   NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME
2524    3619    gene    0   +   NC_0077121_SODALIS_GLOSSINIDIUS_STR_MORSITANS_CHROMOSOME

And I was wondering how to add 2-3 different chromosomes in the new column. In my case, I have just one chromosome but if it was two then (chr 1, chr 2)?

Here is my B file with modified column 1, still no result. I was wondering if the column need to be exactly similar between two files to get the overlap as still I can see the difference in Chromosome name in column 1 ?
new file B

NC_007712   0       4171146 source  0   +
NC_007712   0       1395    gene    0   +
NC_007712   0       1395    CDS     0   +
NC_007712   1397    2498    gene    0   +
NC_007712   1397    2498    CDS     0   +

the chromosome names need to match EXACTLY

you also need to stop posting a new question when you already suspect what the answer is - you have to make an honest effort otherwise you are just wasting everyone's time - including yours.

Log in to answer this question.