This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import* | |
col1_array = [] | |
col2_array = [] | |
col1_array_index = 1 | |
col2_array_index = 1 | |
for row in file("2columns.txt"): | |
row = row.split() | |
col1 = row[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First three commands reads the data in to a file variable | |
set fp [open "2columns.txt" r] | |
set content [read $fp] | |
close $fp | |
# Next two commands reads all rows | |
set records [split $content "\n"] | |
set count 0 | |
# Next commands parses each row where two columns are separated by a white-space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
//Stores line | |
char row[4]; | |
void main() | |
{ | |
// File variable to open file | |
FILE *file_pointer = fopen("2columns.txt", "r"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Accepts text file with two columns and prints each column | |
open(input_file, "2columns.txt"); | |
while(<input_file>) | |
{ | |
# You will need it if there is whitespace at the end of line | |
#chomp; | |
#Splits the line by White-Space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 3 | |
4 5 | |
9 2 | |
6 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read file with two columns in Ruby | |
input_file = File.new("2columns.txt", "r") | |
while(line = input_file.gets) | |
col1, col2 = line.split(' ') | |
puts col1 | |
puts col2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$input_file = fopen("2columns.txt", "r"); | |
while(true) | |
{ | |
$row = fgets($input_file); | |
if($row == null) | |
break; | |
echo $input_file; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN{ | |
# Defining variables | |
arr_index = 0; | |
arr_max = 4; | |
} | |
{ | |
# Stores first and second columns respectively for each row | |
col1[arr_index] = $1; | |
col2[arr_index] = $2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import* | |
values = [] | |
#after operations using values array, we write the output to a text file | |
with open("appendLines.txt", "a") as newf: | |
newf.write('\n') | |
newf.write(str(len(values))) | |
newf.write('\t') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import* | |
import networkx as nx | |
line_count = 0 | |
G = nx.Graph() | |
f = open("deleted_motif_edges.txt", "w") | |
for row in file('100ecoliadjusted.txt'): | |
row.split() |
OlderNewer