I'm pretty new to the world of scripting and have a problem in my research lab that, if a script could be written, would have days worth of manual labor and graciously ask for the community's assistance in how I could go about writing a Python or perhaps a Perl script to solve this problem. Any assistance or direction would be GREATLY appreciated!
In the attachment I have a file with four columns as input data, where $1 and $2 essentially come as a pair and $3 and $4 also come as pairs. However, I want to find three-way triplet (tripartite) graph relationships within the data such that there are two main types present:
Type 1) TF --> Gene <-- mir <-- TF
Type 2) miR --> Gene <-- TF <-- miR
This could be broken into two different scripts if need be:
For the first script (Type 1)
Print TF
IF TF present in $TF twice
AND Target present BOTH in one row of $miR and $Gene
THEN print miR and Gene in question as miR and Gene
THEN print 1 in $Type
For the second script (Type 2)
Print miR
IF miR present in $miR twice
AND Gene present BOTH in one row of $TF and $Target
THEN print TF and Target in question as TF and Gene
THEN print 2 in $Type
The attachment has both input and what I hope to receive as output.
In the attachment I have a file with four columns as input data, where $1 and $2 essentially come as a pair and $3 and $4 also come as pairs. However, I want to find three-way triplet (tripartite) graph relationships within the data such that there are two main types present:
Type 1) TF --> Gene <-- mir <-- TF
Type 2) miR --> Gene <-- TF <-- miR
This could be broken into two different scripts if need be:
For the first script (Type 1)
Print TF
IF TF present in $TF twice
AND Target present BOTH in one row of $miR and $Gene
THEN print miR and Gene in question as miR and Gene
THEN print 1 in $Type
For the second script (Type 2)
Print miR
IF miR present in $miR twice
AND Gene present BOTH in one row of $TF and $Target
THEN print TF and Target in question as TF and Gene
THEN print 2 in $Type
The attachment has both input and what I hope to receive as output.