py2ls 0.2.4.6__py3-none-any.whl → 0.2.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2ls/.git/index +0 -0
- py2ls/batman.py +32 -1
- py2ls/bio.py +25 -22
- py2ls/data/usages_sns.json +2 -1
- py2ls/ips.py +1258 -724
- py2ls/ml2ls.py +1841 -390
- py2ls/plot.py +500 -235
- {py2ls-0.2.4.6.dist-info → py2ls-0.2.4.8.dist-info}/METADATA +2 -2
- {py2ls-0.2.4.6.dist-info → py2ls-0.2.4.8.dist-info}/RECORD +10 -10
- {py2ls-0.2.4.6.dist-info → py2ls-0.2.4.8.dist-info}/WHEEL +0 -0
    
        py2ls/.git/index
    CHANGED
    
    | Binary file | 
    
        py2ls/batman.py
    CHANGED
    
    | @@ -37,7 +37,38 @@ def convert_to_html(text_list, strict=False): | |
| 37 37 | 
             
                        text = text.replace(escape_seq, html_rep)
         | 
| 38 38 | 
             
                    html_content += text.replace("\n", "<br>")  # Add line breaks for newlines
         | 
| 39 39 | 
             
                if strict:
         | 
| 40 | 
            -
                    html_content = "<html><body>\n" + html_content + "\n</body></html>"
         | 
| 40 | 
            +
                    # html_content = "<html><body>\n" + html_content + "\n</body></html>"
         | 
| 41 | 
            +
                            # Include mobile-friendly CSS for responsive tables
         | 
| 42 | 
            +
                    css_style = """
         | 
| 43 | 
            +
                    <style>
         | 
| 44 | 
            +
                        .table-container {
         | 
| 45 | 
            +
                            overflow-x: auto;
         | 
| 46 | 
            +
                            -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
         | 
| 47 | 
            +
                            margin-bottom: 20px;
         | 
| 48 | 
            +
                        }
         | 
| 49 | 
            +
                        table {
         | 
| 50 | 
            +
                            width: 100%;
         | 
| 51 | 
            +
                            border-collapse: collapse;
         | 
| 52 | 
            +
                        }
         | 
| 53 | 
            +
                        th, td {
         | 
| 54 | 
            +
                            padding: 8px;
         | 
| 55 | 
            +
                            border: 1px solid #ddd;
         | 
| 56 | 
            +
                            text-align: left;
         | 
| 57 | 
            +
                        }
         | 
| 58 | 
            +
                    </style>
         | 
| 59 | 
            +
                    """
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                    # Wrap the HTML content in the responsive container div
         | 
| 62 | 
            +
                    html_content = f"""
         | 
| 63 | 
            +
                    <html>
         | 
| 64 | 
            +
                        <head>{css_style}</head>
         | 
| 65 | 
            +
                        <body>
         | 
| 66 | 
            +
                            <div class="table-container">
         | 
| 67 | 
            +
                                {html_content}
         | 
| 68 | 
            +
                            </div>
         | 
| 69 | 
            +
                        </body>
         | 
| 70 | 
            +
                    </html>
         | 
| 71 | 
            +
                    """
         | 
| 41 72 | 
             
                return html_content
         | 
