差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
20210804 [2021/08/04 05:44] – 133.11.144.10 | 20210804 [Unknown date] (現在) – 削除 - 外部編集 (Unknown date) 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== 20210804 ====== | ||
- | |||
- | ===== MitoFishDBに2つ以上ヒットしている、ntデータベースのデータの確認 ===== | ||
- | |||
- | pandasを主に使用。以下のリンクを参考にした。 | ||
- | |||
- | pandasのデータフレームに対してループ処理:[[https:// | ||
- | |||
- | pandasのデータフレームに対してIndexを振り直す:[[https:// | ||
- | |||
- | pandasのデータフレームをソート:[[https:// | ||
- | |||
- | / | ||
- | |||
- | script/ | ||
- | |||
- | import sys | ||
- | import pandas as pd | ||
- | | ||
- | def main(): | ||
- | srrID = sys.argv[1] | ||
- | inputFilePath = " | ||
- | outputFilePath = " | ||
- | out_f = open(outputFilePath," | ||
- | try: | ||
- | df = pd.read_table(inputFilePath) | ||
- | df_copy = df.copy() | ||
- | df_copy = df_copy.drop(df.columns[0], | ||
- | | ||
- | for columnName, item in df_copy.iteritems(): | ||
- | try: | ||
- | column_sorted = item.sort_values(ascending=False) | ||
- | column_sorted_resetIndex = column_sorted.reset_index(drop=True) | ||
- | top_hit = column_sorted_resetIndex[0] | ||
- | second_hit = column_sorted_resetIndex[1] | ||
- | if second_hit == 0: | ||
- | pass | ||
- | else: | ||
- | row = srrID + " | ||
- | out_f.write(row + " | ||
- | except: | ||
- | pass | ||
- | except: | ||
- | pass | ||
- | out_f.close() | ||
- | if __name__ == " | ||
- | main() | ||
- | |||