I have read the content of a text file into pandas and needed some help matching the pattern.
Here is the pattern, where a
can any number greater than zero and b
can be zero or any number greater than zero:
father=a|0 || 0|a
mother=a|0 || 0|a
daughter1=b|0 || 0|b
daughter2=a|0 || 0|a
daughter3=b|0 || 0|b
son1=a|0 || 0|a
son2=b|0 || 0|b
Here is the function that reads the content of text file to pandas
import pandas as pd
def read():
varian=pd.read_csv('file.txt',sep = "\t")
father=varian["FATHER"]
mother=varian["MOTHER"]
daughter1=varian["DAUGHTER1"]
daughter2=varian["DAUGHTER2"]
daughter3=varian["DAUGHTER3"]
son1=varian["SON1"]
son2=varian["SON2"]
The content of the file looks like this
HROM POS REF ALT FATHER MOTHER DAUGHTER1 DAUGHTER2 DAUGHTER3 SON1 SON2 INFO FREQUECY
1 1226852 G C 1/0 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=12 0.005494505
1 1847936 C T 0/1 1/1 1|1 1|1 1|1 1|1 0|1 AC=1;AN=2184 0.000457875
1 2428427 C G 0/1 0/0 0|0 0|0 0|0 0|0 1|0 AC=4;AN=2184 0.001831502
1 2515616 G A 1/0 1/0 1/0 1|1 1|1 1/0 1/0 AC=1;AN=2184 0.000457875
1 3801895 T C 1/0 1/0 0|0 1/0 1/0 0|0 1|1 AC=10;AN=2184 0.004578755
#CHROM
? Does it really start withHROM
? Also, please look at our formatting tools to see how to format your posts correctly and avoid confusion. $\endgroup$