Essentially what I want to write the lines of the document that match the ids list referenced in the code.
nodeIDs.txt:
... has 417 objects of,
10000
10023
1017
1019
1021
1026
1027
1029
...
Adherens junction.txt:
... has 73 lines of,
4301: AFDN; afadin, adherens junction formation factor
1496: CTNNA2; catenin alpha 2
283106: CSNK2A3; casein kinase 2 alpha 3
2241: FER; FER tyrosine kinase
60: ACTB; actin beta
1956: EGFR; epidermal growth factor receptor
56288: PARD3; par-3 family cell polarity regulator
10458: BAIAP2; BAI1 associated protein 2
51176: LEF1; lymphoid enhancer binding factor 1
I'm trying to get the program to go line by line and reference the ids list and if the beginning characters of the line match any of the ones found in the list to write that line to a new document. I was researching data sets, but I was unsure if these would work here.
My code so far:
ids = []
with open('nodeIDs.txt', 'r') as n:
for line in n:
ids.append(line)
n.close()
# Import data from the pathway file and turn into a list
g = []
with open('Adherens junction.txt', 'r') as a:
for line in a:
g.append(line)
a.close()
aj = open('Adherens.txt', 'a')
for line in a:
if ids[i] in line:
aj.write(line)
aj.close()
Can you help me get this working?