Entering edit mode
5.2 years ago
Obex33
▴
30
I have a file delimited File 1:
NC_025345 4569 4950 KX838946.2
NC_025345 16546 17066 KJ641660.1
NC_025345 11996 12085 KX932454.2
And another File 2:
NC_025345.1 RefSeq gene 5690 7513 . + . ID=gene-NZ82_gp4;Dbxref=GeneID:20964334;Name=NZ82_gp4;gbkey=Gene;gene_biotype=protein_coding;locus_tag=NZ82_gp4
NC_025345.1 RefSeq gene 8016 10046 . + . ID=gene-NZ82_gp5;Dbxref=GeneID:20964335;Name=NZ82_gp5;gbkey=Gene;gene_biotype=protein_coding;locus_tag=NZ82_gp5
NC_025345.1 RefSeq gene 10337 16933 . + . ID=gene-NZ82_gp6;Dbxref=GeneID:20964336;Name=NZ82_gp6;gbkey=Gene;gene_biotype=protein_coding;locus_tag=NZ82_gp6
I want to use each lines of File 1 to search File 2 and print lines where column 2 and 3 of File 1 fall in between column 2 and 3 of File 2 to a new output file. So that I will have a final output file like this:
NC_025345 11996 12085 KX932454.2 NC_025345.1 RefSeq gene 10337 16933 . + . ID=gene-NZ82_gp6;Dbxref=GeneID:20964336;Name=NZ82_gp6;gbkey=Gene;gene_biotype=protein_coding;locus_tag=NZ82_gp6
Hi, bedtools intersect does not work for this kind of file entries. Where column1 of file1 macthes column2 of file2 and then column 2 and 3 of file1 is >= and <= column 4 and 5 of file2 respectively, both lines should be printed in new file3. thanks
of course it doesn't. You'll first need to move your columns and then apply bedtools.
https://www.google.com/search?q=linux+change+columns+order