| 42 73 |  | 
| 43 74 |  | 
    
        py2ls/bio.py
    CHANGED
    
    | @@ -166,9 +166,23 @@ def get_probe( | |
| 166 166 | 
             
                if platform_id is None:
         | 
| 167 167 | 
             
                    df_meta = get_meta(geo=geo, dataset=dataset, verbose=False)
         | 
| 168 168 | 
             
                    platform_id = df_meta["platform_id"].unique().tolist()
         | 
| 169 | 
            -
                    platform_id = platform_id[0] if len(platform_id) == 1 else platform_id
         | 
| 170 169 | 
             
                    print(f"Platform: {platform_id}")
         | 
| 171 | 
            -
                 | 
| 170 | 
            +
                if len(platform_id) > 1:
         | 
| 171 | 
            +
                    df_probe= geo[dataset].gpls[platform_id[0]].table
         | 
| 172 | 
            +
                    # df_probe=pd.DataFrame()
         | 
| 173 | 
            +
                    # # Iterate over each platform ID and collect the probe tables
         | 
| 174 | 
            +
                    # for platform_id_ in platform_id:
         | 
| 175 | 
            +
                    #     if platform_id_ in geo[dataset].gpls:
         | 
| 176 | 
            +
                    #         df_probe_ = geo[dataset].gpls[platform_id_].table
         | 
| 177 | 
            +
                    #         if not df_probe_.empty:
         | 
| 178 | 
            +
                    #             df_probe=pd.concat([df_probe, df_probe_])
         | 
| 179 | 
            +
                    #         else:
         | 
| 180 | 
            +
                    #             print(f"Warning: Probe table for platform {platform_id_} is empty.")
         | 
| 181 | 
            +
                    #     else:
         | 
| 182 | 
            +
                    #         print(f"Warning: Platform ID {platform_id_} not found in dataset {dataset}.")
         | 
| 183 | 
            +
                else:
         | 
| 184 | 
            +
                    df_probe= geo[dataset].gpls[platform_id[0]].table
         | 
| 185 | 
            +
                
         | 
| 172 186 | 
             
                if df_probe.empty:
         | 
| 173 187 | 
             
                    print(
         | 
| 174 188 | 
             
                        f"Warning: cannot find the probe info. 看一下是不是在单独的文件中包含了probe信息"
         | 
| @@ -215,9 +229,12 @@ def get_data(geo: dict, dataset: str = "GSE25097", verbose=False): | |
| 215 229 | 
             
                df_expression = get_expression_data(geo, dataset=dataset)
         | 
| 216 230 | 
             
                if not df_expression.select_dtypes(include=["number"]).empty:
         | 
| 217 231 | 
             
                    # 如果数据全部是counts类型的话, 则使用TMM进行normalize
         | 
| 218 | 
            -
                    if 'counts' in get_data_type(df_expression): | 
| 219 | 
            -
                         | 
| 220 | 
            -
             | 
| 232 | 
            +
                    if 'counts' in get_data_type(df_expression):
         | 
| 233 | 
            +
                        try:
         | 
| 234 | 
            +
                            df_expression=counts2expression(df_expression.T).T 
         | 
| 235 | 
            +
                            print(f"{dataset}'s type is raw read counts, nomalized(transformed) via 'TMM'")
         | 
| 236 | 
            +
                        except Exception as e: 
         | 
| 237 | 
            +
                            print("raw counts data")
         | 
| 221 238 | 
             
                if any([df_probe.empty, df_expression.empty]):
         | 
| 222 239 | 
             
                    print(
         | 
| 223 240 | 
             
                        f"got empty values, check the probe info. 看一下是不是在单独的文件中包含了probe信息"
         | 
| @@ -237,23 +254,9 @@ def get_data(geo: dict, dataset: str = "GSE25097", verbose=False): | |
| 237 254 | 
             
                # get meta info
         | 
| 238 255 | 
             
                df_meta = get_meta(geo, dataset=dataset, verbose=False)
         | 
| 239 256 | 
             
                col_rm = [
         | 
| 240 | 
            -
                    "channel_count",
         | 
| 241 | 
            -
                    " | 
| 242 | 
            -
                    " | 
| 243 | 
            -
                    "contact_city",
         | 
| 244 | 
            -
                    "contact_country",
         | 
| 245 | 
            -
                    "contact_department",
         | 
| 246 | 
            -
                    "contact_email",
         | 
| 247 | 
            -
                    "contact_institute",
         | 
| 248 | 
            -
                    "contact_laboratory",
         | 
| 249 | 
            -
                    "contact_name",
         | 
| 250 | 
            -
                    "contact_phone",
         | 
| 251 | 
            -
                    "contact_state",
         | 
| 252 | 
            -
                    "contact_zip/postal_code",
         | 
| 253 | 
            -
                    "contributor",
         | 
| 254 | 
            -
                    "manufacture_protocol",
         | 
| 255 | 
            -
                    "taxid",
         | 
| 256 | 
            -
                    "web_link",
         | 
| 257 | 
            +
                    "channel_count","contact_web_link","contact_address","contact_city","contact_country","contact_department",
         | 
| 258 | 
            +
                    "contact_email","contact_institute","contact_laboratory","contact_name","contact_phone","contact_state",
         | 
| 259 | 
            +
                    "contact_zip/postal_code","contributor","manufacture_protocol","taxid","web_link",
         | 
| 257 260 | 
             
                ]
         | 
| 258 261 | 
             
                # rm unrelavent columns
         | 
| 259 262 | 
             
                df_meta = df_meta.drop(columns=[col for col in col_rm if col in df_meta.columns])
         | 
    
        py2ls/data/usages_sns.json
    CHANGED
    
    | @@ -21,5 +21,6 @@ | |
| 21 21 | 
             
                "residplot": "seaborn.residplot(data=None,*,x=None,y=None,x_partial=None,y_partial=None,lowess=False,order=1,robust=False,dropna=True,label=None,color=None,scatter_kws=None,line_kws=None,ax=None)\nhttps://seaborn.pydata.org/generated/seaborn.residplot.html",
         | 
| 22 22 | 
             
                "pairplot": "seaborn.pairplot(data,*,hue=None,hue_order=None,palette=None,vars=None,x_vars=None,y_vars=None,kind='scatter',diag_kind='auto',markers=None,height=2.5,aspect=1,corner=False,dropna=False,plot_kws=None,diag_kws=None,grid_kws=None,size=None)\nhttps://seaborn.pydata.org/generated/seaborn.pairplot.html",
         | 
| 23 23 | 
             
                "jointplot": "seaborn.jointplot(data=None,*,x=None,y=None,hue=None,kind='scatter',height=6,ratio=5,space=0.2,dropna=False,xlim=None,ylim=None,color=None,palette=None,hue_order=None,hue_norm=None,marginal_ticks=False,joint_kws=None,marginal_kws=None,**kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.jointplot.html",
         | 
| 24 | 
            -
                "plotting_context": "seaborn.plotting_context(context=None,font_scale=1,rc=None)\nhttps://seaborn.pydata.org/generated/seaborn.plotting_context.html"
         | 
| 24 | 
            +
                "plotting_context": "seaborn.plotting_context(context=None,font_scale=1,rc=None)\nhttps://seaborn.pydata.org/generated/seaborn.plotting_context.html",
         | 
| 25 | 
            +
                "swarmplot":"seaborn.swarmplot(data=None, *, x=None, y=None, hue=None, order=None, hue_order=None, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor=None, linewidth=0, hue_norm=None, log_scale=None, native_scale=False, formatter=None, legend='auto', warn_thresh=0.05, ax=None, **kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.swarmplot.html"
         | 
| 25 26 | 
             
            }
         |