对于文件夹function request(id) {
// return the AJAX promise
return $.ajax({
url: '<secret URL to Parse Database>' + id,
dataType: 'json',
async : true
});
}
function sendTheRequest(ids,....) {
// you probably don't need this filter if you go the promise route
const id = ids.filter(function(item, pos) {
return ids.indexOf(item) == pos;
})
return request(id).then(function(response){
// deal with your returned data
// conditional. if still 'ids', do recursive, call again
if(ids.length) sendTheRequest(ids,...)
});
}
function putAllIds(ids){
return sendTheRequest(ids);
}
putAllIds().done(function(res) {
console.log(res);
}
中的所有文件,我想组合列,如我的示例所示。我想将列c(“mir”,“seq”,“mism”,“add”,“t5”,“t3”)组合为输出中的rownames,并将miraligner
组合为相应输入的列文件。
我不知道如何为多个输入文件执行此操作
"freq"
输出
> setwd("~/miraligner/")
> file_list <- list.files(pattern = "*.mirna")
> head(file_list)
[1] "1_JH_F12_S41.mirna" "107_MAE_E7_S11.mirna" "108_IME_A8_S23.mirna" "109_GW_B11_S27.mirna" "111_PH_H1_S77.mirna"
[6] "116_TH_E6_S10.mirna"
> head(1_JH_F12_S41.mirna)
seq name freq mir start end mism add t5 t3 s5 s3 DB
1 TGGAGTGTGATAATGGTGTTT seq_100003_x4 4 hsa-miR-122-5p 15 35 11TC 0 0 g GCTGTGGA TTTGTGTC miRNA
2 TGTAAACATCCCCGACCGGAAGCT seq_100045_x4 4 hsa-miR-30d-5p 6 29 17CT 0 0 CT TTGTTGTA GAAGCTGT miRNA
3 CTAGACTGAAGCTCCTTGAAAA seq_100048_x4 4 hsa-miR-151a-3p 47 65 0 I-AAA 0 gg CCTACTAG GAGGACAG miRNA
4 AGGCGGAGACTTGGGCAATTGC seq_100059_x4 4 hsa-miR-25-5p 14 35 0 0 0 C TGAGAGGC ATTGCTGG miRNA
5 AAACCGTTACCATTACTGAAT seq_100067_x4 4 hsa-miR-451a 17 35 0 I-AT 0 gtt AAGGAAAC AGTTTAGT miRNA
6 TGAGGTAGTAGCTTGTGCTGTT seq_10007_x24 24 hsa-let-7i-5p 6 27 12CT 0 0 0 TGGCTGAG TGTTGGTC miRNA
precursor ambiguity
1 hsa-mir-122 1
2 hsa-mir-30d 1
3 hsa-mir-151a 1
4 hsa-mir-25 1
5 hsa-mir-451a 1
6 hsa-let-7i 1
这是我的开始:
ID freq_file1 freq_file2 freq_file3
hsa-miR-122-5p_TGGAGTGTGATAATGGTGTTT_11TC_0_0_g 4 2 12
hsa-miR-30d-5p_TGTAAACATCCCCGACCGGAAGCT_17CT_0_0_CT 4 12 5
答案 0 :(得分:0)
我要做的是以下几点:
读取data.frame中的每个文件,
删除不必要的列,(x.column <- NULL
)
然后使用合并函数在需要的地方添加列
help(merge)
确保使用正确的&#34;全部&#34;参数(即,即使第一个文件中不存在该行,您是否希望将freq保留在第二个文件的行中?)