in reply to Re: Help with locating bp region in chromosome
in thread Help with locating bp region in chromosome

Sorry about that, but here is the data input as well as the output for my code.

Below is pos.txt, or where the position of the bp is located (1st col chromosome, 2nd col position).

chr1 104 104 0 0 + chr1 145 145 0 0 + chr1 205 205 0 0 + chr1 600 600 0 0 + chr3 500 500 0 0 + chr4 150 150 0 0 + chr4 175 175 0 0 + chr7 400 400 0 0 + chr7 550 550 0 0 + chr9 100 100 0 0 + chr11 680 680 0 0 + chr11 681 681 0 0 + chr22 105 105 0 0 + chr22 110 110 0 0 + chr22 350 350 0 0 +

Below is reg.txt, or where the region is located (1st col chromosome, 2nd col start of region, 3rd col end of region).

chr1 100 159 0 chr1 200 260 0 chr1 500 750 0 chr3 450 700 0 chr4 100 300 0 chr7 350 600 0 chr9 100 125 0 chr11 679 687 0 chr22 100 200 0 chr22 300 400 0

Below is my output, where first 4 col are from reg.txt and last 5 are from pos.txt. As you can see, my code only correctly outputs answers for part of the first chromosome, and it does not continue past that. This is the main problem I face, to understand how I can get a loop to cover all cases.

chr1 100 159 0 104 104 0 0 + chr1 100 159 0 145 145 0 0 +

Replies are listed 'Best First'.
Re^3: Help with locating bp region in chromosome
by toolic (Bishop) on Jun 23, 2011 at 16:28 UTC
    The code you posted produces no output for me (try downloading the code you posted yourself).

    You should also post the exact output you expect to get.

      I did download the code I posted, and it worked for me because I saved the input files as testReg.txt and testPos.txt respectively instead of reg.txt and pos.txt. Sorry about that. The beginning of the code is where I specify the file names.

      The correct output should look like:

      chr1 100 159 0 chr1 104 104 0 0 + chr1 100 159 0 chr1 145 145 0 0 + chr1 200 260 0 chr1 205 205 0 0 + chr1 500 750 0 chr1 600 600 0 0 + chr3 450 700 0 chr3 500 500 0 0 + chr4 100 300 0 chr4 150 150 0 0 + chr4 100 300 0 chr4 175 175 0 0 + chr7 350 600 0 chr7 400 400 0 0 + chr7 350 600 0 chr7 550 550 0 0 + chr9 100 125 0 chr9 100 100 0 0 + chr11 679 687 0 chr11 680 680 0 0 + chr11 679 687 0 chr11 681 681 0 0 + chr22 100 200 0 chr22 105 105 0 0 + chr22 100 200 0 chr22 110 110 0 0 + chr22 300 400 0 chr22 350 350 0 0 +

      but as in my previous reply I can only get the first to lines to output at all (let alone correctly). Again, first 4 columns are from testReg.txt and last 6 columns are from testPos.txt. The "chr" column from testPos.txt isn't necessary in the output, but I was trying to include it as well.

      The Re^4 post should include my reply if you click on the title, but for some reason it doesn't display in the original thread

        Well, I was waiting for you to respond. It is easy to get lost in the detail and get confused about the logic. Hopefullly you'll notice whats going on, strip the obsolete comments, and rename things, and understand what is going on :)
Re^3: Help with locating bp region in chromosome
by Anonymous Monk on Jun 24, 2011 at 02:07 UTC