作者 主題: 檔案轉換  (閱讀 4431 次)

0 會員 與 1 訪客 正在閱讀本文。

hallohallo

  • 憂鬱的高中生
  • ***
  • 文章數: 134
    • 檢視個人資料
檔案轉換
« 於: 2010-07-09 01:54 »
INPUT的檔案是
>V0021801ss_R1 0.99840
Actinobacteria 0.47776
Firmicutes 0.46654
Proteobacteria 0.05301
Fusobacteria 0.00109
>V0021801ss_R2 0.99945
Actinobacteria 0.51141
Firmicutes 0.46129
Proteobacteria 0.02587
Fusobacteria 0.00088
>V00515ds10c_R1 0.97549
Proteobacteria 0.55737
Actinobacteria 0.41289
Firmicutes 0.00278
Bacteroidetes 0.00204
>V00515ds10c_R2 0.96915
Proteobacteria 0.69188
Actinobacteria 0.27383
Firmicutes 0.00310
Bacteroidetes 0.00034
>V01319ds_R1 0.65029
Proteobacteria 0.31293
Actinobacteria 0.23243
Firmicutes 0.09146
Bacteroidetes 0.00756
我希望OUTPUT檔案可以變成
V0021801ss_R1 Actinobacteria*Firmicutes*Proteobacteria*Fusobacteria 0.47776*0.46654*0.05301*0.00109
V0021801ss_R2 Actinobacteria*Firmicutes*Proteobacteria*Fusobacteria 0.46129*0.51141*0.02587*0.00088
V00515ds10c_R1 Proteobacteria*Actinobacteria*Firmicutes*Bacteroidetes 0.55737*0.41289*0.00278*0.00204
V00515ds10c_R2 Proteobacteria*Actinobacteria*Firmicutes*Bacteroidetes 0.69188*0.27383*0.00310*0.00034
V01319ds_R1 Proteobacteria*Actinobacteria*Firmicutes*Bacteroidetes 0.31293*0.23243*0.09146*0.00756

請大大指點一下

Yamaka

  • 俺是博士!
  • *****
  • 文章數: 4913
    • 檢視個人資料
    • http://www.ecmagic.com
回覆: 檔案轉換
« 回覆 #1 於: 2010-07-09 08:59 »
INPUT的檔案是
>V0021801ss_R1 0.99840
Actinobacteria 0.47776
Firmicutes 0.46654
Proteobacteria 0.05301
Fusobacteria 0.00109
>V0021801ss_R2 0.99945
Actinobacteria 0.51141
Firmicutes 0.46129
Proteobacteria 0.02587
Fusobacteria 0.00088
>V00515ds10c_R1 0.97549
Proteobacteria 0.55737
Actinobacteria 0.41289
Firmicutes 0.00278
Bacteroidetes 0.00204
>V00515ds10c_R2 0.96915
Proteobacteria 0.69188
Actinobacteria 0.27383
Firmicutes 0.00310
Bacteroidetes 0.00034
>V01319ds_R1 0.65029
Proteobacteria 0.31293
Actinobacteria 0.23243
Firmicutes 0.09146
Bacteroidetes 0.00756
我希望OUTPUT檔案可以變成
V0021801ss_R1 Actinobacteria*Firmicutes*Proteobacteria*Fusobacteria 0.47776*0.46654*0.05301*0.00109
V0021801ss_R2 Actinobacteria*Firmicutes*Proteobacteria*Fusobacteria 0.46129*0.51141*0.02587*0.00088
V00515ds10c_R1 Proteobacteria*Actinobacteria*Firmicutes*Bacteroidetes 0.55737*0.41289*0.00278*0.00204
V00515ds10c_R2 Proteobacteria*Actinobacteria*Firmicutes*Bacteroidetes 0.69188*0.27383*0.00310*0.00034
V01319ds_R1 Proteobacteria*Actinobacteria*Firmicutes*Bacteroidetes 0.31293*0.23243*0.09146*0.00756

請大大指點一下

String.split() 或是 java.util.regex 切割後再自己組合