I need a Python script to compare two input files that will look like the [login to view URL] and [login to view URL] to produce an [login to view URL] file.
Step 1:
- First, delete each odd line in an input file, creating a stack of lines, where each line contains only these letters: A, G, C, T and -:
For example, if an input file contains four lines:
>Blablabla1
ATTA-
>Blablabla2
TTT-T
Then the output will look like:
ATTA-
TTT-T
- Second, go letter by letter and calculate the content for column
In our example, the stack of lines:
ATTA-
TTT-T
Will be transformed into this table:
Position, A(%), T(%), G(%), C(%), -(%)
1, 50, 50, 0, 0, 0
2, 0, 100, 0, 0, 0
3, 0, 100, 0, 0, 0
4, 50, 0, 0, 0, 50
5, 0, 50, 0, 0, 50
Step 2:
When both input files are converted into their corresponding “content tables”, the script should subtract one of these tables from another to create a “difference content table”.
For example, if the first content table looks like this:
Position, A(%), T(%), G(%), C(%), -(%)
1, 50, 50, 0, 0, 0
2, 0, 100, 0, 0, 0
And the second one looks like this,
Position, A(%), T(%), G(%), C(%), -(%)
1, 50, 50, 0, 0, 0
2, 0, 50, 0, 50, 0
Then, the resulting table will look like this:
Position, A(%), T(%), G(%), C(%), -(%)
1, 0, 0, 0, 0, 0
2, 0, 50, 0, -50, 0
This resulting table should be saved as a [login to view URL] file.
Hope this is clear