Hello,
Greetings!
please help me produce the following solution. I need
to produce one big matrix file from several files in different levels.
If it helps, the index folder provides information on chromosome index and
the data folder provides information on values for chromosomes.
there are 2 folders at the same level, index and data.
The index folder has multiple files named chr1, chr2 etc.
The data folder has many subfolders, Each subfolder has multiple files named chr1, chr2 etc. with the same names
as files in the index folder. A particular file and its namesake will have the same number of rows in it.
So if chr1 in index has 5 rows, chr1 in all subfolders within data will also have 5 rows.
The output should be a big matrix with a nested format, where the rownames(first col) starting row2 should be the file names
and the column names(first row) startng col3 should be the names of corresponding subfolders in data folder.
All files have 1 column and multiple rows with only integer numbers.
Greetings!
please help me produce the following solution. I need
to produce one big matrix file from several files in different levels.
If it helps, the index folder provides information on chromosome index and
the data folder provides information on values for chromosomes.
there are 2 folders at the same level, index and data.
The index folder has multiple files named chr1, chr2 etc.
The data folder has many subfolders, Each subfolder has multiple files named chr1, chr2 etc. with the same names
as files in the index folder. A particular file and its namesake will have the same number of rows in it.
So if chr1 in index has 5 rows, chr1 in all subfolders within data will also have 5 rows.
The output should be a big matrix with a nested format, where the rownames(first col) starting row2 should be the file names
and the column names(first row) startng col3 should be the names of corresponding subfolders in data folder.
All files have 1 column and multiple rows with only integer numbers.
Code:
Index folder
chr1
1
2
3
5
6
chr2
1
2
3
4
5
7
chr3
1
5
7
Data Folder
Subfolder1
chr1
1
0
1
0
0
chr2
0
1
0
1
0
1
chr3
0
0
2
Subfolder2
chr1
1
1
2
2
3
chr2
1
3
4
6
0
0
chr3
1
0
0
Output
Subfolder1 Subfolder2
chr1 1 1 1
chr1 2 0 1
chr1 3 1 2
chr1 5 0 2
chr1 6 0 3
chr2 1 0 1
chr2 2 1 3
chr2 3 0 4
chr2 4 1 6
chr2 5 0 0
chr2 7 1 0
chr3 1 0 1
chr3 5 0 0
chr3 7 2 0